Implement linking of text encoder and tokenizer directories in conversion process. Enhance error handling in LTX2TextEncoder for tokenizer loading, providing a fallback model if the specified path is unavailable.

This commit is contained in:
Prince Canuma
2026-03-09 18:25:32 +01:00
parent 41ed62f7e8
commit 576e01da14
2 changed files with 31 additions and 1 deletions

View File

@@ -754,7 +754,10 @@ class LTX2TextEncoder(nn.Module):
if tokenizer_path.exists():
self.processor = AutoTokenizer.from_pretrained(str(tokenizer_path), trust_remote_code=True)
else:
self.processor = AutoTokenizer.from_pretrained(text_encoder_path, trust_remote_code=True)
try:
self.processor = AutoTokenizer.from_pretrained(text_encoder_path, trust_remote_code=True)
except Exception:
self.processor = AutoTokenizer.from_pretrained("google/gemma-3-12b-it", trust_remote_code=True)
# Set left padding to match official LTX-2 text encoder
self.processor.padding_side = "left"