The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Add left padding to LTXAV text encoder. (#12456)
comfyanonymous712efb466b93
diff --git a/comfy/text_encoders/lt.py b/comfy/text_encoders/lt.pyindex 3f87dfd6a..9cf87c0b2 100644--- a/comfy/text_encoders/lt.py+++ b/comfy/text_encoders/lt.py@@ -25,7 +25,7 @@ def ltxv_te(*args, **kwargs):class Gemma3_12BTokenizer(sd1_clip.SDTokenizer):def __init__(self, embedding_directory=None, tokenizer_data={}):tokenizer = tokenizer_data.get("spiece_model", None)- super().__init__(tokenizer, pad_with_end=False, embedding_size=3840, embedding_key='gemma3_12b', tokenizer_class=SPieceTokenizer, has_end_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, disable_weights=True, tokenizer_args={"add_bos": True, "add_eos": False}, tokenizer_data=tokenizer_data)+ super().__init__(tokenizer, pad_with_end=False, embedding_size=3840, embedding_key='gemma3_12b', tokenizer_class=SPieceTokenizer, has_end_token=False, pad_to_max_length=False, max_length=99999999, min_length=512, pad_left=True, disable_weights=True, tokenizer_args={"add_bos": True, "add_eos": False}, tokenizer_data=tokenizer_data)def state_dict(self):return {"spiece_model": self.tokenizer.serialize_model()}@@ -97,6 +97,7 @@ class LTXAVTEModel(torch.nn.Module):token_weight_pairs = token_weight_pairs["gemma3_12b"]out, pooled, extra = self.gemma3_12b.encode_token_weights(token_weight_pairs)+ out = out[:, :, -torch.sum(extra["attention_mask"]).item():]out_device = out.deviceif comfy.model_management.should_use_bf16(self.execution_device):out = out.to(device=self.execution_device, dtype=torch.bfloat16)@@ -138,6 +139,7 @@ class LTXAVTEModel(torch.nn.Module):token_weight_pairs = token_weight_pairs.get("gemma3_12b", [])num_tokens = sum(map(lambda a: len(a), token_weight_pairs))+ num_tokens = max(num_tokens, 64)return num_tokens * constant * 1024 * 1024def ltxav_te(dtype_llama=None, llama_quantization_metadata=None):