Skip to content

SOTA Open Source TTS

Fix UnboundLocalError for tokenizer in from_pretrained (#1238)

Andrew Morgan29199c5b2c3b
diff --git a/fish_speech/models/text2semantic/llama.py b/fish_speech/models/text2semantic/llama.py
index 3c40f41..c96aa46 100644
--- a/fish_speech/models/text2semantic/llama.py
+++ b/fish_speech/models/text2semantic/llama.py
@@ -496,6 +496,7 @@ class BaseTransformer(nn.Module):
config.rope_base = rope_base
logger.info(f"Override rope_base to {rope_base}")
+ tokenizer = None
try:
tokenizer = FishTokenizer.from_pretrained(path)
config.semantic_begin_id = tokenizer.semantic_begin_id