Nodes/comfyui-ltx2-efficient/LTX2 Conditioning Helper
ComfyUI Node

LTX2 Conditioning Helper

Fix the 7680-dimension prompt that LTX can't eat

By kakachiex2·Created 7 months ago·Updated 7 months ago· 10
LTX2 Conditioning Helper
  • conditioning
  • CONDITIONING
fix_dimensionstrue
slice_methodKeep Last 4096 (Slot 2 - LTX Connector)
add_attention_masktrue

LTX-2's text encoder is dual-headed - Gemma 3 12B plus a connector - and the two heads together produce conditioning that's 7680 dimensions wide. The generation model only wants 4096. Feed it the full thing and you get dimension-mismatch errors, or worse, silently broken output. LTX2ConditioningHelper is the small utility that fixes that conditioning before it hits the sampler: it slices the right 4096 channels and makes sure the model's required attention_mask is present. If you've hit a cryptic shape error in an LTX-2 workflow, this is often the missing node.

How it works

The mismatch comes in two flavors, and which half you keep depends on your encoder stack:

  • Gemma 3 (3584) + LTX embeddings connector (4096) = 7680. The LTX-compatible embeddings live in the last 4096. Use Keep Last 4096 (Slot 2 - LTX Connector).
  • T5-XXL (4096) + Gemma (3584) = 7680. The LTX-compatible embeddings live in the first 4096. Use Keep First 4096 (Slot 1 - T5).

The node also injects attention_mask into the conditioning dictionary if it's missing. The code deliberately sets it to None rather than a tensor of ones, with a comment explaining that an explicit mask shape can clash with LTX's internal reshaping - None just means "attend to everything" under scaled-dot-product attention, which is what you want for a plain text prompt.

The inputs

  • conditioning - the CONDITIONING output from your text encode (this pack's LTX2TextEncodeOptimized, or any encoder).
  • fix_dimensions - default on; slices 7680 → 4096 when needed.
  • slice_method - which 4096 to keep: Keep Last 4096 (Slot 2), Keep First 4096 (Slot 1), or Auto-detect LTX position, which guesses by comparing the variance of the two candidate slices. Auto-detect is clever but heuristic; if you know your stack, just pick the slot.
  • add_attention_mask - default on; adds the attention_mask key.

Output is a CONDITIONING of the same type, wired into your sampler's positive/negative. Drop it between the text encoder and the sampler - one per prompt, positive and negative.

Installation

It ships in the kakachiex2/comfyui-ltx2-efficient pack: ComfyUI Manager (search "LTX2 Efficient"), or:

cd ComfyUI/custom_nodes/
git clone https://github.com/kakachiex2/comfyui-ltx2-efficient
cd comfyui-ltx2-efficient
pip install -r requirements.txt

Restart ComfyUI. No model files, no dependencies beyond the optional pynvml the pack lists.

Troubleshooting

  • "Dimension already 4096" - the node prints this when no slicing was needed. If you're still getting errors, the problem is elsewhere.
  • Warning about dimension < 4096 - your encoder produced fewer than 4096 channels, which LTX won't accept. Check that you're loading the right text encoder and not some quantized half-model that drops channels.
  • Still broken after "Keep Last 4096" - you may have a T5+Gemma stack and need Slot 1 instead. Flip the slice_method; auto-detect is there precisely because people get this wrong.

It's a small node doing a fiddly job, and it's the kind of thing that either fixes your whole workflow or turns out to be unnecessary - but when LTX-2 throws a dimension error at the sampler, this is the first place I'd look. The same slicing logic is also baked into the pack's samplers and the LTX2ModelPatcher, so if you use those, you might not need the standalone helper at all.

CategoryLTX2-Video/utils

Inputs (4)

NameTypeDefaultDescription
conditioningCONDITIONING
fix_dimensionsBOOLEANtrue
slice_methodCOMBOKeep Last 4096 (Slot 2 - LTX Connector)3 options: Keep Last 4096 (Slot 2 - LTX Connector), Keep First 4096 (Slot 1 - T5), Auto-detect LTX position
add_attention_maskBOOLEANtrue

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING