Fix issue with ltx2 custom te repo path

This commit is contained in:
Jaret Burkett
2026-03-25 09:50:18 -06:00
parent b8000dbcbc
commit dfde30f231

View File

@@ -398,24 +398,27 @@ class LTX2Model(BaseModel):
text_encoder.load_state_dict(te_state_dict, assign=True, strict=True) text_encoder.load_state_dict(te_state_dict, assign=True, strict=True)
del te_state_dict del te_state_dict
flush() flush()
else: elif self.model_config.te_name_or_path is not None:
te_tokenizer_subfolder = "tokenizer" # a repo or folder
te_model_subfolder = "text_encoder"
if self.model_config.te_name_or_path is not None:
te_path = self.model_config.te_name_or_path
else:
if self.ltx_te_path is not None:
# pull from original repo for 2.3
te_path = self.ltx_te_path
te_tokenizer_subfolder = ""
te_model_subfolder = ""
else:
te_path = base_te_path
tokenizer = GemmaTokenizerFast.from_pretrained( tokenizer = GemmaTokenizerFast.from_pretrained(
te_path, subfolder=te_tokenizer_subfolder self.model_config.te_name_or_path
) )
text_encoder = Gemma3ForConditionalGeneration.from_pretrained( text_encoder = Gemma3ForConditionalGeneration.from_pretrained(
te_path, subfolder=te_model_subfolder, dtype=dtype self.model_config.te_name_or_path, dtype=dtype
)
elif self.ltx_te_path is not None:
# pull from model specific te
tokenizer = GemmaTokenizerFast.from_pretrained(self.ltx_te_path)
text_encoder = Gemma3ForConditionalGeneration.from_pretrained(
self.ltx_te_path, dtype=dtype
)
else:
# using combo hf repo
tokenizer = GemmaTokenizerFast.from_pretrained(
self.model_config.name_or_path, subfolder="tokenizer"
)
text_encoder = Gemma3ForConditionalGeneration.from_pretrained(
self.model_config.name_or_path, subfolder="text_encoder", dtype=dtype
) )
# remove the vision tower # remove the vision tower