Cause of the Error
The error message:
> TypeError: LTXVModel.forward() missing 1 required positional argument: 'attention_mask'
indicates that the forward() method of the LTXVModel (used in ComfyUI with the LTX 2B model) expects an argument called attention_mask, but it was not provided when the model was called[2][1][5][7].
This is a common issue in PyTorch and Hugging Face Transformers models, where the attention_mask is used to tell the model which tokens in the input should be attended to (i.e., are not padding)[3][9]. If you don't supply this argument, and the model's forward() method requires it, you'll get this error.
How to Fix
1. Ensure You Are Using the Correct Workflow/Node
- ComfyUI-LTXVideo and LTX Models: According to the GitHub issue, this error often happens if you are not using the model as produced by the "configurator node" in ComfyUI. Make sure your workflow is set up so that the LTX model node receives all required inputs, including the attention mask[1].
2. Provide the attention_mask Argument
- If Editing Code: When calling the model, ensure you pass the
attention_mask argument. For example:
output = model(input_ids=input_ids, attention_mask=attention_mask)
- In ComfyUI: If you are not writing code directly, but using nodes and workflows:
- Check that the node feeding into the LTXVModel provides both
input_ids and attention_mask.
- If you are loading or saving conditioning data, make sure the file or node includes the attention mask as part of the data[2].
3. Update or Reconfigure Your Nodes
- Switch CLIP Model: Some users reported that changing the CLIP model in the CLIP panel to a compatible version (like
t5xxl_fp8_e4m3fn.safetensors) resolved similar issues[1].
- Use the Configurator Node: Always use the output of the configurator node as your model input, as it ensures all required arguments are passed[1].
4. Check for Workflow or Node Updates
- Update ComfyUI and Extensions: Make sure you are using the latest versions of ComfyUI and any LTX-related extensions, as bugs like this are sometimes fixed in updates[1][8].
5. Example: Minimal Fix
If you are writing a custom node or script, ensure the call looks like:
# Example for Hugging Face-style models
outputs = model(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'])
If you are using ComfyUI nodes, ensure the node chain provides both input_ids and attention_mask to the LTXVModel node.
Summary Table
| Cause | Solution |
|---|
Not passing attention_mask to model | Ensure attention_mask is provided in the call or node |
| Using wrong node output as model input | Use output from configurator node |
| Incompatible CLIP or model version | Switch to a compatible model (e.g., t5xxl_fp8_e4m3fn.safetensors) |
| Outdated workflow or extension | Update ComfyUI and all related extensions |
References
- The error is caused by a missing required argument in the model call[2][5][7].
- In ComfyUI, using the correct node outputs and compatible models is essential[1].
- The
attention_mask is a standard argument in transformer models to handle padding and masking[3][9].
In summary:
Double-check your workflow to ensure the LTXVModel node receives an attention_mask argument, use the configurator node output, and update your models and extensions as needed. This should resolve the error and allow you to load and use the LTX 2B model in ComfyUI[1][2].