'Linear' object has no attribute 'weight' crash when sampling LTX-2 with MixedPrecisionOps after embedding connector move
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
LTX-2 (LTXAV) model should load and sample successfully using the native ComfyUI workflow with Kijai's loaders after the embedding connector was moved from text encoder to diffusion model ([commit f266b8d](https://github.com/Comfy-Org/ComfyUI/commit/f266b8d352607799afb4adf339cdfa854025185e)).
### Actual Behavior
ComfyUI crashes with AttributeError: 'Linear' object has no attribute 'weight' during prepare_sampling → load_models_gpu → module_size → state_dict().
The crash occurs in comfy/ops.py line 833:
pythonif isinstance(self.weight, QuantizedTensor):
^^^^^^^^^^^
AttributeError: 'Linear' object has no attribute 'weight'
The error happens because MixedPrecisionOps uses disable_weight_init, which creates Linear layers without initializing weights. When module_size() calls state_dict() to calculate VRAM requirements before sampling, it iterates over all layers — including those from the audio_embeddings_connector and video_embeddings_connector which were never assigned weights (they are loaded separately). The state_dict() override in MixedPrecisionOps.Linear accesses self.weight without checking if it exists, causing the crash.
### Steps to Reproduce
Update ComfyUI to latest master (post-commit f266b8d)
Update KJNodes to latest version
Load the LTX-2 19B model (fp8 mixed precision / quantized single-file) using Kijai's LTXAV loaders
Load Gemma 3 12B text encoder
Queue a prompt (text-to-video or image-to-video)
Error occurs immediately when sampling begins (during prepare_sampling → load_models_gpu)
### Debug Logs
```powershell
ComfyUI version: 0.14.1
ComfyUI frontend version: 1.39.14
Python version: 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]
Pytorch version: 2.9.1+cu130
Platform: Windows
Device: cuda:0 NVIDIA RTX PRO 6000 Blackwell Workstation Edition
Total VRAM: 97887 MB
Total RAM: 130407 MB
VRAM state: NORMAL_VRAM
Launch args: --reserve-vram 4 --disable-pinned-memory --disable-cuda-malloc
Full Console Output
VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
Requested to load VideoVAE
loaded completely; 90352.68 MB usable, 2331.69 MB loaded, full load: True
Found quantization metadata version 1
Detected mixed precision quantization
Using mixed precision operations
model weight dtype torch.bfloat16, manual cast: torch.bfloat16
model_type FLUX
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.0.attn1.to_q
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.0.attn1.to_k
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.0.attn1.to_v
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.0.attn1.to_out.0
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.0.ff.net.0.proj
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.0.ff.net.2
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.1.attn1.to_q
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.1.attn1.to_k
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.1.attn1.to_v
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.1.attn1.to_out.0
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.1.ff.net.0.proj
Missing weight for layer audio_embeddings_connector.transformer_1d_blocks.1.ff.net.2
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.0.attn1.to_q
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.0.attn1.to_k
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.0.attn1.to_v
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.0.attn1.to_out.0
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.0.ff.net.0.proj
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.0.ff.net.2
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.1.attn1.to_q
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.1.attn1.to_k
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.1.attn1.to_v
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.1.attn1.to_out.0
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.1.ff.net.0.proj
Missing weight for layer video_embeddings_connector.transformer_1d_blocks.1.ff.net.2
unet missing: ['audio_embeddings_connector.learnable_registers',
'audio_embeddings_connector.transformer_1d_blocks.0.attn1.q_norm.weight',
'audio_embeddings_connector.transformer_1d_blocks.0.attn1.k_norm.weight',
'audio_embeddings_connector.transformer_1d_blocks.1.attn1.q_norm.weight',
'audio_embeddings_connector.transformer_1d_blocks.1.attn1.k_norm.weight',
'video_embeddings_connector.learnable_registers',
'video_embeddings_connector.transformer_1d_blocks.0.attn1.q_norm.weight',
'video_embeddings_connector.transformer_1d_blocks.0.attn1.k_norm.weight',
'video_embeddings_connector.transformer_1d_blocks.1.attn1.q_norm.weight',
'video_embeddings_connector.transformer_1d_blocks.1.attn1.k_norm.weight']
Found quantization metadata version 1
Using MixedPrecisionOps for text encoder
Requested to load LTXAVTEModel_
loaded completely; 10375.02 MB loaded, full load: True
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cuda:0, dtype: torch.float16
Requested to load LTXAV
!!! Exception during processing !!! 'Linear' object has no attribute 'weight'
Full Traceback
Traceback (most recent call last):
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 524, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(...)
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 333, in get_output_data
return_values = await _async_map_node_over_list(...)
File "D:\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 963, in execute
samples = guider.sample(...)
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 1049, in sample
output = executor.execute(...)
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 983, in outer_sample
self.inner_model, self.conds, self.loaded_models = comfy.sampler_helpers.prepare_sampling(...)
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sampler_helpers.py", line 144, in _prepare_sampling
comfy.model_management.load_models_gpu(...)
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 713, in load_models_gpu
total_memory_required[loaded_model.device] = ... + loaded_model.model_memory_required(loaded_model.device)
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 523, in model_memory_required
return self.model_memory()
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 511, in model_memory
return self.model.model_size()
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_patcher.py", line 295, in model_size
self.size = comfy.model_management.module_size(self.model)
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 480, in module_size
sd = module.state_dict()
File "...\torch\nn\modules\module.py", line 2265, in state_dict
module.state_dict(
[Previous line repeated 3 more times]
File "D:\ComfyUI_windows_portable\ComfyUI\comfy\ops.py", line 833, in state_dict
if isinstance(self.weight, QuantizedTensor):
^^^^^^^^^^^
AttributeError: 'Linear' object has no attribute 'weight'
```
### Other
This workflow was working before updating ComfyUI and nodes
The error is 100% reproducible on every queue
The Missing weight for layer warnings for audio_embeddings_connector and video_embeddings_connector are expected (loaded separately), but they leave Linear layers without a weight attribute which then crashes state_dict()
This is the same class of bug as #11128 and #11963, where MixedPrecisionOps.Linear.state_dict() assumes .weight always exists, but disable_weight_init means it may not
The issue was introduced/exposed by the embedding connector refactor in commit f266b8d
Contributor guide
Assessment
This issue has not been assessed yet.