Skip to content

[Bug] LTX-2 模型在 fp8 精度下,开启 cpu_offload 的情况下,加载模型报错 #851

@carloszhang999

Description

@carloszhang999

2026-01-30 03:35:22.054 | INFO | lightx2v.utils.utils:validate_task_arguments:617 - ✓ Task 'i2av' arguments validated successfully
2026-01-30 03:35:22.055 | INFO | lightx2v.utils.set_config:set_config:42 - Loading some config from /workspace/LightX2V/config/ltx2_fp8.json
2026-01-30 03:35:22.055 | INFO | lightx2v.utils.set_config:print_config:168 - config:
{
"do_mm_calib": false,
"cpu_offload": true,
"max_area": false,
"vae_stride": [
4,
8,
8
],
"patch_size": 1,
"feature_caching": "NoCaching",
"teacache_thresh": 0.26,
"use_ret_steps": false,
"use_bfloat16": true,
"lora_configs": null,
"use_prompt_enhancer": false,
"parallel": false,
"seq_parallel": false,
"cfg_parallel": false,
"enable_cfg": true,
"use_image_encoder": true,
"model_cls": "ltx2",
"task": "i2av",
"model_path": "/workspace/LightX2V/models/LTX-2",
"sf_model_path": null,
"config_json": "/workspace/LightX2V/config/ltx2_fp8.json",
"infer_steps": 40,
"target_video_length": 121,
"target_height": 512,
"target_width": 768,
"attn_type": "sage_attn2",
"sample_guide_scale": 4,
"sample_shift": [
2.05,
0.95
],
"offload_granularity": "block",
"gemma_cpu_offload": true,
"vae_cpu_offload": true,
"num_channels_latents": 128,
"fps": 24,
"audio_fps": 24000,
"audio_mel_bins": 16,
"double_precision_rope": true,
"dit_quantized_ckpt": "/workspace/LightX2V/models/LTX-2/ltx-2-19b-dev-fp8.safetensors",
"dit_quantized": true,
"dit_quant_scheme": "fp8-pertensor",
"skip_fp8_block_index": [
0,
43,
44,
45,
46,
47
],
"_class_name": "LTX2VideoTransformer3DModel",
"_diffusers_version": "0.37.0.dev0",
"activation_fn": "gelu-approximate",
"attention_bias": true,
"attention_head_dim": 128,
"attention_out_bias": true,
"audio_attention_head_dim": 64,
"audio_cross_attention_dim": 2048,
"audio_hop_length": 160,
"audio_in_channels": 128,
"audio_num_attention_heads": 32,
"audio_out_channels": 128,
"audio_patch_size": 1,
"audio_patch_size_t": 1,
"audio_pos_embed_max_pos": 20,
"audio_sampling_rate": 16000,
"audio_scale_factor": 4,
"base_height": 2048,
"base_width": 2048,
"caption_channels": 3840,
"causal_offset": 1,
"cross_attention_dim": 4096,
"cross_attn_timestep_scale_multiplier": 1000,
"in_channels": 128,
"norm_elementwise_affine": false,
"norm_eps": 1e-06,
"num_attention_heads": 32,
"num_layers": 48,
"out_channels": 128,
"patch_size_t": 1,
"pos_embed_max_pos": 20,
"qk_norm": "rms_norm_across_heads",
"rope_double_precision": true,
"rope_theta": 10000.0,
"rope_type": "split",
"timestep_scale_multiplier": 1000,
"vae_scale_factors": [
8,
32,
32
]
}
2026-01-30 03:35:22.055 | DEBUG | lightx2v.utils.utils:validate_config_paths:633 - ✓ Verified dit_quantized_ckpt: /workspace/LightX2V/models/LTX-2/ltx-2-19b-dev-fp8.safetensors
2026-01-30 03:35:22.055 | INFO | lightx2v.utils.utils:validate_config_paths:660 - ✓ Config checkpoint paths validated successfully
2026-01-30 03:35:22.151 | INFO | lightx2v.models.runners.default_runner:init_modules:72 - Initializing runner modules...
2026-01-30 03:35:22.151 | INFO | lightx2v.utils.custom_compiler:_discover_compiled_methods:120 - [Compile] Discovering compiled methods for LTX2Model...
2026-01-30 03:35:22.151 | INFO | lightx2v.utils.custom_compiler:_discover_compiled_methods:125 - [Compile] Found compiled method: _infer_cond_uncond
2026-01-30 03:35:22.180 | INFO | lightx2v.models.networks.ltx2.model:_load_quant_ckpt:217 - Loading weights from /workspace/LightX2V/models/LTX-2/ltx-2-19b-dev-fp8.safetensors
2026-01-30 03:35:47.199 | INFO | lightx2v.utils.profiler:exit:57 - [Profile] Single GPU - Level2_Log Load models cost 25.047789 seconds
2026-01-30 03:35:47.199 | INFO | lightx2v.utils.profiler:exit:57 - [Profile] Single GPU - Level1_Log Total Cost cost 25.048097 seconds
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/workspace/LightX2V/lightx2v/infer.py", line 170, in
main()
File "/workspace/LightX2V/lightx2v/infer.py", line 157, in main
runner = init_runner(config)
^^^^^^^^^^^^^^^^^^^
File "/workspace/LightX2V/lightx2v/infer.py", line 34, in init_runner
runner.init_modules()
File "/workspace/LightX2V/lightx2v/models/runners/default_runner.py", line 74, in init_modules
self.load_model()
File "/workspace/LightX2V/lightx2v/utils/profiler.py", line 94, in sync_wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/workspace/LightX2V/lightx2v/models/runners/ltx2/ltx2_runner.py", line 35, in load_model
self.model = self.load_transformer()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/LightX2V/lightx2v/models/runners/ltx2/ltx2_runner.py", line 49, in load_transformer
model = LTX2Model(**ltx2_model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/LightX2V/lightx2v/models/networks/ltx2/model.py", line 108, in init
self._init_weights()
File "/workspace/LightX2V/lightx2v/models/networks/ltx2/model.py", line 277, in _init_weights
self._apply_weights()
File "/workspace/LightX2V/lightx2v/models/networks/ltx2/model.py", line 286, in _apply_weights
self.transformer_weights.load(self.original_weight_dict)
File "/workspace/LightX2V/lightx2v/common/modules/weight_module.py", line 20, in load
module.load(weight_dict)
File "/workspace/LightX2V/lightx2v/common/modules/weight_module.py", line 20, in load
module.load(weight_dict)
File "/workspace/LightX2V/lightx2v/common/modules/weight_module.py", line 20, in load
module.load(weight_dict)
[Previous line repeated 2 more times]
File "/workspace/LightX2V/lightx2v/common/ops/mm/mm_weight.py", line 362, in load
self.load_quantized(weight_dict)
File "/workspace/LightX2V/lightx2v/common/ops/mm/mm_weight.py", line 2116, in load_quantized
device_tensors, pin_tensors = create_default_tensors(self.base_attrs, weight_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/LightX2V/lightx2v/common/ops/utils.py", line 186, in create_default_tensors
device = weight_dict[first_tensor_name].device
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'model.diffusion_model.transformer_blocks.1.attn1.to_q.weight'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions