diff --git a/.gitignore b/.gitignore
index d9dbaeafd..6abf5551b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,8 @@
*.ipynb*
build/
dist/
+!configs/platforms/ascend_npu/dist/
+!configs/platforms/ascend_npu/dist/*.json
.cache/
server_cache/
app/.gradio/
diff --git a/configs/platforms/ascend_npu/dist/flux2_dev.json b/configs/platforms/ascend_npu/dist/flux2_dev.json
new file mode 100644
index 000000000..11bf2afe8
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/flux2_dev.json
@@ -0,0 +1,27 @@
+{
+ "model_cls": "flux2_dev",
+ "task": "t2i",
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "sample_guide_scale": 4.0,
+ "vae_scale_factor": 16,
+ "feature_caching": "None",
+ "enable_cfg": false,
+ "patch_size": 2,
+ "tokenizer_max_length": 512,
+ "text_encoder_out_layers": [
+ 10,
+ 20,
+ 30
+ ],
+ "attn_type": "npu_flash_attn",
+ "cpu_offload": false,
+ "offload_granularity": "block",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "tensor_p_size": 8
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/hunyuan_video_t2v_480p.json b/configs/platforms/ascend_npu/dist/hunyuan_video_t2v_480p.json
new file mode 100644
index 000000000..f95877aaf
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/hunyuan_video_t2v_480p.json
@@ -0,0 +1,25 @@
+{
+ "infer_steps": 50,
+ "transformer_model_name": "480p_i2v",
+ "fps": 24,
+ "target_video_length": 121,
+ "vae_stride": [
+ 4,
+ 16,
+ 16
+ ],
+ "sample_shift": 5.0,
+ "sample_guide_scale": 6.0,
+ "aspect_ratio": "16:9",
+ "enable_cfg": true,
+ "attn_type": "npu_flash_attn",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/longcat_image_t2i.json b/configs/platforms/ascend_npu/dist/longcat_image_t2i.json
new file mode 100644
index 000000000..61a5e3b5b
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/longcat_image_t2i.json
@@ -0,0 +1,24 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "attn_type": "npu_flash_attn",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "enable_cfg_renorm": true,
+ "cfg_renorm_min": 0.0,
+ "axes_dims_rope": [
+ 16,
+ 56,
+ 56
+ ],
+ "dit_quant_scheme": "Default",
+ "rms_norm_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/ltx2_3.json b/configs/platforms/ascend_npu/dist/ltx2_3.json
new file mode 100644
index 000000000..ea0107bc7
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/ltx2_3.json
@@ -0,0 +1,59 @@
+{
+ "infer_steps": 30,
+ "target_video_length": 121,
+ "target_height": 512,
+ "target_width": 768,
+ "attn_type": "npu_flash_attn",
+ "sample_guide_scale": 3.0,
+ "sample_shift": [
+ 2.05,
+ 0.95
+ ],
+ "enable_cfg": true,
+ "cpu_offload": false,
+ "gemma_cpu_offload": true,
+ "vae_cpu_offload": false,
+ "audio_mel_cpu_offload": true,
+ "offload_granularity": "model",
+ "norm_modulate_backend": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "num_channels_latents": 128,
+ "fps": 24,
+ "audio_fps": 24000,
+ "audio_mel_bins": 16,
+ "double_precision_rope": false,
+ "use_tiling_vae": false,
+ "dit_original_ckpt": "/data/wushuo1/models/LTX-2.3/ltx-2.3-22b-dev.safetensors",
+ "caption_proj_before_connector": true,
+ "cross_attention_adaln": true,
+ "apply_gated_attention": true,
+ "mm_guider": {
+ "enabled": true,
+ "video": {
+ "cfg_scale": 3.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [
+ 28
+ ],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ },
+ "audio": {
+ "cfg_scale": 7.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [
+ 28
+ ],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ }
+ },
+ "parallel": {
+ "tensor_p_size": 8
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/qwen_image_t2i_2512.json b/configs/platforms/ascend_npu/dist/qwen_image_t2i_2512.json
new file mode 100644
index 000000000..029b0d398
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/qwen_image_t2i_2512.json
@@ -0,0 +1,21 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "prompt_template_encode": "<|im_start|>system\nDescribe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
+ "prompt_template_encode_start_idx": 34,
+ "attn_type": "npu_flash_attn",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "vae_decode_parallel": true,
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/wan_moe_t2v.json b/configs/platforms/ascend_npu/dist/wan_moe_t2v.json
new file mode 100644
index 000000000..422f5822e
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/wan_moe_t2v.json
@@ -0,0 +1,28 @@
+{
+ "infer_steps": 40,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "npu_flash_attn",
+ "cross_attn_1_type": "npu_flash_attn",
+ "cross_attn_2_type": "npu_flash_attn",
+ "sample_guide_scale": [
+ 4.0,
+ 3.0
+ ],
+ "sample_shift": 12.0,
+ "enable_cfg": true,
+ "cpu_offload": true,
+ "offload_granularity": "model",
+ "boundary": 0.875,
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/wan_t2v.json b/configs/platforms/ascend_npu/dist/wan_t2v.json
new file mode 100644
index 000000000..e0b164b2a
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/wan_t2v.json
@@ -0,0 +1,24 @@
+{
+ "infer_steps": 50,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "npu_flash_attn",
+ "cross_attn_1_type": "npu_flash_attn",
+ "cross_attn_2_type": "npu_flash_attn",
+ "sample_guide_scale": 6,
+ "sample_shift": 8,
+ "enable_cfg": true,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/wan_t2v_sf.json b/configs/platforms/ascend_npu/dist/wan_t2v_sf.json
new file mode 100644
index 000000000..9cef3435e
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/wan_t2v_sf.json
@@ -0,0 +1,37 @@
+{
+ "infer_steps": 4,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "npu_flash_attn",
+ "cross_attn_1_type": "npu_flash_attn",
+ "cross_attn_2_type": "npu_flash_attn",
+ "sample_guide_scale": 1,
+ "sample_shift": 5.0,
+ "enable_cfg": false,
+ "cpu_offload": false,
+ "dit_original_ckpt": "/data/wushuo1/models/Self-Forcing/checkpoints/self_forcing_dmd.pt",
+ "causal_rope_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "ar_config": {
+ "local_attn_size": -1,
+ "num_frame_per_chunk": 3,
+ "timesteps_index": [
+ 0,
+ 179,
+ 358,
+ 679
+ ],
+ "kv_offload": false,
+ "async_vae_decode": false
+ },
+ "parallel": {
+ "seq_p_size": 4,
+ "cfg_p_size": 2,
+ "seq_p_attn_type": "ulysses"
+ }
+}
diff --git a/configs/platforms/ascend_npu/dist/z_image_turbo_t2i.json b/configs/platforms/ascend_npu/dist/z_image_turbo_t2i.json
new file mode 100644
index 000000000..809939126
--- /dev/null
+++ b/configs/platforms/ascend_npu/dist/z_image_turbo_t2i.json
@@ -0,0 +1,19 @@
+{
+ "aspect_ratio": "16:9",
+ "num_channels_latents": 16,
+ "infer_steps": 9,
+ "attn_type": "npu_flash_attn",
+ "enable_cfg": false,
+ "sample_guide_scale": 0.0,
+ "patch_size": 2,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 2,
+ "seq_p_attn_type": "ulysses"
+ }
+}
diff --git a/configs/platforms/ascend_npu/qwen_image_i2i_2511.json b/configs/platforms/ascend_npu/qwen_image_i2i_2511.json
deleted file mode 100755
index 88bb21160..000000000
--- a/configs/platforms/ascend_npu/qwen_image_i2i_2511.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "infer_steps": 40,
- "prompt_template_encode": "<|im_start|>system\nDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
- "prompt_template_encode_start_idx": 64,
- "resize_mode": "adaptive",
- "attn_type": "npu_flash_attn",
- "enable_cfg": true,
- "sample_guide_scale": 4.0,
- "CONDITION_IMAGE_SIZE": 147456,
- "USE_IMAGE_ID_IN_PROMPT": true,
- "cpu_offload": true,
- "offload_granularity": "model",
- "modulate_type": "torch",
- "rope_type": "torch",
- "layer_norm_type": "torch",
- "rms_norm_type": "torch"
-}
diff --git a/configs/platforms/ascend_npu/single/flux2_dev.json b/configs/platforms/ascend_npu/single/flux2_dev.json
new file mode 100644
index 000000000..d1f5dddd0
--- /dev/null
+++ b/configs/platforms/ascend_npu/single/flux2_dev.json
@@ -0,0 +1,20 @@
+{
+ "model_cls": "flux2_dev",
+ "task": "t2i",
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "sample_guide_scale": 4.0,
+ "vae_scale_factor": 16,
+ "feature_caching": "None",
+ "enable_cfg": false,
+ "patch_size": 2,
+ "tokenizer_max_length": 512,
+ "text_encoder_out_layers": [10, 20, 30],
+ "attn_type": "npu_flash_attn",
+ "cpu_offload": true,
+ "offload_granularity": "block",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/ascend_npu/single/hunyuan_video_t2v_480p.json b/configs/platforms/ascend_npu/single/hunyuan_video_t2v_480p.json
new file mode 100644
index 000000000..8022c3164
--- /dev/null
+++ b/configs/platforms/ascend_npu/single/hunyuan_video_t2v_480p.json
@@ -0,0 +1,16 @@
+{
+ "infer_steps": 50,
+ "transformer_model_name": "480p_i2v",
+ "fps": 24,
+ "target_video_length": 121,
+ "vae_stride": [4, 16, 16],
+ "sample_shift": 5.0,
+ "sample_guide_scale": 6.0,
+ "aspect_ratio": "16:9",
+ "enable_cfg": true,
+ "attn_type": "npu_flash_attn",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/ascend_npu/longcat_image_t2i.json b/configs/platforms/ascend_npu/single/longcat_image_t2i.json
similarity index 100%
rename from configs/platforms/ascend_npu/longcat_image_t2i.json
rename to configs/platforms/ascend_npu/single/longcat_image_t2i.json
diff --git a/configs/platforms/ascend_npu/single/ltx2_3.json b/configs/platforms/ascend_npu/single/ltx2_3.json
new file mode 100644
index 000000000..5e5fbbfa1
--- /dev/null
+++ b/configs/platforms/ascend_npu/single/ltx2_3.json
@@ -0,0 +1,46 @@
+{
+ "infer_steps": 30,
+ "target_video_length": 121,
+ "target_height": 512,
+ "target_width": 768,
+ "attn_type": "npu_flash_attn",
+ "sample_guide_scale": 3.0,
+ "sample_shift": [2.05, 0.95],
+ "enable_cfg": true,
+ "cpu_offload": true,
+ "offload_granularity": "model",
+ "norm_modulate_backend": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "num_channels_latents": 128,
+ "fps": 24,
+ "audio_fps": 24000,
+ "audio_mel_bins":16,
+ "double_precision_rope": false,
+ "use_tiling_vae": false,
+ "dit_original_ckpt": "/data/wushuo1/models/LTX-2.3/ltx-2.3-22b-dev.safetensors",
+ "caption_proj_before_connector": true,
+ "cross_attention_adaln": true,
+ "apply_gated_attention": true,
+ "mm_guider": {
+ "enabled": true,
+ "video": {
+ "cfg_scale": 3.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ },
+ "audio": {
+ "cfg_scale": 7.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ }
+ }
+}
diff --git a/configs/platforms/ascend_npu/qwen_image_t2i_2512.json b/configs/platforms/ascend_npu/single/qwen_image_t2i_2512.json
similarity index 94%
rename from configs/platforms/ascend_npu/qwen_image_t2i_2512.json
rename to configs/platforms/ascend_npu/single/qwen_image_t2i_2512.json
index 88039e37b..bee934f63 100755
--- a/configs/platforms/ascend_npu/qwen_image_t2i_2512.json
+++ b/configs/platforms/ascend_npu/single/qwen_image_t2i_2512.json
@@ -3,7 +3,7 @@
"aspect_ratio": "16:9",
"prompt_template_encode": "<|im_start|>system\nDescribe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
"prompt_template_encode_start_idx": 34,
- "attn_type": "flash_attn3",
+ "attn_type": "npu_flash_attn",
"enable_cfg": true,
"sample_guide_scale": 4.0,
"cpu_offload": true,
diff --git a/configs/platforms/ascend_npu/wan_ti2v_t2v.json b/configs/platforms/ascend_npu/single/wan_moe_t2v.json
old mode 100755
new mode 100644
similarity index 57%
rename from configs/platforms/ascend_npu/wan_ti2v_t2v.json
rename to configs/platforms/ascend_npu/single/wan_moe_t2v.json
index eb078a7fb..fbf272dad
--- a/configs/platforms/ascend_npu/wan_ti2v_t2v.json
+++ b/configs/platforms/ascend_npu/single/wan_moe_t2v.json
@@ -1,28 +1,25 @@
{
- "infer_steps": 50,
- "target_video_length": 121,
+ "infer_steps": 40,
+ "target_video_length": 81,
"text_len": 512,
- "target_height": 704,
+ "target_height": 720,
"target_width": 1280,
- "num_channels_latents": 48,
- "vae_stride": [
- 4,
- 16,
- 16
- ],
"self_attn_1_type": "npu_flash_attn",
"cross_attn_1_type": "npu_flash_attn",
"cross_attn_2_type": "npu_flash_attn",
- "sample_guide_scale": 5.0,
- "sample_shift": 5.0,
+ "sample_guide_scale": [
+ 4.0,
+ 3.0
+ ],
+ "sample_shift": 12.0,
"enable_cfg": true,
- "cpu_offload": true,
+ "cpu_offload": false,
"offload_granularity": "model",
+ "t5_cpu_offload": false,
+ "vae_cpu_offload": false,
+ "boundary": 0.875,
"modulate_type": "torch",
"rope_type": "torch",
"layer_norm_type": "torch",
- "rms_norm_type": "torch",
- "t5_cpu_offload": false,
- "vae_cpu_offload": false,
- "fps": 24
+ "rms_norm_type": "torch"
}
diff --git a/configs/platforms/ascend_npu/wan_t2v.json b/configs/platforms/ascend_npu/single/wan_t2v.json
similarity index 100%
rename from configs/platforms/ascend_npu/wan_t2v.json
rename to configs/platforms/ascend_npu/single/wan_t2v.json
diff --git a/configs/platforms/ascend_npu/single/wan_t2v_sf.json b/configs/platforms/ascend_npu/single/wan_t2v_sf.json
new file mode 100644
index 000000000..cdae6e79e
--- /dev/null
+++ b/configs/platforms/ascend_npu/single/wan_t2v_sf.json
@@ -0,0 +1,27 @@
+{
+ "infer_steps": 4,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "npu_flash_attn",
+ "cross_attn_1_type": "npu_flash_attn",
+ "cross_attn_2_type": "npu_flash_attn",
+ "sample_guide_scale": 1,
+ "sample_shift": 5.0,
+ "enable_cfg": false,
+ "cpu_offload": false,
+ "dit_original_ckpt": "/data/wushuo1/models/Self-Forcing/checkpoints/self_forcing_dmd.pt",
+ "causal_rope_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "ar_config": {
+ "local_attn_size": -1,
+ "num_frame_per_chunk": 3,
+ "timesteps_index": [0, 179, 358, 679],
+ "kv_offload": false,
+ "async_vae_decode": false
+ }
+}
diff --git a/configs/platforms/ascend_npu/z_image_turbo_t2i.json b/configs/platforms/ascend_npu/single/z_image_turbo_t2i.json
similarity index 100%
rename from configs/platforms/ascend_npu/z_image_turbo_t2i.json
rename to configs/platforms/ascend_npu/single/z_image_turbo_t2i.json
diff --git a/configs/platforms/metax/qwen_image_i2i_2511.json b/configs/platforms/metax/qwen_image_i2i_2511.json
deleted file mode 100755
index e891fd88c..000000000
--- a/configs/platforms/metax/qwen_image_i2i_2511.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "infer_steps": 40,
- "prompt_template_encode": "<|im_start|>system\nDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
- "prompt_template_encode_start_idx": 64,
- "resize_mode": "adaptive",
- "attn_type": "flash_attn2",
- "enable_cfg": true,
- "sample_guide_scale": 4.0,
- "CONDITION_IMAGE_SIZE": 147456,
- "USE_IMAGE_ID_IN_PROMPT": true,
- "modulate_type": "torch",
- "rope_type": "torch",
- "layer_norm_type": "torch",
- "rms_norm_type": "torch"
-}
diff --git a/configs/platforms/metax/single/flux2_dev.json b/configs/platforms/metax/single/flux2_dev.json
new file mode 100644
index 000000000..7365be6d9
--- /dev/null
+++ b/configs/platforms/metax/single/flux2_dev.json
@@ -0,0 +1,20 @@
+{
+ "model_cls": "flux2_dev",
+ "task": "t2i",
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "sample_guide_scale": 4.0,
+ "vae_scale_factor": 16,
+ "feature_caching": "None",
+ "enable_cfg": false,
+ "patch_size": 2,
+ "tokenizer_max_length": 512,
+ "text_encoder_out_layers": [10, 20, 30],
+ "attn_type": "flash_attn2",
+ "cpu_offload": true,
+ "offload_granularity": "block",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/metax/single/hunyuan_video_t2v_480p.json b/configs/platforms/metax/single/hunyuan_video_t2v_480p.json
new file mode 100644
index 000000000..7c0a2e0a4
--- /dev/null
+++ b/configs/platforms/metax/single/hunyuan_video_t2v_480p.json
@@ -0,0 +1,16 @@
+{
+ "infer_steps": 50,
+ "transformer_model_name": "480p_t2v",
+ "fps": 24,
+ "target_video_length": 121,
+ "vae_stride": [4, 16, 16],
+ "sample_shift": 5.0,
+ "sample_guide_scale": 6.0,
+ "aspect_ratio": "16:9",
+ "enable_cfg": true,
+ "attn_type": "flash_attn2",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/metax/single/longcat_image_t2i.json b/configs/platforms/metax/single/longcat_image_t2i.json
new file mode 100644
index 000000000..2070cb311
--- /dev/null
+++ b/configs/platforms/metax/single/longcat_image_t2i.json
@@ -0,0 +1,15 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "attn_type": "flash_attn2",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "enable_cfg_renorm": true,
+ "cfg_renorm_min": 0.0,
+ "axes_dims_rope": [16, 56, 56],
+ "dit_quant_scheme": "Default",
+ "rms_norm_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch"
+}
diff --git a/configs/platforms/metax/single/ltx_2_3.json b/configs/platforms/metax/single/ltx_2_3.json
new file mode 100644
index 000000000..cd0fc5de4
--- /dev/null
+++ b/configs/platforms/metax/single/ltx_2_3.json
@@ -0,0 +1,46 @@
+{
+ "infer_steps": 30,
+ "target_video_length": 121,
+ "target_height": 512,
+ "target_width": 768,
+ "attn_type": "flash_attn2",
+ "sample_guide_scale": 3.0,
+ "sample_shift": [2.05, 0.95],
+ "enable_cfg": true,
+ "cpu_offload": true,
+ "offload_granularity": "model",
+ "norm_modulate_backend": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "num_channels_latents": 128,
+ "fps": 24,
+ "audio_fps": 24000,
+ "audio_mel_bins": 16,
+ "double_precision_rope": false,
+ "use_tiling_vae": false,
+ "dit_original_ckpt": "/data/models/LTX-2.3/ltx-2.3-22b-dev.safetensors",
+ "caption_proj_before_connector": true,
+ "cross_attention_adaln": true,
+ "apply_gated_attention": true,
+ "mm_guider": {
+ "enabled": true,
+ "video": {
+ "cfg_scale": 3.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ },
+ "audio": {
+ "cfg_scale": 7.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ }
+ }
+}
diff --git a/configs/platforms/metax/qwen_image_t2i_2512.json b/configs/platforms/metax/single/qwen_image_t2i_2512.json
similarity index 50%
rename from configs/platforms/metax/qwen_image_t2i_2512.json
rename to configs/platforms/metax/single/qwen_image_t2i_2512.json
index 8d61a7be3..e1b986773 100755
--- a/configs/platforms/metax/qwen_image_t2i_2512.json
+++ b/configs/platforms/metax/single/qwen_image_t2i_2512.json
@@ -1,7 +1,8 @@
{
"infer_steps": 40,
- "prompt_template_encode": "<|im_start|>system\nDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
- "prompt_template_encode_start_idx": 64,
+ "aspect_ratio": "16:9",
+ "prompt_template_encode": "<|im_start|>system\nDescribe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
+ "prompt_template_encode_start_idx": 34,
"resize_mode": "adaptive",
"attn_type": "flash_attn2",
"enable_cfg": true,
@@ -12,6 +13,6 @@
"rope_type": "torch",
"layer_norm_type": "torch",
"rms_norm_type": "torch",
- "cpu_offload": "true",
+ "cpu_offload": true,
"offload_granularity": "model"
}
diff --git a/configs/platforms/metax/wan22_t2v.json b/configs/platforms/metax/single/wan22_t2v.json
similarity index 100%
rename from configs/platforms/metax/wan22_t2v.json
rename to configs/platforms/metax/single/wan22_t2v.json
diff --git a/configs/platforms/metax/wan_t2v.json b/configs/platforms/metax/single/wan_t2v.json
similarity index 100%
rename from configs/platforms/metax/wan_t2v.json
rename to configs/platforms/metax/single/wan_t2v.json
diff --git a/configs/platforms/metax/single/wan_t2v_sf.json b/configs/platforms/metax/single/wan_t2v_sf.json
new file mode 100644
index 000000000..b2d09abb8
--- /dev/null
+++ b/configs/platforms/metax/single/wan_t2v_sf.json
@@ -0,0 +1,27 @@
+{
+ "infer_steps": 4,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "flash_attn2",
+ "cross_attn_1_type": "flash_attn2",
+ "cross_attn_2_type": "flash_attn2",
+ "sample_guide_scale": 1,
+ "sample_shift": 5.0,
+ "enable_cfg": false,
+ "cpu_offload": false,
+ "dit_original_ckpt": "/data/models/Self-Forcing/checkpoints/self_forcing_dmd.pt",
+ "causal_rope_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "ar_config": {
+ "local_attn_size": -1,
+ "num_frame_per_chunk": 3,
+ "timesteps_index": [0, 179, 358, 679],
+ "kv_offload": false,
+ "async_vae_decode": false
+ }
+}
diff --git a/configs/platforms/mlu/z_image_turbo_t2i_dist.json b/configs/platforms/metax/single/z_image_turbo_t2i.json
similarity index 59%
rename from configs/platforms/mlu/z_image_turbo_t2i_dist.json
rename to configs/platforms/metax/single/z_image_turbo_t2i.json
index f95fa499b..46a6701ae 100644
--- a/configs/platforms/mlu/z_image_turbo_t2i_dist.json
+++ b/configs/platforms/metax/single/z_image_turbo_t2i.json
@@ -2,12 +2,16 @@
"aspect_ratio": "16:9",
"num_channels_latents": 16,
"infer_steps": 9,
- "attn_type": "mlu_flash_attn",
+ "attn_type": "flash_attn2",
"enable_cfg": false,
"sample_guide_scale": 0.0,
"patch_size": 2,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
"rope_type": "torch",
- "rms_norm_type": "mlu_rms_norm",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
"parallel": {
"seq_p_size": 2,
"seq_p_attn_type": "ulysses"
diff --git a/configs/platforms/mlu/qwen_image_i2i_2511.json b/configs/platforms/mlu/qwen_image_i2i_2511.json
deleted file mode 100755
index 8b956dc8f..000000000
--- a/configs/platforms/mlu/qwen_image_i2i_2511.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "infer_steps": 40,
- "prompt_template_encode": "<|im_start|>system\nDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
- "prompt_template_encode_start_idx": 64,
- "resize_mode": "adaptive",
- "attn_type": "mlu_flash_attn",
- "enable_cfg": true,
- "sample_guide_scale": 4.0,
- "CONDITION_IMAGE_SIZE": 147456,
- "USE_IMAGE_ID_IN_PROMPT": true,
- "modulate_type": "torch",
- "rope_type": "torch",
- "layer_norm_type": "torch",
- "rms_norm_type": "mlu_rms_norm"
-}
diff --git a/configs/platforms/mlu/single/flux2_dev.json b/configs/platforms/mlu/single/flux2_dev.json
new file mode 100644
index 000000000..a8eeba971
--- /dev/null
+++ b/configs/platforms/mlu/single/flux2_dev.json
@@ -0,0 +1,20 @@
+{
+ "model_cls": "flux2_dev",
+ "task": "t2i",
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "sample_guide_scale": 4.0,
+ "vae_scale_factor": 16,
+ "feature_caching": "None",
+ "enable_cfg": false,
+ "patch_size": 2,
+ "tokenizer_max_length": 512,
+ "text_encoder_out_layers": [10, 20, 30],
+ "attn_type": "mlu_flash_attn",
+ "cpu_offload": true,
+ "offload_granularity": "block",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "mlu_rms_norm"
+}
diff --git a/configs/platforms/mlu/single/hunyuan_video_t2v_480p.json b/configs/platforms/mlu/single/hunyuan_video_t2v_480p.json
new file mode 100644
index 000000000..c7450bc7c
--- /dev/null
+++ b/configs/platforms/mlu/single/hunyuan_video_t2v_480p.json
@@ -0,0 +1,16 @@
+{
+ "infer_steps": 50,
+ "transformer_model_name": "480p_i2v",
+ "fps": 24,
+ "target_video_length": 121,
+ "vae_stride": [4, 16, 16],
+ "sample_shift": 5.0,
+ "sample_guide_scale": 6.0,
+ "aspect_ratio": "16:9",
+ "enable_cfg": true,
+ "attn_type": "mlu_flash_attn",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "mlu_rms_norm"
+}
diff --git a/configs/platforms/mlu/single/longcat_image_t2i.json b/configs/platforms/mlu/single/longcat_image_t2i.json
new file mode 100644
index 000000000..0c914aad8
--- /dev/null
+++ b/configs/platforms/mlu/single/longcat_image_t2i.json
@@ -0,0 +1,15 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "attn_type": "mlu_flash_attn",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "enable_cfg_renorm": true,
+ "cfg_renorm_min": 0.0,
+ "axes_dims_rope": [16, 56, 56],
+ "dit_quant_scheme": "Default",
+ "rms_norm_type": "mlu_rms_norm",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch"
+}
diff --git a/configs/platforms/mlu/single/ltx2_3.json b/configs/platforms/mlu/single/ltx2_3.json
new file mode 100644
index 000000000..197d1b6d8
--- /dev/null
+++ b/configs/platforms/mlu/single/ltx2_3.json
@@ -0,0 +1,46 @@
+{
+ "infer_steps": 30,
+ "target_video_length": 121,
+ "target_height": 512,
+ "target_width": 768,
+ "attn_type": "mlu_flash_attn",
+ "sample_guide_scale": 3.0,
+ "sample_shift": [2.05, 0.95],
+ "enable_cfg": true,
+ "cpu_offload": true,
+ "offload_granularity": "model",
+ "norm_modulate_backend": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "mlu_rms_norm",
+ "num_channels_latents": 128,
+ "fps": 24,
+ "audio_fps": 24000,
+ "audio_mel_bins": 16,
+ "double_precision_rope": false,
+ "use_tiling_vae": false,
+ "dit_original_ckpt": "/data/models/LTX-2.3/ltx-2.3-22b-dev.safetensors",
+ "caption_proj_before_connector": true,
+ "cross_attention_adaln": true,
+ "apply_gated_attention": true,
+ "mm_guider": {
+ "enabled": true,
+ "video": {
+ "cfg_scale": 3.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ },
+ "audio": {
+ "cfg_scale": 7.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ }
+ }
+}
diff --git a/configs/platforms/mlu/single/qwen_image_t2i_2512.json b/configs/platforms/mlu/single/qwen_image_t2i_2512.json
new file mode 100755
index 000000000..f8aabbeb5
--- /dev/null
+++ b/configs/platforms/mlu/single/qwen_image_t2i_2512.json
@@ -0,0 +1,15 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "prompt_template_encode": "<|im_start|>system\nDescribe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
+ "prompt_template_encode_start_idx": 34,
+ "attn_type": "mlu_flash_attn",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "mlu_rms_norm"
+}
diff --git a/configs/platforms/mlu/single/wan_moe_t2v.json b/configs/platforms/mlu/single/wan_moe_t2v.json
new file mode 100644
index 000000000..d5956c82a
--- /dev/null
+++ b/configs/platforms/mlu/single/wan_moe_t2v.json
@@ -0,0 +1,25 @@
+{
+ "infer_steps": 40,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 720,
+ "target_width": 1280,
+ "self_attn_1_type": "mlu_flash_attn",
+ "cross_attn_1_type": "mlu_flash_attn",
+ "cross_attn_2_type": "mlu_flash_attn",
+ "sample_guide_scale": [
+ 4.0,
+ 3.0
+ ],
+ "sample_shift": 12.0,
+ "enable_cfg": true,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "t5_cpu_offload": false,
+ "vae_cpu_offload": false,
+ "boundary": 0.875,
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "mlu_rms_norm"
+}
diff --git a/configs/platforms/mlu/wan_t2v.json b/configs/platforms/mlu/single/wan_t2v.json
similarity index 100%
rename from configs/platforms/mlu/wan_t2v.json
rename to configs/platforms/mlu/single/wan_t2v.json
diff --git a/configs/platforms/mlu/single/wan_t2v_sf.json b/configs/platforms/mlu/single/wan_t2v_sf.json
new file mode 100644
index 000000000..cbd73c77a
--- /dev/null
+++ b/configs/platforms/mlu/single/wan_t2v_sf.json
@@ -0,0 +1,27 @@
+{
+ "infer_steps": 4,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "mlu_flash_attn",
+ "cross_attn_1_type": "mlu_flash_attn",
+ "cross_attn_2_type": "mlu_flash_attn",
+ "sample_guide_scale": 1,
+ "sample_shift": 5.0,
+ "enable_cfg": false,
+ "cpu_offload": false,
+ "dit_original_ckpt": "/data/models/Self-Forcing/checkpoints/self_forcing_dmd.pt",
+ "causal_rope_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "mlu_rms_norm",
+ "ar_config": {
+ "local_attn_size": -1,
+ "num_frame_per_chunk": 3,
+ "timesteps_index": [0, 179, 358, 679],
+ "kv_offload": false,
+ "async_vae_decode": false
+ }
+}
diff --git a/configs/platforms/mlu/z_image_turbo_t2i.json b/configs/platforms/mlu/single/z_image_turbo_t2i.json
similarity index 67%
rename from configs/platforms/mlu/z_image_turbo_t2i.json
rename to configs/platforms/mlu/single/z_image_turbo_t2i.json
index 769d1ea1d..4300d403c 100644
--- a/configs/platforms/mlu/z_image_turbo_t2i.json
+++ b/configs/platforms/mlu/single/z_image_turbo_t2i.json
@@ -6,6 +6,10 @@
"enable_cfg": false,
"sample_guide_scale": 0.0,
"patch_size": 2,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
"rope_type": "torch",
+ "layer_norm_type": "torch",
"rms_norm_type": "mlu_rms_norm"
}
diff --git a/configs/platforms/nvidia/dist/flux2_dev_tp8.json b/configs/platforms/nvidia/dist/flux2_dev_tp8.json
new file mode 100644
index 000000000..3decaffd0
--- /dev/null
+++ b/configs/platforms/nvidia/dist/flux2_dev_tp8.json
@@ -0,0 +1,27 @@
+{
+ "model_cls": "flux2_dev",
+ "task": "t2i",
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "sample_guide_scale": 4.0,
+ "vae_scale_factor": 16,
+ "feature_caching": "None",
+ "enable_cfg": false,
+ "patch_size": 2,
+ "tokenizer_max_length": 512,
+ "text_encoder_out_layers": [
+ 10,
+ 20,
+ 30
+ ],
+ "attn_type": "flash_attn2",
+ "cpu_offload": false,
+ "offload_granularity": "block",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "tensor_p_size": 8
+ }
+}
diff --git a/configs/platforms/nvidia/dist/hunyuan_video_t2v_480p_dist8.json b/configs/platforms/nvidia/dist/hunyuan_video_t2v_480p_dist8.json
new file mode 100644
index 000000000..f492b3a35
--- /dev/null
+++ b/configs/platforms/nvidia/dist/hunyuan_video_t2v_480p_dist8.json
@@ -0,0 +1,26 @@
+{
+ "infer_steps": 50,
+ "transformer_model_name": "480p_i2v",
+ "fps": 24,
+ "target_video_length": 121,
+ "vae_stride": [
+ 4,
+ 16,
+ 16
+ ],
+ "sample_shift": 5.0,
+ "sample_guide_scale": 6.0,
+ "aspect_ratio": "16:9",
+ "enable_cfg": true,
+ "attn_type": "flash_attn2",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ },
+ "align_single_card_shape": true
+}
diff --git a/configs/platforms/nvidia/dist/longcat_image_t2i_dist8.json b/configs/platforms/nvidia/dist/longcat_image_t2i_dist8.json
new file mode 100644
index 000000000..ef4344572
--- /dev/null
+++ b/configs/platforms/nvidia/dist/longcat_image_t2i_dist8.json
@@ -0,0 +1,24 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "attn_type": "flash_attn2",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "enable_cfg_renorm": true,
+ "cfg_renorm_min": 0.0,
+ "axes_dims_rope": [
+ 16,
+ 56,
+ 56
+ ],
+ "dit_quant_scheme": "Default",
+ "rms_norm_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/nvidia/dist/ltx2_3_tp8.json b/configs/platforms/nvidia/dist/ltx2_3_tp8.json
new file mode 100644
index 000000000..cadf86c57
--- /dev/null
+++ b/configs/platforms/nvidia/dist/ltx2_3_tp8.json
@@ -0,0 +1,57 @@
+{
+ "infer_steps": 30,
+ "target_video_length": 121,
+ "target_height": 512,
+ "target_width": 768,
+ "attn_type": "flash_attn2",
+ "sample_guide_scale": 3.0,
+ "sample_shift": [
+ 2.05,
+ 0.95
+ ],
+ "enable_cfg": true,
+ "cpu_offload": false,
+ "gemma_cpu_offload": true,
+ "vae_cpu_offload": false,
+ "norm_modulate_backend": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "num_channels_latents": 128,
+ "fps": 24,
+ "audio_fps": 24000,
+ "audio_mel_bins": 16,
+ "double_precision_rope": false,
+ "use_tiling_vae": false,
+ "dit_original_ckpt": "/data/nvme1/wushuo/hf_models/models/LTX-2.3/ltx-2.3-22b-dev.safetensors",
+ "caption_proj_before_connector": true,
+ "cross_attention_adaln": true,
+ "apply_gated_attention": true,
+ "mm_guider": {
+ "enabled": true,
+ "video": {
+ "cfg_scale": 3.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [
+ 28
+ ],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ },
+ "audio": {
+ "cfg_scale": 7.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [
+ 28
+ ],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ }
+ },
+ "parallel": {
+ "tensor_p_size": 8
+ }
+}
diff --git a/configs/platforms/nvidia/dist/qwen_image_t2i_2512_dist8.json b/configs/platforms/nvidia/dist/qwen_image_t2i_2512_dist8.json
new file mode 100644
index 000000000..d79b82578
--- /dev/null
+++ b/configs/platforms/nvidia/dist/qwen_image_t2i_2512_dist8.json
@@ -0,0 +1,20 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "prompt_template_encode": "<|im_start|>system\nDescribe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
+ "prompt_template_encode_start_idx": 34,
+ "attn_type": "flash_attn2",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/nvidia/dist/wan_moe_t2v_dist8.json b/configs/platforms/nvidia/dist/wan_moe_t2v_dist8.json
new file mode 100644
index 000000000..4656fe366
--- /dev/null
+++ b/configs/platforms/nvidia/dist/wan_moe_t2v_dist8.json
@@ -0,0 +1,30 @@
+{
+ "infer_steps": 40,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "flash_attn2",
+ "cross_attn_1_type": "flash_attn2",
+ "cross_attn_2_type": "flash_attn2",
+ "sample_guide_scale": [
+ 4.0,
+ 3.0
+ ],
+ "sample_shift": 12.0,
+ "enable_cfg": true,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "t5_cpu_offload": false,
+ "vae_cpu_offload": false,
+ "boundary": 0.875,
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/nvidia/dist/wan_t2v_dist8.json b/configs/platforms/nvidia/dist/wan_t2v_dist8.json
new file mode 100644
index 000000000..26380ba3a
--- /dev/null
+++ b/configs/platforms/nvidia/dist/wan_t2v_dist8.json
@@ -0,0 +1,24 @@
+{
+ "infer_steps": 50,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "flash_attn2",
+ "cross_attn_1_type": "flash_attn2",
+ "cross_attn_2_type": "flash_attn2",
+ "sample_guide_scale": 6,
+ "sample_shift": 8,
+ "enable_cfg": true,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 4,
+ "seq_p_attn_type": "ulysses",
+ "cfg_p_size": 2
+ }
+}
diff --git a/configs/platforms/nvidia/dist/wan_t2v_sf_dist8.json b/configs/platforms/nvidia/dist/wan_t2v_sf_dist8.json
new file mode 100644
index 000000000..80d326ea3
--- /dev/null
+++ b/configs/platforms/nvidia/dist/wan_t2v_sf_dist8.json
@@ -0,0 +1,37 @@
+{
+ "infer_steps": 4,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "flash_attn2",
+ "cross_attn_1_type": "flash_attn2",
+ "cross_attn_2_type": "flash_attn2",
+ "sample_guide_scale": 1,
+ "sample_shift": 5.0,
+ "enable_cfg": false,
+ "cpu_offload": false,
+ "dit_original_ckpt": "/data/nvme1/wushuo/hf_models/models/Self-Forcing/checkpoints/self_forcing_dmd.pt",
+ "causal_rope_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "ar_config": {
+ "local_attn_size": -1,
+ "num_frame_per_chunk": 3,
+ "timesteps_index": [
+ 0,
+ 179,
+ 358,
+ 679
+ ],
+ "kv_offload": false,
+ "async_vae_decode": false
+ },
+ "parallel": {
+ "seq_p_size": 4,
+ "cfg_p_size": 2,
+ "seq_p_attn_type": "ulysses"
+ }
+}
diff --git a/configs/platforms/nvidia/dist/z_image_turbo_t2i_dist2.json b/configs/platforms/nvidia/dist/z_image_turbo_t2i_dist2.json
new file mode 100644
index 000000000..46a6701ae
--- /dev/null
+++ b/configs/platforms/nvidia/dist/z_image_turbo_t2i_dist2.json
@@ -0,0 +1,19 @@
+{
+ "aspect_ratio": "16:9",
+ "num_channels_latents": 16,
+ "infer_steps": 9,
+ "attn_type": "flash_attn2",
+ "enable_cfg": false,
+ "sample_guide_scale": 0.0,
+ "patch_size": 2,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "parallel": {
+ "seq_p_size": 2,
+ "seq_p_attn_type": "ulysses"
+ }
+}
diff --git a/configs/platforms/nvidia/qwen_image_i2i_2511.json b/configs/platforms/nvidia/qwen_image_i2i_2511.json
deleted file mode 100755
index 9093a458a..000000000
--- a/configs/platforms/nvidia/qwen_image_i2i_2511.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "infer_steps": 40,
- "prompt_template_encode": "<|im_start|>system\nDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
- "prompt_template_encode_start_idx": 64,
- "resize_mode": "adaptive",
- "attn_type": "flash_attn3",
- "enable_cfg": true,
- "sample_guide_scale": 4.0,
- "CONDITION_IMAGE_SIZE": 147456,
- "USE_IMAGE_ID_IN_PROMPT": true
-}
diff --git a/configs/platforms/nvidia/single/flux2_dev.json b/configs/platforms/nvidia/single/flux2_dev.json
new file mode 100644
index 000000000..7365be6d9
--- /dev/null
+++ b/configs/platforms/nvidia/single/flux2_dev.json
@@ -0,0 +1,20 @@
+{
+ "model_cls": "flux2_dev",
+ "task": "t2i",
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "sample_guide_scale": 4.0,
+ "vae_scale_factor": 16,
+ "feature_caching": "None",
+ "enable_cfg": false,
+ "patch_size": 2,
+ "tokenizer_max_length": 512,
+ "text_encoder_out_layers": [10, 20, 30],
+ "attn_type": "flash_attn2",
+ "cpu_offload": true,
+ "offload_granularity": "block",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/nvidia/single/hunyuan_video_t2v_480p.json b/configs/platforms/nvidia/single/hunyuan_video_t2v_480p.json
new file mode 100644
index 000000000..03c5707d4
--- /dev/null
+++ b/configs/platforms/nvidia/single/hunyuan_video_t2v_480p.json
@@ -0,0 +1,16 @@
+{
+ "infer_steps": 50,
+ "transformer_model_name": "480p_i2v",
+ "fps": 24,
+ "target_video_length": 121,
+ "vae_stride": [4, 16, 16],
+ "sample_shift": 5.0,
+ "sample_guide_scale": 6.0,
+ "aspect_ratio": "16:9",
+ "enable_cfg": true,
+ "attn_type": "flash_attn2",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/nvidia/single/longcat_image_t2i.json b/configs/platforms/nvidia/single/longcat_image_t2i.json
new file mode 100644
index 000000000..2070cb311
--- /dev/null
+++ b/configs/platforms/nvidia/single/longcat_image_t2i.json
@@ -0,0 +1,15 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "attn_type": "flash_attn2",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "enable_cfg_renorm": true,
+ "cfg_renorm_min": 0.0,
+ "axes_dims_rope": [16, 56, 56],
+ "dit_quant_scheme": "Default",
+ "rms_norm_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch"
+}
diff --git a/configs/platforms/nvidia/single/ltx2_3.json b/configs/platforms/nvidia/single/ltx2_3.json
new file mode 100644
index 000000000..ac99ca3e2
--- /dev/null
+++ b/configs/platforms/nvidia/single/ltx2_3.json
@@ -0,0 +1,46 @@
+{
+ "infer_steps": 30,
+ "target_video_length": 121,
+ "target_height": 512,
+ "target_width": 768,
+ "attn_type": "flash_attn2",
+ "sample_guide_scale": 3.0,
+ "sample_shift": [2.05, 0.95],
+ "enable_cfg": true,
+ "cpu_offload": true,
+ "offload_granularity": "model",
+ "norm_modulate_backend": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "num_channels_latents": 128,
+ "fps": 24,
+ "audio_fps": 24000,
+ "audio_mel_bins": 16,
+ "double_precision_rope": false,
+ "use_tiling_vae": false,
+ "dit_original_ckpt": "/data/nvme1/wushuo/hf_models/models/LTX-2.3/ltx-2.3-22b-dev.safetensors",
+ "caption_proj_before_connector": true,
+ "cross_attention_adaln": true,
+ "apply_gated_attention": true,
+ "mm_guider": {
+ "enabled": true,
+ "video": {
+ "cfg_scale": 3.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ },
+ "audio": {
+ "cfg_scale": 7.0,
+ "stg_scale": 1.0,
+ "stg_blocks": [28],
+ "modality_scale": 3.0,
+ "rescale_scale": 0.7,
+ "skip_step": 0
+ }
+ }
+}
diff --git a/configs/platforms/nvidia/single/qwen_image_t2i_2512.json b/configs/platforms/nvidia/single/qwen_image_t2i_2512.json
new file mode 100644
index 000000000..dfec1a844
--- /dev/null
+++ b/configs/platforms/nvidia/single/qwen_image_t2i_2512.json
@@ -0,0 +1,15 @@
+{
+ "infer_steps": 50,
+ "aspect_ratio": "16:9",
+ "prompt_template_encode": "<|im_start|>system\nDescribe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n",
+ "prompt_template_encode_start_idx": 34,
+ "attn_type": "flash_attn2",
+ "enable_cfg": true,
+ "sample_guide_scale": 4.0,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/nvidia/single/wan_moe_t2v.json b/configs/platforms/nvidia/single/wan_moe_t2v.json
new file mode 100644
index 000000000..418128efc
--- /dev/null
+++ b/configs/platforms/nvidia/single/wan_moe_t2v.json
@@ -0,0 +1,25 @@
+{
+ "infer_steps": 40,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "flash_attn2",
+ "cross_attn_1_type": "flash_attn2",
+ "cross_attn_2_type": "flash_attn2",
+ "sample_guide_scale": [
+ 4.0,
+ 3.0
+ ],
+ "sample_shift": 12.0,
+ "enable_cfg": true,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "t5_cpu_offload": false,
+ "vae_cpu_offload": false,
+ "boundary": 0.875,
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/nvidia/single/wan_t2v.json b/configs/platforms/nvidia/single/wan_t2v.json
new file mode 100755
index 000000000..539634fbb
--- /dev/null
+++ b/configs/platforms/nvidia/single/wan_t2v.json
@@ -0,0 +1,19 @@
+{
+ "infer_steps": 50,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "flash_attn2",
+ "cross_attn_1_type": "flash_attn2",
+ "cross_attn_2_type": "flash_attn2",
+ "sample_guide_scale": 6,
+ "sample_shift": 8,
+ "enable_cfg": true,
+ "cpu_offload": true,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/nvidia/single/wan_t2v_sf.json b/configs/platforms/nvidia/single/wan_t2v_sf.json
new file mode 100644
index 000000000..5f1308f9f
--- /dev/null
+++ b/configs/platforms/nvidia/single/wan_t2v_sf.json
@@ -0,0 +1,27 @@
+{
+ "infer_steps": 4,
+ "target_video_length": 81,
+ "text_len": 512,
+ "target_height": 480,
+ "target_width": 832,
+ "self_attn_1_type": "flash_attn2",
+ "cross_attn_1_type": "flash_attn2",
+ "cross_attn_2_type": "flash_attn2",
+ "sample_guide_scale": 1,
+ "sample_shift": 5.0,
+ "enable_cfg": false,
+ "cpu_offload": false,
+ "dit_original_ckpt": "/data/nvme1/wushuo/hf_models/models/Self-Forcing/checkpoints/self_forcing_dmd.pt",
+ "causal_rope_type": "torch",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch",
+ "ar_config": {
+ "local_attn_size": -1,
+ "num_frame_per_chunk": 3,
+ "timesteps_index": [0, 179, 358, 679],
+ "kv_offload": false,
+ "async_vae_decode": false
+ }
+}
diff --git a/configs/platforms/nvidia/single/z_image_turbo_t2i.json b/configs/platforms/nvidia/single/z_image_turbo_t2i.json
new file mode 100644
index 000000000..b3504446b
--- /dev/null
+++ b/configs/platforms/nvidia/single/z_image_turbo_t2i.json
@@ -0,0 +1,15 @@
+{
+ "aspect_ratio": "16:9",
+ "num_channels_latents": 16,
+ "infer_steps": 9,
+ "attn_type": "flash_attn2",
+ "enable_cfg": false,
+ "sample_guide_scale": 0.0,
+ "patch_size": 2,
+ "cpu_offload": false,
+ "offload_granularity": "model",
+ "modulate_type": "torch",
+ "rope_type": "torch",
+ "layer_norm_type": "torch",
+ "rms_norm_type": "torch"
+}
diff --git a/configs/platforms/nvidia/wan_t2v.json b/configs/platforms/nvidia/wan_t2v.json
deleted file mode 100755
index 2e2825047..000000000
--- a/configs/platforms/nvidia/wan_t2v.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "infer_steps": 50,
- "target_video_length": 81,
- "text_len": 512,
- "target_height": 480,
- "target_width": 832,
- "self_attn_1_type": "flash_attn3",
- "cross_attn_1_type": "flash_attn3",
- "cross_attn_2_type": "flash_attn3",
- "sample_guide_scale": 6,
- "sample_shift": 8,
- "enable_cfg": true,
- "cpu_offload": false
-}
diff --git a/docs/ZH_CN/.readthedocs.yaml b/docs/ZH_CN/.readthedocs.yaml
deleted file mode 100644
index c3677c609..000000000
--- a/docs/ZH_CN/.readthedocs.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-version: 2
-
-# Set the version of Python and other tools you might need
-build:
- os: ubuntu-20.04
- tools:
- python: "3.10"
-
-formats:
- - epub
-
-sphinx:
- configuration: docs/ZH_CN/source/conf.py
-
-python:
- install:
- - requirements: requirements-docs.txt
diff --git a/docs/ZH_CN/Makefile b/docs/ZH_CN/Makefile
deleted file mode 100755
index d0c3cbf10..000000000
--- a/docs/ZH_CN/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Minimal makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line, and also
-# from the environment for the first two.
-SPHINXOPTS ?=
-SPHINXBUILD ?= sphinx-build
-SOURCEDIR = source
-BUILDDIR = build
-
-# Put it first so that "make" without argument is like "make help".
-help:
- @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-
-.PHONY: help Makefile
-
-# Catch-all target: route all unknown targets to Sphinx using the new
-# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
-%: Makefile
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/ZH_CN/make.bat b/docs/ZH_CN/make.bat
deleted file mode 100755
index 747ffb7b3..000000000
--- a/docs/ZH_CN/make.bat
+++ /dev/null
@@ -1,35 +0,0 @@
-@ECHO OFF
-
-pushd %~dp0
-
-REM Command file for Sphinx documentation
-
-if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=sphinx-build
-)
-set SOURCEDIR=source
-set BUILDDIR=build
-
-%SPHINXBUILD% >NUL 2>NUL
-if errorlevel 9009 (
- echo.
- echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
- echo.installed, then set the SPHINXBUILD environment variable to point
- echo.to the full path of the 'sphinx-build' executable. Alternatively you
- echo.may add the Sphinx directory to PATH.
- echo.
- echo.If you don't have Sphinx installed, grab it from
- echo.https://www.sphinx-doc.org/
- exit /b 1
-)
-
-if "%1" == "" goto help
-
-%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
-goto end
-
-:help
-%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
-
-:end
-popd
diff --git a/docs/ZH_CN/source/conf.py b/docs/ZH_CN/source/conf.py
deleted file mode 100755
index 659c3130d..000000000
--- a/docs/ZH_CN/source/conf.py
+++ /dev/null
@@ -1,128 +0,0 @@
-# Configuration file for the Sphinx documentation builder.
-#
-# This file only contains a selection of the most common options. For a full
-# list see the documentation:
-# https://www.sphinx-doc.org/en/master/usage/configuration.html
-
-# -- Path setup --------------------------------------------------------------
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-
-import logging
-import os
-import sys
-from typing import List
-
-import sphinxcontrib.redoc
-from sphinx.ext import autodoc
-
-logger = logging.getLogger(__name__)
-sys.path.append(os.path.abspath("../.."))
-
-# -- Project information -----------------------------------------------------
-
-project = "Lightx2v"
-copyright = "2025, Lightx2v Team"
-author = "the Lightx2v Team"
-
-# -- General configuration ---------------------------------------------------
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = [
- "sphinx.ext.napoleon",
- "sphinx.ext.viewcode",
- "sphinx.ext.intersphinx",
- "sphinx_copybutton",
- "sphinx.ext.autodoc",
- "sphinx.ext.autosummary",
- "sphinx.ext.mathjax",
- "myst_parser",
- "sphinxarg.ext",
- "sphinxcontrib.redoc",
- "sphinxcontrib.openapi",
-]
-
-myst_enable_extensions = [
- "dollarmath",
- "amsmath",
-]
-
-html_static_path = ["_static"]
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ["_templates"]
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This pattern also affects html_static_path and html_extra_path.
-exclude_patterns: List[str] = ["**/*.template.rst"]
-
-# Exclude the prompt "$" when copying code
-copybutton_prompt_text = r"\$ "
-copybutton_prompt_is_regexp = True
-
-# -- Options for HTML output -------------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
-html_title = project
-html_theme = "sphinx_book_theme"
-# html_theme = 'sphinx_rtd_theme'
-html_logo = "../../../assets/img_lightx2v.png"
-html_theme_options = {
- "path_to_docs": "docs/ZH_CN/source",
- "repository_url": "https://github.com/ModelTC/lightx2v",
- "use_repository_button": True,
-}
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-# html_static_path = ['_static']
-
-
-# Generate additional rst documentation here.
-def setup(app):
- # from docs.source.generate_examples import generate_examples
- # generate_examples()
- pass
-
-
-# Mock out external dependencies here.
-autodoc_mock_imports = [
- "cpuinfo",
- "torch",
- "transformers",
- "psutil",
- "prometheus_client",
- "sentencepiece",
- "lightllmnumpy",
- "tqdm",
- "tensorizer",
-]
-
-for mock_target in autodoc_mock_imports:
- if mock_target in sys.modules:
- logger.info(
- "Potentially problematic mock target (%s) found; autodoc_mock_imports cannot mock modules that have already been loaded into sys.modules when the sphinx build starts.",
- mock_target,
- )
-
-
-class MockedClassDocumenter(autodoc.ClassDocumenter):
- """Remove note about base class when a class is derived from object."""
-
- def add_line(self, line: str, source: str, *lineno: int) -> None:
- if line == " Bases: :py:class:`object`":
- return
- super().add_line(line, source, *lineno)
-
-
-autodoc.ClassDocumenter = MockedClassDocumenter
-
-navigation_with_keys = False
diff --git a/docs/ZH_CN/source/deploy_guides/deploy_comfyui.md b/docs/ZH_CN/source/deploy_guides/deploy_comfyui.md
deleted file mode 100644
index 9355731c7..000000000
--- a/docs/ZH_CN/source/deploy_guides/deploy_comfyui.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# ComfyUI 部署
-
-## ComfyUI-Lightx2vWrapper
-
-LightX2V 的官方 ComfyUI 集成节点已经发布在独立仓库中,提供了完整的模块化配置系统和优化功能。
-
-### 项目地址
-
-- GitHub: [https://github.com/ModelTC/ComfyUI-Lightx2vWrapper](https://github.com/ModelTC/ComfyUI-Lightx2vWrapper)
-
-### 主要特性
-
-- 模块化配置系统:为视频生成的各个方面提供独立节点
-- 支持文生视频(T2V)和图生视频(I2V)两种生成模式
-- 高级优化功能:
- - TeaCache 加速(最高 3 倍加速)
- - 量化支持(int8、fp8)
- - CPU 卸载内存优化
- - 轻量级 VAE 选项
-- LoRA 支持:可链式组合多个 LoRA 模型
-- 多模型支持:wan2.1、hunyuan 等架构
-
-### 安装和使用
-
-请访问上述 GitHub 仓库查看详细的安装说明、使用教程和示例工作流。
diff --git a/docs/ZH_CN/source/deploy_guides/deploy_gradio.md b/docs/ZH_CN/source/deploy_guides/deploy_gradio.md
deleted file mode 100644
index 244b7889d..000000000
--- a/docs/ZH_CN/source/deploy_guides/deploy_gradio.md
+++ /dev/null
@@ -1,242 +0,0 @@
-# Gradio 部署指南
-
-## 📖 概述
-
-Lightx2v 是一个轻量级的视频推理和生成引擎,提供基于 Gradio 的 Web 界面,支持图像到视频(Image-to-Video)和文本到视频(Text-to-Video)两种生成模式。
-
-对于Windows系统,我们提供了便捷的一键部署方式,支持自动环境配置和智能参数优化。详细操作请参考[一键启动Gradio](./deploy_local_windows.md/#一键启动gradio推荐)章节。
-
-
-
-## 📁 文件结构
-
-```
-LightX2V/app/
-├── gradio_demo.py # 英文界面演示
-├── gradio_demo_zh.py # 中文界面演示
-├── run_gradio.sh # 启动脚本
-├── README.md # 说明文档
-├── outputs/ # 生成视频保存目录
-└── inference_logs.log # 推理日志
-```
-
-本项目包含两个主要演示文件:
-- `gradio_demo.py` - 英文界面版本
-- `gradio_demo_zh.py` - 中文界面版本
-
-## 🚀 快速开始
-
-### 环境要求
-
-按照[快速开始文档](../getting_started/quickstart.md)安装环境
-
-#### 推荐优化库配置
-
-- ✅ [Flash attention](https://github.com/Dao-AILab/flash-attention)
-- ✅ [Sage attention](https://github.com/thu-ml/SageAttention)
-- ✅ [vllm-kernel](https://github.com/vllm-project/vllm)
-- ✅ [sglang-kernel](https://github.com/sgl-project/sglang/tree/main/sgl-kernel)
-- ✅ [q8-kernel](https://github.com/KONAKONA666/q8_kernels) (仅支持ADA架构的GPU)
-
-可根据需要,按照各算子的项目主页教程进行安装。
-
-### 📥 模型下载
-
-可通过前端界面一键下载模型,提供了两个下载源,huggingface和modelscope,可根据自己情况选择
-也可参考[模型结构文档](../getting_started/model_structure.md)下载完整模型(包含量化和非量化版本)或仅下载量化/非量化版本。
-
-#### wan2.1 模型目录结构
-
-```
-models/
-├── wan2.1_i2v_720p_lightx2v_4step.safetensors # 原始精度
-├── wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step.safetensors # FP8 量化
-├── wan2.1_i2v_720p_int8_lightx2v_4step.safetensors # INT8 量化
-├── wan2.1_i2v_720p_int8_lightx2v_4step_split # INT8 量化分block存储目录
-├── wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step_split # FP8 量化分block存储目录
-├── 其他权重(例如t2v)
-├── t5/clip/xlm-roberta-large/google # text和image encoder
-├── vae/lightvae/lighttae # vae
-└── config.json # 模型配置文件
-```
-
-#### wan2.2 模型目录结构
-
-```
-models/
-├── wan2.2_i2v_A14b_high_noise_lightx2v_4step_1030.safetensors # high noise 原始精度
-├── wan2.2_i2v_A14b_high_noise_fp8_e4m3_lightx2v_4step_1030.safetensors # high noise FP8 量化
-├── wan2.2_i2v_A14b_high_noise_int8_lightx2v_4step_1030.safetensors # high noise INT8 量化
-├── wan2.2_i2v_A14b_high_noise_int8_lightx2v_4step_1030_split # high noise INT8 量化分block存储目录
-├── wan2.2_i2v_A14b_low_noise_lightx2v_4step.safetensors # low noise 原始精度
-├── wan2.2_i2v_A14b_low_noise_fp8_e4m3_lightx2v_4step.safetensors # low noise FP8 量化
-├── wan2.2_i2v_A14b_low_noise_int8_lightx2v_4step.safetensors # low noise INT8 量化
-├── wan2.2_i2v_A14b_low_noise_int8_lightx2v_4step_split # low noise INT8 量化分block存储目录
-├── t5/clip/xlm-roberta-large/google # text和image encoder
-├── vae/lightvae/lighttae # vae
-└── config.json # 模型配置文件
-```
-
-**📝 下载说明**:
-
-- 模型权重可从 HuggingFace 下载:
- - [Wan2.1-Distill-Models](https://huggingface.co/lightx2v/Wan2.1-Distill-Models)
- - [Wan2.2-Distill-Models](https://huggingface.co/lightx2v/Wan2.2-Distill-Models)
-- Text 和 Image Encoder 可从 [Encoders](https://huggingface.co/lightx2v/Encoders) 下载
-- VAE 可从 [Autoencoders](https://huggingface.co/lightx2v/Autoencoders) 下载
-- 对于 `xxx_split` 目录(例如 `wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step_split`),即按照 block 存储的多个 safetensors,适用于内存不足的设备。例如内存 16GB 以内,请根据自身情况下载
-
-
-### 启动方式
-
-#### 方式一:使用启动脚本(推荐)
-
-**Linux 环境:**
-```bash
-# 1. 编辑启动脚本,配置相关路径
-cd app/
-vim run_gradio.sh
-
-# 需要修改的配置项:
-# - lightx2v_path: Lightx2v项目根目录路径
-# - model_path: 模型根目录路径(包含所有模型文件)
-
-# 💾 重要提示:建议将模型路径指向SSD存储位置
-# 例如:/mnt/ssd/models/ 或 /data/ssd/models/
-
-# 2. 运行启动脚本
-bash run_gradio.sh
-
-# 3. 或使用参数启动
-bash run_gradio.sh --lang zh --port 8032
-bash run_gradio.sh --lang en --port 7862
-```
-
-**Windows 环境:**
-```cmd
-# 1. 编辑启动脚本,配置相关路径
-cd app\
-notepad run_gradio_win.bat
-
-# 需要修改的配置项:
-# - lightx2v_path: Lightx2v项目根目录路径
-# - model_path: 模型根目录路径(包含所有模型文件)
-
-# 💾 重要提示:建议将模型路径指向SSD存储位置
-# 例如:D:\models\ 或 E:\models\
-
-# 2. 运行启动脚本
-run_gradio_win.bat
-
-# 3. 或使用参数启动
-run_gradio_win.bat --lang zh --port 8032
-run_gradio_win.bat --lang en --port 7862
-```
-
-#### 方式二:直接命令行启动
-
-```bash
-pip install -v git+https://github.com/ModelTC/LightX2V.git
-```
-
-**Linux 环境:**
-
-**中文界面版本:**
-```bash
-python gradio_demo_zh.py \
- --model_path /path/to/models \
- --server_name 0.0.0.0 \
- --server_port 7862
-```
-
-**英文界面版本:**
-```bash
-python gradio_demo.py \
- --model_path /path/to/models \
- --server_name 0.0.0.0 \
- --server_port 7862
-```
-
-**Windows 环境:**
-
-**中文界面版本:**
-```cmd
-python gradio_demo_zh.py ^
- --model_path D:\models ^
- --server_name 127.0.0.1 ^
- --server_port 7862
-```
-
-**英文界面版本:**
-```cmd
-python gradio_demo.py ^
- --model_path D:\models ^
- --server_name 127.0.0.1 ^
- --server_port 7862
-```
-
-**💡 提示**:模型类型(wan2.1/wan2.2)、任务类型(i2v/t2v)以及具体的模型文件选择均在 Web 界面中进行配置。
-
-## 📋 命令行参数
-
-| 参数 | 类型 | 必需 | 默认值 | 说明 |
-|------|------|------|--------|------|
-| `--model_path` | str | ✅ | - | 模型根目录路径(包含所有模型文件的目录) |
-| `--server_port` | int | ❌ | 7862 | 服务器端口 |
-| `--server_name` | str | ❌ | 0.0.0.0 | 服务器IP地址 |
-| `--output_dir` | str | ❌ | ./outputs | 输出视频保存目录 |
-
-**💡 说明**:模型类型(wan2.1/wan2.2)、任务类型(i2v/t2v)以及具体的模型文件选择均在 Web 界面中进行配置。
-
-## 🎯 功能特性
-
-### 模型配置
-
-- **模型类型**: 支持 wan2.1 和 wan2.2 两种模型架构
-- **任务类型**: 支持图像到视频(i2v)和文本到视频(t2v)两种生成模式
-- **模型选择**: 前端自动识别并筛选可用的模型文件,支持自动检测量化精度
-- **编码器配置**: 支持选择 T5 文本编码器、CLIP 图像编码器和 VAE 解码器
-- **算子选择**: 支持多种注意力算子和量化矩阵乘法算子,系统会根据安装状态自动排序
-
-### 输入参数
-
-- **提示词 (Prompt)**: 描述期望的视频内容
-- **负向提示词 (Negative Prompt)**: 指定不希望出现的元素
-- **输入图像**: i2v 模式下需要上传输入图像
-- **分辨率**: 支持多种预设分辨率(480p/540p/720p)
-- **随机种子**: 控制生成结果的随机性
-- **推理步数**: 影响生成质量和速度的平衡(蒸馏模型默认为 4 步)
-
-### 视频参数
-
-- **FPS**: 每秒帧数
-- **总帧数**: 视频长度
-- **CFG缩放因子**: 控制提示词影响强度(1-10,蒸馏模型默认为 1)
-- **分布偏移**: 控制生成风格偏离程度(0-10)
-
-## 🔧 自动配置功能
-
-系统会根据您的硬件配置(GPU 显存和 CPU 内存)自动配置最优推理选项,无需手动调整。启动时会自动应用最佳配置,包括:
-
-- **GPU 内存优化**: 根据显存大小自动启用 CPU 卸载、VAE 分块推理等
-- **CPU 内存优化**: 根据系统内存自动启用延迟加载、模块卸载等
-- **算子选择**: 自动选择已安装的最优算子(按优先级排序)
-- **量化配置**: 根据模型文件名自动检测并应用量化精度
-
-
-### 日志查看
-
-```bash
-# 查看推理日志
-tail -f inference_logs.log
-
-# 查看GPU使用情况
-nvidia-smi
-
-# 查看系统资源
-htop
-```
-
-欢迎提交Issue和Pull Request来改进这个项目!
-
-**注意**: 使用本工具生成的视频内容请遵守相关法律法规,不得用于非法用途。
diff --git a/docs/ZH_CN/source/deploy_guides/deploy_local_windows.md b/docs/ZH_CN/source/deploy_guides/deploy_local_windows.md
deleted file mode 100644
index eec764f9d..000000000
--- a/docs/ZH_CN/source/deploy_guides/deploy_local_windows.md
+++ /dev/null
@@ -1,85 +0,0 @@
-# Windows 本地部署指南
-
-## 📖 概述
-
-本文档将详细指导您在Windows环境下完成LightX2V的本地部署配置,包括批处理文件推理、Gradio Web界面推理等多种使用方式。
-
-## 🚀 快速开始
-
-### 环境要求
-
-#### 硬件要求
-- **GPU**: NVIDIA GPU,建议 8GB+ VRAM
-- **内存**: 建议 16GB+ RAM
-- **存储**: 强烈建议使用 SSD 固态硬盘,机械硬盘会导致模型加载缓慢
-
-## 🎯 使用方式
-
-### 方式一:使用批处理文件推理
-
-参考[快速开始文档](../getting_started/quickstart.md)安装环境,并使用[批处理文件](https://github.com/ModelTC/LightX2V/tree/main/scripts/win)运行。
-
-### 方式二:使用Gradio Web界面推理
-
-#### 手动配置Gradio
-
-参考[快速开始文档](../getting_started/quickstart.md)安装环境,参考[Gradio部署指南](./deploy_gradio.md)
-
-#### 一键启动Gradio(推荐)
-
-**📦 下载软件包**
-- [夸克网盘](https://pan.quark.cn/s/f44023dcf8c8)
-
-
-**📁 目录结构**
-解压后,确保目录结构如下:
-
-```
-├── env/ # LightX2V 环境目录
-├── LightX2V/ # LightX2V 项目目录
-├── start_lightx2v.bat # 一键启动脚本
-├── lightx2v_config.txt # 配置文件
-├── LightX2V使用说明.txt # LightX2V使用说明
-├── outputs/ # 生成的视频保存目录
-└── models/ # 模型存放目录
-```
-
-**RTX 50系显卡用户注意**:我们提供了专用的运行环境。请从[夸克网盘](https://pan.quark.cn/s/52b9a8c8f07a)下载,解压后替换软件包中的 `env/` 目录即可。
-
-**📥 下载模型**:
-
-可直接从gradio前端下载,提供了两个下载源,huggingface和modelscope,可根据自己情况选择,或参考[模型结构文档](../getting_started/model_structure.md)手动下载
-
-
-**📋 配置参数**
-
-编辑 `lightx2v_config.txt` 文件,根据需要修改以下参数:
-
-```ini
-
-# 界面语言 (zh: 中文, en: 英文)
-lang=zh
-
-# 服务器端口
-port=8032
-
-# GPU设备ID (0, 1, 2...)
-gpu=0
-
-# 模型路径
-model_path=models/
-```
-
-**🚀 启动服务**
-
-双击运行 `start_lightx2v.bat` 文件,脚本将:
-1. 自动读取配置文件
-2. 验证模型路径和文件完整性
-3. 启动 Gradio Web 界面
-4. 自动打开浏览器访问服务
-
-
-
-
-**⚠️ 重要提示**:
-- **页面显示问题**: 如果网页打开空白或显示异常,请运行 `pip install --upgrade gradio` 升级Gradio版本。
diff --git a/docs/ZH_CN/source/deploy_guides/deploy_service.md b/docs/ZH_CN/source/deploy_guides/deploy_service.md
deleted file mode 100644
index 120b70284..000000000
--- a/docs/ZH_CN/source/deploy_guides/deploy_service.md
+++ /dev/null
@@ -1,89 +0,0 @@
-# 服务化部署
-
-lightx2v 提供异步服务功能。代码入口点在 [这里](https://github.com/ModelTC/LightX2V/blob/main/lightx2v/server/main.py)
-
-### 启动服务
-
-```shell
-# 修改脚本中的路径
-bash scripts/server/start_server.sh
-```
-
-`--port 8000` 选项表示服务将绑定到本地机器的 `8000` 端口。您可以根据需要更改此端口。
-
-### 客户端发送请求
-
-```shell
-python scripts/server/post.py
-```
-
-服务端点:`/v1/tasks/`
-
-`scripts/server/post.py` 中的 `message` 参数如下:
-
-```python
-message = {
- "prompt": "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage.",
- "negative_prompt": "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走",
- "image_path": "",
- "target_shape": [720, 720],
-}
-```
-
-1. `prompt`、`negative_prompt` 和 `image_path` 是视频生成的基本输入。`image_path` 可以是空字符串,表示不需要图像输入。`target_shape` 指定输出视频分辨率(可以不设置;不设置按照配置里的分辨率输出)
-
-
-### 客户端检查服务器状态
-
-```shell
-python scripts/server/check_status.py
-```
-
-服务端点包括:
-
-1. `/v1/service/status` 用于检查服务状态。返回服务是 `busy` 还是 `idle`。服务只有在 `idle` 时才接受新请求。
-
-2. `/v1/tasks/` 用于获取服务器接收和完成的所有任务。
-
-3. `/v1/tasks/{task_id}/status` 用于获取指定 `task_id` 的任务状态。返回任务是 `processing` 还是 `completed`。
-
-### 客户端随时停止服务器上的当前任务
-
-```shell
-python scripts/server/stop_running_task.py
-```
-
-服务端点:`/v1/tasks/running`
-
-终止任务后,服务器不会退出,而是返回等待新请求的状态。
-
-### 在单个节点上启动多个服务
-
-在单个节点上,您可以使用 `scripts/server/start_server.sh` 启动多个服务(注意同一 IP 下的端口号必须不同),或者可以使用 `scripts/server/start_multi_servers.sh` 同时启动多个服务:
-
-```shell
-num_gpus=8 bash scripts/server/start_multi_servers.sh
-```
-
-其中 `num_gpus` 表示要启动的服务数量;服务将从 `--start_port` 开始在连续端口上运行。
-
-### 多个服务之间的调度
-
-```shell
-python scripts/server/post_multi_servers.py
-```
-
-`post_multi_servers.py` 将根据服务的空闲状态调度多个客户端请求。
-
-### API 端点总结
-
-| 端点 | 方法 | 描述 |
-|------|------|------|
-| `/v1/tasks/` | POST | 创建视频生成任务 |
-| `/v1/tasks/form` | POST | 通过表单创建视频生成任务 |
-| `/v1/tasks/` | GET | 获取所有任务列表 |
-| `/v1/tasks/{task_id}/status` | GET | 获取指定任务状态 |
-| `/v1/tasks/{task_id}/result` | GET | 获取指定任务的结果视频文件 |
-| `/v1/tasks/running` | DELETE | 停止当前运行的任务 |
-| `/v1/files/download/{file_path}` | GET | 下载文件 |
-| `/v1/service/status` | GET | 获取服务状态 |
diff --git a/docs/ZH_CN/source/deploy_guides/for_low_latency.md b/docs/ZH_CN/source/deploy_guides/for_low_latency.md
deleted file mode 100755
index b101f6494..000000000
--- a/docs/ZH_CN/source/deploy_guides/for_low_latency.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# 低延迟场景部署
-
-在低延迟的场景,我们会追求更快的速度,忽略显存和内存开销等问题。我们提供两套方案:
-
-## 💡 方案一:步数蒸馏模型的推理
-
-该方案可以参考[步数蒸馏文档](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/step_distill.html)
-
-🧠 **步数蒸馏**是非常直接的视频生成模型的加速推理方案。从50步蒸馏到4步,耗时将缩短到原来的4/50。同时,该方案下,仍然可以和以下方案结合使用:
-1. [高效注意力机制方案](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/attention.html)
-2. [模型量化](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/quantization.html)
-
-## 💡 方案二:非步数蒸馏模型的推理
-
-步数蒸馏需要比较大的训练资源,以及步数蒸馏后的模型,可能会出现视频动态范围变差的问题。
-
-对于非步数蒸馏的原始模型,我们可以使用以下方案或者多种方案结合的方式进行加速:
-
-1. [并行推理](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/parallel.html) 进行多卡并行加速。
-2. [特征缓存](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/cache.html) 降低实际推理步数。
-3. [高效注意力机制方案](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/attention.html) 加速 Attention 的推理。
-4. [模型量化](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/quantization.html) 加速 Linear 层的推理。
-5. [变分辨率推理](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/changing_resolution.html) 降低中间推理步的分辨率。
-
-## 💡 使用Tiny VAE
-
-在某些情况下,VAE部分耗时会比较大,可以使用轻量级VAE进行加速,同时也可以降低一部分显存。
-
-```python
-{
- "use_tae": true,
- "tae_path": "/path to taew2_1.pth"
-}
-```
-taew2_1.pth 权重可以从[这里](https://github.com/madebyollin/taehv/raw/refs/heads/main/taew2_1.pth)下载
-
-
-## ⚠️ 注意
-
-有一部分的加速方案之间目前无法结合使用,我们目前正在致力于解决这一问题。
-
-如有问题,欢迎在 [🐛 GitHub Issues](https://github.com/ModelTC/lightx2v/issues) 中进行错误报告或者功能请求
diff --git a/docs/ZH_CN/source/deploy_guides/for_low_resource.md b/docs/ZH_CN/source/deploy_guides/for_low_resource.md
deleted file mode 100755
index c5e50dea8..000000000
--- a/docs/ZH_CN/source/deploy_guides/for_low_resource.md
+++ /dev/null
@@ -1,223 +0,0 @@
-# Lightx2v 低资源部署指南
-
-## 📋 概述
-
-本指南专门针对硬件资源受限的环境,特别是**8GB显存 + 16/32GB内存**的配置,详细说明如何成功运行Lightx2v 14B模型进行480p和720p视频生成。
-
-Lightx2v是一个强大的视频生成模型,但在资源受限的环境下需要精心优化才能流畅运行。本指南将为您提供从硬件选择到软件配置的完整解决方案,确保您能够在有限的硬件条件下获得最佳的视频生成体验。
-
-## 🎯 目标硬件配置详解
-
-### 推荐硬件规格
-
-**GPU要求**:
-- **显存**: 8GB (RTX 3060/3070/4060/4060Ti 等)
-- **架构**: 支持CUDA的NVIDIA显卡
-
-**系统内存**:
-- **最低要求**: 16GB DDR4
-- **推荐配置**: 32GB DDR4/DDR5
-- **内存速度**: 建议3200MHz及以上
-
-**存储要求**:
-- **类型**: 强烈推荐NVMe SSD
-- **容量**: 至少50GB可用空间
-- **速度**: 读取速度建议3000MB/s以上
-
-**CPU要求**:
-- **核心数**: 建议8核心及以上
-- **频率**: 建议3.0GHz及以上
-- **架构**: 支持AVX2指令集
-
-## ⚙️ 核心优化策略详解
-
-### 1. 环境优化
-
-在运行Lightx2v之前,建议设置以下环境变量以优化性能:
-
-```bash
-# CUDA内存分配优化
-export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
-
-# 启用CUDA Graph模式,提升推理性能
-export ENABLE_GRAPH_MODE=true
-
-# 使用BF16精度推理,减少显存占用(默认FP32精度)
-export DTYPE=BF16
-```
-
-**优化说明**:
-- `expandable_segments:True`: 允许CUDA内存段动态扩展,减少内存碎片
-- `ENABLE_GRAPH_MODE=true`: 启用CUDA Graph,减少内核启动开销
-- `DTYPE=BF16`: 使用BF16精度,在保持质量的同时减少显存占用
-
-### 2. 量化策略
-
-量化是低资源环境下的关键优化技术,通过降低模型精度来减少内存占用。
-
-#### 量化方案对比
-
-**FP8量化** (推荐用于RTX 40系列):
-```python
-# 适用于支持FP8的GPU,提供更好的精度
-dit_quant_scheme = "fp8" # DIT模型量化
-t5_quant_scheme = "fp8" # T5文本编码器量化
-clip_quant_scheme = "fp8" # CLIP视觉编码器量化
-```
-
-**INT8量化** (通用方案):
-```python
-# 适用于所有GPU,内存占用最小
-dit_quant_scheme = "int8" # 8位整数量化
-t5_quant_scheme = "int8" # 文本编码器量化
-clip_quant_scheme = "int8" # 视觉编码器量化
-```
-### 3. 高效算子选择指南
-
-选择合适的算子可以显著提升推理速度和减少内存占用。
-
-#### 注意力算子选择
-
-**推荐优先级**:
-1. **[Sage Attention](https://github.com/thu-ml/SageAttention)** (最高优先级)
-
-2. **[Flash Attention](https://github.com/Dao-AILab/flash-attention)** (通用方案)
-
-
-#### 矩阵乘算子选择
-
-**ADA架构显卡** (RTX 40系列):
-
-推荐优先级:
-1. **[q8-kernel](https://github.com/KONAKONA666/q8_kernels)** (最高性能,仅支持ADA架构)
-2. **[sglang-kernel](https://github.com/sgl-project/sglang/tree/main/sgl-kernel)** (平衡方案)
-3. **[vllm-kernel](https://github.com/vllm-project/vllm)** (通用方案)
-
-**其他架构显卡**:
-1. **[sglang-kernel](https://github.com/sgl-project/sglang/tree/main/sgl-kernel)** (推荐)
-2. **[vllm-kernel](https://github.com/vllm-project/vllm)** (备选)
-
-### 4. 参数卸载策略详解
-
-参数卸载技术允许模型在CPU和磁盘之间动态调度参数,突破显存限制。
-
-#### 三级卸载架构
-
-```python
-# 磁盘-CPU-GPU三级卸载配置
-cpu_offload=True # 启用CPU卸载
-t5_cpu_offload=True # 启用T5编码器CPU卸载
-offload_granularity=phase # DIT模型细粒度卸载
-t5_offload_granularity=block # T5编码器细粒度卸载
-lazy_load = True # 启用延迟加载机制
-num_disk_workers = 2 # 磁盘I/O工作线程数
-```
-
-#### 卸载策略详解
-
-**延迟加载机制**:
-- 模型参数按需从磁盘加载到CPU
-- 减少运行时内存占用
-- 支持大模型在有限内存下运行
-
-**磁盘存储优化**:
-- 使用高速SSD存储模型参数
-- 按照block分组存储模型文件
-- 参考转换脚本[文档](https://github.com/ModelTC/lightx2v/tree/main/tools/convert/readme_zh.md),转换时指定`--save_by_block`参数
-
-### 5. 显存优化技术详解
-
-针对720p视频生成的显存优化策略。
-
-#### CUDA内存管理
-
-```python
-# CUDA内存清理配置
-clean_cuda_cache = True # 及时清理GPU缓存
-rotary_chunk = True # 旋转位置编码分块计算
-rotary_chunk_size = 100 # 分块大小,可根据显存调整
-```
-
-#### 分块计算策略
-
-**旋转位置编码分块**:
-- 将长序列分成小块处理
-- 减少峰值显存占用
-- 保持计算精度
-
-### 6. VAE优化详解
-
-VAE (变分自编码器) 是视频生成的关键组件,优化VAE可以显著提升性能。
-
-#### VAE分块推理
-
-```python
-# VAE优化配置
-use_tiling_vae = True # 启用VAE分块推理
-```
-
-#### 轻量级VAE
-
-```python
-# VAE优化配置
-use_tae = True
-tae_path = "/path to taew2_1.pth"
-```
-taew2_1.pth 权重可以从[这里](https://github.com/madebyollin/taehv/raw/refs/heads/main/taew2_1.pth)下载
-
-**VAE优化效果**:
-- 标准VAE: 基准性能,100%质量保持
-- 标准VAE分块: 降低显存,增加推理时间,100%质量保持
-- 轻量VAE: 极低显存,视频质量有损
-
-
-### 7. 模型选择策略
-
-选择合适的模型版本对低资源环境至关重要。
-
-#### 推荐模型对比
-
-**蒸馏模型** (强烈推荐):
-- ✅ **[Wan2.1-I2V-14B-480P-StepDistill-CfgDistill-Lightx2v](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-480P-StepDistill-CfgDistill-Lightx2v)**
-
-- ✅ **[Wan2.1-I2V-14B-720P-StepDistill-CfgDistill-Lightx2v](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-720P-StepDistill-CfgDistill-Lightx2v)**
-
-
-#### 性能优化建议
-
-使用上述蒸馏模型时,可以进一步优化性能:
-- 关闭CFG: `"enable_cfg": false`
-- 减少推理步数: `infer_step: 4`
-- 参考配置文件: [config](https://github.com/ModelTC/LightX2V/tree/main/configs/distill)
-
-## 🚀 完整配置示例
-
-### 预配置模板
-
-- **[14B模型480p视频生成配置](https://github.com/ModelTC/lightx2v/tree/main/configs/offload/disk/wan_i2v_phase_lazy_load_480p.json)**
-
-- **[14B模型720p视频生成配置](https://github.com/ModelTC/lightx2v/tree/main/configs/offload/disk/wan_i2v_phase_lazy_load_720p.json)**
-
-- **[1.3B模型720p视频生成配置](https://github.com/ModelTC/LightX2V/tree/main/configs/offload/block/wan_t2v_1_3b.json)**
- - 1.3B模型推理瓶颈是T5 encoder,配置文件专门针对T5进行优化
-
-**[启动脚本](https://github.com/ModelTC/LightX2V/tree/main/scripts/wan/run_wan_i2v_lazy_load.sh)**
-
-
-## 📚 参考资源
-
-- [参数卸载机制文档](../method_tutorials/offload.md) - 深入了解卸载技术原理
-- [量化技术指南](../method_tutorials/quantization.md) - 量化技术详细说明
-- [Gradio部署指南](deploy_gradio.md) - Gradio部署详细说明
-
-## ⚠️ 重要注意事项
-
-1. **硬件要求**: 确保您的硬件满足最低配置要求
-2. **驱动版本**: 建议使用最新的NVIDIA驱动 (535+)
-3. **CUDA版本**: 确保CUDA版本与PyTorch兼容 (建议CUDA 11.8+)
-4. **存储空间**: 预留足够的磁盘空间用于模型缓存 (至少50GB)
-5. **网络环境**: 首次下载模型需要稳定的网络连接
-6. **环境变量**: 务必设置推荐的环境变量以优化性能
-
-
-**技术支持**: 如遇到问题,请提交Issue到项目仓库。
diff --git a/docs/ZH_CN/source/deploy_guides/lora_deploy.md b/docs/ZH_CN/source/deploy_guides/lora_deploy.md
deleted file mode 100644
index c75b71dc8..000000000
--- a/docs/ZH_CN/source/deploy_guides/lora_deploy.md
+++ /dev/null
@@ -1,213 +0,0 @@
-# LoRA 模型部署与相关工具
-
-LoRA (Low-Rank Adaptation) 是一种高效的模型微调技术,通过低秩矩阵分解显著减少可训练参数数量。LightX2V 全面支持 LoRA 技术,包括 LoRA 推理、LoRA 提取和 LoRA 合并等功能。
-
-## 🎯 LoRA 技术特性
-
-- **灵活部署**:支持动态加载和移除 LoRA 权重
-- **多种格式**:支持多种 LoRA 权重格式和命名约定
-- **工具完善**:提供完整的 LoRA 提取、合并工具链
-
-## 📜 LoRA 推理部署
-
-### 配置文件方式
-
-在配置文件中指定 LoRA 路径:
-
-```json
-{
- "lora_configs": [
- {
- "path": "/path/to/your/lora.safetensors",
- "strength": 1.0
- }
- ]
-}
-```
-
-**配置参数说明:**
-
-- `lora_path`: LoRA 权重文件路径列表,支持多个 LoRA 同时加载
-- `strength_model`: LoRA 强度系数 (alpha),控制 LoRA 对原模型的影响程度
-
-### 命令行方式
-
-直接在命令行中指定 LoRA 路径(仅支持加载单个 LoRA):
-
-```bash
-python -m lightx2v.infer \
- --model_cls wan2.1 \
- --task t2v \
- --model_path /path/to/model \
- --config_json /path/to/config.json \
- --lora_path /path/to/your/lora.safetensors \
- --lora_strength 0.8 \
- --prompt "Your prompt here"
-```
-
-### 多LoRA配置
-
-要使用多个具有不同强度的LoRA,请在配置JSON文件中指定:
-
-```json
-{
- "lora_configs": [
- {
- "path": "/path/to/first_lora.safetensors",
- "strength": 0.8
- },
- {
- "path": "/path/to/second_lora.safetensors",
- "strength": 0.5
- }
- ]
-}
-```
-
-### 支持的 LoRA 格式
-
-LightX2V 支持多种 LoRA 权重命名约定:
-
-| 格式类型 | 权重命名 | 说明 |
-|----------|----------|------|
-| **标准 LoRA** | `lora_A.weight`, `lora_B.weight` | 标准的 LoRA 矩阵分解格式 |
-| **Down/Up 格式** | `lora_down.weight`, `lora_up.weight` | 另一种常见的命名约定 |
-| **差值格式** | `diff` | `weight` 权重差值 |
-| **偏置差值** | `diff_b` | `bias` 权重差值 |
-| **调制差值** | `diff_m` | `modulation` 权重差值 |
-
-### 推理脚本示例
-
-**步数蒸馏 LoRA 推理:**
-
-```bash
-# T2V LoRA 推理
-bash scripts/wan/run_wan_t2v_distill_4step_cfg_lora.sh
-
-# I2V LoRA 推理
-bash scripts/wan/run_wan_i2v_distill_4step_cfg_lora.sh
-```
-
-**音频驱动 LoRA 推理:**
-
-```bash
-bash scripts/wan/run_wan_i2v_audio.sh
-```
-
-### API 服务中使用 LoRA
-
-在 API 服务中通过 [config 文件](wan_t2v_distill_4step_cfg_lora.json) 指定,对 [scripts/server/start_server.sh](https://github.com/ModelTC/lightx2v/blob/main/scripts/server/start_server.sh) 中的启动命令进行修改:
-
-```bash
-python -m lightx2v.api_server \
- --model_cls wan2.1_distill \
- --task t2v \
- --model_path $model_path \
- --config_json ${lightx2v_path}/configs/distill/wan_t2v_distill_4step_cfg_lora.json \
- --port 8000 \
- --nproc_per_node 1
-```
-
-## 🔧 LoRA 提取工具
-
-使用 `tools/extract/lora_extractor.py` 从两个模型的差异中提取 LoRA 权重。
-
-### 基本用法
-
-```bash
-python tools/extract/lora_extractor.py \
- --source-model /path/to/base/model \
- --target-model /path/to/finetuned/model \
- --output /path/to/extracted/lora.safetensors \
- --rank 32
-```
-
-### 参数说明
-
-| 参数 | 类型 | 必需 | 默认值 | 说明 |
-|------|------|------|--------|------|
-| `--source-model` | str | ✅ | - | 基础模型路径 |
-| `--target-model` | str | ✅ | - | 微调后模型路径 |
-| `--output` | str | ✅ | - | 输出 LoRA 文件路径 |
-| `--source-type` | str | ❌ | `safetensors` | 基础模型格式 (`safetensors`/`pytorch`) |
-| `--target-type` | str | ❌ | `safetensors` | 微调模型格式 (`safetensors`/`pytorch`) |
-| `--output-format` | str | ❌ | `safetensors` | 输出格式 (`safetensors`/`pytorch`) |
-| `--rank` | int | ❌ | `32` | LoRA 秩值 |
-| `--output-dtype` | str | ❌ | `bf16` | 输出数据类型 |
-| `--diff-only` | bool | ❌ | `False` | 仅保存权重差值,不进行 LoRA 分解 |
-
-### 高级用法示例
-
-**提取高秩 LoRA:**
-
-```bash
-python tools/extract/lora_extractor.py \
- --source-model /path/to/base/model \
- --target-model /path/to/finetuned/model \
- --output /path/to/high_rank_lora.safetensors \
- --rank 64 \
- --output-dtype fp16
-```
-
-**仅保存权重差值:**
-
-```bash
-python tools/extract/lora_extractor.py \
- --source-model /path/to/base/model \
- --target-model /path/to/finetuned/model \
- --output /path/to/weight_diff.safetensors \
- --diff-only
-```
-
-## 🔀 LoRA 合并工具
-
-使用 `tools/extract/lora_merger.py` 将 LoRA 权重合并到基础模型中,以进行后续量化等操作。
-
-### 基本用法
-
-```bash
-python tools/extract/lora_merger.py \
- --source-model /path/to/base/model \
- --lora-model /path/to/lora.safetensors \
- --output /path/to/merged/model.safetensors \
- --alpha 1.0
-```
-
-### 参数说明
-
-| 参数 | 类型 | 必需 | 默认值 | 说明 |
-|------|------|------|--------|------|
-| `--source-model` | str | ✅ | 无 | 基础模型路径 |
-| `--lora-model` | str | ✅ | 无 | LoRA 权重路径 |
-| `--output` | str | ✅ | 无 | 输出合并模型路径 |
-| `--source-type` | str | ❌ | `safetensors` | 基础模型格式 |
-| `--lora-type` | str | ❌ | `safetensors` | LoRA 权重格式 |
-| `--output-format` | str | ❌ | `safetensors` | 输出格式 |
-| `--alpha` | float | ❌ | `1.0` | LoRA 合并强度 |
-| `--output-dtype` | str | ❌ | `bf16` | 输出数据类型 |
-
-### 高级用法示例
-
-**部分强度合并:**
-
-```bash
-python tools/extract/lora_merger.py \
- --source-model /path/to/base/model \
- --lora-model /path/to/lora.safetensors \
- --output /path/to/merged_model.safetensors \
- --alpha 0.7 \
- --output-dtype fp32
-```
-
-**多格式支持:**
-
-```bash
-python tools/extract/lora_merger.py \
- --source-model /path/to/base/model.pt \
- --source-type pytorch \
- --lora-model /path/to/lora.safetensors \
- --lora-type safetensors \
- --output /path/to/merged_model.safetensors \
- --output-format safetensors \
- --alpha 1.0
-```
diff --git a/docs/ZH_CN/source/getting_started/benchmark.md b/docs/ZH_CN/source/getting_started/benchmark.md
deleted file mode 100644
index 6adc116c3..000000000
--- a/docs/ZH_CN/source/getting_started/benchmark.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# 基准测试
-
-由于要展示一些视频的播放效果和详细的性能对比,您可以在这个[🔗 页面](https://github.com/ModelTC/LightX2V/blob/main/docs/ZH_CN/source/getting_started/benchmark_source.md)获得更好的展示效果以及相对应的文档内容。
diff --git a/docs/ZH_CN/source/getting_started/benchmark_source.md b/docs/ZH_CN/source/getting_started/benchmark_source.md
deleted file mode 100644
index c399d1837..000000000
--- a/docs/ZH_CN/source/getting_started/benchmark_source.md
+++ /dev/null
@@ -1,149 +0,0 @@
-# 🚀 基准测试
-
-> 本文档展示了LightX2V在不同硬件环境下的性能测试结果,包括H200和RTX 4090平台的详细对比数据。
-
----
-
-## 🖥️ H200 环境 (~140GB显存)
-
-### 📋 软件环境配置
-
-| 组件 | 版本 |
-|:-----|:-----|
-| **Python** | 3.11 |
-| **PyTorch** | 2.7.1+cu128 |
-| **SageAttention** | 2.2.0 |
-| **vLLM** | 0.9.2 |
-| **sgl-kernel** | 0.1.8 |
-
----
-
-### 🎬 480P 5s视频测试
-
-**测试配置:**
-- **模型**: [Wan2.1-I2V-14B-480P-Lightx2v](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-480P-Lightx2v)
-- **参数**: `infer_steps=40`, `seed=42`, `enable_cfg=True`
-
-#### 📊 性能对比表
-
-| 配置 | 推理时间(s) | GPU显存占用(GB) | 加速比 | 视频效果 |
-|:-----|:----------:|:---------------:|:------:|:--------:|
-| **Wan2.1 Official** | 366 | 71 | 1.0x | |
-| **FastVideo** | 292 | 26 | **1.25x** | |
-| **LightX2V_1** | 250 | 53 | **1.46x** | |
-| **LightX2V_2** | 216 | 50 | **1.70x** | |
-| **LightX2V_3** | 191 | 35 | **1.92x** | |
-| **LightX2V_3-Distill** | 14 | 35 | **🏆 20.85x** | |
-| **LightX2V_4** | 107 | 35 | **3.41x** | |
-
----
-
-### 🎬 720P 5s视频测试
-
-**测试配置:**
-- **模型**: [Wan2.1-I2V-14B-720P-Lightx2v](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-720P-Lightx2v)
-- **参数**: `infer_steps=40`, `seed=1234`, `enable_cfg=True`
-
-#### 📊 性能对比表
-
-| 配置 | 推理时间(s) | GPU显存占用(GB) | 加速比 | 视频效果 |
-|:-----|:----------:|:---------------:|:------:|:--------:|
-| **Wan2.1 Official** | 974 | 81 | 1.0x | |
-| **FastVideo** | 914 | 40 | **1.07x** | |
-| **LightX2V_1** | 807 | 65 | **1.21x** | |
-| **LightX2V_2** | 751 | 57 | **1.30x** | |
-| **LightX2V_3** | 671 | 43 | **1.45x** | |
-| **LightX2V_3-Distill** | 44 | 43 | **🏆 22.14x** | |
-| **LightX2V_4** | 344 | 46 | **2.83x** | |
-
----
-
-## 🖥️ RTX 4090 环境 (~24GB显存)
-
-### 📋 软件环境配置
-
-| 组件 | 版本 |
-|:-----|:-----|
-| **Python** | 3.9.16 |
-| **PyTorch** | 2.5.1+cu124 |
-| **SageAttention** | 2.1.0 |
-| **vLLM** | 0.6.6 |
-| **sgl-kernel** | 0.0.5 |
-| **q8-kernels** | 0.0.0 |
-
----
-
-### 🎬 480P 5s视频测试
-
-**测试配置:**
-- **模型**: [Wan2.1-I2V-14B-480P-Lightx2v](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-480P-Lightx2v)
-- **参数**: `infer_steps=40`, `seed=42`, `enable_cfg=True`
-
-#### 📊 性能对比表
-
-| 配置 | 推理时间(s) | GPU显存占用(GB) | 加速比 | 视频效果 |
-|:-----|:----------:|:---------------:|:------:|:--------:|
-| **Wan2GP(profile=3)** | 779 | 20 | **1.0x** | |
-| **LightX2V_5** | 738 | 16 | **1.05x** | |
-| **LightX2V_5-Distill** | 68 | 16 | **11.45x** | |
-| **LightX2V_6** | 630 | 12 | **1.24x** | |
-| **LightX2V_6-Distill** | 63 | 12 | **🏆 12.36x** | |
-
----
-
-### 🎬 720P 5s视频测试
-
-**测试配置:**
-- **模型**: [Wan2.1-I2V-14B-720P-Lightx2v](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-720P-Lightx2v)
-- **参数**: `infer_steps=40`, `seed=1234`, `enable_cfg=True`
-
-#### 📊 性能对比表
-
-| 配置 | 推理时间(s) | GPU显存占用(GB) | 加速比 | 视频效果 |
-|:-----|:----------:|:---------------:|:------:|:--------:|
-| **Wan2GP(profile=3)** | -- | OOM | -- | |
-| **LightX2V_5** | 2473 | 23 | -- | |
-| **LightX2V_5-Distill** | 183 | 23 | -- | |
-| **LightX2V_6** | 2169 | 18 | -- | |
-| **LightX2V_6-Distill** | 171 | 18 | -- | |
-
----
-
-## 📖 配置说明
-
-### 🖥️ H200 环境配置说明
-
-| 配置 | 技术特点 |
-|:-----|:---------|
-| **Wan2.1 Official** | 基于[Wan2.1官方仓库](https://github.com/Wan-Video/Wan2.1)的原始实现 |
-| **FastVideo** | 基于[FastVideo官方仓库](https://github.com/hao-ai-lab/FastVideo),使用SageAttention2后端优化 |
-| **LightX2V_1** | 使用SageAttention2替换原生注意力机制,采用DIT BF16+FP32(部分敏感层)混合精度计算,在保持精度的同时提升计算效率 |
-| **LightX2V_2** | 统一使用BF16精度计算,进一步减少显存占用和计算开销,同时保持生成质量 |
-| **LightX2V_3** | 引入FP8量化技术显著减少计算精度要求,结合Tiling VAE技术优化显存使用 |
-| **LightX2V_3-Distill** | 在LightX2V_3基础上使用4步蒸馏模型(`infer_steps=4`, `enable_cfg=False`),进一步减少推理步数并保持生成质量 |
-| **LightX2V_4** | 在LightX2V_3基础上加入TeaCache(teacache_thresh=0.2)缓存复用技术,通过智能跳过冗余计算实现加速 |
-
-### 🖥️ RTX 4090 环境配置说明
-
-| 配置 | 技术特点 |
-|:-----|:---------|
-| **Wan2GP(profile=3)** | 基于[Wan2GP仓库](https://github.com/deepbeepmeep/Wan2GP)实现,使用MMGP优化技术。profile=3配置适用于至少32GB内存和24GB显存的RTX 3090/4090环境,通过牺牲显存来适应有限的内存资源。使用量化模型:[480P模型](https://huggingface.co/DeepBeepMeep/Wan2.1/blob/main/wan2.1_image2video_480p_14B_quanto_mbf16_int8.safetensors)和[720P模型](https://huggingface.co/DeepBeepMeep/Wan2.1/blob/main/wan2.1_image2video_720p_14B_quanto_mbf16_int8.safetensors) |
-| **LightX2V_5** | 使用SageAttention2替换原生注意力机制,采用DIT FP8+FP32(部分敏感层)混合精度计算,启用CPU offload技术,将部分敏感层执行FP32精度计算,将DIT推理过程中异步数据卸载到CPU上,节省显存,offload粒度为block级别 |
-| **LightX2V_5-Distill** | 在LightX2V_5基础上使用4步蒸馏模型(`infer_steps=4`, `enable_cfg=False`),进一步减少推理步数并保持生成质量 |
-| **LightX2V_6** | 在LightX2V_3基础上启用CPU offload技术,将部分敏感层执行FP32精度计算,将DIT推理过程中异步数据卸载到CPU上,节省显存,offload粒度为block级别 |
-| **LightX2V_6-Distill** | 在LightX2V_6基础上使用4步蒸馏模型(`infer_steps=4`, `enable_cfg=False`),进一步减少推理步数并保持生成质量 |
-
----
-
-## 📁 配置文件参考
-
-基准测试相关的配置文件和运行脚本可在以下位置获取:
-
-| 类型 | 链接 | 说明 |
-|:-----|:-----|:-----|
-| **配置文件** | [configs/bench](https://github.com/ModelTC/LightX2V/tree/main/configs/bench) | 包含各种优化配置的JSON文件 |
-| **运行脚本** | [scripts/bench](https://github.com/ModelTC/LightX2V/tree/main/scripts/bench) | 包含基准测试的执行脚本 |
-
----
-
-> 💡 **提示**: 建议根据您的硬件配置选择合适的优化方案,以获得最佳的性能表现。
diff --git a/docs/ZH_CN/source/getting_started/model_structure.md b/docs/ZH_CN/source/getting_started/model_structure.md
deleted file mode 100644
index 8ceb48a10..000000000
--- a/docs/ZH_CN/source/getting_started/model_structure.md
+++ /dev/null
@@ -1,571 +0,0 @@
-# 模型格式与加载指南
-
-## 📖 概述
-
-LightX2V 是一个灵活的视频生成推理框架,支持多种模型来源和格式,为用户提供丰富的选择:
-
-- ✅ **Wan 官方模型**:直接兼容 Wan2.1 和 Wan2.2 官方发布的完整模型
-- ✅ **单文件模型**:支持 LightX2V 发布的单文件格式模型(包含量化版本)
-- ✅ **LoRA 模型**:支持加载 LightX2V 发布的蒸馏 LoRA
-
-本文档将详细介绍各种模型格式的使用方法、配置参数和最佳实践。
-
----
-
-## 🗂️ 格式一:Wan 官方模型
-
-### 模型仓库
-- [Wan2.1 Collection](https://huggingface.co/collections/Wan-AI/wan21-68ac4ba85372ae5a8e282a1b)
-- [Wan2.2 Collection](https://huggingface.co/collections/Wan-AI/wan22-68ac4ae80a8b477e79636fc8)
-
-### 模型特点
-- **官方保证**:Wan-AI 官方发布的完整模型,质量最高
-- **完整组件**:包含所有必需的组件(DIT、T5、CLIP、VAE)
-- **原始精度**:使用 BF16/FP32 精度,无量化损失
-- **兼容性强**:与 Wan 官方工具链完全兼容
-
-### Wan2.1 官方模型
-
-#### 目录结构
-
-以 [Wan2.1-I2V-14B-720P](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-720P) 为例:
-
-```
-Wan2.1-I2V-14B-720P/
-├── diffusion_pytorch_model-00001-of-00007.safetensors # DIT 模型分片 1
-├── diffusion_pytorch_model-00002-of-00007.safetensors # DIT 模型分片 2
-├── diffusion_pytorch_model-00003-of-00007.safetensors # DIT 模型分片 3
-├── diffusion_pytorch_model-00004-of-00007.safetensors # DIT 模型分片 4
-├── diffusion_pytorch_model-00005-of-00007.safetensors # DIT 模型分片 5
-├── diffusion_pytorch_model-00006-of-00007.safetensors # DIT 模型分片 6
-├── diffusion_pytorch_model-00007-of-00007.safetensors # DIT 模型分片 7
-├── diffusion_pytorch_model.safetensors.index.json # 分片索引文件
-├── models_t5_umt5-xxl-enc-bf16.pth # T5 文本编码器
-├── models_clip_open-clip-xlm-roberta-large-vit-huge-14.pth # CLIP 编码器
-├── Wan2.1_VAE.pth # VAE 编解码器
-├── config.json # 模型配置
-├── xlm-roberta-large/ # CLIP tokenizer
-├── google/ # T5 tokenizer
-├── assets/
-└── examples/
-```
-
-#### 使用方法
-
-```bash
-# 下载模型
-huggingface-cli download Wan-AI/Wan2.1-I2V-14B-720P \
- --local-dir ./models/Wan2.1-I2V-14B-720P
-
-# 配置启动脚本
-model_path=./models/Wan2.1-I2V-14B-720P
-lightx2v_path=/path/to/LightX2V
-
-# 运行推理
-cd LightX2V/scripts
-bash wan/run_wan_i2v.sh
-```
-
-### Wan2.2 官方模型
-
-#### 目录结构
-
-以 [Wan2.2-I2V-A14B](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B) 为例:
-
-```
-Wan2.2-I2V-A14B/
-├── high_noise_model/ # 高噪声模型目录
-│ ├── diffusion_pytorch_model-00001-of-00009.safetensors
-│ ├── diffusion_pytorch_model-00002-of-00009.safetensors
-│ ├── ...
-│ ├── diffusion_pytorch_model-00009-of-00009.safetensors
-│ └── diffusion_pytorch_model.safetensors.index.json
-├── low_noise_model/ # 低噪声模型目录
-│ ├── diffusion_pytorch_model-00001-of-00009.safetensors
-│ ├── diffusion_pytorch_model-00002-of-00009.safetensors
-│ ├── ...
-│ ├── diffusion_pytorch_model-00009-of-00009.safetensors
-│ └── diffusion_pytorch_model.safetensors.index.json
-├── models_t5_umt5-xxl-enc-bf16.pth # T5 文本编码器
-├── Wan2.1_VAE.pth # VAE 编解码器
-├── configuration.json # 模型配置
-├── google/ # T5 tokenizer
-├── assets/ # 示例资源(可选)
-└── examples/ # 示例文件(可选)
-```
-
-#### 使用方法
-
-```bash
-# 下载模型
-huggingface-cli download Wan-AI/Wan2.2-I2V-A14B \
- --local-dir ./models/Wan2.2-I2V-A14B
-
-# 配置启动脚本
-model_path=./models/Wan2.2-I2V-A14B
-lightx2v_path=/path/to/LightX2V
-
-# 运行推理
-cd LightX2V/scripts
-bash wan22/run_wan22_moe_i2v.sh
-```
-
-### 可用模型列表
-
-#### Wan2.1 官方模型列表
-
-| 模型名称 | 下载链接 |
-|---------|----------|
-| Wan2.1-I2V-14B-720P | [链接](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-720P) |
-| Wan2.1-I2V-14B-480P | [链接](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-480P) |
-| Wan2.1-T2V-14B | [链接](https://huggingface.co/Wan-AI/Wan2.1-T2V-14B) |
-| Wan2.1-T2V-1.3B | [链接](https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B) |
-| Wan2.1-FLF2V-14B-720P | [链接](https://huggingface.co/Wan-AI/Wan2.1-FLF2V-14B-720P) |
-| Wan2.1-VACE-14B | [链接](https://huggingface.co/Wan-AI/Wan2.1-VACE-14B) |
-| Wan2.1-VACE-1.3B | [链接](https://huggingface.co/Wan-AI/Wan2.1-VACE-1.3B) |
-
-#### Wan2.2 官方模型列表
-
-| 模型名称 | 下载链接 |
-|---------|----------|
-| Wan2.2-I2V-A14B | [链接](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B) |
-| Wan2.2-T2V-A14B | [链接](https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B) |
-| Wan2.2-TI2V-5B | [链接](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B) |
-| Wan2.2-Animate-14B | [链接](https://huggingface.co/Wan-AI/Wan2.2-Animate-14B) |
-
-### 使用提示
-
-> 💡 **量化模型使用**:如需使用量化模型,可参考[模型转换脚本](https://github.com/ModelTC/LightX2V/blob/main/tools/convert/readme_zh.md)进行转换,或直接使用下方格式二中的预转换量化模型
->
-> 💡 **显存优化**:对于 RTX 4090 24GB 或更小显存的设备,建议结合量化技术和 CPU 卸载功能:
-> - 量化配置:参考[量化技术文档](../method_tutorials/quantization.md)
-> - CPU 卸载:参考[参数卸载文档](../method_tutorials/offload.md)
-> - Wan2.1 配置:参考 [offload 配置文件](https://github.com/ModelTC/LightX2V/tree/main/configs/offload)
-> - Wan2.2 配置:参考 [wan22 配置文件](https://github.com/ModelTC/LightX2V/tree/main/configs/wan22) 中以 `4090` 结尾的配置
-
----
-
-## 🗂️ 格式二:LightX2V 单文件模型(推荐)
-
-### 模型仓库
-- [Wan2.1-LightX2V](https://huggingface.co/lightx2v/Wan2.1-Distill-Models)
-- [Wan2.2-LightX2V](https://huggingface.co/lightx2v/Wan2.2-Distill-Models)
-
-### 模型特点
-- **单文件管理**:单个 safetensors 文件,易于管理和部署
-- **多精度支持**:提供原始精度、FP8、INT8 等多种精度版本
-- **蒸馏加速**:支持 4-step 快速推理
-- **工具兼容**:兼容 ComfyUI 等其他工具
-
-**示例**:
-- `wan2.1_i2v_720p_lightx2v_4step.safetensors` - 720P 图生视频原始精度
-- `wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step.safetensors` - 720P 图生视频 FP8 量化
-- `wan2.1_i2v_480p_int8_lightx2v_4step.safetensors` - 480P 图生视频 INT8 量化
-- ...
-
-### Wan2.1 单文件模型
-
-#### 场景 A:下载单个模型文件
-
-**步骤 1:选择并下载模型**
-
-```bash
-# 创建模型目录
-mkdir -p ./models/wan2.1_i2v_720p
-
-# 下载 720P 图生视频 FP8 量化模型
-huggingface-cli download lightx2v/Wan2.1-Distill-Models \
- --local-dir ./models/wan2.1_i2v_720p \
- --include "wan2.1_i2v_720p_lightx2v_4step.safetensors"
-```
-
-**步骤 2:手动组织其他模块**
-
-目录结构如下
-```
-wan2.1_i2v_720p/
-├── wan2.1_i2v_720p_lightx2v_4step.safetensors # 原始精度
-└── t5/clip/vae/config.json/xlm-roberta-large/google等其他组件 # 需要手动组织
-```
-
-**步骤 3:配置启动脚本**
-
-```bash
-# 在启动脚本中设置(指向包含模型文件的目录)
-model_path=./models/wan2.1_i2v_720p
-lightx2v_path=/path/to/LightX2V
-
-# 运行脚本
-cd LightX2V/scripts
-bash wan/run_wan_i2v_distill_4step_cfg.sh
-```
-
-> 💡 **提示**:当目录下只有一个模型文件时,LightX2V 会自动加载该文件。
-
-#### 场景 B:下载多个模型文件
-
-当您下载了多个不同精度的模型到同一目录时,需要在配置文件中明确指定使用哪个模型。
-
-**步骤 1:下载多个模型**
-
-```bash
-# 创建模型目录
-mkdir -p ./models/wan2.1_i2v_720p_multi
-
-# 下载原始精度模型
-huggingface-cli download lightx2v/Wan2.1-Distill-Models \
- --local-dir ./models/wan2.1_i2v_720p_multi \
- --include "wan2.1_i2v_720p_lightx2v_4step.safetensors"
-
-# 下载 FP8 量化模型
-huggingface-cli download lightx2v/Wan2.1-Distill-Models \
- --local-dir ./models/wan2.1_i2v_720p_multi \
- --include "wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step.safetensors"
-
-# 下载 INT8 量化模型
-huggingface-cli download lightx2v/Wan2.1-Distill-Models \
- --local-dir ./models/wan2.1_i2v_720p_multi \
- --include "wan2.1_i2v_720p_int8_lightx2v_4step.safetensors"
-```
-
-**步骤 2:手动组织其他模块**
-
-目录结构如下:
-
-```
-wan2.1_i2v_720p_multi/
-├── wan2.1_i2v_720p_lightx2v_4step.safetensors # 原始精度
-├── wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step.safetensors # FP8 量化
-└── wan2.1_i2v_720p_int8_lightx2v_4step.safetensors # INT8 量化
-└── t5/clip/vae/config.json/xlm-roberta-large/google等其他组件 # 需要手动组织
-```
-
-**步骤 3:在配置文件中指定模型**
-
-编辑配置文件(如 `configs/distill/wan_i2v_distill_4step_cfg.json`):
-
-```json
-{
- // 使用原始精度模型
- "dit_original_ckpt": "./models/wan2.1_i2v_720p_multi/wan2.1_i2v_720p_lightx2v_4step.safetensors",
-
- // 或使用 FP8 量化模型
- // "dit_quantized_ckpt": "./models/wan2.1_i2v_720p_multi/wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step.safetensors",
- // "dit_quantized": true,
- // "dit_quant_scheme": "fp8-vllm",
-
- // 或使用 INT8 量化模型
- // "dit_quantized_ckpt": "./models/wan2.1_i2v_720p_multi/wan2.1_i2v_720p_int8_lightx2v_4step.safetensors",
- // "dit_quantized": true,
- // "dit_quant_scheme": "int8-vllm",
-
- // 其他配置...
-}
-```
-### 使用提示
-
-> 💡 **配置参数说明**:
-> - **dit_original_ckpt**:用于指定原始精度模型(BF16/FP32/FP16)的路径
-> - **dit_quantized_ckpt**:用于指定量化模型(FP8/INT8)的路径,需配合 `dit_quantized` 和 `dit_quant_scheme` 参数使用
-
-**步骤 4:启动推理**
-
-```bash
-cd LightX2V/scripts
-bash wan/run_wan_i2v_distill_4step_cfg.sh
-```
-
-### Wan2.2 单文件模型
-
-#### 目录结构要求
-
-使用 Wan2.2 单文件模型时,需要手动创建特定的目录结构:
-
-```
-wan2.2_models/
-├── high_noise_model/ # 高噪声模型目录(必须)
-│ └── wan2.2_i2v_A14b_high_noise_lightx2v_4step.safetensors # 高噪声模型文件
-└── low_noise_model/ # 低噪声模型目录(必须)
-│ └── wan2.2_i2v_A14b_low_noise_lightx2v_4step.safetensors # 低噪声模型文件
-└── t5/vae/config.json/xlm-roberta-large/google等其他组件 # 需要手动组织
-```
-
-#### 场景 A:每个目录下只有一个模型文件
-
-```bash
-# 创建必需的子目录
-mkdir -p ./models/wan2.2_models/high_noise_model
-mkdir -p ./models/wan2.2_models/low_noise_model
-
-# 下载高噪声模型到对应目录
-huggingface-cli download lightx2v/Wan2.2-Distill-Models \
- --local-dir ./models/wan2.2_models/high_noise_model \
- --include "wan2.2_i2v_A14b_high_noise_scaled_fp8_e4m3_lightx2v_4step.safetensors"
-
-# 下载低噪声模型到对应目录
-huggingface-cli download lightx2v/Wan2.2-Distill-Models \
- --local-dir ./models/wan2.2_models/low_noise_model \
- --include "wan2.2_i2v_A14b_low_noise_scaled_fp8_e4m3_lightx2v_4step.safetensors"
-
-# 配置启动脚本(指向父目录)
-model_path=./models/wan2.2_models
-lightx2v_path=/path/to/LightX2V
-
-# 运行脚本
-cd LightX2V/scripts
-bash wan22/run_wan22_moe_i2v_distill.sh
-```
-
-> 💡 **提示**:当每个子目录下只有一个模型文件时,LightX2V 会自动加载。
-
-#### 场景 B:每个目录下有多个模型文件
-
-当您在 `high_noise_model/` 和 `low_noise_model/` 目录下分别放置了多个不同精度的模型时,需要在配置文件中明确指定。
-
-```bash
-# 创建目录
-mkdir -p ./models/wan2.2_models_multi/high_noise_model
-mkdir -p ./models/wan2.2_models_multi/low_noise_model
-
-# 下载高噪声模型的多个版本
-huggingface-cli download lightx2v/Wan2.2-Distill-Models \
- --local-dir ./models/wan2.2_models_multi/high_noise_model \
- --include "wan2.2_i2v_A14b_high_noise_*.safetensors"
-
-# 下载低噪声模型的多个版本
-huggingface-cli download lightx2v/Wan2.2-Distill-Models \
- --local-dir ./models/wan2.2_models_multi/low_noise_model \
- --include "wan2.2_i2v_A14b_low_noise_*.safetensors"
-```
-
-**目录结构**:
-
-```
-wan2.2_models_multi/
-├── high_noise_model/
-│ ├── wan2.2_i2v_A14b_high_noise_lightx2v_4step.safetensors # 原始精度
-│ ├── wan2.2_i2v_A14b_high_noise_fp8_e4m3_lightx2v_4step.safetensors # FP8 量化
-│ └── wan2.2_i2v_A14b_high_noise_int8_lightx2v_4step.safetensors # INT8 量化
-└── low_noise_model/
-│ ├── wan2.2_i2v_A14b_low_noise_lightx2v_4step.safetensors # 原始精度
-│ ├── wan2.2_i2v_A14b_low_noise_fp8_e4m3_lightx2v_4step.safetensors # FP8 量化
-│ └── wan2.2_i2v_A14b_low_noise_int8_lightx2v_4step.safetensors # INT8 量化
-└── t5/vae/config.json/xlm-roberta-large/google等其他组件 # 需要手动组织
-```
-
-**配置文件设置**:
-
-```json
-{
- // 使用原始精度模型
- "high_noise_original_ckpt": "./models/wan2.2_models_multi/high_noise_model/wan2.2_i2v_A14b_high_noise_lightx2v_4step.safetensors",
- "low_noise_original_ckpt": "./models/wan2.2_models_multi/low_noise_model/wan2.2_i2v_A14b_low_noise_lightx2v_4step.safetensors",
-
- // 或使用 FP8 量化模型
- // "high_noise_quantized_ckpt": "./models/wan2.2_models_multi/high_noise_model/wan2.2_i2v_A14b_high_noise_fp8_e4m3_lightx2v_4step.safetensors",
- // "low_noise_quantized_ckpt": "./models/wan2.2_models_multi/low_noise_model/wan2.2_i2v_A14b_low_noise_fp8_e4m3_lightx2v_4step.safetensors",
- // "dit_quantized": true,
- // "dit_quant_scheme": "fp8-vllm"
-
- // 或使用 INT8 量化模型
- // "high_noise_quantized_ckpt": "./models/wan2.2_models_multi/high_noise_model/wan2.2_i2v_A14b_high_noise_int8_lightx2v_4step.safetensors",
- // "low_noise_quantized_ckpt": "./models/wan2.2_models_multi/low_noise_model/wan2.2_i2v_A14b_low_noise_int8_lightx2v_4step.safetensors",
- // "dit_quantized": true,
- // "dit_quant_scheme": "int8-vllm"
-}
-```
-
-### 使用提示
-
-> 💡 **配置参数说明**:
-> - **high_noise_original_ckpt** / **low_noise_original_ckpt**:用于指定原始精度模型(BF16/FP32/FP16)的路径
-> - **high_noise_quantized_ckpt** / **low_noise_quantized_ckpt**:用于指定量化模型(FP8/INT8)的路径,需配合 `dit_quantized` 和 `dit_quant_scheme` 参数使用
-
-
-### 可用模型列表
-
-#### Wan2.1 单文件模型列表
-
-**图生视频模型(I2V)**
-
-| 文件名 | 精度 | 说明 |
-|--------|------|------|
-| `wan2.1_i2v_480p_lightx2v_4step.safetensors` | BF16 | 4步模型原始精度 |
-| `wan2.1_i2v_480p_scaled_fp8_e4m3_lightx2v_4step.safetensors` | FP8 | 4步模型FP8 量化 |
-| `wan2.1_i2v_480p_int8_lightx2v_4step.safetensors` | INT8 | 4步模型INT8 量化 |
-| `wan2.1_i2v_480p_scaled_fp8_e4m3_lightx2v_4step_comfyui.safetensors` | FP8 | 4步模型ComfyUI 格式 |
-| `wan2.1_i2v_720p_lightx2v_4step.safetensors` | BF16 | 4步模型原始精度 |
-| `wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step.safetensors` | FP8 | 4步模型FP8 量化 |
-| `wan2.1_i2v_720p_int8_lightx2v_4step.safetensors` | INT8 | 4步模型INT8 量化 |
-| `wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step_comfyui.safetensors` | FP8 | 4步模型ComfyUI 格式 |
-
-**文生视频模型(T2V)**
-
-| 文件名 | 精度 | 说明 |
-|--------|------|------|
-| `wan2.1_t2v_14b_lightx2v_4step.safetensors` | BF16 | 4步模型原始精度 |
-| `wan2.1_t2v_14b_scaled_fp8_e4m3_lightx2v_4step.safetensors` | FP8 | 4步模型FP8 量化 |
-| `wan2.1_t2v_14b_int8_lightx2v_4step.safetensors` | INT8 | 4步模型INT8 量化 |
-| `wan2.1_t2v_14b_scaled_fp8_e4m3_lightx2v_4step_comfyui.safetensors` | FP8 | 4步模型ComfyUI 格式 |
-
-#### Wan2.2 单文件模型列表
-
-**图生视频模型(I2V)- A14B 系列**
-
-| 文件名 | 精度 | 说明 |
-|--------|------|------|
-| `wan2.2_i2v_A14b_high_noise_lightx2v_4step.safetensors` | BF16 | 高噪声模型-4步原始精度 |
-| `wan2.2_i2v_A14b_high_noise_scaled_fp8_e4m3_lightx2v_4step.safetensors` | FP8 | 高噪声模型-4步FP8量化 |
-| `wan2.2_i2v_A14b_high_noise_int8_lightx2v_4step.safetensors` | INT8 | 高噪声模型-4步INT8量化 |
-| `wan2.2_i2v_A14b_low_noise_lightx2v_4step.safetensors` | BF16 | 低噪声模型-4步原始精度 |
-| `wan2.2_i2v_A14b_low_noise_scaled_fp8_e4m3_lightx2v_4step.safetensors` | FP8 | 低噪声模型-4步FP8量化 |
-| `wan2.2_i2v_A14b_low_noise_int8_lightx2v_4step.safetensors` | INT8 | 低噪声模型-4步INT8量化 |
-
-> 💡 **使用提示**:
-> - Wan2.2 模型采用双噪声架构,需要同时下载高噪声(high_noise)和低噪声(low_noise)模型
-> - 详细的目录组织方式请参考上方"Wan2.2 单文件模型"部分
-
----
-
-## 🗂️ 格式三:LightX2V LoRA 模型
-
-LoRA(Low-Rank Adaptation)模型提供了一种轻量级的模型微调方案,可以在不修改基础模型的情况下实现特定效果的定制化。
-
-### 模型仓库
-
-- **Wan2.1 LoRA 模型**:[lightx2v/Wan2.1-Distill-Loras](https://huggingface.co/lightx2v/Wan2.1-Distill-Loras)
-- **Wan2.2 LoRA 模型**:[lightx2v/Wan2.2-Distill-Loras](https://huggingface.co/lightx2v/Wan2.2-Distill-Loras)
-
-### 使用方式
-
-#### 方式一:离线合并
-
-将 LoRA 权重离线合并到基础模型中,生成新的完整模型文件。
-
-**操作步骤**:
-
-参考 [模型转换文档](https://github.com/ModelTC/lightx2v/tree/main/tools/convert/readme_zh.md) 进行离线合并。
-
-**优点**:
-- ✅ 推理时无需额外加载 LoRA
-- ✅ 性能更优
-
-**缺点**:
-- ❌ 需要额外存储空间
-- ❌ 切换不同 LoRA 需要重新合并
-
-#### 方式二:在线加载
-
-在推理时动态加载 LoRA 权重,无需修改基础模型。
-
-**LoRA 应用原理**:
-
-```python
-# LoRA 权重应用公式
-# lora_scale = (alpha / rank)
-# W' = W + lora_scale * B @ A
-# 其中:B = up_proj (out_features, rank)
-# A = down_proj (rank, in_features)
-
-if weights_dict["alpha"] is not None:
- lora_scale = weights_dict["alpha"] / lora_down.shape[0]
-elif alpha is not None:
- lora_scale = alpha / lora_down.shape[0]
-else:
- lora_scale = 1.0
-```
-
-**配置方法**:
-
-**Wan2.1 LoRA 配置**:
-
-```json
-{
- "lora_configs": [
- {
- "path": "wan2.1_i2v_lora_rank64_lightx2v_4step.safetensors",
- "strength": 1.0,
- "alpha": null
- }
- ]
-}
-```
-
-**Wan2.2 LoRA 配置**:
-
-由于 Wan2.2 采用双模型架构(高噪声/低噪声),需要分别为两个模型配置 LoRA:
-
-```json
-{
- "lora_configs": [
- {
- "name": "low_noise_model",
- "path": "wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step.safetensors",
- "strength": 1.0,
- "alpha": null
- },
- {
- "name": "high_noise_model",
- "path": "wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step.safetensors",
- "strength": 1.0,
- "alpha": null
- }
- ]
-}
-```
-
-**参数说明**:
-
-| 参数 | 说明 | 默认值 |
-|------|------|--------|
-| `path` | LoRA 模型文件路径 | 必填 |
-| `strength` | LoRA 强度系数,范围 [0.0, 1.0] | 1.0 |
-| `alpha` | LoRA 缩放因子,`null` 时使用模型内置值 | null |
-| `name` | (仅 Wan2.2)指定应用到哪个模型 | 必填 |
-
-**优点**:
-- ✅ 灵活切换不同 LoRA
-- ✅ 节省存储空间
-- ✅ 可动态调整 LoRA 强度
-
-**缺点**:
-- ❌ 推理时需额外加载时间
-- ❌ 略微增加显存占用
-
----
-
-## 📚 相关资源
-
-### 官方仓库
-- [LightX2V GitHub](https://github.com/ModelTC/LightX2V)
-- [LightX2V 单文件模型仓库](https://huggingface.co/lightx2v/Wan2.1-Distill-Models)
-- [Wan-AI 官方模型仓库](https://huggingface.co/Wan-AI)
-
-### 模型下载链接
-
-**Wan2.1 系列**
-- [Wan2.1 Collection](https://huggingface.co/collections/Wan-AI/wan21-68ac4ba85372ae5a8e282a1b)
-
-**Wan2.2 系列**
-- [Wan2.2 Collection](https://huggingface.co/collections/Wan-AI/wan22-68ac4ae80a8b477e79636fc8)
-
-**LightX2V 单文件模型**
-- [Wan2.1-Distill-Models](https://huggingface.co/lightx2v/Wan2.1-Distill-Models)
-- [Wan2.2-Distill-Models](https://huggingface.co/lightx2v/Wan2.2-Distill-Models)
-
-### 文档链接
-- [量化技术文档](../method_tutorials/quantization.md)
-- [参数卸载文档](../method_tutorials/offload.md)
-- [配置文件示例](https://github.com/ModelTC/LightX2V/tree/main/configs)
-
----
-
-通过本文档,您应该能够:
-
-✅ 理解 LightX2V 支持的所有模型格式
-✅ 根据需求选择合适的模型和精度
-✅ 正确下载和组织模型文件
-✅ 配置启动参数并成功运行推理
-✅ 解决常见的模型加载问题
-
-如有其他问题,欢迎在 [GitHub Issues](https://github.com/ModelTC/LightX2V/issues) 中提问。
diff --git a/docs/ZH_CN/source/getting_started/quickstart.md b/docs/ZH_CN/source/getting_started/quickstart.md
deleted file mode 100755
index 181406a9f..000000000
--- a/docs/ZH_CN/source/getting_started/quickstart.md
+++ /dev/null
@@ -1,361 +0,0 @@
-# LightX2V 快速入门指南
-
-欢迎使用 LightX2V!本指南将帮助您快速搭建环境并开始使用 LightX2V 进行视频生成。
-
-## 📋 目录
-
-- [系统要求](#系统要求)
-- [Linux 系统环境搭建](#linux-系统环境搭建)
- - [Docker 环境(推荐)](#docker-环境推荐)
- - [Conda 环境搭建](#conda-环境搭建)
-- [Windows 系统环境搭建](#windows-系统环境搭建)
-- [推理使用](#推理使用)
-
-## 🚀 系统要求
-
-- **操作系统**: Linux (Ubuntu 18.04+) 或 Windows 10/11
-- **Python**: 3.10 或更高版本
-- **GPU**: NVIDIA GPU,支持 CUDA,至少 8GB 显存
-- **内存**: 建议 16GB 或更多
-- **存储**: 至少 50GB 可用空间
-
-## 🐧 Linux 系统环境搭建
-
-### 🐳 Docker 环境(推荐)
-
-我们强烈推荐使用 Docker 环境,这是最简单快捷的安装方式。
-
-#### 1. 拉取镜像
-
-访问 LightX2V 的 [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags),选择一个最新日期的 tag,比如 `26052801-cu130`:
-
-```bash
-docker pull lightx2v/lightx2v:26052801-cu130
-```
-
-我们推荐使用`cuda130`环境,以获得更快的推理速度,若需要使用`cuda128`和`cuda124`环境,可以使用带`-cu128`和`-cu124`后缀的镜像版本:
-
-```bash
-docker pull lightx2v/lightx2v:26011201-cu128
-docker pull lightx2v/lightx2v:25101501-cu124
-```
-
-#### 2. 运行容器
-
-```bash
-docker run --gpus all -itd --ipc=host --name [容器名] -v [挂载设置] --entrypoint /bin/bash [镜像id]
-```
-
-#### 3. 中国镜像源(可选)
-
-对于中国大陆地区,如果拉取镜像时网络不稳定,可以从阿里云上拉取:
-
-```bash
-# cuda130
-docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:26052801-cu130
-
-# cuda128
-docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:26011201-cu128
-
-# cuda124
-docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25101501-cu124
-```
-
-### 🐍 Conda 环境搭建
-
-如果您希望使用 Conda 自行搭建环境,请按照以下步骤操作:
-
-#### 步骤 1: 克隆项目
-
-```bash
-# 下载项目代码
-git clone https://github.com/ModelTC/LightX2V.git
-cd LightX2V
-```
-
-#### 步骤 2: 创建 conda 虚拟环境
-
-```bash
-# 创建并激活 conda 环境
-conda create -n lightx2v python=3.11 -y
-conda activate lightx2v
-```
-
-#### 步骤 3: 安装依赖及代码
-
-```bash
-pip install -v -e .
-```
-
-#### 步骤 4: 安装注意力机制算子
-
-**选项 A: Flash Attention 2**
-```bash
-git clone https://github.com/Dao-AILab/flash-attention.git --recursive
-cd flash-attention && python setup.py install
-```
-
-**选项 B: Flash Attention 3(用于 Hopper 架构显卡)**
-```bash
-cd flash-attention/hopper && python setup.py install
-```
-
-**选项 C: SageAttention 2(推荐)**
-```bash
-git clone https://github.com/thu-ml/SageAttention.git
-cd SageAttention && CUDA_ARCHITECTURES="8.0,8.6,8.9,9.0,12.0" EXT_PARALLEL=4 NVCC_APPEND_FLAGS="--threads 8" MAX_JOBS=32 pip install -v -e .
-```
-
-#### 步骤 4: 安装量化算子(可选)
-
-量化算子用于支持模型量化功能,可以显著降低显存占用并加速推理。根据您的需求选择合适的量化算子:
-
-**选项 A: VLLM Kernels(推荐)**
-适用于多种量化方案,支持 FP8 等量化格式。
-
-```bash
-pip install vllm
-```
-
-或者从源码安装以获得最新功能:
-
-```bash
-git clone https://github.com/vllm-project/vllm.git
-cd vllm
-uv pip install -e .
-```
-
-**选项 B: SGL Kernels**
-适用于 SGL 量化方案,需要 torch == 2.8.0。
-
-```bash
-pip install sgl-kernel --upgrade
-```
-
-**选项 C: Q8 Kernels**
-适用于 Ada 架构显卡(如 RTX 4090、L40S 等)。
-
-```bash
-git clone https://github.com/KONAKONA666/q8_kernels.git
-cd q8_kernels && git submodule init && git submodule update
-python setup.py install
-```
-
-> 💡 **提示**:
-> - 如果不需要使用量化功能,可以跳过此步骤
-> - 量化模型可以从 [LightX2V HuggingFace](https://huggingface.co/lightx2v) 下载
-> - 更多量化相关信息请参考 [量化文档](method_tutorials/quantization.html)
-
-#### 步骤 5: 验证安装
-```python
-import lightx2v
-print(f"LightX2V 版本: {lightx2v.__version__}")
-```
-
-## 🪟 Windows 系统环境搭建
-
-Windows 系统仅支持 Conda 环境搭建方式,请按照以下步骤操作:
-
-### 🐍 Conda 环境搭建
-
-#### 步骤 1: 检查 CUDA 版本
-
-首先确认您的 GPU 驱动和 CUDA 版本:
-
-```cmd
-nvidia-smi
-```
-
-记录输出中的 **CUDA Version** 信息,后续安装时需要保持版本一致。
-
-#### 步骤 2: 创建 Python 环境
-
-```cmd
-# 创建新环境(推荐 Python 3.12)
-conda create -n lightx2v python=3.12 -y
-
-# 激活环境
-conda activate lightx2v
-```
-
-> 💡 **提示**: 建议使用 Python 3.10 或更高版本以获得最佳兼容性。
-
-#### 步骤 3: 安装 PyTorch 框架
-
-**方法一:下载官方 wheel 包(推荐)**
-
-1. 访问 [PyTorch 官方下载页面](https://download.pytorch.org/whl/torch/)
-2. 选择对应版本的 wheel 包,注意匹配以下参数:
- - **Python 版本**: 与您的环境一致
- - **CUDA 版本**: 与您的 GPU 驱动匹配
- - **平台**: 选择 Windows 版本
-
-**示例(Python 3.12 + PyTorch 2.6 + CUDA 12.4):**
-
-```cmd
-# 下载并安装 PyTorch
-pip install torch-2.6.0+cu124-cp312-cp312-win_amd64.whl
-
-# 安装配套包
-pip install torchvision==0.21.0 torchaudio==2.6.0
-```
-
-**方法二:使用 pip 直接安装**
-
-```cmd
-# CUDA 12.4 版本示例
-pip install torch==2.6.0+cu124 torchvision==0.21.0+cu124 torchaudio==2.6.0+cu124 --index-url https://download.pytorch.org/whl/cu124
-```
-
-#### 步骤 4: 克隆项目并安装依赖
-
-```cmd
-# 克隆项目代码
-git clone https://github.com/ModelTC/LightX2V.git
-cd LightX2V
-
-# 安装 Windows 专用依赖
-pip install -r requirements_win.txt
-pip install -v -e .
-```
-
-#### 步骤 5: 安装注意力机制算子
-
-**选项 A: Flash Attention 2**
-
-```cmd
-pip install flash-attn==2.7.2.post1
-```
-
-**选项 B: SageAttention 2(强烈推荐)**
-
-**下载源:**
-- [Windows 专用版本 1](https://github.com/woct0rdho/SageAttention/releases)
-- [Windows 专用版本 2](https://github.com/sdbds/SageAttention-for-windows/releases)
-
-```cmd
-# 安装 SageAttention(请根据实际文件名调整)
-pip install sageattention-2.1.1+cu126torch2.6.0-cp312-cp312-win_amd64.whl
-```
-
-> ⚠️ **注意**: SageAttention 的 CUDA 版本可以不严格对齐,但 Python 和 PyTorch 版本必须匹配。
-
-#### 步骤 6 (可选): 安装量化算子
-
-默认使用 Triton kernel 进行量化推理,实现高效且无需安装额外依赖,只需确保已安装 `triton-windows` 即可。
-
-如需使用其他量化算子,可安装以下选项:
-
-**1. 安装 Windows 版 vLLM**
-
-从 [vllm-windows releases](https://github.com/SystemPanic/vllm-windows/releases) 下载对应的 wheel 包。
-
-**版本匹配要求:**
-- Python 版本匹配
-- PyTorch 版本匹配
-- CUDA 版本匹配
-
-```cmd
-# 安装 vLLM(请根据实际文件名调整)
-pip install vllm-0.9.1+cu124-cp312-cp312-win_amd64.whl
-```
-
-**2. 安装 q8-kernels**
-
-对于 RTX 40 系显卡,推荐安装 `q8_kernel==0.1.0`:
-
-```bash
-git clone https://github.com/KONAKONA666/q8_kernels.git
-cd q8_kernels && git submodule init && git submodule update
-python setup.py install
-```
-
-对于其他显卡,推荐安装 `q8_kernel==0.5.0`,请参考 [LTX-Video-Q8-Kernels](https://github.com/Lightricks/LTX-Video-Q8-Kernels)。
-
-> 💡 **提示**:
-> - 建议使用默认的 Triton kernel 进行推理
-> - 量化模型可以从 [LightX2V HuggingFace](https://huggingface.co/lightx2v) 下载
-> - 更多量化相关信息请参考 [量化文档](method_tutorials/quantization.html)
-
-#### 步骤 8: 验证安装
-```python
-import lightx2v
-print(f"LightX2V 版本: {lightx2v.__version__}")
-```
-
-## 🎯 推理使用
-
-### 📥 模型准备
-
-在开始推理之前,您需要提前下载好模型文件。我们推荐:
-
-- **下载源**: 从 [LightX2V 官方 Hugging Face](https://huggingface.co/lightx2v/)或者其他开源模型库下载模型
-- **存储位置**: 建议将模型存储在 SSD 磁盘上以获得更好的读取性能
-- **可用模型**: 包括 Wan2.1-I2V、Wan2.1-T2V 等多种模型,支持不同分辨率和功能
-
-### 📁 配置文件与脚本
-
-推理会用到的配置文件都在[这里](https://github.com/ModelTC/LightX2V/tree/main/configs),脚本都在[这里](https://github.com/ModelTC/LightX2V/tree/main/scripts)。
-
-需要将下载的模型路径配置到运行脚本中。除了脚本中的输入参数,`--config_json` 指向的配置文件中也会包含一些必要参数,您可以根据需要自行修改。
-
-### 🚀 开始推理
-
-#### Linux 环境
-
-```bash
-# 修改脚本中的路径后运行
-bash scripts/wan/run_wan_t2v.sh
-```
-
-#### Windows 环境
-
-```cmd
-# 使用 Windows 批处理脚本
-scripts\win\run_wan_t2v.bat
-```
-#### Python脚本启动
-
-```python
-from lightx2v import LightX2VPipeline
-
-pipe = LightX2VPipeline(
- model_path="/path/to/Wan2.1-T2V-14B",
- model_cls="wan2.1",
- task="t2v",
-)
-
-pipe.create_generator(
- attn_mode="sage_attn2",
- infer_steps=50,
- height=480, # 720
- width=832, # 1280
- num_frames=81,
- guidance_scale=5.0,
- sample_shift=5.0,
-)
-
-seed = 42
-prompt = "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
-negative_prompt = "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
-save_result_path="/path/to/save_results/output.mp4"
-
-pipe.generate(
- seed=seed,
- prompt=prompt,
- negative_prompt=negative_prompt,
- save_result_path=save_result_path,
-)
-```
-
-
-## 📞 获取帮助
-
-如果您在安装或使用过程中遇到问题,请:
-
-1. 在 [GitHub Issues](https://github.com/ModelTC/LightX2V/issues) 中搜索相关问题
-2. 提交新的 Issue 描述您的问题
-
----
-
-🎉 **恭喜!** 现在您已经成功搭建了 LightX2V 环境,可以开始享受视频生成的乐趣了!
diff --git a/docs/ZH_CN/source/index.rst b/docs/ZH_CN/source/index.rst
deleted file mode 100755
index 84b3892cf..000000000
--- a/docs/ZH_CN/source/index.rst
+++ /dev/null
@@ -1,69 +0,0 @@
-欢迎了解 Lightx2v!
-==================
-
-.. figure:: ../../../assets/img_lightx2v.png
- :width: 80%
- :align: center
- :alt: Lightx2v
- :class: no-scaled-link
-
-.. raw:: html
-
-
-
-
- LightX2V: 一个轻量级的视频生成推理框架
-
-
-
-LightX2V 是一个轻量级的视频生成推理框架,集成多种先进的视频生成推理技术,统一支持 文本生成视频 (T2V)、图像生成视频 (I2V) 等多种生成任务及模型。X2V 表示将不同的输入模态(X,如文本或图像)转换(to)为视频输出(V)。
-
-GitHub: https://github.com/ModelTC/lightx2v
-
-HuggingFace: https://huggingface.co/lightx2v
-
-文档列表
--------------
-
-.. toctree::
- :maxdepth: 1
- :caption: 快速入门
-
- 快速入门
- 模型结构
- 基准测试
-
-.. toctree::
- :maxdepth: 1
- :caption: 方法教程
-
- 模型量化
- 特征缓存
- 注意力机制
- 参数卸载
- 并行推理
- 变分辨率推理
- 步数蒸馏
- 自回归蒸馏
- 视频帧插值
- PyTorch Trace Profiling
-
-.. toctree::
- :maxdepth: 1
- :caption: 部署指南
-
- 低延迟场景部署
- 低资源场景部署
- Lora模型部署
- 服务化部署
- Gradio部署
- ComfyUI部署
- 本地windows电脑部署
diff --git a/docs/ZH_CN/source/method_tutorials/attention.md b/docs/ZH_CN/source/method_tutorials/attention.md
deleted file mode 100644
index 06f957057..000000000
--- a/docs/ZH_CN/source/method_tutorials/attention.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# 注意力机制
-
-## LightX2V支持的注意力机制
-
-| 名称 | 类型名称 | GitHub 链接 |
-|--------------------|------------------|-------------|
-| Flash Attention 2 | `flash_attn2` | [flash-attention v2](https://github.com/Dao-AILab/flash-attention) |
-| Flash Attention 3 | `flash_attn3` | [flash-attention v3](https://github.com/Dao-AILab/flash-attention) |
-| Sage Attention 2 | `sage_attn2` | [SageAttention](https://github.com/thu-ml/SageAttention) |
-| Radial Attention | `radial_attn` | [Radial Attention](https://github.com/mit-han-lab/radial-attention) |
-| Sparge Attention | `sparge_ckpt` | [Sparge Attention](https://github.com/thu-ml/SpargeAttn) |
-
----
-
-## 配置示例
-
-注意力机制的config文件在[这里](https://github.com/ModelTC/lightx2v/tree/main/configs/attentions)
-
-通过指定--config_json到具体的config文件,即可以测试不同的注意力机制
-
-比如对于radial_attn,配置如下:
-
-```json
-{
- "self_attn_1_type": "radial_attn",
- "cross_attn_1_type": "flash_attn3",
- "cross_attn_2_type": "flash_attn3"
-}
-```
-
-如需更换为其他类型,只需将对应值替换为上述表格中的类型名称即可。
-
-tips: radial_attn因为稀疏算法原理的限制只能用在self attention
-
-如需进一步定制注意力机制的行为,请参考各注意力库的官方文档或实现代码。
diff --git a/docs/ZH_CN/source/method_tutorials/autoregressive_distill.md b/docs/ZH_CN/source/method_tutorials/autoregressive_distill.md
deleted file mode 100644
index 19845ce07..000000000
--- a/docs/ZH_CN/source/method_tutorials/autoregressive_distill.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# 自回归蒸馏
-
-自回归蒸馏是 LightX2V 中的一个技术探索,通过训练蒸馏模型将推理步数从原始的 40-50 步减少到 **8 步**,在实现推理加速的同时能够通过 KV Cache 技术生成无限长视频。
-
-> ⚠️ 警告:目前自回归蒸馏的效果一般,加速效果也没有达到预期,但是可以作为一个长期的研究项目。目前 LightX2V 仅支持 T2V 的自回归模型。
-
-## 🔍 技术原理
-
-自回归蒸馏通过 [CausVid](https://github.com/tianweiy/CausVid) 技术实现。CausVid 针对 1.3B 的自回归模型进行步数蒸馏、CFG蒸馏。LightX2V 在其基础上,进行了一系列扩展:
-
-1. **更大的模型**:支持 14B 模型的自回归蒸馏训练;
-2. **更完整的数据处理流程**:生成 50,000 个提示词-视频对的训练数据集;
-
-具体实现可参考 [CausVid-Plus](https://github.com/GoatWu/CausVid-Plus)。
-
-## 🛠️ 配置文件说明
-
-### 配置文件
-
-在 [configs/causvid/](https://github.com/ModelTC/lightx2v/tree/main/configs/causvid) 目录下提供了配置选项:
-
-| 配置文件 | 模型地址 |
-|----------|------------|
-| [wan_t2v_causvid.json](https://github.com/ModelTC/lightx2v/blob/main/configs/causvid/wan_t2v_causvid.json) | https://huggingface.co/lightx2v/Wan2.1-T2V-14B-CausVid |
-
-### 关键配置参数
-
-```json
-{
- "enable_cfg": false, // 关闭CFG以提升速度
- "num_fragments": 3, // 一次生成视频的段数,每段5s
- "num_frames": 21, // 每段视频的帧数,谨慎修改!
- "num_frame_per_block": 3, // 每个自回归块的帧数,谨慎修改!
- "num_blocks": 7, // 每段视频的自回归块数,谨慎修改!
- "frame_seq_length": 1560, // 每帧的编码长度,谨慎修改!
- "denoising_step_list": [ // 去噪时间步列表
- 999, 934, 862, 756, 603, 410, 250, 140, 74
- ]
-}
-```
-
-## 📜 使用方法
-
-### 模型准备
-
-将下载好的模型(`causal_model.pt` 或者 `causal_model.safetensors`)放到 Wan 模型根目录的 `causvid_models/` 文件夹下即可
-- 对于 T2V:`Wan2.1-T2V-14B/causvid_models/`
-
-### 推理脚本
-
-```bash
-bash scripts/wan/run_wan_t2v_causvid.sh
-```
diff --git a/docs/ZH_CN/source/method_tutorials/cache.md b/docs/ZH_CN/source/method_tutorials/cache.md
deleted file mode 100644
index a867119c8..000000000
--- a/docs/ZH_CN/source/method_tutorials/cache.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# 特征缓存
-
-由于要展示一些视频的播放效果,你可以在这个[🔗 页面](https://github.com/ModelTC/LightX2V/blob/main/docs/ZH_CN/source/method_tutorials/cache_source.md)获得更好的展示效果以及相对应的文档内容。
diff --git a/docs/ZH_CN/source/method_tutorials/cache_source.md b/docs/ZH_CN/source/method_tutorials/cache_source.md
deleted file mode 100644
index 37624af05..000000000
--- a/docs/ZH_CN/source/method_tutorials/cache_source.md
+++ /dev/null
@@ -1,139 +0,0 @@
-# 特征缓存
-
-## 缓存加速算法
-- 在扩散模型的推理过程中,缓存复用是一种重要的加速算法。
-- 其核心思想是在部分时间步跳过冗余计算,通过复用历史缓存结果提升推理效率。
-- 算法的关键在于如何决策在哪些时间步进行缓存复用,通常基于模型状态变化或误差阈值动态判断。
-- 在推理过程中,需要缓存如中间特征、残差、注意力输出等关键内容。当进入可复用时间步时,直接利用已缓存的内容,通过泰勒展开等近似方法重构当前输出,从而减少重复计算,实现高效推理。
-
-### TeaCache
-`TeaCache`的核心思想是通过对相邻时间步输入的**相对L1**距离进行累加,当累计距离达到设定阈值时,判定当前时间步不使用缓存复用;相反,当累计距离未达到设定阈值时则使用缓存复用加速推理过程。
-- 具体来说,算法在每一步推理时计算当前输入与上一步输入的相对L1距离,并将其累加。
-- 当累计距离未超过阈值,说明模型状态变化不明显,则直接复用最近一次缓存的内容,跳过部分冗余计算。这样可以显著减少模型的前向计算次数,提高推理速度。
-
-实际效果上,TeaCache 在保证生成质量的前提下,实现了明显的加速。在单卡H200上,加速前后的用时与视频对比如下:
-
-
-
- |
- 加速前:58s
- |
-
- 加速后:17.9s
- |
-
-
- |
-
- |
-
-
- |
-
-
-
-
-- 加速比为:**3.24**
-- config:[wan_t2v_1_3b_tea_480p.json](https://github.com/ModelTC/lightx2v/tree/main/configs/caching/teacache/wan_t2v_1_3b_tea_480p.json)
-- 参考论文:[https://arxiv.org/abs/2411.19108](https://arxiv.org/abs/2411.19108)
-
-### TaylorSeer Cache
-`TaylorSeer Cache`的核心在于利用泰勒公式对缓存内容进行再次计算,作为缓存复用时间步的残差补偿。
-- 具体做法是在缓存复用的时间步,不仅简单地复用历史缓存,还通过泰勒展开对当前输出进行近似重构。这样可以在减少计算量的同时,进一步提升输出的准确性。
-- 泰勒展开能够有效捕捉模型状态的微小变化,使得缓存复用带来的误差得到补偿,从而在加速的同时保证生成质量。
-
-`TaylorSeer Cache`适用于对输出精度要求较高的场景,能够在缓存复用的基础上进一步提升模型推理的表现。
-
-
-
- |
- 加速前:57.7s
- |
-
- 加速后:41.3s
- |
-
-
- |
-
- |
-
-
- |
-
-
-
-
-- 加速比为:**1.39**
-- config:[wan_t2v_taylorseer](https://github.com/ModelTC/lightx2v/tree/main/configs/caching/taylorseer/wan_t2v_taylorseer.json)
-- 参考论文:[https://arxiv.org/abs/2503.06923](https://arxiv.org/abs/2503.06923)
-
-### AdaCache
-`AdaCache`的核心思想是根据指定block块中的部分缓存内容,动态调整缓存复用的步长。
-- 算法会分析相邻两个时间步在特定 block 内的特征差异,根据差异大小自适应地决定下一个缓存复用的时间步间隔。
-- 当模型状态变化较小时,步长自动加大,减少缓存更新频率;当状态变化较大时,步长缩小,保证输出质量。
-
-这样可以根据实际推理过程中的动态变化,灵活调整缓存策略,实现更高效的加速和更优的生成效果。AdaCache 适合对推理速度和生成质量都有较高要求的应用场景。
-
-
-
- |
- 加速前:227s
- |
-
- 加速后:83s
- |
-
-
- |
-
- |
-
-
- |
-
-
-
-
-- 加速比为:**2.73**
-- config:[wan_i2v_ada](https://github.com/ModelTC/lightx2v/tree/main/configs/caching/adacache/wan_i2v_ada.json)
-- 参考论文:[https://arxiv.org/abs/2411.02397](https://arxiv.org/abs/2411.02397)
-
-### CustomCache
-`CustomCache`综合了`TeaCache`和`TaylorSeer Cache`的优势。
-- 它结合了`TeaCache`在缓存决策上的实时性和合理性,通过动态阈值判断何时进行缓存复用.
-- 同时利用`TaylorSeer`的泰勒展开方法对已缓存内容进行利用。
-
-这样不仅能够高效地决定缓存复用的时机,还能最大程度地利用缓存内容,提升输出的准确性和生成质量。实际测试表明,`CustomCache`在多个内容生成任务上,生成的视频质量优于单独使用`TeaCache、TaylorSeer Cache`或`AdaCache`的方案,是目前综合性能最优的缓存加速算法之一。
-
-
-
- |
- 加速前:57.9s
- |
-
- 加速后:16.6s
- |
-
-
- |
-
- |
-
-
- |
-
-
-
-
-- 加速比为:**3.49**
-- config:[wan_t2v_custom_1_3b](https://github.com/ModelTC/lightx2v/tree/main/configs/caching/custom/wan_t2v_custom_1_3b.json)
-
-
-## 使用方式
-
-特征缓存的config文件在[这里](https://github.com/ModelTC/lightx2v/tree/main/configs/caching)
-
-通过指定--config_json到具体的config文件,即可以测试不同的cache算法
-
-[这里](https://github.com/ModelTC/lightx2v/tree/main/scripts/cache)有一些运行脚本供使用。
diff --git a/docs/ZH_CN/source/method_tutorials/changing_resolution.md b/docs/ZH_CN/source/method_tutorials/changing_resolution.md
deleted file mode 100644
index e4a51490d..000000000
--- a/docs/ZH_CN/source/method_tutorials/changing_resolution.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# 变分辨率推理
-
-## 概述
-
-变分辨率推理是一种优化去噪过程的技术策略,通过在不同的去噪阶段采用不同的分辨率来提升计算效率并保持生成质量。该方法的核心思想是:在去噪过程的前期使用较低分辨率进行粗略去噪,在后期切换到正常分辨率进行精细化处理。
-
-## 技术原理
-
-### 分阶段去噪策略
-
-变分辨率推理基于以下观察:
-
-- **前期去噪**:主要处理粗糙的噪声和整体结构,不需要过多的细节信息
-- **后期去噪**:专注于细节优化和高频信息恢复,需要完整的分辨率信息
-
-### 分辨率切换机制
-
-1. **低分辨率阶段**(前期)
- - 将输入降采样到较低分辨率(如原尺寸的0.75)
- - 执行初始的去噪步骤
- - 快速移除大部分噪声,建立基本结构
-
-2. **正常分辨率阶段**(后期)
- - 将第一步的去噪结果上采样回原始分辨率
- - 继续执行剩余的去噪步骤
- - 恢复细节信息,完成精细化处理
-
-
-### U型分辨率策略
-
-如果在刚开始的去噪步,降低分辨率,可能会导致最后的生成的视频和正常推理的生成的视频,整体差异偏大。因此可以采用U型的分辨率策略,即最一开始保持几步的原始分辨率,再降低分辨率推理。
-
-## 使用方式
-
-变分辨率推理的config文件在[这里](https://github.com/ModelTC/LightX2V/tree/main/configs/changing_resolution)
-
-通过指定--config_json到具体的config文件,即可以测试变分辨率推理。
-
-可以参考[这里](https://github.com/ModelTC/LightX2V/blob/main/scripts/changing_resolution)的脚本运行。
-
-
-### 举例1:
-```
-{
- "infer_steps": 50,
- "changing_resolution": true,
- "resolution_rate": [0.75],
- "changing_resolution_steps": [25]
-}
-```
-
-表示总步数为50,1到25步的分辨率为0.75倍原始分辨率,26到最后一步的分辨率为原始分辨率。
-
-### 举例2:
-```
-{
- "infer_steps": 50,
- "changing_resolution": true,
- "resolution_rate": [1.0, 0.75],
- "changing_resolution_steps": [10, 35]
-}
-```
-
-表示总步数为50,1到10步的分辨率为原始分辨率,11到35步的分辨率为0.75倍原始分辨率,36到最后一步的分辨率为原始分辨率。
-
-通常来说,假设`changing_resolution_steps`为[A, B, C],去噪的起始步为1,总步数为X,则推理会被分成4个部分。
-
-分别是,(0, A], (A, B]. (B, C], (C, X],每个部分是左开右闭集合。
diff --git a/docs/ZH_CN/source/method_tutorials/offload.md b/docs/ZH_CN/source/method_tutorials/offload.md
deleted file mode 100644
index 2581bc44d..000000000
--- a/docs/ZH_CN/source/method_tutorials/offload.md
+++ /dev/null
@@ -1 +0,0 @@
-参考 https://github.com/ModelTC/LightX2V-BLOG/blob/main/_articles/Offload.md
diff --git a/docs/ZH_CN/source/method_tutorials/parallel.md b/docs/ZH_CN/source/method_tutorials/parallel.md
deleted file mode 100644
index a6ff0dfe2..000000000
--- a/docs/ZH_CN/source/method_tutorials/parallel.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# 并行推理
-
-LightX2V 支持分布式并行推理,能够利用多个 GPU 进行推理。DiT部分支持两种并行注意力机制:**Ulysses** 和 **Ring**,同时还支持 **Cfg 并行推理**。并行推理,显著降低推理耗时和减轻每个GPU的显存开销。
-
-## DiT 并行配置
-
-### 1. Ulysses 并行
-
-**配置方式:**
-```json
- "parallel": {
- "seq_p_size": 4,
- "seq_p_attn_type": "ulysses"
- }
-```
-
-### 2. Ring 并行
-
-
-**配置方式:**
-```json
- "parallel": {
- "seq_p_size": 4,
- "seq_p_attn_type": "ring"
- }
-```
-
-## Cfg 并行配置
-
-**配置方式:**
-```json
- "parallel": {
- "cfg_p_size": 2
- }
-```
-
-## 混合并行配置
-
-**配置方式:**
-```json
- "parallel": {
- "seq_p_size": 4,
- "seq_p_attn_type": "ulysses",
- "cfg_p_size": 2
- }
-```
-
-
-## 使用方式
-
-并行推理的config文件在[这里](https://github.com/ModelTC/lightx2v/tree/main/configs/dist_infer)
-
-通过指定--config_json到具体的config文件,即可以测试并行推理
-
-[这里](https://github.com/ModelTC/lightx2v/tree/main/scripts/dist_infer)有一些运行脚本供使用。
diff --git a/docs/ZH_CN/source/method_tutorials/quantization.md b/docs/ZH_CN/source/method_tutorials/quantization.md
deleted file mode 100644
index 311367cc6..000000000
--- a/docs/ZH_CN/source/method_tutorials/quantization.md
+++ /dev/null
@@ -1,158 +0,0 @@
-# 模型量化技术
-
-## 📖 概述
-
-LightX2V 支持对 DIT、T5 和 CLIP 模型进行量化推理,通过降低模型精度来减少显存占用并提升推理速度。
-
----
-
-## 🔧 量化模式
-
-| 量化模式 | 权重量化 | 激活量化 | 计算内核 | 适用硬件 |
-|--------------|----------|----------|----------|----------|
-| `fp8-vllm` | FP8 通道对称 | FP8 通道动态对称 | [VLLM](https://github.com/vllm-project/vllm) | H100/H200/H800, RTX 40系等 |
-| `int8-vllm` | INT8 通道对称 | INT8 通道动态对称 | [VLLM](https://github.com/vllm-project/vllm) | A100/A800, RTX 30/40系等 |
-| `fp8-sgl` | FP8 通道对称 | FP8 通道动态对称 | [SGL](https://github.com/sgl-project/sglang/tree/main/sgl-kernel) | H100/H200/H800, RTX 40系等 |
-| `int8-sgl` | INT8 通道对称 | INT8 通道动态对称 | [SGL](https://github.com/sgl-project/sglang/tree/main/sgl-kernel) | A100/A800, RTX 30/40系等 |
-| `fp8-q8f` | FP8 通道对称 | FP8 通道动态对称 | [Q8-Kernels](https://github.com/KONAKONA666/q8_kernels) | RTX 40系, L40S等 |
-| `int8-q8f` | INT8 通道对称 | INT8 通道动态对称 | [Q8-Kernels](https://github.com/KONAKONA666/q8_kernels) | RTX 40系, L40S等 |
-| `int8-torchao` | INT8 通道对称 | INT8 通道动态对称 | [TorchAO](https://github.com/pytorch/ao) | A100/A800, RTX 30/40系等 |
-| `int4-g128-marlin` | INT4 分组对称 | FP16 | [Marlin](https://github.com/IST-DASLab/marlin) | H200/H800/A100/A800, RTX 30/40系等 |
-| `fp8-b128-deepgemm` | FP8 分块对称 | FP8 分组对称 | [DeepGemm](https://github.com/deepseek-ai/DeepGEMM) | H100/H200/H800, RTX 40系等|
-
----
-
-## 🔧 量化模型获取
-
-### 方式一:下载预量化模型
-
-从 LightX2V 模型仓库下载预量化的模型:
-
-**DIT 模型**
-
-从 [Wan2.1-Distill-Models](https://huggingface.co/lightx2v/Wan2.1-Distill-Models) 下载预量化的 DIT 模型:
-
-```bash
-# 下载 DIT FP8 量化模型
-huggingface-cli download lightx2v/Wan2.1-Distill-Models \
- --local-dir ./models \
- --include "wan2.1_i2v_720p_scaled_fp8_e4m3_lightx2v_4step.safetensors"
-```
-
-**Encoder 模型**
-
-从 [Encoders-LightX2V](https://huggingface.co/lightx2v/Encoders-Lightx2v) 下载预量化的 T5 和 CLIP 模型:
-
-```bash
-# 下载 T5 FP8 量化模型
-huggingface-cli download lightx2v/Encoders-Lightx2v \
- --local-dir ./models \
- --include "models_t5_umt5-xxl-enc-fp8.pth"
-
-# 下载 CLIP FP8 量化模型
-huggingface-cli download lightx2v/Encoders-Lightx2v \
- --local-dir ./models \
- --include "models_clip_open-clip-xlm-roberta-large-vit-huge-14-fp8.pth"
-```
-
-### 方式二:自行量化模型
-
-详细量化工具使用方法请参考:[模型转换文档](https://github.com/ModelTC/lightx2v/tree/main/tools/convert/readme_zh.md)
-
----
-
-## 🚀 量化模型使用
-
-### DIT 模型量化
-
-#### 支持的量化模式
-
-DIT 量化模式(`dit_quant_scheme`)支持:`fp8-vllm`、`int8-vllm`、`fp8-sgl`、`int8-sgl`、`fp8-q8f`、`int8-q8f`、`int8-torchao`、`int4-g128-marlin`、`fp8-b128-deepgemm`
-
-#### 配置示例
-
-```json
-{
- "dit_quantized": true,
- "dit_quant_scheme": "fp8-sgl",
- "dit_quantized_ckpt": "/path/to/dit_quantized_model" // 可选
-}
-```
-
-> 💡 **提示**:当运行脚本的 `model_path` 中只有一个 DIT 模型时,`dit_quantized_ckpt` 可以不用单独指定。
-
-### T5 模型量化
-
-#### 支持的量化模式
-
-T5 量化模式(`t5_quant_scheme`)支持:`int8-vllm`、`fp8-sgl`、`int8-q8f`、`fp8-q8f`、`int8-torchao`
-
-#### 配置示例
-
-```json
-{
- "t5_quantized": true,
- "t5_quant_scheme": "fp8-sgl",
- "t5_quantized_ckpt": "/path/to/t5_quantized_model" // 可选
-}
-```
-
-> 💡 **提示**:当运行脚本指定的 `model_path` 中存在 T5 量化模型(如 `models_t5_umt5-xxl-enc-fp8.pth` 或 `models_t5_umt5-xxl-enc-int8.pth`)时,`t5_quantized_ckpt` 可以不用单独指定。
-
-### CLIP 模型量化
-
-#### 支持的量化模式
-
-CLIP 量化模式(`clip_quant_scheme`)支持:`int8-vllm`、`fp8-sgl`、`int8-q8f`、`fp8-q8f`、`int8-torchao`
-
-#### 配置示例
-
-```json
-{
- "clip_quantized": true,
- "clip_quant_scheme": "fp8-sgl",
- "clip_quantized_ckpt": "/path/to/clip_quantized_model" // 可选
-}
-```
-
-> 💡 **提示**:当运行脚本指定的 `model_path` 中存在 CLIP 量化模型(如 `models_clip_open-clip-xlm-roberta-large-vit-huge-14-fp8.pth` 或 `models_clip_open-clip-xlm-roberta-large-vit-huge-14-int8.pth`)时,`clip_quantized_ckpt` 可以不用单独指定。
-
-### 性能优化策略
-
-如果显存不够,可以结合参数卸载来进一步减少显存占用,参考[参数卸载文档](../method_tutorials/offload.md):
-
-> - **Wan2.1 配置**:参考 [offload 配置文件](https://github.com/ModelTC/LightX2V/tree/main/configs/offload)
-> - **Wan2.2 配置**:参考 [wan22 配置文件](https://github.com/ModelTC/LightX2V/tree/main/configs/wan22) 中以 `4090` 结尾的配置
-
----
-
-## 📚 相关资源
-
-### 配置文件示例
-- [INT8 量化配置](https://github.com/ModelTC/LightX2V/blob/main/configs/quantization/wan_i2v.json)
-- [Q8F 量化配置](https://github.com/ModelTC/LightX2V/blob/main/configs/quantization/wan_i2v_q8f.json)
-- [TorchAO 量化配置](https://github.com/ModelTC/LightX2V/blob/main/configs/quantization/wan_i2v_torchao.json)
-
-### 运行脚本
-- [量化推理脚本](https://github.com/ModelTC/LightX2V/tree/main/scripts/quantization)
-
-### 工具文档
-- [量化工具文档](https://github.com/ModelTC/lightx2v/tree/main/tools/convert/readme_zh.md)
-- [LightCompress 量化文档](https://github.com/ModelTC/llmc/blob/main/docs/zh_cn/source/backend/lightx2v.md)
-
-### 模型仓库
-- [Wan2.1-LightX2V 量化模型](https://huggingface.co/lightx2v/Wan2.1-Distill-Models)
-- [Wan2.2-LightX2V 量化模型](https://huggingface.co/lightx2v/Wan2.2-Distill-Models)
-- [Encoders 量化模型](https://huggingface.co/lightx2v/Encoders-Lightx2v)
-
----
-
-通过本文档,您应该能够:
-
-✅ 理解 LightX2V 支持的量化方案
-✅ 根据硬件选择合适的量化策略
-✅ 正确配置量化参数
-✅ 获取和使用量化模型
-✅ 优化推理性能和显存使用
-
-如有其他问题,欢迎在 [GitHub Issues](https://github.com/ModelTC/LightX2V/issues) 中提问。
diff --git a/docs/ZH_CN/source/method_tutorials/step_distill.md b/docs/ZH_CN/source/method_tutorials/step_distill.md
deleted file mode 100644
index 2ed48c810..000000000
--- a/docs/ZH_CN/source/method_tutorials/step_distill.md
+++ /dev/null
@@ -1,183 +0,0 @@
-# 步数蒸馏
-
-步数蒸馏是 LightX2V 中的一项重要优化技术,通过训练蒸馏模型将推理步数从原始的 40-50 步大幅减少到 **4 步**,在保持视频质量的同时显著提升推理速度。LightX2V 在实现步数蒸馏的同时也加入了 CFG 蒸馏,进一步提升推理速度。
-
-## 🔍 技术原理
-
-### DMD 蒸馏
-
-步数蒸馏的核心技术是 [DMD 蒸馏](https://arxiv.org/abs/2311.18828)。DMD 蒸馏的框架如下图所示:
-
-
-

-
-
-DMD蒸馏的核心思想是最小化蒸馏模型与原始模型输出分布的 KL 散度:
-
-$$
-\begin{aligned}
-D_{KL}\left(p_{\text{fake}} \; \| \; p_{\text{real}} \right) &= \mathbb{E}{x\sim p\text{fake}}\left(\log\left(\frac{p_\text{fake}(x)}{p_\text{real}(x)}\right)\right)\\
-&= \mathbb{E}{\substack{
-z \sim \mathcal{N}(0; \mathbf{I}) \\
-x = G_\theta(z)
-}}-\big(\log~p_\text{real}(x) - \log~p_\text{fake}(x)\big).
-\end{aligned}
-$$
-
-由于直接计算概率密度几乎是不可能的,因此 DMD 蒸馏改为计算这个 KL 散度的梯度:
-
-$$
-\begin{aligned}
-\nabla_\theta D_{KL}
-&= \mathbb{E}{\substack{
-z \sim \mathcal{N}(0; \mathbf{I}) \\
-x = G_\theta(z)
-} } \Big[-
-\big(
-s_\text{real}(x) - s_\text{fake}(x)\big)
-\hspace{.5mm} \frac{dG}{d\theta}
-\Big],
-\end{aligned}
-$$
-
-其中 $s_\text{real}(x) =\nabla_{x} \text{log}~p_\text{real}(x)$ 和 $s_\text{fake}(x) =\nabla_{x} \text{log}~p_\text{fake}(x)$ 为得分函数。得分函数可以由模型进行计算。因此,DMD 蒸馏一共维护三个模型:
-
-- `real_score`,计算真实分布的得分;由于真实分布是固定的,因此 DMD 蒸馏使用固定权重的原始模型作为其得分函数;
-- `fake_score`,计算伪分布的得分;由于伪分布是不断更新的,因此 DMD 蒸馏使用原始模型对其初始化,并对其进行微调以学习生成器的输出分布;
-- `generator`,学生模型,通过计算 `real_score` 与 `fake_score` KL 散度的梯度指导其优化方向。
-
-> 参考文献:
-> 1. [DMD (One-step Diffusion with Distribution Matching Distillation)](https://arxiv.org/abs/2311.18828)
-> 2. [DMD2 (Improved Distribution Matching Distillation for Fast Image Synthesis)](https://arxiv.org/abs/2405.14867)
-
-### Self-Forcing
-
-DMD 蒸馏技术是针对图像生成的。Lightx2v 中的步数蒸馏基于 [Self-Forcing](https://github.com/guandeh17/Self-Forcing) 技术实现。Self-Forcing 的整体实现与 DMD 类似,但是仿照 DMD2,去掉了它的回归损失,而是使用了 ODE 初始化。此外,Self-Forcing 针对视频生成任务加入了一个重要优化:
-
-目前基于 DMD 蒸馏的方法难以一步生成视频。Self-Forcing 每次选择一个时间步进行优化,generator 仅仅在这一步计算梯度。这种方法使得 Self-Forcing 的训练速度显著提升,并且提升了中间时间步的去噪质量,其效果亦有所提升。
-
-> 参考文献:
-> 1. [Self-Forcing (Self Forcing: Bridging the Train-Test Gap in Autoregressive Video Diffusion)](https://arxiv.org/abs/2506.08009)
-
-### Lightx2v
-
-Self-Forcing 针对 1.3B 的自回归模型进行步数蒸馏、CFG蒸馏。LightX2V 在其基础上,进行了一系列扩展:
-
-1. **更大的模型**:支持 14B 模型的步数蒸馏训练;
-2. **更多的模型**:支持标准的双向模型,以及 I2V 模型的步数蒸馏训练;
-3. **更好的效果**:Lightx2v 使用了约 50,000 条数据的高质量 prompt 进行训练;
-
-具体实现可参考 [Self-Forcing-Plus](https://github.com/GoatWu/Self-Forcing-Plus)。
-
-## 🎯 技术特性
-
-- **推理加速**:推理步数从 40-50 步减少到 4 步且无需 CFG,速度提升约 **20-24x**
-- **质量保持**:通过蒸馏技术保持原有的视频生成质量
-- **兼容性强**:支持 T2V 和 I2V 任务
-- **使用灵活**:支持加载完整步数蒸馏模型,或者在原生模型的基础上加载步数蒸馏LoRA;支持与 int8/fp8 模型量化相兼容
-
-## 🛠️ 配置文件说明
-
-### 基础配置文件
-
-在 [configs/distill/](https://github.com/ModelTC/lightx2v/tree/main/configs/distill) 目录下提供了多种配置选项:
-
-| 配置文件 | 用途 | 模型地址 |
-|----------|------|------------|
-| [wan_t2v_distill_4step_cfg.json](https://github.com/ModelTC/lightx2v/blob/main/configs/distill/wan_t2v_distill_4step_cfg.json) | 加载 T2V 4步蒸馏完整模型 | [hugging-face](https://huggingface.co/lightx2v/Wan2.1-T2V-14B-StepDistill-CfgDistill-Lightx2v/blob/main/distill_models/distill_model.safetensors) |
-| [wan_i2v_distill_4step_cfg.json](https://github.com/ModelTC/lightx2v/blob/main/configs/distill/wan_i2v_distill_4step_cfg.json) | 加载 I2V 4步蒸馏完整模型 | [hugging-face](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-480P-StepDistill-CfgDistill-Lightx2v/blob/main/distill_models/distill_model.safetensors) |
-| [wan_t2v_distill_4step_cfg_lora.json](https://github.com/ModelTC/lightx2v/blob/main/configs/distill/wan_t2v_distill_4step_cfg_lora.json) | 加载 Wan-T2V 模型和步数蒸馏 LoRA | [hugging-face](https://huggingface.co/lightx2v/Wan2.1-T2V-14B-StepDistill-CfgDistill-Lightx2v/blob/main/loras/Wan21_T2V_14B_lightx2v_cfg_step_distill_lora_rank64.safetensors) |
-| [wan_i2v_distill_4step_cfg_lora.json](https://github.com/ModelTC/lightx2v/blob/main/configs/distill/wan_i2v_distill_4step_cfg_lora.json) | 加载 Wan-I2V 模型和步数蒸馏 LoRA | [hugging-face](https://huggingface.co/lightx2v/Wan2.1-I2V-14B-480P-StepDistill-CfgDistill-Lightx2v/blob/main/loras/Wan21_I2V_14B_lightx2v_cfg_step_distill_lora_rank64.safetensors) |
-
-### 关键配置参数
-
-- 由于 DMD 蒸馏仅训练几个固定的时间步,因此我们推荐使用 `LCM Scheduler` 进行推理。[WanStepDistillScheduler](https://github.com/ModelTC/LightX2V/blob/main/lightx2v/models/schedulers/wan/step_distill/scheduler.py) 中,已经固定使用 `LCM Scheduler`,无需用户进行配置。
-- `infer_steps`, `denoising_step_list` 和 `sample_shift` 设置为与训练时相匹配的参数,一般不建议用户修改。
-- `enable_cfg` 一定设置为 `false`(等价于设置 `sample_guide_scale = 1`),否则可能出现视频完全模糊的现象。
-- `lora_configs` 支持融合不同强度的多个 lora。当 `lora_configs` 不为空时,默认加载原始的 `Wan2.1` 模型。因此使用 `lora_config` 并且想要使用步数蒸馏时,请设置步数蒸馏lora的路径与强度。
-
-```json
-{
- "infer_steps": 4, // 推理步数
- "denoising_step_list": [1000, 750, 500, 250], // 去噪时间步列表
- "sample_shift": 5, // 调度器 timestep shift
- "enable_cfg": false, // 关闭CFG以提升速度
- "lora_configs": [ // LoRA权重路径(可选)
- {
- "path": "path/to/distill_lora.safetensors",
- "strength": 1.0
- }
- ]
-}
-```
-
-## 📜 使用方法
-
-### 模型准备
-
-**完整模型:**
-将下载好的模型(`distill_model.pt` 或者 `distill_model.safetensors`)放到 Wan 模型根目录的 `distill_models/` 文件夹下即可
-
-- 对于 T2V:`Wan2.1-T2V-14B/distill_models/`
-- 对于 I2V-480P:`Wan2.1-I2V-14B-480P/distill_models/`
-
-**LoRA:**
-
-1. 将下载好的 LoRA 放到任意位置
-2. 修改配置文件中的 `lora_path` 参数为 LoRA 存放路径即可
-
-### 推理脚本
-
-**T2V 完整模型:**
-
-```bash
-bash scripts/wan/run_wan_t2v_distill_4step_cfg.sh
-```
-
-**I2V 完整模型:**
-
-```bash
-bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh
-```
-
-### 步数蒸馏 LoRA 推理脚本
-
-**T2V LoRA:**
-
-```bash
-bash scripts/wan/run_wan_t2v_distill_4step_cfg_lora.sh
-```
-
-**I2V LoRA:**
-
-```bash
-bash scripts/wan/run_wan_i2v_distill_4step_cfg_lora.sh
-```
-
-## 🔧 服务化部署
-
-### 启动蒸馏模型服务
-
-对 [scripts/server/start_server.sh](https://github.com/ModelTC/lightx2v/blob/main/scripts/server/start_server.sh) 中的启动命令进行修改:
-
-```bash
-python -m lightx2v.api_server \
- --model_cls wan2.1_distill \
- --task t2v \
- --model_path $model_path \
- --config_json ${lightx2v_path}/configs/distill/wan_t2v_distill_4step_cfg.json \
- --port 8000 \
- --nproc_per_node 1
-```
-
-运行服务启动脚本:
-
-```bash
-scripts/server/start_server.sh
-```
-
-更多详细信息见[服务化部署](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/deploy_guides/deploy_service.html)。
-
-### 在 Gradio 界面中使用
-
-见 [Gradio 文档](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/deploy_guides/deploy_gradio.html)
diff --git a/docs/ZH_CN/source/method_tutorials/torch_profiling.md b/docs/ZH_CN/source/method_tutorials/torch_profiling.md
deleted file mode 100644
index 94e799bde..000000000
--- a/docs/ZH_CN/source/method_tutorials/torch_profiling.md
+++ /dev/null
@@ -1,215 +0,0 @@
-# PyTorch Trace Profiling
-
-## 概述
-
-LightX2V 提供 `lightx2v.utils.torch_trace_profiler` 模块,基于 PyTorch Profiler 采集 CPU / CUDA kernel 级 trace,并导出为:
-
-- **TensorBoard** 格式(`.pt.trace.json`,在 TensorBoard 的 **PYTORCH PROFILER** 页查看)
-- **Chrome Trace** 格式(`.json`,可用 Perfetto 或 Chrome Tracing 查看)
-
-在目标函数的**调用处**使用 `TorchTraceProfileContext` 即可采集;未包裹的调用不受影响。每个进程全局只允许 profile **一个**调用点(首次执行者生效)。
-
----
-
-## 构造参数
-
-在调用处创建 `TorchTraceProfileContext(...)`,所有参数均有默认值:
-
-| 参数 | 默认值 | 说明 |
-|------|--------|------|
-| `name` | `None` | 调用点标签,用于日志与全局唯一性识别;省略时使用被调用函数的 qualified name |
-| `profile_format` | `tensorboard` | `tensorboard` 或 `chrome` |
-| `tb_dir` | `{cwd}/save_results/torch_profile` | TensorBoard logdir |
-| `chrome_path` | `{cwd}/save_results/trace.json` | Chrome trace 输出路径(`profile_format=chrome` 时生效) |
-| `wait` | `1` | schedule:等待步数(不采集) |
-| `warmup` | `3` | schedule:预热步数(采集但不导出) |
-| `active` | `1` | schedule:有效采集步数(导出 trace) |
-| `with_stack` | `False` | 是否采集 Python 调用栈 |
-| `tensorboard_port` | `16006` | 日志中提示的 TensorBoard 端口 |
-
-是否采集 trace 取决于代码里是否写了 `TorchTraceProfileContext`;导出路径与 schedule 通过构造参数配置。
-
-### 导出格式说明
-
-| `FORMAT` | 产出 | 查看方式 |
-|----------|------|----------|
-| `tensorboard` | `{TB_DIR}/*.pt.trace.json` | TensorBoard → **PYTORCH PROFILER** |
-| `chrome` | `{CHROME_PATH}` | 见下文「查看 Chrome trace」 |
-
----
-
-## 快速开始
-
-### 1. 采集 trace
-
-以 Qwen Image 为例,在 `qwen_image_runner.py` 顶部取消注释 import,并在 `run()` 的 `infer_main` 调用处取消注释 profile 代码(可按需修改参数),然后正常运行推理(如 `scripts/qwen_image/qwen_image_i2i_2511.sh`):
-
-```python
-from lightx2v.utils.torch_trace_profiler import TorchTraceProfileContext
-
-
-with TorchTraceProfileContext(
- "🚀 infer_main",
- tb_dir="save_results/torch_profile",
- with_stack=True,
-) as profile:
- profile.run(self.model.infer, self.inputs)
-```
-
-推理结束后日志会打印 trace 路径及查看命令。
-
-### 2. 查看 TensorBoard
-
-先安装 PyTorch Profiler 插件(一次性):
-
-```bash
-pip install tensorboard torch-tb-profiler
-```
-
-**注意:** 必须打开 **PYTORCH PROFILER** 标签页。默认 SCALARS 页没有 profiler trace 文件,会显示 “No dashboards are active”,属于正常现象。
-
-在 **trace 文件所在的环境** 启动 TensorBoard(logdir 与构造参数 tb_dir 一致):
-
-```bash
-tensorboard --logdir save_results/torch_profile --port 16006 --bind_all
-```
-
-浏览器打开:
-
-```
-http://127.0.0.1:16006/#pytorch_profiler
-```
-
-下面分两种常见部署情况说明,二者可叠加(例如 Remote SSH 连远程宿主机,而推理又在 Docker 里)。
-
-#### Remote SSH
-
-只要 TensorBoard 跑在远程机器上,而浏览器在本地,就需要把远程端口转到本地。
-
-在 IDE **Ports** 面板转发远程的 `16006`(或你指定的 `TENSORBOARD_PORT`),再在本地浏览器打开 `http://127.0.0.1:16006/#pytorch_profiler`。
-
-#### 推理在 Docker 内
-
-trace 写在容器文件系统里,宿主机上直接 `tensorboard --logdir ...` 读不到容器内的 logdir;且容器内 TensorBoard 监听的是容器网络地址,宿主机 `127.0.0.1:16006` 默认也访问不到。
-
-推荐使用 bridge 脚本(需显式指定容器名与 logdir,示例见脚本头部注释):
-
-```bash
-TENSORBOARD_CONTAINER=wyr_lightx2v_h100_202605 \
-TORCH_PROFILE_TB_DIR=/data/nvme0/wangyingrui/LightX2V/save_results/torch_profile \
-bash /data/nvme0/wangyingrui/wyr_scripts/run_tensorboard_docker_bridge.sh
-```
-
-若代码里使用 `tb_dir="save_results/torch_profile"` 且在 LightX2V repo 根目录运行推理,则 `TORCH_PROFILE_TB_DIR` 通常为 `{LightX2V}/save_results/torch_profile` 的**容器内绝对路径**。
-
-脚本会:
-
-1. 在推理同一容器内启动 TensorBoard(`--logdir` 为 `TORCH_PROFILE_TB_DIR`)
-2. 在宿主机启动 TCP 代理,把 `0.0.0.0:16006` 转发到容器内 TB 端口
-
-若 logdir 下没有 `*.pt.trace.json`,脚本会打印 WARNING。
-
-### 3. 查看 Chrome trace
-
-Chrome 格式 trace(`profile_format="chrome"` 时的 `trace.json`)可用以下方式打开:
-
-#### Perfetto UI(推荐)
-
-1. 打开 [https://ui.perfetto.dev/](https://ui.perfetto.dev/)
-2. **Open trace file**,选择 trace 文件
-
-#### Chrome Tracing
-
-1. 将 trace 下载到本机(Remote 环境需先下载)
-2. 浏览器打开 `chrome://tracing`
-3. **Load**,选择 JSON 文件
-
-Docker 内采集时,同样需先把 `trace.json` 从容器拷到本机(或挂载目录可见),再在 Perfetto / Chrome 中打开。
-
----
-
-## 在代码中接入
-
-在**调用处**用 context 包裹,并通过 `.run(func, *args)` 发起 profile;未包裹的代码路径零开销:
-
-```python
-from lightx2v.utils.torch_trace_profiler import TorchTraceProfileContext
-
-with TorchTraceProfileContext(
- "my_forward",
- profile_format="tensorboard",
- tb_dir="save_results/torch_profile",
- with_stack=True,
-) as profile:
- profile.run(my_forward, arg1, arg2)
-```
-
-首次执行该调用点时,会按 schedule **重复调用**目标函数(默认 5 次:wait=1 / warmup=3 / active=1),每轮末尾 `prof.step()`,并在 active 阶段导出 trace。
-
-要点:
-
-- **开关在调用处**:想 profile 哪段逻辑,就在哪行调用外包一层;评测完删除或注释即可
-- **全局唯一**:每个进程只允许 profile 一个调用点;若多处写了 context,仅**首次执行**的那个会采集,其余打 log 并正常执行
-- 采集完成后,后续调用恢复为单次正常执行
-- 需要再次采集:`TorchTraceProfiler.reset_session()`
-- 需要 Python 调用栈:构造时设 `with_stack=True`
-- 子区间分析:在代码里用 `torch.profiler.record_function("my_region")` 包裹目标代码
-
-Qwen Image 参考实现:`lightx2v/models/runners/qwen_image/qwen_image_runner.py` 的 `run()` 中 `infer_main` 调用处(见注释示例)。
-
----
-
-## Schedule 说明
-
-默认 schedule 为 **wait=1 / warmup=3 / active=1**(共 5 步):
-
-```
-step 1 : wait — 不采集
-step 2 ~ 4 : warmup — 采集但不导出(GPU 预热、编译稳定)
-step 5 : active — 采集并导出 trace
-```
-
-总 `prof.step()` 次数固定为 `wait + warmup + active`,由三者自动决定。
-
----
-
-## 常见问题
-
-### TensorBoard 显示 “No dashboards are active”
-
-- 打开 **PYTORCH PROFILER** 页,不是 SCALARS
-- 确认 logdir 下有 `.pt.trace.json`
-- 确认已安装 `torch-tb-profiler`
-
-### `trace.json` 未生成
-
-- `profile_format="chrome"`
-- schedule 已跑完 active 步
-- 查看日志中 `[Profile] step=... chrome=...`
-
-### Remote SSH 下 localhost 无响应
-
-TensorBoard 已在远程(或容器已桥接到宿主机)监听 `--bind_all` 后,在 IDE **Ports** 转发对应端口;与是否在 Docker 内无关。
-
-### Docker 内 TB 打不开 / logdir 为空
-
-- 确认 TB 与推理在**同一容器**,且 `--logdir` 为容器内路径
-- 确认宿主机已 `-p` 映射或存在到容器 IP 的 TCP 代理
-
-### Trace 里点 GPU kernel 只有 C++ 栈、没有 Python 栈
-
-- 采集时需设 `with_stack=True` 并重新 profile
-- GPU kernel 事件本身挂在 CUDA 层;Python 栈在 CPU / `python_function` 侧,可在 TensorBoard Operator 视图或 Perfetto 的 CPU track 中查看
-
-### 共用机器端口冲突
-
-为每位使用者指定不同 `tensorboard_port`(如 `16006`、`26006`)。
-
----
-
-## 相关文件
-
-| 文件 | 说明 |
-|------|------|
-| `lightx2v/utils/torch_trace_profiler.py` | 核心模块 |
-| `lightx2v/models/runners/qwen_image/qwen_image_runner.py` | Qwen Image 调用处注释示例 |
diff --git a/docs/ZH_CN/source/method_tutorials/video_frame_interpolation.md b/docs/ZH_CN/source/method_tutorials/video_frame_interpolation.md
deleted file mode 100644
index 7df2b6b4e..000000000
--- a/docs/ZH_CN/source/method_tutorials/video_frame_interpolation.md
+++ /dev/null
@@ -1,246 +0,0 @@
-# 视频帧插值 (VFI)
-
-> **重要说明**: 视频帧插值功能通过配置文件启用,而不是通过命令行参数。请在配置 JSON 文件中添加 `video_frame_interpolation` 配置块来启用此功能。
-
-## 概述
-
-视频帧插值(VFI)是一种在现有帧之间生成中间帧的技术,用于提高帧率并创建更流畅的视频播放效果。LightX2V 集成了 RIFE(Real-Time Intermediate Flow Estimation)模型,提供高质量的帧插值能力。
-
-## 什么是 RIFE?
-
-RIFE 是一种最先进的视频帧插值方法,使用光流估计来生成中间帧。它能够有效地:
-
-- 提高视频帧率(例如,从 16 FPS 提升到 32 FPS)
-- 创建平滑的运动过渡
-- 保持高视觉质量,最少伪影
-- 实时处理视频
-
-## 安装和设置
-
-### 下载 RIFE 模型
-
-首先,使用提供的脚本下载 RIFE 模型权重:
-
-```bash
-python tools/download_rife.py <目标目录>
-```
-
-例如,下载到指定位置:
-```bash
-python tools/download_rife.py /path/to/rife/train_log
-```
-
-此脚本将:
-- 从 HuggingFace 下载 RIFEv4.26 模型
-- 提取并将模型文件放置在正确的目录中
-- 清理临时文件
-
-## 使用方法
-
-### 配置文件设置
-
-视频帧插值功能通过配置文件启用。在你的配置 JSON 文件中添加 `video_frame_interpolation` 配置块:
-
-```json
-{
- "infer_steps": 50,
- "target_video_length": 81,
- "target_height": 480,
- "target_width": 832,
- "fps": 16,
- "video_frame_interpolation": {
- "algo": "rife",
- "target_fps": 32,
- "model_path": "/path/to/rife/train_log"
- }
-}
-```
-
-### 命令行使用
-
-使用包含 VFI 配置的配置文件运行推理:
-
-```bash
-python lightx2v/infer.py \
- --model_cls wan2.1 \
- --task t2v \
- --model_path /path/to/model \
- --config_json ./configs/video_frame_interpolation/wan_t2v.json \
- --prompt "美丽的海上日落" \
- --save_result_path ./output.mp4
-```
-
-### 配置参数说明
-
-在 `video_frame_interpolation` 配置块中:
-
-- `algo`: 帧插值算法,目前支持 "rife"
-- `target_fps`: 输出视频的目标帧率
-- `model_path`: RIFE 模型路径,通常为 "train_log"
-
-其他相关配置:
-- `fps`: 源视频帧率(默认 16)
-
-### 配置优先级
-
-系统会自动处理视频帧率配置,优先级如下:
-1. `video_frame_interpolation.target_fps` - 如果启用视频帧插值,使用此帧率作为输出帧率
-2. `fps`(默认 16)- 如果未启用视频帧插值,使用此帧率;同时总是用作源帧率
-
-
-## 工作原理
-
-### 帧插值过程
-
-1. **源视频生成**: 基础模型以源 FPS 生成视频帧
-2. **帧分析**: RIFE 分析相邻帧以估计光流
-3. **中间帧生成**: 在现有帧之间生成新帧
-4. **时序平滑**: 插值帧创建平滑的运动过渡
-
-### 技术细节
-
-- **输入格式**: ComfyUI 图像张量 [N, H, W, C],范围 [0, 1]
-- **输出格式**: 插值后的 ComfyUI 图像张量 [M, H, W, C],范围 [0, 1]
-- **处理**: 自动填充和分辨率处理
-- **内存优化**: 高效的 GPU 内存管理
-
-## 示例配置
-
-### 基础帧率翻倍
-
-创建配置文件 `wan_t2v_vfi_32fps.json`:
-
-```json
-{
- "infer_steps": 50,
- "target_video_length": 81,
- "target_height": 480,
- "target_width": 832,
- "seed": 42,
- "sample_guide_scale": 6,
- "enable_cfg": true,
- "fps": 16,
- "video_frame_interpolation": {
- "algo": "rife",
- "target_fps": 32,
- "model_path": "/path/to/rife/train_log"
- }
-}
-```
-
-运行命令:
-```bash
-python lightx2v/infer.py \
- --model_cls wan2.1 \
- --task t2v \
- --model_path ./models/wan2.1 \
- --config_json ./wan_t2v_vfi_32fps.json \
- --prompt "一只小猫在花园里玩耍" \
- --save_result_path ./output_32fps.mp4
-```
-
-### 更高帧率增强
-
-创建配置文件 `wan_i2v_vfi_60fps.json`:
-
-```json
-{
- "infer_steps": 30,
- "target_video_length": 81,
- "target_height": 480,
- "target_width": 832,
- "seed": 42,
- "sample_guide_scale": 6,
- "enable_cfg": true,
- "fps": 16,
- "video_frame_interpolation": {
- "algo": "rife",
- "target_fps": 60,
- "model_path": "/path/to/rife/train_log"
- }
-}
-```
-
-运行命令:
-```bash
-python lightx2v/infer.py \
- --model_cls wan2.1 \
- --task i2v \
- --model_path ./models/wan2.1 \
- --config_json ./wan_i2v_vfi_60fps.json \
- --image_path ./input.jpg \
- --prompt "平滑的相机运动" \
- --save_result_path ./output_60fps.mp4
-```
-
-## 性能考虑
-
-### 内存使用
-
-- RIFE 处理需要额外的 GPU 内存
-- 内存使用量与视频分辨率和长度成正比
-- 对于较长的视频,考虑使用较低的分辨率
-
-### 处理时间
-
-- 帧插值会增加处理开销
-- 更高的目标帧率需要更多计算
-- 处理时间大致与插值帧数成正比
-
-### 质量与速度权衡
-
-- 更高的插值比率可能引入伪影
-- 最佳范围:2x 到 4x 帧率增加
-- 对于极端插值(>4x),考虑多次处理
-
-## 最佳实践
-
-### 最佳使用场景
-
-- **运动密集视频**: 从帧插值中受益最多
-- **相机运动**: 更平滑的平移和缩放
-- **动作序列**: 减少运动模糊感知
-- **慢动作效果**: 创建流畅的慢动作视频
-
-### 推荐设置
-
-- **源 FPS**: 16-24 FPS(基础模型生成)
-- **目标 FPS**: 32-60 FPS(2x 到 4x 增加)
-- **分辨率**: 最高 720p 以获得最佳性能
-
-### 故障排除
-
-#### 常见问题
-
-1. **内存不足**: 减少视频分辨率或目标 FPS
-2. **输出中有伪影**: 降低插值比率
-3. **处理缓慢**: 检查 GPU 内存并考虑使用 CPU 卸载
-
-#### 解决方案
-
-通过修改配置文件来解决问题:
-
-```json
-{
- // 内存问题解决:使用较低分辨率
- "target_height": 480,
- "target_width": 832,
-
- // 质量问题解决:使用适中的插值
- "video_frame_interpolation": {
- "target_fps": 24 // 而不是 60
- },
-
- // 性能问题解决:启用卸载
- "cpu_offload": true
-}
-```
-
-## 技术实现
-
-LightX2V 中的 RIFE 集成包括:
-
-- **RIFEWrapper**: 与 ComfyUI 兼容的 RIFE 模型包装器
-- **自动模型加载**: 与推理管道的无缝集成
-- **内存优化**: 高效的张量管理和 GPU 内存使用
-- **质量保持**: 在添加帧的同时保持原始视频质量
diff --git a/lightx2v/infer.py b/lightx2v/infer.py
index f63e811f6..c6237984d 100755
--- a/lightx2v/infer.py
+++ b/lightx2v/infer.py
@@ -255,7 +255,6 @@ def main():
# validate_task_arguments(args)
seed_all(args.seed)
-
# set config
config = set_config(args)
# init input_info
diff --git a/lightx2v/models/input_encoders/hf/ltx2/gemma/attention.py b/lightx2v/models/input_encoders/hf/ltx2/gemma/attention.py
index ac9083020..1b402fdd6 100755
--- a/lightx2v/models/input_encoders/hf/ltx2/gemma/attention.py
+++ b/lightx2v/models/input_encoders/hf/ltx2/gemma/attention.py
@@ -1,3 +1,4 @@
+import os
from enum import Enum
from typing import Protocol
@@ -5,12 +6,16 @@
from lightx2v.models.input_encoders.hf.ltx2.gemma.rope import LTXRopeType, apply_rotary_emb
+_DISABLE_XFORMERS_PLATFORMS = {"metax_cuda"}
+_USE_XFORMERS = os.getenv("PLATFORM") not in _DISABLE_XFORMERS_PLATFORMS
+
memory_efficient_attention = None
flash_attn_interface = None
-try:
- from xformers.ops import memory_efficient_attention
-except ImportError:
- memory_efficient_attention = None
+if _USE_XFORMERS:
+ try:
+ from xformers.ops import memory_efficient_attention
+ except ImportError:
+ memory_efficient_attention = None
try:
# FlashAttention3 and XFormersAttention cannot be used together
if memory_efficient_attention is None:
diff --git a/lightx2v/models/input_encoders/hf/ltx2/gemma/encoders/encoder_configurator.py b/lightx2v/models/input_encoders/hf/ltx2/gemma/encoders/encoder_configurator.py
index f86972d48..4851cb24d 100755
--- a/lightx2v/models/input_encoders/hf/ltx2/gemma/encoders/encoder_configurator.py
+++ b/lightx2v/models/input_encoders/hf/ltx2/gemma/encoders/encoder_configurator.py
@@ -137,24 +137,41 @@ def _create_feature_extractor(transformer_config: dict) -> torch.nn.Module:
)
-def create_and_populate(module: GemmaTextEncoder) -> GemmaTextEncoder:
- model = module.model
- v_model = model.model.vision_tower.vision_model
- l_model = model.model.language_model
+def _resolve_vision_model(vision_tower: torch.nn.Module) -> torch.nn.Module:
+ return getattr(vision_tower, "vision_model", vision_tower)
+
+
+def _register_or_replace_buffer(module: torch.nn.Module, name: str, value: torch.Tensor) -> None:
+ if name in module._buffers:
+ module._buffers[name] = value
+ else:
+ module.register_buffer(name, value)
+
+
+def _populate_legacy_rotary_buffers(l_model: torch.nn.Module, config: Gemma3Config) -> None:
+ if not hasattr(l_model, "rotary_emb_local"):
+ return
- config = model.config.text_config
dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
- base = config.rope_local_base_freq
+ base = getattr(config, "rope_local_base_freq", 10000)
local_rope_freqs = 1.0 / (base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(dtype=torch.float) / dim))
inv_freqs, _ = ROPE_INIT_FUNCTIONS[config.rope_scaling["rope_type"]](config)
+ _register_or_replace_buffer(l_model.rotary_emb_local, "inv_freq", local_rope_freqs)
+ _register_or_replace_buffer(l_model.rotary_emb, "inv_freq", inv_freqs)
+
+
+def create_and_populate(module: GemmaTextEncoder) -> GemmaTextEncoder:
+ model = module.model
+ v_model = _resolve_vision_model(model.model.vision_tower)
+ l_model = model.model.language_model
+
positions_length = len(v_model.embeddings.position_ids[0])
position_ids = torch.arange(positions_length, dtype=torch.long, device="cpu").unsqueeze(0)
- v_model.embeddings.register_buffer("position_ids", position_ids)
+ _register_or_replace_buffer(v_model.embeddings, "position_ids", position_ids)
embed_scale = torch.tensor(model.config.text_config.hidden_size**0.5, device="cpu")
- l_model.embed_tokens.register_buffer("embed_scale", embed_scale)
- l_model.rotary_emb_local.register_buffer("inv_freq", local_rope_freqs)
- l_model.rotary_emb.register_buffer("inv_freq", inv_freqs)
+ _register_or_replace_buffer(l_model.embed_tokens, "embed_scale", embed_scale)
+ _populate_legacy_rotary_buffers(l_model, model.config.text_config)
return module
diff --git a/lightx2v/models/networks/flux2/infer/transformer_infer.py b/lightx2v/models/networks/flux2/infer/transformer_infer.py
index b4d120990..869bcae06 100644
--- a/lightx2v/models/networks/flux2/infer/transformer_infer.py
+++ b/lightx2v/models/networks/flux2/infer/transformer_infer.py
@@ -13,6 +13,14 @@ def __init__(self, config):
self.infer_conditional = True
self.clean_cuda_cache = self.config.get("clean_cuda_cache", False)
+ self.tp_group = None
+ self.tp_rank = 0
+ self.tp_size = 1
+ if self.config.get("tensor_parallel", False):
+ self.tp_group = self.config.get("device_mesh").get_group(mesh_dim="tensor_p")
+ self.tp_rank = dist.get_rank(self.tp_group)
+ self.tp_size = dist.get_world_size(self.tp_group)
+
self.inner_dim = config.get("num_attention_heads", 24) * config.get("attention_head_dim", 64)
if self.config.get("seq_parallel", False):
@@ -58,7 +66,7 @@ def infer_double_stream_block(
image_rotary_emb,
img_attn_hook=None,
):
- heads = self.config["num_attention_heads"]
+ heads = self.config["num_attention_heads"] // self.tp_size
head_dim = self.config["attention_head_dim"]
(shift_msa, scale_msa, gate_msa), (shift_mlp, scale_mlp, gate_mlp) = self._split_double_modulation(temb_mod_img)
@@ -169,7 +177,7 @@ def infer_single_stream_block(
image_rotary_emb,
num_txt_tokens=0,
):
- heads = self.config["num_attention_heads"]
+ heads = self.config["num_attention_heads"] // self.tp_size
head_dim = self.config["attention_head_dim"]
if encoder_hidden_states is not None:
diff --git a/lightx2v/models/networks/flux2/model.py b/lightx2v/models/networks/flux2/model.py
index d0c389194..4b5b1d479 100644
--- a/lightx2v/models/networks/flux2/model.py
+++ b/lightx2v/models/networks/flux2/model.py
@@ -12,6 +12,7 @@
from lightx2v.models.networks.flux2.weights.pre_weights import Flux2DevPreWeights, Flux2PreWeights
from lightx2v.models.networks.flux2.weights.transformer_weights import Flux2TransformerWeights
from lightx2v.utils.custom_compiler import compiled_method
+from lightx2v_platform.base import global_var
class _Flux2TransformerModelBase(BaseTransformerModel):
@@ -24,10 +25,248 @@ def __init__(self, config, model_path, device):
super().__init__(model_path, config, device)
self.in_channels = self.config.get("transformer_in_channels", self.config.get("in_channels", 64))
self.attention_kwargs = {}
+ self._init_tensor_parallel()
self._init_infer_class()
self._init_weights()
self._init_infer()
+ def _init_tensor_parallel(self):
+ if self.config.get("tensor_parallel", False):
+ self.use_tp = True
+ self.tp_group = self.config.get("device_mesh").get_group(mesh_dim="tensor_p")
+ self.tp_rank = dist.get_rank(self.tp_group)
+ self.tp_size = dist.get_world_size(self.tp_group)
+ else:
+ self.use_tp = False
+ self.tp_group = None
+ self.tp_rank = 0
+ self.tp_size = 1
+
+ def _should_load_weights(self):
+ if self.config.get("device_mesh") is None:
+ return True
+ if dist.is_initialized() and self.use_tp:
+ return dist.get_rank() == 0
+ return super()._should_load_weights()
+
+ def _load_ckpt(self, unified_dtype, sensitive_layer):
+ if not self.use_tp:
+ return super()._load_ckpt(unified_dtype, sensitive_layer)
+ original_device = self.device
+ self.device = torch.device("cpu")
+ try:
+ return super()._load_ckpt(unified_dtype, sensitive_layer)
+ finally:
+ self.device = original_device
+
+ def _load_quant_ckpt(self, unified_dtype, sensitive_layer):
+ if not self.use_tp:
+ return super()._load_quant_ckpt(unified_dtype, sensitive_layer)
+ original_device = self.device
+ self.device = torch.device("cpu")
+ try:
+ return super()._load_quant_ckpt(unified_dtype, sensitive_layer)
+ finally:
+ self.device = original_device
+
+ def _rank_device(self):
+ ai_device = global_var.AI_DEVICE
+ if ai_device is None:
+ return torch.device("cpu")
+ if dist.is_initialized():
+ return torch.device(f"{ai_device}:{dist.get_rank()}")
+ return torch.device(ai_device)
+
+ def _sync_device(self):
+ ai_device = global_var.AI_DEVICE
+ device_module = getattr(torch, ai_device, None) if ai_device else None
+ if device_module is not None and hasattr(device_module, "synchronize"):
+ device_module.synchronize()
+
+ def _load_weights_from_rank0(self, weight_dict, is_weight_loader):
+ if not self.use_tp:
+ return super()._load_weights_from_rank0(weight_dict, is_weight_loader)
+ if self.cpu_offload:
+ raise NotImplementedError("Flux2 tensor parallel weight loading does not support cpu_offload yet.")
+
+ global_src_rank = 0
+ target_device = self._rank_device()
+
+ if is_weight_loader:
+ processed_weight_dict = {}
+ meta_dict = {}
+ processed_bias_keys = set()
+ for key, tensor in weight_dict.items():
+ split_type = self._get_split_type(key)
+ if key.endswith(".weight") and split_type is not None:
+ split_weights = self._split_weight_for_tp(key, tensor, self.tp_size)
+ for rank_idx, split_weight in enumerate(split_weights):
+ rank_key = f"{key}__tp_rank_{rank_idx}"
+ processed_weight_dict[rank_key] = split_weight.contiguous()
+ meta_dict[key] = {"shape": split_weights[0].shape, "dtype": split_weights[0].dtype, "is_tp": True}
+
+ bias_key = key.replace(".weight", ".bias")
+ if bias_key in weight_dict and split_type in ("col", "ff_fused_col", "single_fused_col"):
+ bias_splits = self._split_bias_for_tp(bias_key, weight_dict[bias_key], split_type, self.tp_size)
+ for rank_idx, split_bias in enumerate(bias_splits):
+ processed_weight_dict[f"{bias_key}__tp_rank_{rank_idx}"] = split_bias.contiguous()
+ meta_dict[bias_key] = {"shape": bias_splits[0].shape, "dtype": bias_splits[0].dtype, "is_tp": True}
+ processed_bias_keys.add(bias_key)
+ elif key not in processed_bias_keys:
+ processed_weight_dict[key] = tensor
+ meta_dict[key] = {"shape": tensor.shape, "dtype": tensor.dtype, "is_tp": False}
+
+ obj_list = [meta_dict]
+ dist.broadcast_object_list(obj_list, src=global_src_rank)
+ synced_meta_dict = obj_list[0]
+ weight_dict = processed_weight_dict
+ else:
+ obj_list = [None]
+ dist.broadcast_object_list(obj_list, src=global_src_rank)
+ synced_meta_dict = obj_list[0]
+
+ distributed_weight_dict = {key: torch.empty(meta["shape"], dtype=meta["dtype"], device=target_device) for key, meta in synced_meta_dict.items()}
+ dist.barrier()
+
+ for key in sorted(synced_meta_dict.keys()):
+ meta = synced_meta_dict[key]
+ if meta.get("is_tp", False):
+ for rank_idx in range(self.tp_size):
+ if is_weight_loader:
+ src_tensor = weight_dict[f"{key}__tp_rank_{rank_idx}"].to(target_device, non_blocking=True)
+ else:
+ src_tensor = torch.empty(meta["shape"], dtype=meta["dtype"], device=target_device)
+ dist.broadcast(src_tensor, src=global_src_rank)
+ if rank_idx == self.tp_rank:
+ distributed_weight_dict[key].copy_(src_tensor, non_blocking=True)
+ del src_tensor
+ else:
+ if is_weight_loader:
+ distributed_weight_dict[key].copy_(weight_dict[key].to(target_device, non_blocking=True), non_blocking=True)
+ dist.broadcast(distributed_weight_dict[key], src=global_src_rank)
+
+ self._sync_device()
+ return distributed_weight_dict
+
+ def _get_split_type(self, key):
+ if ".norm_" in key:
+ return None
+ if key.endswith(".weight") and "single_transformer_blocks." in key and ".attn.to_qkv_mlp_proj." in key:
+ return "single_fused_col"
+ if key.endswith(".weight") and "single_transformer_blocks." in key and ".attn.to_out." in key:
+ return "single_fused_row"
+ if key.endswith(".weight") and (".ff.linear_in." in key or ".ff_context.linear_in." in key):
+ return "ff_fused_col"
+ col_patterns = (
+ ".attn.to_q.",
+ ".attn.to_k.",
+ ".attn.to_v.",
+ ".attn.add_q_proj.",
+ ".attn.add_k_proj.",
+ ".attn.add_v_proj.",
+ )
+ row_patterns = (
+ ".attn.to_out.0.",
+ ".attn.to_add_out.",
+ ".ff.linear_out.",
+ ".ff_context.linear_out.",
+ )
+ if any(pattern in key for pattern in col_patterns):
+ return "col"
+ if any(pattern in key for pattern in row_patterns):
+ return "row"
+ return None
+
+ def _split_bias_for_tp(self, key, bias, split_type, tp_size):
+ if split_type == "col":
+ assert bias.shape[0] % tp_size == 0, f"bias dimension ({bias.shape[0]}) must be divisible by tp_size ({tp_size}) for {key}"
+ return list(torch.chunk(bias, tp_size, dim=0))
+
+ if split_type == "ff_fused_col":
+ assert bias.shape[0] % 2 == 0, f"invalid fused SwiGLU bias dim for {key}: {bias.shape[0]}"
+ ffn_dim = bias.shape[0] // 2
+ assert ffn_dim % tp_size == 0, f"ffn_dim ({ffn_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ gate, up = torch.split(bias, [ffn_dim, ffn_dim], dim=0)
+ gate_chunks = torch.chunk(gate, tp_size, dim=0)
+ up_chunks = torch.chunk(up, tp_size, dim=0)
+ return [torch.cat([gate_chunks[rank_idx], up_chunks[rank_idx]], dim=0) for rank_idx in range(tp_size)]
+
+ if split_type == "single_fused_col":
+ inner_dim = self.config["num_attention_heads"] * self.config["attention_head_dim"]
+ ffn_dim_twice = bias.shape[0] - 3 * inner_dim
+ assert ffn_dim_twice > 0 and ffn_dim_twice % 2 == 0, f"invalid fused qkv/mlp bias dim for {key}: {bias.shape[0]}"
+ ffn_dim = ffn_dim_twice // 2
+ assert inner_dim % tp_size == 0, f"inner_dim ({inner_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ assert ffn_dim % tp_size == 0, f"ffn_dim ({ffn_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ q, k, v, mlp_1, mlp_2 = torch.split(bias, [inner_dim, inner_dim, inner_dim, ffn_dim, ffn_dim], dim=0)
+ chunks = [torch.chunk(part, tp_size, dim=0) for part in (q, k, v, mlp_1, mlp_2)]
+ return [torch.cat([part_chunks[rank_idx] for part_chunks in chunks], dim=0) for rank_idx in range(tp_size)]
+
+ raise ValueError(f"Unsupported Flux2 TP bias split type {split_type} for {key}")
+
+ def _split_weight_for_tp(self, key, weight, tp_size):
+ split_type = self._get_split_type(key)
+ if split_type is None:
+ return [weight] * tp_size
+
+ if split_type == "col":
+ assert weight.shape[0] % tp_size == 0, f"out_dim ({weight.shape[0]}) must be divisible by tp_size ({tp_size}) for {key}"
+ return list(torch.chunk(weight, tp_size, dim=0))
+
+ if split_type == "row":
+ assert weight.shape[1] % tp_size == 0, f"in_dim ({weight.shape[1]}) must be divisible by tp_size ({tp_size}) for {key}"
+ return list(torch.chunk(weight, tp_size, dim=1))
+
+ if split_type == "ff_fused_col":
+ assert weight.shape[0] % 2 == 0, f"invalid fused SwiGLU out_dim for {key}: {weight.shape[0]}"
+ ffn_dim = weight.shape[0] // 2
+ assert ffn_dim % tp_size == 0, f"ffn_dim ({ffn_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ gate, up = torch.split(weight, [ffn_dim, ffn_dim], dim=0)
+ gate_chunks = torch.chunk(gate, tp_size, dim=0)
+ up_chunks = torch.chunk(up, tp_size, dim=0)
+ return [torch.cat([gate_chunks[rank_idx], up_chunks[rank_idx]], dim=0) for rank_idx in range(tp_size)]
+
+ inner_dim = self.config["num_attention_heads"] * self.config["attention_head_dim"]
+ if split_type == "single_fused_col":
+ ffn_dim_twice = weight.shape[0] - 3 * inner_dim
+ assert ffn_dim_twice > 0 and ffn_dim_twice % 2 == 0, f"invalid fused qkv/mlp out_dim for {key}: {weight.shape[0]}"
+ ffn_dim = ffn_dim_twice // 2
+ assert inner_dim % tp_size == 0, f"inner_dim ({inner_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ assert ffn_dim % tp_size == 0, f"ffn_dim ({ffn_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ q, k, v, mlp_1, mlp_2 = torch.split(weight, [inner_dim, inner_dim, inner_dim, ffn_dim, ffn_dim], dim=0)
+ return [
+ torch.cat(
+ [
+ torch.chunk(q, tp_size, dim=0)[rank_idx],
+ torch.chunk(k, tp_size, dim=0)[rank_idx],
+ torch.chunk(v, tp_size, dim=0)[rank_idx],
+ torch.chunk(mlp_1, tp_size, dim=0)[rank_idx],
+ torch.chunk(mlp_2, tp_size, dim=0)[rank_idx],
+ ],
+ dim=0,
+ )
+ for rank_idx in range(tp_size)
+ ]
+
+ if split_type == "single_fused_row":
+ ffn_dim = weight.shape[1] - inner_dim
+ assert ffn_dim > 0, f"invalid fused output in_dim for {key}: {weight.shape[1]}"
+ assert inner_dim % tp_size == 0, f"inner_dim ({inner_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ assert ffn_dim % tp_size == 0, f"ffn_dim ({ffn_dim}) must be divisible by tp_size ({tp_size}) for {key}"
+ attn, mlp = torch.split(weight, [inner_dim, ffn_dim], dim=1)
+ return [
+ torch.cat(
+ [
+ torch.chunk(attn, tp_size, dim=1)[rank_idx],
+ torch.chunk(mlp, tp_size, dim=1)[rank_idx],
+ ],
+ dim=1,
+ )
+ for rank_idx in range(tp_size)
+ ]
+
+ raise ValueError(f"Unsupported Flux2 TP split type {split_type} for {key}")
+
def _init_infer(self):
self.transformer_infer = self.transformer_infer_class(self.config)
self.pre_infer = self.pre_infer_class(self.config)
diff --git a/lightx2v/models/networks/flux2/weights/transformer_weights.py b/lightx2v/models/networks/flux2/weights/transformer_weights.py
index da3ed9141..fccca0c72 100644
--- a/lightx2v/models/networks/flux2/weights/transformer_weights.py
+++ b/lightx2v/models/networks/flux2/weights/transformer_weights.py
@@ -1,7 +1,49 @@
+import torch.distributed as dist
+
from lightx2v.common.modules.weight_module import WeightModule, WeightModuleList
from lightx2v.utils.registry_factory import ATTN_WEIGHT_REGISTER, MM_WEIGHT_REGISTER, RMS_WEIGHT_REGISTER
+def _tp_info(config):
+ if not config.get("tensor_parallel", False):
+ return None, 0, 1
+ tp_group = config.get("device_mesh").get_group(mesh_dim="tensor_p")
+ return tp_group, dist.get_rank(tp_group), dist.get_world_size(tp_group)
+
+
+def _mm_weight(config, weight_name, bias_name=None, split_dim=None, create_cuda_buffer=False, create_cpu_buffer=False):
+ mm_type = config.get("dit_quant_scheme", "Default")
+ if config.get("tensor_parallel", False) and split_dim is not None:
+ tp_group, tp_rank, tp_size = _tp_info(config)
+ return MM_WEIGHT_REGISTER["TensorParallel"](
+ weight_name=weight_name,
+ bias_name=bias_name,
+ mm_type=mm_type,
+ tp_group=tp_group,
+ tp_rank=tp_rank,
+ tp_size=tp_size,
+ split_dim=split_dim,
+ create_cuda_buffer=create_cuda_buffer,
+ create_cpu_buffer=create_cpu_buffer,
+ )
+ return MM_WEIGHT_REGISTER[mm_type](
+ weight_name,
+ bias_name,
+ create_cuda_buffer,
+ create_cpu_buffer,
+ )
+
+
+def _rms_weight(config, weight_name, create_cuda_buffer=False, create_cpu_buffer=False):
+ # Flux2 q/k RMSNorm weights are head_dim-sized, so TP over heads must replicate them.
+ rms_norm_type = config.get("rms_norm_type", "torch")
+ return RMS_WEIGHT_REGISTER[rms_norm_type](
+ weight_name,
+ create_cuda_buffer,
+ create_cpu_buffer,
+ )
+
+
class Flux2DoubleBlockWeights(WeightModule):
"""Weights for a single double-stream transformer block."""
@@ -16,112 +58,20 @@ def __init__(self, config, block_idx, create_cuda_buffer=False, create_cpu_buffe
p = f"transformer_blocks.{self.block_idx}"
- self.add_module(
- "to_q",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.to_q.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "to_k",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.to_k.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "to_v",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.to_v.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "norm_q",
- RMS_WEIGHT_REGISTER[self.rms_norm_type](
- f"{p}.attn.norm_q.weight",
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "norm_k",
- RMS_WEIGHT_REGISTER[self.rms_norm_type](
- f"{p}.attn.norm_k.weight",
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
+ self.add_module("to_q", _mm_weight(config, f"{p}.attn.to_q.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("to_k", _mm_weight(config, f"{p}.attn.to_k.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("to_v", _mm_weight(config, f"{p}.attn.to_v.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("norm_q", _rms_weight(config, f"{p}.attn.norm_q.weight", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("norm_k", _rms_weight(config, f"{p}.attn.norm_k.weight", create_cuda_buffer, create_cpu_buffer))
- self.add_module(
- "add_q_proj",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.add_q_proj.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "add_k_proj",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.add_k_proj.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "add_v_proj",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.add_v_proj.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "norm_added_q",
- RMS_WEIGHT_REGISTER[self.rms_norm_type](
- f"{p}.attn.norm_added_q.weight",
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "norm_added_k",
- RMS_WEIGHT_REGISTER[self.rms_norm_type](
- f"{p}.attn.norm_added_k.weight",
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
+ self.add_module("add_q_proj", _mm_weight(config, f"{p}.attn.add_q_proj.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("add_k_proj", _mm_weight(config, f"{p}.attn.add_k_proj.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("add_v_proj", _mm_weight(config, f"{p}.attn.add_v_proj.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("norm_added_q", _rms_weight(config, f"{p}.attn.norm_added_q.weight", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("norm_added_k", _rms_weight(config, f"{p}.attn.norm_added_k.weight", create_cuda_buffer, create_cpu_buffer))
- self.add_module(
- "to_out",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.to_out.0.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "to_add_out",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.to_add_out.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
+ self.add_module("to_out", _mm_weight(config, f"{p}.attn.to_out.0.weight", None, "row", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("to_add_out", _mm_weight(config, f"{p}.attn.to_add_out.weight", None, "row", create_cuda_buffer, create_cpu_buffer))
self.add_module("calculate", ATTN_WEIGHT_REGISTER[self.attn_type]())
@@ -131,43 +81,10 @@ def __init__(self, config, block_idx, create_cuda_buffer=False, create_cpu_buffe
ATTN_WEIGHT_REGISTER[self.config["parallel"].get("seq_p_attn_type", "ulysses")](),
)
- self.add_module(
- "ff_net_0",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.ff.linear_in.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "ff_net_2",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.ff.linear_out.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
-
- self.add_module(
- "ff_context_net_0",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.ff_context.linear_in.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "ff_context_net_2",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.ff_context.linear_out.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
+ self.add_module("ff_net_0", _mm_weight(config, f"{p}.ff.linear_in.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("ff_net_2", _mm_weight(config, f"{p}.ff.linear_out.weight", None, "row", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("ff_context_net_0", _mm_weight(config, f"{p}.ff_context.linear_in.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("ff_context_net_2", _mm_weight(config, f"{p}.ff_context.linear_out.weight", None, "row", create_cuda_buffer, create_cpu_buffer))
def to_cuda(self, non_blocking=True):
for module in self._modules.values():
@@ -194,42 +111,10 @@ def __init__(self, config, block_idx, create_cuda_buffer=False, create_cpu_buffe
p = f"single_transformer_blocks.{self.block_idx}"
- self.add_module(
- "to_qkv_mlp_proj",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.to_qkv_mlp_proj.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
-
- self.add_module(
- "norm_q",
- RMS_WEIGHT_REGISTER[self.rms_norm_type](
- f"{p}.attn.norm_q.weight",
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
- self.add_module(
- "norm_k",
- RMS_WEIGHT_REGISTER[self.rms_norm_type](
- f"{p}.attn.norm_k.weight",
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
-
- self.add_module(
- "to_out",
- MM_WEIGHT_REGISTER[self.mm_type](
- f"{p}.attn.to_out.weight",
- None,
- create_cuda_buffer,
- create_cpu_buffer,
- ),
- )
+ self.add_module("to_qkv_mlp_proj", _mm_weight(config, f"{p}.attn.to_qkv_mlp_proj.weight", None, "col", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("norm_q", _rms_weight(config, f"{p}.attn.norm_q.weight", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("norm_k", _rms_weight(config, f"{p}.attn.norm_k.weight", create_cuda_buffer, create_cpu_buffer))
+ self.add_module("to_out", _mm_weight(config, f"{p}.attn.to_out.weight", None, "row", create_cuda_buffer, create_cpu_buffer))
self.add_module("calculate", ATTN_WEIGHT_REGISTER[self.attn_type]())
@@ -260,8 +145,6 @@ def __init__(self, config):
self.num_single_layers = config.get("num_single_layers", 20)
self.mm_type = config.get("dit_quant_scheme", "Default")
- inner_dim = config.get("num_attention_heads", 24) * config.get("attention_head_dim", 64)
-
self.double_blocks = WeightModuleList([Flux2DoubleBlockWeights(config, i) for i in range(self.num_layers)])
self.single_blocks = WeightModuleList([Flux2SingleBlockWeights(config, i) for i in range(self.num_single_layers)])
self.register_offload_buffers(config)
@@ -269,24 +152,9 @@ def __init__(self, config):
self.add_module("double_blocks", self.double_blocks)
self.add_module("single_blocks", self.single_blocks)
- self.add_module(
- "double_stream_modulation_img_linear",
- MM_WEIGHT_REGISTER[self.mm_type](
- "double_stream_modulation_img.linear.weight",
- ),
- )
- self.add_module(
- "double_stream_modulation_txt_linear",
- MM_WEIGHT_REGISTER[self.mm_type](
- "double_stream_modulation_txt.linear.weight",
- ),
- )
- self.add_module(
- "single_stream_modulation_linear",
- MM_WEIGHT_REGISTER[self.mm_type](
- "single_stream_modulation.linear.weight",
- ),
- )
+ self.add_module("double_stream_modulation_img_linear", _mm_weight(config, "double_stream_modulation_img.linear.weight"))
+ self.add_module("double_stream_modulation_txt_linear", _mm_weight(config, "double_stream_modulation_txt.linear.weight"))
+ self.add_module("single_stream_modulation_linear", _mm_weight(config, "single_stream_modulation.linear.weight"))
def register_offload_buffers(self, config):
if config.get("cpu_offload", False) and config.get("offload_granularity", "block") == "block":
diff --git a/lightx2v/models/networks/hunyuan_video/infer/pre_infer.py b/lightx2v/models/networks/hunyuan_video/infer/pre_infer.py
index 2671f2b44..6a233bc72 100755
--- a/lightx2v/models/networks/hunyuan_video/infer/pre_infer.py
+++ b/lightx2v/models/networks/hunyuan_video/infer/pre_infer.py
@@ -7,9 +7,10 @@
from torch.nn import functional as F
from lightx2v.utils.envs import *
+from lightx2v.utils.registry_factory import ATTN_WEIGHT_REGISTER
from lightx2v_platform.base.global_var import AI_DEVICE, PLATFORM
-from .attn_no_pad import flash_attn_no_pad, flash_attn_no_pad_v3, sage_attn_no_pad_v2
+from .attn_no_pad import flash_attn_no_pad, flash_attn_no_pad_v3, flash_attn_varlen_qkvpacked_func, pad_input, sage_attn_no_pad_v2, unpad_input
from .module_io import HunyuanVideo15InferModuleOutput
from .posemb_layers import get_nd_rotary_pos_embed
@@ -21,6 +22,16 @@
TIMESTEP_EMBEDDING_CUDA_AVAILABLE = False
+_TOKEN_REFINER_ATTN_TYPE_BY_PLATFORM = {
+ "ascend_npu": "npu_flash_attn",
+ "metax_cuda": "torch",
+}
+
+
+def _get_token_refiner_attn_type():
+ return _TOKEN_REFINER_ATTN_TYPE_BY_PLATFORM.get(PLATFORM, "flash_attn2")
+
+
def apply_gate(x, gate=None, tanh=False):
"""AI is creating summary for apply_gate
@@ -40,6 +51,46 @@ def apply_gate(x, gate=None, tanh=False):
return x * gate.unsqueeze(1)
+def _torch_attention(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, attn_mask: Optional[torch.Tensor] = None, causal: bool = False) -> torch.Tensor:
+ q = q.transpose(1, 2)
+ k = k.transpose(1, 2)
+ v = v.transpose(1, 2)
+ if attn_mask is not None:
+ attn_mask = attn_mask[:, None, None, :].expand(-1, 1, q.shape[-2], -1)
+ out = F.scaled_dot_product_attention(q, k, v, attn_mask=attn_mask, is_causal=causal)
+ return out.transpose(1, 2)
+
+
+def _npu_attention(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, attn_mask: Optional[torch.Tensor] = None) -> torch.Tensor:
+ batch, seqlen, heads, dim = q.shape
+ if attn_mask is None:
+ lengths = torch.full((batch,), seqlen, dtype=torch.int32, device=q.device)
+ indices = torch.arange(batch * seqlen, device=q.device)
+ else:
+ attn_mask = attn_mask.bool()
+ lengths = attn_mask.sum(dim=1, dtype=torch.int32)
+ indices = attn_mask.reshape(-1).nonzero(as_tuple=False).squeeze(1)
+
+ cu_seqlens = torch.zeros(batch + 1, dtype=torch.int32, device=q.device)
+ cu_seqlens[1:] = torch.cumsum(lengths, dim=0)
+ q_unpad = q.reshape(batch * seqlen, heads, dim)[indices]
+ k_unpad = k.reshape(batch * seqlen, heads, dim)[indices]
+ v_unpad = v.reshape(batch * seqlen, heads, dim)[indices]
+
+ out_unpad = ATTN_WEIGHT_REGISTER["npu_flash_attn"]().apply(
+ q=q_unpad,
+ k=k_unpad,
+ v=v_unpad,
+ cu_seqlens_q=cu_seqlens,
+ cu_seqlens_kv=cu_seqlens,
+ max_seqlen_q=int(lengths.max().item()),
+ max_seqlen_kv=int(lengths.max().item()),
+ )
+ out = torch.zeros(batch * seqlen, heads * dim, dtype=out_unpad.dtype, device=out_unpad.device)
+ out[indices] = out_unpad
+ return out.reshape(batch, seqlen, heads, dim)
+
+
@torch.compiler.disable
def attention(
q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, drop_rate: float = 0.0, attn_mask: Optional[torch.Tensor] = None, causal: bool = False, attn_type: str = "flash_attn2"
@@ -62,11 +113,18 @@ def attention(
if attn_mask is not None and attn_mask.dtype != torch.bool:
attn_mask = attn_mask.bool()
if attn_type == "flash_attn2":
- x = flash_attn_no_pad(qkv, attn_mask, causal=causal, dropout_p=drop_rate, softmax_scale=None)
+ if flash_attn_varlen_qkvpacked_func is None or pad_input is None or unpad_input is None:
+ x = _torch_attention(q, k, v, attn_mask=attn_mask, causal=causal)
+ else:
+ x = flash_attn_no_pad(qkv, attn_mask, causal=causal, dropout_p=drop_rate, softmax_scale=None)
elif attn_type == "flash_attn3":
x = flash_attn_no_pad_v3(qkv, attn_mask, causal=causal, dropout_p=drop_rate, softmax_scale=None)
elif attn_type == "sage_attn2":
x = sage_attn_no_pad_v2(qkv, attn_mask, causal=causal, dropout_p=drop_rate, softmax_scale=None)
+ elif attn_type == "npu_flash_attn":
+ x = _npu_attention(q, k, v, attn_mask=attn_mask)
+ elif attn_type == "torch":
+ x = _torch_attention(q, k, v, attn_mask=attn_mask, causal=causal)
b, s, a, d = x.shape
out = x.reshape(b, s, -1)
return out
@@ -218,7 +276,7 @@ def run_individual_token_refiner(self, weights, out, mask, c):
norm_x = block.norm1.apply(out.unsqueeze(0)).squeeze(0)
qkv = block.self_attn_qkv.apply(norm_x).unsqueeze(0)
q, k, v = rearrange(qkv, "B L (K H D) -> K B L H D", K=3, H=self.heads_num)
- attn = attention(q, k, v, attn_mask=mask, attn_type="flash_attn2").squeeze(0)
+ attn = attention(q, k, v, attn_mask=mask, attn_type=_get_token_refiner_attn_type()).squeeze(0)
out = out + apply_gate(block.self_attn_proj.apply(attn).unsqueeze(0), gate_msa).squeeze(0)
tmp = block.mlp_fc1.apply(block.norm2.apply(out))
tmp = torch.nn.functional.silu(tmp)
diff --git a/lightx2v/models/networks/longcat_image/infer/transformer_infer.py b/lightx2v/models/networks/longcat_image/infer/transformer_infer.py
index 7c8229db6..b8e70d36d 100755
--- a/lightx2v/models/networks/longcat_image/infer/transformer_infer.py
+++ b/lightx2v/models/networks/longcat_image/infer/transformer_infer.py
@@ -21,10 +21,12 @@ def __init__(self, config):
if self.config.get("seq_parallel", False):
self.seq_p_group = self.config.get("device_mesh").get_group(mesh_dim="seq_p")
self.seq_p_fp8_comm = self.config["parallel"].get("seq_p_fp8_comm", False)
+ self.seq_p_fp4_comm = self.config["parallel"].get("seq_p_fp4_comm", False)
self.enable_head_parallel = self.config["parallel"].get("seq_p_head_parallel", False)
else:
self.seq_p_group = None
self.seq_p_fp8_comm = False
+ self.seq_p_fp4_comm = False
self.enable_head_parallel = False
# RoPE function selection
@@ -141,16 +143,33 @@ def infer_double_stream_block(
cu_seqlens = torch.tensor([0, total_len], dtype=torch.int32)
# Use registered attention module
- attn_output = block_weights.calculate.apply(
- q=query,
- k=key,
- v=value,
- cu_seqlens_q=cu_seqlens,
- cu_seqlens_kv=cu_seqlens,
- max_seqlen_q=total_len,
- max_seqlen_kv=total_len,
- model_cls="longcat_image",
- )
+ if self.config["seq_parallel"]:
+ txt_len = encoder_hidden_states.shape[0]
+ attn_output = block_weights.calculate_parallel.apply(
+ q=query,
+ k=key,
+ v=value,
+ slice_qkv_len=txt_len,
+ cu_seqlens_qkv=cu_seqlens,
+ attention_module=block_weights.calculate,
+ seq_p_group=self.seq_p_group,
+ use_fp8_comm=self.seq_p_fp8_comm,
+ use_fp4_comm=self.seq_p_fp4_comm,
+ enable_head_parallel=self.enable_head_parallel,
+ img_first=False,
+ model_cls="longcat_image",
+ )
+ else:
+ attn_output = block_weights.calculate.apply(
+ q=query,
+ k=key,
+ v=value,
+ cu_seqlens_q=cu_seqlens,
+ cu_seqlens_kv=cu_seqlens,
+ max_seqlen_q=total_len,
+ max_seqlen_kv=total_len,
+ model_cls="longcat_image",
+ )
# Split back to text and image
txt_len = encoder_hidden_states.shape[0]
@@ -251,16 +270,32 @@ def infer_single_stream_block(
cu_seqlens = torch.tensor([0, total_len], dtype=torch.int32)
# Use registered attention module
- attn_output = block_weights.calculate.apply(
- q=query,
- k=key,
- v=value,
- cu_seqlens_q=cu_seqlens,
- cu_seqlens_kv=cu_seqlens,
- max_seqlen_q=total_len,
- max_seqlen_kv=total_len,
- model_cls="longcat_image",
- )
+ if self.config["seq_parallel"]:
+ attn_output = block_weights.calculate_parallel.apply(
+ q=query,
+ k=key,
+ v=value,
+ slice_qkv_len=txt_len,
+ cu_seqlens_qkv=cu_seqlens,
+ attention_module=block_weights.calculate,
+ seq_p_group=self.seq_p_group,
+ use_fp8_comm=self.seq_p_fp8_comm,
+ use_fp4_comm=self.seq_p_fp4_comm,
+ enable_head_parallel=self.enable_head_parallel,
+ img_first=False,
+ model_cls="longcat_image",
+ )
+ else:
+ attn_output = block_weights.calculate.apply(
+ q=query,
+ k=key,
+ v=value,
+ cu_seqlens_q=cu_seqlens,
+ cu_seqlens_kv=cu_seqlens,
+ max_seqlen_q=total_len,
+ max_seqlen_kv=total_len,
+ model_cls="longcat_image",
+ )
# Concatenate attention output and MLP output, then project
combined_output = torch.cat([attn_output, mlp_hidden_states], dim=-1)
diff --git a/lightx2v/models/networks/longcat_image/model.py b/lightx2v/models/networks/longcat_image/model.py
index ce1f97686..356484a90 100755
--- a/lightx2v/models/networks/longcat_image/model.py
+++ b/lightx2v/models/networks/longcat_image/model.py
@@ -1,5 +1,6 @@
import torch
import torch.distributed as dist
+import torch.nn.functional as F
from lightx2v.models.networks.base_model import BaseTransformerModel
from lightx2v.models.networks.longcat_image.infer.offload.transformer_infer import LongCatImageOffloadTransformerInfer
@@ -29,8 +30,6 @@ def __init__(self, model_path, config, device):
# Use transformer_in_channels to avoid conflict with VAE's in_channels
self.in_channels = self.config.get("transformer_in_channels", self.config.get("in_channels", 64))
self.attention_kwargs = {}
- if self.config["seq_parallel"]:
- raise NotImplementedError("Sequence parallel is not implemented for LongCatImageTransformerModel")
self._init_infer_class()
self._init_weights()
self._init_infer()
@@ -65,6 +64,9 @@ def _infer_cond_uncond(self, latents_input, prompt_embeds, infer_condition=True)
encoder_hidden_states=prompt_embeds,
)
+ if self.config["seq_parallel"]:
+ pre_infer_out = self._seq_parallel_pre_process(pre_infer_out)
+
hidden_states = self.transformer_infer.infer(
block_weights=self.transformer_weights,
pre_infer_out=pre_infer_out,
@@ -72,15 +74,37 @@ def _infer_cond_uncond(self, latents_input, prompt_embeds, infer_condition=True)
noise_pred = self.post_infer.infer(self.post_weight, hidden_states, pre_infer_out.temb)
+ if self.config["seq_parallel"]:
+ noise_pred = self._seq_parallel_post_process(noise_pred)
+
return noise_pred
@torch.no_grad()
def _seq_parallel_pre_process(self, pre_infer_out):
- raise NotImplementedError("Sequence parallel pre-process is not implemented for LongCatImageTransformerModel")
+ if pre_infer_out.input_image_latents is not None:
+ raise NotImplementedError("Sequence parallel is not implemented for LongCat I2I input image latents.")
+
+ world_size = dist.get_world_size(self.seq_p_group)
+ cur_rank = dist.get_rank(self.seq_p_group)
+ seqlen = pre_infer_out.hidden_states.shape[0]
+ self._seq_parallel_output_seq_len = seqlen
+
+ padding_size = (world_size - (seqlen % world_size)) % world_size
+ if padding_size > 0:
+ pre_infer_out.hidden_states = F.pad(pre_infer_out.hidden_states, (0, 0, 0, padding_size))
+ pre_infer_out.hidden_states = torch.chunk(pre_infer_out.hidden_states, world_size, dim=0)[cur_rank]
+ return pre_infer_out
@torch.no_grad()
- def _seq_parallel_post_process(self, x):
- raise NotImplementedError("Sequence parallel post-process is not implemented for LongCatImageTransformerModel")
+ def _seq_parallel_post_process(self, noise_pred):
+ world_size = dist.get_world_size(self.seq_p_group)
+ gathered_noise_pred = [torch.empty_like(noise_pred) for _ in range(world_size)]
+ dist.all_gather(gathered_noise_pred, noise_pred, group=self.seq_p_group)
+ noise_pred = torch.cat(gathered_noise_pred, dim=1)
+ output_seq_len = getattr(self, "_seq_parallel_output_seq_len", None)
+ if output_seq_len is not None:
+ noise_pred = noise_pred[:, :output_seq_len]
+ return noise_pred
@compiled_method()
@torch.no_grad()
diff --git a/lightx2v/models/networks/longcat_image/weights/transformer_weights.py b/lightx2v/models/networks/longcat_image/weights/transformer_weights.py
index 7d9596158..7c081d964 100755
--- a/lightx2v/models/networks/longcat_image/weights/transformer_weights.py
+++ b/lightx2v/models/networks/longcat_image/weights/transformer_weights.py
@@ -150,6 +150,11 @@ def __init__(self, config, block_idx, create_cuda_buffer=False, create_cpu_buffe
# Attention calculation module
self.add_module("calculate", ATTN_WEIGHT_REGISTER[self.attn_type]())
+ if self.config["seq_parallel"]:
+ self.add_module(
+ "calculate_parallel",
+ ATTN_WEIGHT_REGISTER[self.config["parallel"].get("seq_p_attn_type", "ulysses")](),
+ )
# Image FFN
self.add_module(
@@ -296,6 +301,11 @@ def __init__(self, config, block_idx, create_cuda_buffer=False, create_cpu_buffe
# Attention calculation module
self.add_module("calculate", ATTN_WEIGHT_REGISTER[self.attn_type]())
+ if self.config["seq_parallel"]:
+ self.add_module(
+ "calculate_parallel",
+ ATTN_WEIGHT_REGISTER[self.config["parallel"].get("seq_p_attn_type", "ulysses")](),
+ )
def to_cuda(self, non_blocking=True):
for module in self._modules.values():
diff --git a/lightx2v/models/networks/ltx2/model.py b/lightx2v/models/networks/ltx2/model.py
index 935fc0890..2eae9876a 100755
--- a/lightx2v/models/networks/ltx2/model.py
+++ b/lightx2v/models/networks/ltx2/model.py
@@ -23,6 +23,7 @@
from lightx2v.utils.custom_compiler import compiled_method
from lightx2v.utils.envs import *
from lightx2v.utils.utils import *
+from lightx2v_platform.base import global_var
def _multimodal_guider_calculate(
@@ -140,14 +141,15 @@ def _load_weights_from_rank0(self, weight_dict, is_weight_loader):
"""
Load and distribute weights from rank 0 to all ranks.
- Only supports tensor parallel mode with CUDA device.
+ Supports tensor parallel mode on the active LightX2V platform device.
CPU offload is not supported.
"""
# CPU offload is not supported
if self.cpu_offload:
raise NotImplementedError("_load_weights_from_rank0 does not support CPU offload. Please set cpu_offload=False.")
- logger.info("Loading distributed weights with tensor parallel (CUDA only)")
+ device = self._get_parallel_weight_device()
+ logger.info(f"Loading distributed weights with tensor parallel on {device}")
global_src_rank = 0
if is_weight_loader:
@@ -198,11 +200,10 @@ def _load_weights_from_rank0(self, weight_dict, is_weight_loader):
dist.broadcast_object_list(obj_list, src=global_src_rank)
synced_meta_dict = obj_list[0]
- # Allocate tensors on CUDA
+ # Allocate tensors on the active accelerator.
distributed_weight_dict = {}
for key, meta in synced_meta_dict.items():
is_tp = meta.get("is_tp", False)
- device = torch.device(f"cuda:{torch.cuda.current_device()}")
if is_tp:
# TP weight: each rank gets its own slice
distributed_weight_dict[key] = torch.empty(meta["shape"], dtype=meta["dtype"], device=device)
@@ -229,31 +230,52 @@ def _load_weights_from_rank0(self, weight_dict, is_weight_loader):
if rank_key in weight_dict:
if rank_idx == self.tp_rank:
# Copy to my own buffer
- distributed_weight_dict[key].copy_(weight_dict[rank_key], non_blocking=True)
+ distributed_weight_dict[key].copy_(weight_dict[rank_key].to(device), non_blocking=True)
else:
# Send to other ranks
- dist.send(weight_dict[rank_key].contiguous(), dst=rank_idx, group=self.tp_group)
+ dist.send(weight_dict[rank_key].to(device).contiguous(), dst=rank_idx, group=self.tp_group)
else:
# Other ranks: receive from rank 0
dist.recv(distributed_weight_dict[key], src=global_src_rank, group=self.tp_group)
else:
# Non-TP weight: broadcast to all ranks
if is_weight_loader:
- distributed_weight_dict[key].copy_(weight_dict[key], non_blocking=True)
+ distributed_weight_dict[key].copy_(weight_dict[key].to(device), non_blocking=True)
dist.broadcast(distributed_weight_dict[key], src=global_src_rank)
- torch.cuda.synchronize()
+ self._synchronize_parallel_weight_device(device)
- logger.info(f"Weights distributed across {dist.get_world_size()} devices on CUDA")
+ logger.info(f"Weights distributed across {dist.get_world_size()} devices on {device}")
return distributed_weight_dict
+ def _get_parallel_weight_device(self):
+ device_type = global_var.AI_DEVICE or getattr(self, "device", None)
+ device_type = str(device_type).split(":", 1)[0] if device_type else "cpu"
+ if device_type == "cpu":
+ return "cpu"
+
+ device_module = getattr(torch, device_type, None)
+ if device_module is not None and hasattr(device_module, "current_device"):
+ return f"{device_type}:{device_module.current_device()}"
+
+ if dist.is_available() and dist.is_initialized():
+ return f"{device_type}:{dist.get_rank()}"
+
+ return device_type
+
+ def _synchronize_parallel_weight_device(self, device):
+ device_type = str(device).split(":", 1)[0]
+ device_module = getattr(torch, device_type, None)
+ if device_module is not None and hasattr(device_module, "synchronize"):
+ device_module.synchronize()
+
def _is_tp_weight(self, key):
"""Check if a weight key needs TP splitting.
TP weights include:
- - Attention layers: to_q, to_k, to_v, to_out.0, q_norm, k_norm
+ - Attention layers: to_q, to_k, to_v, to_gate_logits, to_out.0, q_norm, k_norm
- FFN layers: net.0.proj, net.2
"""
# Generic patterns that apply to all attention and FFN layers
@@ -261,6 +283,7 @@ def _is_tp_weight(self, key):
".to_q.",
".to_k.",
".to_v.",
+ ".to_gate_logits.",
".to_out.0.",
".q_norm.",
".k_norm.",
@@ -273,14 +296,14 @@ def _get_split_type(self, key):
"""Determine the split type for a weight key.
Returns:
- "col": Column split (to_q, to_k, to_v, net.0.proj)
+ "col": Column split (to_q, to_k, to_v, to_gate_logits, net.0.proj)
"row": Row split (to_out.0, net.2)
"norm": Norm split (q_norm, k_norm)
None: No split needed
"""
if ".q_norm." in key or ".k_norm." in key:
return "norm"
- elif ".to_q." in key or ".to_k." in key or ".to_v." in key or ".net.0.proj." in key:
+ elif ".to_q." in key or ".to_k." in key or ".to_v." in key or ".to_gate_logits." in key or ".net.0.proj." in key:
return "col"
elif ".to_out.0." in key or ".net.2." in key:
return "row"
diff --git a/lightx2v/models/networks/ltx2/weights/transformer_weights.py b/lightx2v/models/networks/ltx2/weights/transformer_weights.py
index 71ef5e977..9688a8fff 100755
--- a/lightx2v/models/networks/ltx2/weights/transformer_weights.py
+++ b/lightx2v/models/networks/ltx2/weights/transformer_weights.py
@@ -526,6 +526,7 @@ def __init__(
self.lazy_load = lazy_load
self.lazy_load_file = lazy_load_file
self.attn_rms_norm_type = self.config.get("rms_norm_type", "sgl-kernel")
+ self.apply_gated_attention = self.config.get("apply_gated_attention", False)
block_lora_prefix = "model.diffusion_model.blocks"
model_prefix = "model.diffusion_model"
@@ -541,6 +542,26 @@ def __init__(
"tp_size": tp_size,
}
+ if self.apply_gated_attention:
+ self.add_module(
+ "to_gate_logits",
+ MM_WEIGHT_REGISTER["TensorParallel"](
+ weight_name=f"{model_prefix}.{block_prefix}.{block_index}.{attn_prefix}.to_gate_logits.weight",
+ bias_name=f"{model_prefix}.{block_prefix}.{block_index}.{attn_prefix}.to_gate_logits.bias",
+ mm_type=mm_type,
+ tp_group=tp_group,
+ tp_rank=tp_rank,
+ tp_size=tp_size,
+ split_dim="col",
+ create_cuda_buffer=create_cuda_buffer,
+ create_cpu_buffer=create_cpu_buffer,
+ lazy_load=self.lazy_load,
+ lazy_load_file=self.lazy_load_file,
+ lora_prefix=block_lora_prefix,
+ lora_path=lora_path,
+ ),
+ )
+
self.add_module(
f"q_norm",
norm_class(
diff --git a/lightx2v/models/networks/wan/infer/self_forcing/pre_infer.py b/lightx2v/models/networks/wan/infer/self_forcing/pre_infer.py
index c45ad2bc7..41d72cf89 100755
--- a/lightx2v/models/networks/wan/infer/self_forcing/pre_infer.py
+++ b/lightx2v/models/networks/wan/infer/self_forcing/pre_infer.py
@@ -6,24 +6,47 @@
from lightx2v.models.networks.wan.infer.module_io import GridOutput
from lightx2v.models.networks.wan.infer.pre_infer import WanPreInfer
from lightx2v.utils.envs import *
-from lightx2v_platform.base.global_var import AI_DEVICE
+from lightx2v_platform.base.global_var import AI_DEVICE, PLATFORM
+
+_POSITION_FLOAT32_PLATFORMS = {
+ "ascend_npu",
+ "cambricon_mlu",
+ "metax_cuda",
+}
+
+
+def _position_math_dtype():
+ if PLATFORM in _POSITION_FLOAT32_PLATFORMS:
+ return torch.float32
+ return torch.float64
+
+
+def _empty_device_cache():
+ device_module = getattr(torch, AI_DEVICE, None)
+ if device_module is not None and hasattr(device_module, "empty_cache"):
+ device_module.empty_cache()
def sinusoidal_embedding_1d(dim, position):
# preprocess
assert dim % 2 == 0
half = dim // 2
- position = position.type(torch.float64)
+ dtype = _position_math_dtype()
+ position = position.type(dtype)
# calculation
- sinusoid = torch.outer(position, torch.pow(10000, -torch.arange(half).to(position).div(half)))
+ sinusoid = torch.outer(position, torch.pow(10000, -torch.arange(half, device=position.device, dtype=dtype).div(half)))
x = torch.cat([torch.cos(sinusoid), torch.sin(sinusoid)], dim=1)
return x
def rope_params(max_seq_len, dim, theta=10000):
assert dim % 2 == 0
- freqs = torch.outer(torch.arange(max_seq_len), 1.0 / torch.pow(theta, torch.arange(0, dim, 2).to(torch.float64).div(dim)))
+ dtype = _position_math_dtype()
+ freqs = torch.outer(
+ torch.arange(max_seq_len, dtype=dtype),
+ 1.0 / torch.pow(theta, torch.arange(0, dim, 2, dtype=dtype).div(dim)),
+ )
freqs = torch.polar(torch.ones_like(freqs), freqs)
return freqs
@@ -97,12 +120,12 @@ def infer(self, weights, inputs, kv_start=0, kv_end=0):
context = weights.text_embedding_2.apply(out)
if self.clean_cuda_cache:
del out
- torch.cuda.empty_cache()
+ _empty_device_cache()
if self.clean_cuda_cache:
if self.config.get("use_image_encoder", True):
del context_clip
- torch.cuda.empty_cache()
+ _empty_device_cache()
grid_sizes = GridOutput(tensor=torch.tensor([[grid_sizes_t, grid_sizes_h, grid_sizes_w]], dtype=torch.int32, device=x.device), tuple=(grid_sizes_t, grid_sizes_h, grid_sizes_w))
diff --git a/lightx2v/models/networks/worldmirror/models/layers/attention.py b/lightx2v/models/networks/worldmirror/models/layers/attention.py
index 869f08c5d..3f5e11456 100755
--- a/lightx2v/models/networks/worldmirror/models/layers/attention.py
+++ b/lightx2v/models/networks/worldmirror/models/layers/attention.py
@@ -11,7 +11,10 @@
_USE_FLASH_ATTN_V3 = True
except ImportError:
- from flash_attn.flash_attn_interface import flash_attn_func as flash_attn_func_v2
+ try:
+ from flash_attn.flash_attn_interface import flash_attn_func as flash_attn_func_v2
+ except ImportError:
+ flash_attn_func_v2 = None
_USE_FLASH_ATTN_V3 = False
from ...comm.communication import _All2All
diff --git a/lightx2v/models/runners/flux2/flux2_runner.py b/lightx2v/models/runners/flux2/flux2_runner.py
index 3c9334295..198d3a76e 100644
--- a/lightx2v/models/runners/flux2/flux2_runner.py
+++ b/lightx2v/models/runners/flux2/flux2_runner.py
@@ -4,6 +4,7 @@
import numpy as np
import torch
+import torch.distributed as dist
from loguru import logger
from lightx2v.models.networks.flux2.model import Flux2DevTransformerModel, Flux2KleinTransformerModel
@@ -48,10 +49,104 @@ def _get_scheduler_class(self):
@ProfilingContext4DebugL2("Load models")
def load_model(self):
+ if self._use_tp_rank0_io():
+ self.text_encoders = None
+ self.vae = None
+ self.model = self.load_transformer()
+ return
+
self.text_encoders = self.load_text_encoder()
self.vae = self.load_vae()
self.model = self.load_transformer()
+ def _use_tp_rank0_io(self):
+ return self.config.get("tensor_parallel", False) and dist.is_initialized()
+
+ def _is_rank0(self):
+ return not dist.is_initialized() or dist.get_rank() == 0
+
+ def _rank_device(self):
+ if dist.is_initialized():
+ return torch.device(f"{AI_DEVICE}:{dist.get_rank()}")
+ return torch.device(AI_DEVICE)
+
+ def _tensor_meta_tree(self, obj):
+ if torch.is_tensor(obj):
+ return {"__tensor__": True, "shape": tuple(obj.shape), "dtype": obj.dtype}
+ if isinstance(obj, dict):
+ return {"__dict__": [(key, self._tensor_meta_tree(value)) for key, value in obj.items()]}
+ if isinstance(obj, list):
+ return {"__list__": [self._tensor_meta_tree(value) for value in obj]}
+ if isinstance(obj, tuple):
+ return {"__tuple__": [self._tensor_meta_tree(value) for value in obj]}
+ return {"__object__": obj}
+
+ def _materialize_meta_tree(self, meta, device):
+ if meta.get("__tensor__", False):
+ return torch.empty(meta["shape"], dtype=meta["dtype"], device=device)
+ if "__dict__" in meta:
+ return {key: self._materialize_meta_tree(value, device) for key, value in meta["__dict__"]}
+ if "__list__" in meta:
+ return [self._materialize_meta_tree(value, device) for value in meta["__list__"]]
+ if "__tuple__" in meta:
+ return tuple(self._materialize_meta_tree(value, device) for value in meta["__tuple__"])
+ return meta["__object__"]
+
+ def _broadcast_tensor_tree(self, obj, src_obj, src=0):
+ if torch.is_tensor(obj):
+ if self._is_rank0():
+ obj = src_obj.to(self._rank_device(), non_blocking=True)
+ dist.broadcast(obj, src=src)
+ return obj
+ if isinstance(obj, dict):
+ return {key: self._broadcast_tensor_tree(value, src_obj[key] if self._is_rank0() else None, src=src) for key, value in obj.items()}
+ if isinstance(obj, list):
+ return [self._broadcast_tensor_tree(value, src_obj[idx] if self._is_rank0() else None, src=src) for idx, value in enumerate(obj)]
+ if isinstance(obj, tuple):
+ return tuple(self._broadcast_tensor_tree(value, src_obj[idx] if self._is_rank0() else None, src=src) for idx, value in enumerate(obj))
+ return obj
+
+ def _broadcast_rank0_payload(self, payload):
+ if not self._use_tp_rank0_io():
+ return payload
+
+ meta_list = [self._tensor_meta_tree(payload) if self._is_rank0() else None]
+ dist.broadcast_object_list(meta_list, src=0)
+ payload_tree = payload if self._is_rank0() else self._materialize_meta_tree(meta_list[0], self._rank_device())
+ payload_tree = self._broadcast_tensor_tree(payload_tree, payload if self._is_rank0() else None, src=0)
+ dist.barrier()
+ return payload_tree
+
+ def _load_rank0_text_encoder(self):
+ if not self._is_rank0():
+ return
+ if self.text_encoders is None or self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
+ self.text_encoders = self.load_text_encoder()
+
+ def _unload_rank0_text_encoder(self):
+ if not self._is_rank0():
+ return
+ if self.text_encoders is not None and (self._use_tp_rank0_io() or self.config.get("lazy_load", False) or self.config.get("unload_modules", False)):
+ del self.text_encoders
+ self.text_encoders = None
+ torch_device_module.empty_cache()
+ gc.collect()
+
+ def _load_rank0_vae(self):
+ if not self._is_rank0():
+ return
+ if self.vae is None or self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
+ self.vae = self.load_vae()
+
+ def _unload_rank0_vae(self):
+ if not self._is_rank0():
+ return
+ if self.vae is not None and (self._use_tp_rank0_io() or self.config.get("lazy_load", False) or self.config.get("unload_modules", False)):
+ del self.vae
+ self.vae = None
+ torch_device_module.empty_cache()
+ gc.collect()
+
def load_vae(self):
return Flux2VAE(self.config)
@@ -64,6 +159,8 @@ def init_modules(self):
assert self.config.get("cpu_offload", False)
task = self.config.get("task", "t2i")
+ if self._use_tp_rank0_io() and task == "i2i":
+ raise NotImplementedError("Flux2 tensor parallel currently supports t2i only; i2i needs rank0 VAE encode broadcast.")
if task == "i2i":
self.run_input_encoder = self._run_input_encoder_local_i2i
self.run_dit = self._run_dit_local_i2i
@@ -73,6 +170,24 @@ def init_modules(self):
@ProfilingContext4DebugL2("Run Encoders")
def _run_input_encoder_local_t2i(self):
+ if self._use_tp_rank0_io():
+ payload = None
+ if self._is_rank0():
+ self._load_rank0_text_encoder()
+ prompt = self.input_info.prompt
+ text_encoder_output = self.run_text_encoder(prompt, neg_prompt=self.input_info.negative_prompt)
+ self._unload_rank0_text_encoder()
+ payload = {
+ "inputs": {
+ "text_encoder_output": text_encoder_output,
+ "image_encoder_output": None,
+ },
+ "target_shape": self.input_info.target_shape,
+ }
+ payload = self._broadcast_rank0_payload(payload)
+ self.input_info.target_shape = payload["target_shape"]
+ return payload["inputs"]
+
prompt = self.input_info.prompt
if self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
self.text_encoders = self.load_text_encoder()
@@ -88,6 +203,22 @@ def _run_input_encoder_local_t2i(self):
@ProfilingContext4DebugL2("Run Encoders I2I")
def _run_input_encoder_local_i2i(self):
+ if self._use_tp_rank0_io():
+ payload = None
+ if self._is_rank0():
+ self._load_rank0_text_encoder()
+ payload = {
+ "inputs": self._run_input_encoder_local_i2i_rank0(),
+ "target_shape": self.input_info.target_shape,
+ }
+ self._unload_rank0_text_encoder()
+ payload = self._broadcast_rank0_payload(payload)
+ self.input_info.target_shape = payload["target_shape"]
+ return payload["inputs"]
+
+ return self._run_input_encoder_local_i2i_rank0()
+
+ def _run_input_encoder_local_i2i_rank0(self):
prompt = self.input_info.prompt
if self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
self.text_encoders = self.load_text_encoder()
@@ -330,9 +461,28 @@ def set_img_shapes(self):
@ProfilingContext4DebugL1("Run VAE Decoder")
def run_vae_decoder(self, latents):
+ if self._use_tp_rank0_io():
+ images = None
+ if self._is_rank0():
+ self._load_rank0_vae()
+ images = self._decode_latents_with_vae(latents)
+ self._unload_rank0_vae()
+ dist.barrier()
+ return images
+
if self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
self.vae = self.load_vae()
+ images = self._decode_latents_with_vae(latents)
+
+ if self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
+ del self.vae
+ torch_device_module.empty_cache()
+ gc.collect()
+
+ return images
+
+ def _decode_latents_with_vae(self, latents):
B, _, C = latents.shape
H = int((self.input_info.latent_image_ids[0, :, 1].max() + 1).item())
@@ -348,14 +498,7 @@ def run_vae_decoder(self, latents):
latents = latents.permute(0, 1, 4, 2, 5, 3)
latents = latents.reshape(B, C // 4, H * 2, W * 2)
- images = self.vae.decode(latents, self.input_info)
-
- if self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
- del self.vae
- torch_device_module.empty_cache()
- gc.collect()
-
- return images
+ return self.vae.decode(latents, self.input_info)
@ProfilingContext4DebugL1("RUN pipeline")
def run_pipeline(self, input_info):
@@ -368,6 +511,7 @@ def run_pipeline(self, input_info):
latents, generator = self.run_dit()
images = self.run_vae_decoder(latents)
+ self.end_run()
if not input_info.return_result_tensor and is_main_process():
image = images[0]
diff --git a/lightx2v/models/runners/hunyuan_video/hunyuan_video_15_runner.py b/lightx2v/models/runners/hunyuan_video/hunyuan_video_15_runner.py
index 560ab895b..2185a8fca 100755
--- a/lightx2v/models/runners/hunyuan_video/hunyuan_video_15_runner.py
+++ b/lightx2v/models/runners/hunyuan_video/hunyuan_video_15_runner.py
@@ -130,13 +130,17 @@ def get_latent_shape_with_target_hw(self, origin_size=None):
]
ori_latent_h, ori_latent_w = latent_shape[2], latent_shape[3]
- if dist.is_initialized() and dist.get_world_size() > 1:
+ align_single_card_shape = self.config.get("align_single_card_shape", True)
+ use_dist_vae_decode = dist.is_initialized() and dist.get_world_size() > 1 and not align_single_card_shape
+ if use_dist_vae_decode:
latent_h, latent_w, world_size_h, world_size_w = self._adjust_latent_for_grid_splitting(ori_latent_h, ori_latent_w, dist.get_world_size())
latent_shape[2], latent_shape[3] = latent_h, latent_w
logger.info(f"ori latent: {ori_latent_h}x{ori_latent_w}, adjust_latent: {latent_h}x{latent_w}, grid: {world_size_h}x{world_size_w}")
else:
latent_shape[2], latent_shape[3] = ori_latent_h, ori_latent_w
world_size_h, world_size_w = None, None
+ if dist.is_initialized() and dist.get_world_size() > 1:
+ logger.info(f"align_single_card_shape enabled, keep latent: {ori_latent_h}x{ori_latent_w}; distributed VAE decode disabled")
self.vae_decoder.world_size_h = world_size_h
self.vae_decoder.world_size_w = world_size_w
diff --git a/lightx2v/models/runners/ltx2/ltx2_runner.py b/lightx2v/models/runners/ltx2/ltx2_runner.py
index ea8060001..22e6f0af4 100755
--- a/lightx2v/models/runners/ltx2/ltx2_runner.py
+++ b/lightx2v/models/runners/ltx2/ltx2_runner.py
@@ -30,6 +30,21 @@ def _ltx2_parse_image_paths(image_path: str) -> list[str]:
return [p.strip() for p in image_path.split(",") if p.strip()]
+def _ltx2_audio_to_stereo(audio: Audio) -> Audio:
+ waveform = audio.waveform
+ if waveform.dim() == 3:
+ if waveform.shape[1] == 1:
+ waveform = waveform.expand(waveform.shape[0], 2, waveform.shape[2]).contiguous()
+ elif waveform.shape[1] > 2:
+ waveform = waveform[:, :2, :].contiguous()
+ elif waveform.dim() == 2:
+ if waveform.shape[0] == 1:
+ waveform = waveform.expand(2, waveform.shape[1]).contiguous()
+ elif waveform.shape[0] > 2:
+ waveform = waveform[:2, :].contiguous()
+ return Audio(waveform=waveform, sampling_rate=audio.sampling_rate)
+
+
def _ltx2_normalize_image_strengths(image_strength, n: int) -> list[float]:
if not isinstance(image_strength, list):
return [float(image_strength)] * n
@@ -483,6 +498,7 @@ def _run_input_encoder_local_ltx2_s2v(self):
decoded = decode_audio_from_file(ap, enc_device, 0.0, max_duration)
if decoded is None:
raise ValueError(f"ltx2_s2v: failed to decode audio from {ap!r}.")
+ decoded = _ltx2_audio_to_stereo(decoded)
with torch.no_grad():
encoded = encode_audio(decoded, self.audio_vae.encoder)
diff --git a/lightx2v/models/runners/qwen_image/qwen_image_runner.py b/lightx2v/models/runners/qwen_image/qwen_image_runner.py
index 448cb6e73..d6ff51259 100755
--- a/lightx2v/models/runners/qwen_image/qwen_image_runner.py
+++ b/lightx2v/models/runners/qwen_image/qwen_image_runner.py
@@ -370,6 +370,8 @@ def get_custom_shape(self):
return (target_width, target_height)
aspect_ratio = self.input_info.aspect_ratio if self.input_info.aspect_ratio else self.config.get("aspect_ratio", None)
+ if not aspect_ratio and self.config.get("task") == "t2i":
+ aspect_ratio = "16:9"
if aspect_ratio in as_maps:
logger.info(f"Qwen Image Runner got aspect ratio: {aspect_ratio}")
width, height = as_maps[aspect_ratio]
@@ -394,6 +396,9 @@ def set_target_shape(self):
if custom_shape is not None:
width, height = custom_shape
else:
+ original_size = getattr(self.input_info, "original_size", None)
+ if not original_size:
+ raise ValueError("Qwen Image requires a valid target_shape/aspect_ratio, or an input image with original_size.")
width, height = self.input_info.original_size[-1]
calculated_width, calculated_height, _ = calculate_dimensions(self.resolution * self.resolution, width / height)
multiple_of = self.config["vae_scale_factor"] * 2
diff --git a/lightx2v/models/runners/wan/wan_sf_runner.py b/lightx2v/models/runners/wan/wan_sf_runner.py
index dead7573b..83fb3fe49 100755
--- a/lightx2v/models/runners/wan/wan_sf_runner.py
+++ b/lightx2v/models/runners/wan/wan_sf_runner.py
@@ -14,6 +14,9 @@
from lightx2v.utils.registry_factory import RUNNER_REGISTER
from lightx2v.utils.utils import get_rank_and_world_size
from lightx2v.utils.video_recorder import VideoRecorder
+from lightx2v_platform.base.global_var import AI_DEVICE
+
+torch_device_module = getattr(torch, AI_DEVICE)
@RUNNER_REGISTER("wan2.1_sf")
@@ -37,7 +40,7 @@ def init_scheduler(self):
def init_kv_cache_manager(self):
kv_mgr = getattr(self.model, "kv_cache_manager", None)
if kv_mgr is None:
- kv_mgr = KVCacheManager(config=self.config, device=torch.device("cuda"), sp_group=self.model.seq_p_group)
+ kv_mgr = KVCacheManager(config=self.config, device=torch.device(AI_DEVICE), sp_group=self.model.seq_p_group)
self.model.kv_cache_manager = kv_mgr
kv_mgr.ar_config = dict(self.config.get("ar_config", {}))
kv_mgr._create_kv_caches(self.input_info.latent_shape)
@@ -60,7 +63,7 @@ def run_vae_decoder(self, latents):
images = self.vae_decoder.decode(latents.to(GET_DTYPE()), use_cache=True)
if self.config.get("lazy_load", False) or self.config.get("unload_modules", False):
del self.vae_decoder
- torch.cuda.empty_cache()
+ torch_device_module.empty_cache()
gc.collect()
return images
@@ -122,7 +125,7 @@ def end_run_segment(self, segment_idx=None):
self.model.scheduler.step_pre(seg_index=segment_idx, step_index=self.model.scheduler.infer_steps - 1, is_rerun=True)
with ProfilingContext4DebugL1("🚀 infer_main_in_rerun"):
self.model.infer(self.inputs)
- torch.cuda.empty_cache()
+ torch_device_module.empty_cache()
@ProfilingContext4DebugL2("Run DiT")
def run_main(self, total_steps=None):
@@ -133,7 +136,7 @@ def run_main(self, total_steps=None):
lazy_vae = self.config.get("lazy_load", False) or self.config.get("unload_modules", False)
if lazy_vae:
self.vae_decoder = self.load_vae_decoder()
- vae_decoder = AsyncVAEChunkDecoder.from_config(self.config, device=torch.device("cuda"), vae_decoder=self.vae_decoder)
+ vae_decoder = AsyncVAEChunkDecoder.from_config(self.config, device=torch.device(AI_DEVICE), vae_decoder=self.vae_decoder)
with no_sync_profiling(enabled=vae_decoder.is_async):
with ProfilingContext4DebugL1(
@@ -165,14 +168,14 @@ def run_main(self, total_steps=None):
self.model.infer(self.inputs)
vae_decoder.submit(self.decode_segment_latents, segment_idx, latents)
- torch.cuda.empty_cache()
+ torch_device_module.empty_cache()
decoded_chunks = vae_decoder.finish()
finally:
if "vae_decoder" in locals():
vae_decoder.finish()
if lazy_vae:
del self.vae_decoder
- torch.cuda.empty_cache()
+ torch_device_module.empty_cache()
gc.collect()
self.gen_video = torch.cat(decoded_chunks, dim=2)
diff --git a/lightx2v/models/schedulers/longcat_image/scheduler.py b/lightx2v/models/schedulers/longcat_image/scheduler.py
index 7a1ecb7ec..e64615596 100755
--- a/lightx2v/models/schedulers/longcat_image/scheduler.py
+++ b/lightx2v/models/schedulers/longcat_image/scheduler.py
@@ -6,6 +6,8 @@
import numpy as np
import torch
+import torch.distributed as dist
+import torch.nn.functional as F
from diffusers.schedulers.scheduling_flow_match_euler_discrete import FlowMatchEulerDiscreteScheduler
from loguru import logger
from torch import nn
@@ -268,6 +270,33 @@ def __init__(self, config):
else:
self.seq_p_group = None
+ def _seq_parallel_rope(self, rotary_emb, txt_seq_len):
+ if self.seq_p_group is None:
+ return rotary_emb
+
+ world_size = dist.get_world_size(self.seq_p_group)
+ cur_rank = dist.get_rank(self.seq_p_group)
+
+ def chunk_image_emb(image_emb):
+ seqlen = image_emb.shape[0]
+ padding_size = (world_size - (seqlen % world_size)) % world_size
+ if padding_size > 0:
+ image_emb = F.pad(image_emb, (0, 0, 0, padding_size))
+ return torch.chunk(image_emb, world_size, dim=0)[cur_rank]
+
+ if self.config.get("rope_type", "flashinfer") == "flashinfer":
+ txt_emb = rotary_emb[:txt_seq_len]
+ img_emb = chunk_image_emb(rotary_emb[txt_seq_len:])
+ return torch.cat([txt_emb, img_emb], dim=0)
+
+ freqs_cos, freqs_sin = rotary_emb
+ txt_cos, img_cos = freqs_cos[:txt_seq_len], freqs_cos[txt_seq_len:]
+ txt_sin, img_sin = freqs_sin[:txt_seq_len], freqs_sin[txt_seq_len:]
+ return (
+ torch.cat([txt_cos, chunk_image_emb(img_cos)], dim=0),
+ torch.cat([txt_sin, chunk_image_emb(img_sin)], dim=0),
+ )
+
@staticmethod
def _pack_latents(latents, batch_size, num_channels, height, width):
"""Pack latents from [B, C, H, W] to [B, (H//2)*(W//2), C*4] for transformer input.
@@ -368,6 +397,7 @@ def prepare(self, input_info):
self.image_rotary_emb = torch.cat([cos_half, sin_half], dim=-1) # [L, D]
else:
self.image_rotary_emb = (freqs_cos, freqs_sin)
+ self.image_rotary_emb = self._seq_parallel_rope(self.image_rotary_emb, txt_seq_len)
# Handle CFG: prepare negative embeddings rotary
if self.config.get("enable_cfg", True):
@@ -382,6 +412,7 @@ def prepare(self, input_info):
self.negative_image_rotary_emb = torch.cat([neg_cos_half, neg_sin_half], dim=-1)
else:
self.negative_image_rotary_emb = (neg_freqs_cos, neg_freqs_sin)
+ self.negative_image_rotary_emb = self._seq_parallel_rope(self.negative_image_rotary_emb, neg_txt_seq_len)
def step_pre(self, step_index):
"""Prepare for a single denoising step."""
@@ -445,6 +476,7 @@ def prepare_i2i(self, input_info, input_image, vae):
self.image_rotary_emb = torch.cat([cos_half, sin_half], dim=-1)
else:
self.image_rotary_emb = (freqs_cos, freqs_sin)
+ self.image_rotary_emb = self._seq_parallel_rope(self.image_rotary_emb, txt_seq_len)
# Store output sequence length for later truncation
self.output_seq_len = self.latents.shape[1]
@@ -462,6 +494,7 @@ def prepare_i2i(self, input_info, input_image, vae):
self.negative_image_rotary_emb = torch.cat([neg_cos_half, neg_sin_half], dim=-1)
else:
self.negative_image_rotary_emb = (neg_freqs_cos, neg_freqs_sin)
+ self.negative_image_rotary_emb = self._seq_parallel_rope(self.negative_image_rotary_emb, neg_txt_seq_len)
def _encode_image(self, image):
"""Encode input image using VAE.
diff --git a/lightx2v/models/video_encoders/hf/hunyuanvideo15/hunyuanvideo_15_vae.py b/lightx2v/models/video_encoders/hf/hunyuanvideo15/hunyuanvideo_15_vae.py
index 52f013e69..c42d74a8d 100755
--- a/lightx2v/models/video_encoders/hf/hunyuanvideo15/hunyuanvideo_15_vae.py
+++ b/lightx2v/models/video_encoders/hf/hunyuanvideo15/hunyuanvideo_15_vae.py
@@ -14,11 +14,18 @@
from einops import rearrange
from torch import Tensor, nn
-from lightx2v_platform.base.global_var import AI_DEVICE
+from lightx2v_platform.base.global_var import AI_DEVICE, PLATFORM
torch_device_module = getattr(torch, AI_DEVICE)
+_REPLICATE_PAD_FLOAT32_PLATFORMS = {
+ "ascend_npu",
+ "cambricon_mlu",
+ "metax_cuda",
+}
+
+
@dataclass
class DecoderOutput(BaseOutput):
sample: torch.FloatTensor
@@ -30,6 +37,12 @@ def swish(x: Tensor) -> Tensor:
return x * torch.sigmoid(x)
+def _pad(x: torch.Tensor, pad, mode: str = "constant", value: float = 0.0) -> torch.Tensor:
+ if mode == "replicate" and PLATFORM in _REPLICATE_PAD_FLOAT32_PLATFORMS and x.dtype == torch.bfloat16:
+ return F.pad(x.float(), pad, mode=mode, value=value).to(dtype=x.dtype)
+ return F.pad(x, pad, mode=mode, value=value)
+
+
def forward_with_checkpointing(module, *inputs, use_checkpointing=False):
"""Forward with optional gradient checkpointing."""
@@ -117,7 +130,7 @@ def forward(self, input):
padded_chunks = []
for i in range(len(chunks)):
if self.padding[0] > 0:
- padded_chunk = F.pad(
+ padded_chunk = _pad(
chunks[i],
(0, 0, 0, 0, self.padding[0], self.padding[0]),
mode="constant" if self.padding_mode == "zeros" else self.padding_mode,
@@ -171,7 +184,7 @@ def __init__(
self.conv = nn.Conv3d(chan_in, chan_out, kernel_size, stride=stride, dilation=dilation, **kwargs)
def forward(self, x):
- x = F.pad(x, self.time_causal_padding, mode=self.pad_mode)
+ x = _pad(x, self.time_causal_padding, mode=self.pad_mode)
return self.conv(x)
diff --git a/lightx2v/models/video_encoders/hf/ltx2/audio_vae/vocoder.py b/lightx2v/models/video_encoders/hf/ltx2/audio_vae/vocoder.py
index 1561a0664..d8328befe 100755
--- a/lightx2v/models/video_encoders/hf/ltx2/audio_vae/vocoder.py
+++ b/lightx2v/models/video_encoders/hf/ltx2/audio_vae/vocoder.py
@@ -7,6 +7,13 @@
from torch import nn
from lightx2v.models.video_encoders.hf.ltx2.audio_vae.resnet import LRELU_SLOPE, ResBlock1
+from lightx2v_platform.base.global_var import PLATFORM
+
+_REPLICATE_PAD_FLOAT32_PLATFORMS = {
+ "ascend_npu",
+ "cambricon_mlu",
+ "metax_cuda",
+}
def get_padding(kernel_size: int, dilation: int = 1) -> int:
@@ -48,6 +55,12 @@ def kaiser_sinc_filter1d(cutoff: float, half_width: float, kernel_size: int) ->
return filter_.view(1, 1, kernel_size)
+def _pad1d(x: torch.Tensor, pad: tuple[int, int], mode: str) -> torch.Tensor:
+ if mode == "replicate" and PLATFORM in _REPLICATE_PAD_FLOAT32_PLATFORMS and x.dtype == torch.bfloat16:
+ return F.pad(x.float(), pad, mode=mode).to(dtype=x.dtype)
+ return F.pad(x, pad, mode=mode)
+
+
class LowPassFilter1d(nn.Module):
def __init__(
self,
@@ -75,7 +88,7 @@ def __init__(
def forward(self, x: torch.Tensor) -> torch.Tensor:
_, n_channels, _ = x.shape
if self.padding:
- x = F.pad(x, (self.pad_left, self.pad_right), mode=self.padding_mode)
+ x = _pad1d(x, (self.pad_left, self.pad_right), mode=self.padding_mode)
return F.conv1d(x, self.filter.expand(n_channels, -1, -1), stride=self.stride, groups=n_channels)
@@ -120,7 +133,7 @@ def __init__(
def forward(self, x: torch.Tensor) -> torch.Tensor:
_, n_channels, _ = x.shape
- x = F.pad(x, (self.pad, self.pad), mode="replicate")
+ x = _pad1d(x, (self.pad, self.pad), mode="replicate")
filt = self.filter.to(dtype=x.dtype, device=x.device).expand(n_channels, -1, -1)
x = self.ratio * F.conv_transpose1d(x, filt, stride=self.stride, groups=n_channels)
return x[..., self.pad_left : -self.pad_right]
diff --git a/scripts/ltx2/run_ltx2_3_i2av_keyframes.sh b/scripts/ltx2/run_ltx2_3_i2av_keyframes.sh
index c385b4164..c0d45bb9f 100755
--- a/scripts/ltx2/run_ltx2_3_i2av_keyframes.sh
+++ b/scripts/ltx2/run_ltx2_3_i2av_keyframes.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# set path and first
+# The model_pathpoints to LTX-2, while the config includes the weights for LTX-2.3
lightx2v_path=/path/to/LightX2V
model_path=Lightricks/LTX-2
diff --git a/scripts/ltx2/run_ltx2_3_rs2v.sh b/scripts/ltx2/run_ltx2_3_rs2v.sh
index 39eda5f8f..c077979d5 100755
--- a/scripts/ltx2/run_ltx2_3_rs2v.sh
+++ b/scripts/ltx2/run_ltx2_3_rs2v.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# set path and first
+# The model_pathpoints to LTX-2, while the config includes the weights for LTX-2.3
lightx2v_path=/path/to/LightX2V
model_path=Lightricks/LTX-2
AUDIO_PATH=
diff --git a/scripts/ltx2/run_ltx2_3_s2v.sh b/scripts/ltx2/run_ltx2_3_s2v.sh
index 4c4678b4a..0572d7f24 100755
--- a/scripts/ltx2/run_ltx2_3_s2v.sh
+++ b/scripts/ltx2/run_ltx2_3_s2v.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# set path and first
+# The model_pathpoints to LTX-2, while the config includes the weights for LTX-2.3
lightx2v_path=/path/to/LightX2V
model_path=Lightricks/LTX-2
AUDIO_PATH=
diff --git a/scripts/ltx2/run_ltx2_3_v2av_motion_pose.sh b/scripts/ltx2/run_ltx2_3_v2av_motion_pose.sh
index 63dd6340a..5cee365a9 100755
--- a/scripts/ltx2/run_ltx2_3_v2av_motion_pose.sh
+++ b/scripts/ltx2/run_ltx2_3_v2av_motion_pose.sh
@@ -4,6 +4,7 @@
# Accepts any of: Canny / Depth / Pose mode
# set path firstly
+# The model_pathpoints to LTX-2, while the config includes the weights for LTX-2.3
lightx2v_path=
model_path=
video_path=
diff --git a/scripts/platforms/ascend_npu/dist/infer_flux2_dev.sh b/scripts/platforms/ascend_npu/dist/infer_flux2_dev.sh
new file mode 100755
index 000000000..21db47db7
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/infer_flux2_dev.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Flux2 Dev T2I 8-NPU tensor-parallel inference script for Ascend NPU 910B
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/FLUX.2-dev}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+export HCCL_CONNECT_TIMEOUT=600 # avoid load ckpt timeout
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls flux2_dev \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/flux2_dev.json" \
+ --prompt 'Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text "BFL Diffusers" on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom.' \
+ --save_result_path "${lightx2v_path}/save_results/flux2_dev_dist8.png" \
+ --seed 42
diff --git a/scripts/platforms/ascend_npu/dist/logging.sh b/scripts/platforms/ascend_npu/dist/logging.sh
new file mode 100755
index 000000000..26e05b933
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/logging.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+LOG_DIR=${LOG_DIR:-${lightx2v_path}/logs/platforms/ascend_npu/dist}
+mkdir -p "${LOG_DIR}"
+
+script_name=$(basename "$0" .sh)
+timestamp=$(date +"%Y%m%d_%H%M%S")
+LOG_FILE=${LOG_FILE:-${LOG_DIR}/${script_name}_${timestamp}.log}
+
+exec > >(tee -a "${LOG_FILE}") 2>&1
+echo "Logging to ${LOG_FILE}"
diff --git a/scripts/platforms/ascend_npu/dist/longcat_image_t2i.sh b/scripts/platforms/ascend_npu/dist/longcat_image_t2i.sh
new file mode 100755
index 000000000..88351b529
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/longcat_image_t2i.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# LongCat Image T2I 8-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/LongCat-Image}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls longcat_image \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/longcat_image_t2i.json" \
+ --prompt "一只小猫躺在沙发上" \
+ --negative_prompt "" \
+ --save_result_path "${lightx2v_path}/save_results/longcat_image_t2i_dist8.png" \
+ --seed 42
diff --git a/scripts/platforms/ascend_npu/dist/qwen_image_t2i_2512.sh b/scripts/platforms/ascend_npu/dist/qwen_image_t2i_2512.sh
new file mode 100755
index 000000000..5d3bb7ce0
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/qwen_image_t2i_2512.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Qwen Image T2I 8-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/Qwen-Image-2512}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls qwen_image \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/qwen_image_t2i_2512.json" \
+ --prompt 'A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition, Ultra HD, 4K, cinematic composition.' \
+ --negative_prompt " " \
+ --save_result_path "${lightx2v_path}/save_results/qwen_image_t2i_2512_dist8.png" \
+ --seed 42
diff --git a/scripts/platforms/ascend_npu/dist/run_hy15_t2v_480p.sh b/scripts/platforms/ascend_npu/dist/run_hy15_t2v_480p.sh
new file mode 100755
index 000000000..0d0e0e6ad
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/run_hy15_t2v_480p.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# HunyuanVideo 1.5 T2V 8-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/HunyuanVideo-1.5}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --seed 123 \
+ --model_cls hunyuan_video_1.5 \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/hunyuan_video_t2v_480p.json" \
+ --prompt "A close-up shot captures a scene on a polished, light-colored granite kitchen counter, illuminated by soft natural light from an unseen window. Initially, the frame focuses on a tall, clear glass filled with golden, translucent apple juice standing next to a single, shiny red apple with a green leaf still attached to its stem. The camera moves horizontally to the right. As the shot progresses, a white ceramic plate smoothly enters the frame, revealing a fresh arrangement of about seven or eight more apples, a mix of vibrant reds and greens, piled neatly upon it. A shallow depth of field keeps the focus sharply on the fruit and glass, while the kitchen backsplash in the background remains softly blurred. The scene is in a realistic style." \
+ --negative_prompt "" \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_hunyuan_video_15_t2v_dist8.mp4"
diff --git a/scripts/platforms/ascend_npu/dist/run_ltx2_3_s2v.sh b/scripts/platforms/ascend_npu/dist/run_ltx2_3_s2v.sh
new file mode 100755
index 000000000..1c0587289
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/run_ltx2_3_s2v.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# LTX-2 S2V 8-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/LTX-2}
+AUDIO_PATH=${AUDIO_PATH:-/data/wushuo1/ltx2_s2v_sample.wav}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls ltx2 \
+ --task ltx2_s2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/ltx2_3.json" \
+ --audio_path "${AUDIO_PATH}" \
+ --prompt "A person speaks clearly in a quiet room, natural lighting, cinematic medium shot." \
+ --negative_prompt "blurry, out of focus, overexposed, underexposed, low contrast, excessive noise, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, disfigured hands, artifacts, inconsistent perspective, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, off-sync audio, AI artifacts." \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_ltx2_s2v_dist8.mp4"
diff --git a/scripts/platforms/ascend_npu/dist/run_wan21_t2v.sh b/scripts/platforms/ascend_npu/dist/run_wan21_t2v.sh
new file mode 100755
index 000000000..6774ccff2
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/run_wan21_t2v.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Wan2.1 T2V 8-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/Wan2.1-T2V-1.3B}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls wan2.1 \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/wan_t2v.json" \
+ --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
+ --negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_wan_t2v_dist8.mp4"
diff --git a/scripts/platforms/ascend_npu/dist/run_wan22_moe_t2v.sh b/scripts/platforms/ascend_npu/dist/run_wan22_moe_t2v.sh
new file mode 100755
index 000000000..9fa85dff5
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/run_wan22_moe_t2v.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Wan2.2 MoE T2V 8-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/Wan2.2-T2V-A14B}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls wan2.2_moe \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/wan_moe_t2v.json" \
+ --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
+ --negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_wan22_moe_t2v_dist8.mp4"
diff --git a/scripts/platforms/ascend_npu/dist/run_wan_t2v_sf.sh b/scripts/platforms/ascend_npu/dist/run_wan_t2v_sf.sh
new file mode 100755
index 000000000..519718e63
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/run_wan_t2v_sf.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Wan2.1 Self-Forcing T2V 8-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/Wan2.1-T2V-1.3B}
+npus=${NPUS:-8}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls wan2.1_sf \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/wan_t2v_sf.json" \
+ --prompt 'A stylish woman strolls down a bustling Tokyo street, the warm glow of neon lights and animated city signs casting vibrant reflections. She wears a sleek black leather jacket paired with a flowing red dress and black boots, her black purse slung over her shoulder. Sunglasses perched on her nose and a bold red lipstick add to her confident, casual demeanor. The street is damp and reflective, creating a mirror-like effect that enhances the colorful lights and shadows. Pedestrians move about, adding to the lively atmosphere. The scene is captured in a dynamic medium shot with the woman walking slightly to one side, highlighting her graceful strides.' \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_wan_t2v_sf_dist8.mp4"
diff --git a/scripts/platforms/ascend_npu/dist/z_image_turbo_t2i.sh b/scripts/platforms/ascend_npu/dist/z_image_turbo_t2i.sh
new file mode 100755
index 000000000..83bb91701
--- /dev/null
+++ b/scripts/platforms/ascend_npu/dist/z_image_turbo_t2i.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# Z-Image Turbo T2I 2-NPU inference script for Ascend NPU
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/wushuo1/LightX2V}
+model_path=${MODEL_PATH:-/data/wushuo1/models/Z-Image-Turbo}
+npus=${NPUS:-2}
+master_port=${MASTER_PORT:-$((29500 + RANDOM % 1000))}
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES="${ASCEND_RT_VISIBLE_DEVICES:-0,1}"
+
+source "${lightx2v_path}/scripts/platforms/ascend_npu/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --master_port="${master_port}" --nproc_per_node="${npus}" -m lightx2v.infer \
+ --model_cls z_image \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/ascend_npu/dist/z_image_turbo_t2i.json" \
+ --prompt 'Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights.' \
+ --negative_prompt " " \
+ --save_result_path "${lightx2v_path}/save_results/z_image_turbo_dist2.png" \
+ --seed 42 \
+ --aspect_ratio "16:9"
diff --git a/scripts/platforms/ascend_npu/qwen_image_i2i_2511.sh b/scripts/platforms/ascend_npu/qwen_image_i2i_2511.sh
deleted file mode 100755
index 24489ce73..000000000
--- a/scripts/platforms/ascend_npu/qwen_image_i2i_2511.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-# System management interface: npu-smi info
-
-# set path firstly
-lightx2v_path=
-model_path=
-
-export PLATFORM=ascend_npu
-export ASCEND_RT_VISIBLE_DEVICES=0
-
-# set environment variables
-source ${lightx2v_path}/scripts/base/base.sh
-
-python -m lightx2v.infer \
- --model_cls qwen_image \
- --task i2i \
- --model_path $model_path \
- --config_json ${lightx2v_path}/configs/platforms/ascend_npu/qwen_image_i2i_2511.json \
- --prompt "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3." \
- --negative_prompt " " \
- --image_path "1.png,2.png,3.png" \
- --save_result_path ${lightx2v_path}/save_results/qwen_image_i2i_2511.png \
- --seed 0
diff --git a/scripts/platforms/ascend_npu/single/infer_flux2_dev.sh b/scripts/platforms/ascend_npu/single/infer_flux2_dev.sh
new file mode 100644
index 000000000..83f245c6c
--- /dev/null
+++ b/scripts/platforms/ascend_npu/single/infer_flux2_dev.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Flux2 Dev T2I Inference Script for Ascend NPU 910B
+# Usage: bash infer_flux2_dev.sh
+
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/FLUX.2-dev
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES=0
+
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+ --model_cls flux2_dev \
+ --task t2i \
+ --model_path $model_path \
+ --config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/flux2_dev.json \
+ --prompt 'Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text "BFL Diffusers" on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom.' \
+ --save_result_path ${lightx2v_path}/save_results/flux2_dev.png \
+ --seed 42
diff --git a/scripts/platforms/ascend_npu/longcat_image_t2i.sh b/scripts/platforms/ascend_npu/single/longcat_image_t2i.sh
similarity index 83%
rename from scripts/platforms/ascend_npu/longcat_image_t2i.sh
rename to scripts/platforms/ascend_npu/single/longcat_image_t2i.sh
index 4b7c93882..72d819d22 100644
--- a/scripts/platforms/ascend_npu/longcat_image_t2i.sh
+++ b/scripts/platforms/ascend_npu/single/longcat_image_t2i.sh
@@ -3,8 +3,8 @@
# LongCat Image T2I Inference Script
# Usage: bash longcat_image_t2i.sh
-lightx2v_path=/workspace
-model_path=/workspace/models/LongCat-Image
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/LongCat-Image
export PLATFORM=ascend_npu
export ASCEND_RT_VISIBLE_DEVICES=0
@@ -18,7 +18,7 @@ python -m lightx2v.infer \
--model_cls longcat_image \
--task t2i \
--model_path $model_path \
- --config_json ${lightx2v_path}/configs/platforms/ascend_npu/longcat_image_t2i.json \
+ --config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/longcat_image_t2i.json \
--prompt "一只小猫躺在沙发上" \
--negative_prompt "" \
--save_result_path ${lightx2v_path}/save_results/longcat_image_t2i.png \
diff --git a/scripts/platforms/ascend_npu/qwen_image_t2i_2512.sh b/scripts/platforms/ascend_npu/single/qwen_image_t2i_2512.sh
similarity index 79%
rename from scripts/platforms/ascend_npu/qwen_image_t2i_2512.sh
rename to scripts/platforms/ascend_npu/single/qwen_image_t2i_2512.sh
index 2dde37f36..eff39831f 100644
--- a/scripts/platforms/ascend_npu/qwen_image_t2i_2512.sh
+++ b/scripts/platforms/ascend_npu/single/qwen_image_t2i_2512.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# set path firstly
-lightx2v_path=/data/nvme1/yongyang/ddc/yong/LightX2V
-model_path=/data/nvme1/models/Qwen/Qwen-Image-2512
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/Qwen-Image-2512
export PLATFORM=ascend_npu
export ASCEND_RT_VISIBLE_DEVICES=0
@@ -14,7 +14,7 @@ python -m lightx2v.infer \
--model_cls qwen_image \
--task t2i \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/ascend_npu/qwen_image_t2i_2512.json \
+--config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/qwen_image_t2i_2512.json \
--prompt 'A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition, Ultra HD, 4K, cinematic composition.' \
--negative_prompt " " \
--save_result_path ${lightx2v_path}/save_results/qwen_image_t2i_2512.png \
diff --git a/scripts/platforms/ascend_npu/single/run_hy15_t2v_480p.sh b/scripts/platforms/ascend_npu/single/run_hy15_t2v_480p.sh
new file mode 100644
index 000000000..4be7fb88a
--- /dev/null
+++ b/scripts/platforms/ascend_npu/single/run_hy15_t2v_480p.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# set path firstly
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/HunyuanVideo-1.5
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES=0
+
+# set environment variables
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--seed 123 \
+--model_cls hunyuan_video_1.5 \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/hunyuan_video_t2v_480p.json \
+--prompt "A close-up shot captures a scene on a polished, light-colored granite kitchen counter, illuminated by soft natural light from an unseen window. Initially, the frame focuses on a tall, clear glass filled with golden, translucent apple juice standing next to a single, shiny red apple with a green leaf still attached to its stem. The camera moves horizontally to the right. As the shot progresses, a white ceramic plate smoothly enters the frame, revealing a fresh arrangement of about seven or eight more apples, a mix of vibrant reds and greens, piled neatly upon it. A shallow depth of field keeps the focus sharply on the fruit and glass, while the kitchen backsplash in the background remains softly blurred. The scene is in a realistic style." \
+--negative_prompt "" \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_hunyuan_video_15_t2v.mp4
diff --git a/scripts/platforms/ascend_npu/single/run_ltx2_3_s2v.sh b/scripts/platforms/ascend_npu/single/run_ltx2_3_s2v.sh
new file mode 100644
index 000000000..92844deb1
--- /dev/null
+++ b/scripts/platforms/ascend_npu/single/run_ltx2_3_s2v.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# set path and first
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/LTX-2
+AUDIO_PATH=/data/wushuo1/ltx2_s2v_sample.wav
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES=0
+
+# set environment variables
+source "${lightx2v_path}/scripts/base/base.sh"
+
+python -m lightx2v.infer \
+ --model_cls ltx2 \
+ --task ltx2_s2v \
+ --model_path "${model_path}" \
+ --config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/ltx2_3.json \
+ --audio_path "${AUDIO_PATH}" \
+ --prompt "A person speaks clearly in a quiet room, natural lighting, cinematic medium shot." \
+ --negative_prompt "blurry, out of focus, overexposed, underexposed, low contrast, excessive noise, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, disfigured hands, artifacts, inconsistent perspective, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, off-sync audio, AI artifacts." \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_ltx2_s2v.mp4" \
diff --git a/scripts/platforms/ascend_npu/run_wan21_t2v.sh b/scripts/platforms/ascend_npu/single/run_wan21_t2v.sh
similarity index 84%
rename from scripts/platforms/ascend_npu/run_wan21_t2v.sh
rename to scripts/platforms/ascend_npu/single/run_wan21_t2v.sh
index 6d378818a..661ea8f0c 100755
--- a/scripts/platforms/ascend_npu/run_wan21_t2v.sh
+++ b/scripts/platforms/ascend_npu/single/run_wan21_t2v.sh
@@ -3,8 +3,8 @@
# System management interface: npu-smi info
# set path firstly
-lightx2v_path=
-model_path=
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/Wan2.1-T2V-1.3B
export PLATFORM=ascend_npu
export ASCEND_RT_VISIBLE_DEVICES=0
@@ -16,7 +16,7 @@ python -m lightx2v.infer \
--model_cls wan2.1 \
--task t2v \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/ascend_npu/wan_t2v.json \
+--config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/wan_t2v.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v.mp4
diff --git a/scripts/platforms/ascend_npu/run_wan22_moe_t2v.sh b/scripts/platforms/ascend_npu/single/run_wan22_moe_t2v.sh
similarity index 83%
rename from scripts/platforms/ascend_npu/run_wan22_moe_t2v.sh
rename to scripts/platforms/ascend_npu/single/run_wan22_moe_t2v.sh
index 1149c0ef9..bc34ec3ec 100755
--- a/scripts/platforms/ascend_npu/run_wan22_moe_t2v.sh
+++ b/scripts/platforms/ascend_npu/single/run_wan22_moe_t2v.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# set path firstly
-lightx2v_path=
-model_path=
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/Wan2.2-T2V-A14B
export PLATFORM=ascend_npu
export ASCEND_RT_VISIBLE_DEVICES=0
@@ -14,7 +14,7 @@ python -m lightx2v.infer \
--model_cls wan2.2_moe \
--task t2v \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/ascend_npu/wan_moe_t2v.json \
+--config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/wan_moe_t2v.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_t2v.mp4
diff --git a/scripts/platforms/ascend_npu/single/run_wan_t2v_sf.sh b/scripts/platforms/ascend_npu/single/run_wan_t2v_sf.sh
new file mode 100644
index 000000000..b82c61191
--- /dev/null
+++ b/scripts/platforms/ascend_npu/single/run_wan_t2v_sf.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# System management interface: npu-smi info
+
+# set path firstly
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/Wan2.1-T2V-1.3B
+
+export PLATFORM=ascend_npu
+export ASCEND_RT_VISIBLE_DEVICES=0
+
+# set environment variables
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--model_cls wan2.1_sf \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/wan_t2v_sf.json \
+--prompt 'A stylish woman strolls down a bustling Tokyo street, the warm glow of neon lights and animated city signs casting vibrant reflections. She wears a sleek black leather jacket paired with a flowing red dress and black boots, her black purse slung over her shoulder. Sunglasses perched on her nose and a bold red lipstick add to her confident, casual demeanor. The street is damp and reflective, creating a mirror-like effect that enhances the colorful lights and shadows. Pedestrians move about, adding to the lively atmosphere. The scene is captured in a dynamic medium shot with the woman walking slightly to one side, highlighting her graceful strides.' \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v_sf.mp4
diff --git a/scripts/platforms/ascend_npu/z_image_turbo_t2i.sh b/scripts/platforms/ascend_npu/single/z_image_turbo_t2i.sh
similarity index 82%
rename from scripts/platforms/ascend_npu/z_image_turbo_t2i.sh
rename to scripts/platforms/ascend_npu/single/z_image_turbo_t2i.sh
index a8eb0fd27..a4e455b5b 100755
--- a/scripts/platforms/ascend_npu/z_image_turbo_t2i.sh
+++ b/scripts/platforms/ascend_npu/single/z_image_turbo_t2i.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# set path firstly
-lightx2v_path=/path/to/LightX2V
-model_path=Tongyi-MAI/Z-Image-Turbo
+lightx2v_path=/data/wushuo1/LightX2V
+model_path=/data/wushuo1/models/Z-Image-Turbo
export PLATFORM=ascend_npu
export ASCEND_RT_VISIBLE_DEVICES=0
@@ -14,7 +14,7 @@ python -m lightx2v.infer \
--model_cls z_image \
--task t2i \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/ascend_npu/z_image_turbo_t2i.json \
+--config_json ${lightx2v_path}/configs/platforms/ascend_npu/single/z_image_turbo_t2i.json \
--prompt 'Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights.' \
--negative_prompt " " \
--save_result_path ${lightx2v_path}/save_results/z_image_turbo.png \
diff --git a/scripts/platforms/metax/qwen_image_i2i_2511.sh b/scripts/platforms/metax/qwen_image_i2i_2511.sh
deleted file mode 100755
index df70aa4df..000000000
--- a/scripts/platforms/metax/qwen_image_i2i_2511.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-# System management interface: mx-smi
-
-# set path firstly
-lightx2v_path=
-model_path=
-
-export PLATFORM="metax_cuda"
-export CUDA_VISIBLE_DEVICES=0
-
-# set environment variables
-source ${lightx2v_path}/scripts/base/base.sh
-
-python -m lightx2v.infer \
- --model_cls qwen_image \
- --task i2i \
- --model_path $model_path \
- --config_json ${lightx2v_path}/configs/platforms/metax/qwen_image_i2i_2511.json \
- --prompt "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3." \
- --negative_prompt " " \
- --image_path "1.png,2.png,3.png" \
- --save_result_path ${lightx2v_path}/save_results/qwen_image_i2i_2511.png \
- --seed 0
diff --git a/scripts/platforms/metax/single/infer_flux2_dev.sh b/scripts/platforms/metax/single/infer_flux2_dev.sh
new file mode 100755
index 000000000..ebdba907b
--- /dev/null
+++ b/scripts/platforms/metax/single/infer_flux2_dev.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Flux2 Dev T2I Inference Script for MetaX
+# System management interface: mx-smi
+
+lightx2v_path=/data/LightX2V
+model_path=/data/models/FLUX.2-dev
+
+export PLATFORM="metax_cuda"
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+ --model_cls flux2_dev \
+ --task t2i \
+ --model_path $model_path \
+ --config_json ${lightx2v_path}/configs/platforms/metax/single/flux2_dev.json \
+ --prompt 'Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text "BFL Diffusers" on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom.' \
+ --save_result_path ${lightx2v_path}/save_results/flux2_dev_metax.png \
+ --seed 42
diff --git a/scripts/platforms/metax/single/logging.sh b/scripts/platforms/metax/single/logging.sh
new file mode 100755
index 000000000..d8db91eb6
--- /dev/null
+++ b/scripts/platforms/metax/single/logging.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+LOG_DIR=${LOG_DIR:-${lightx2v_path}/logs/platforms/metax/single}
+mkdir -p "${LOG_DIR}"
+
+script_name=$(basename "$0" .sh)
+timestamp=$(date +"%Y%m%d_%H%M%S")
+LOG_FILE=${LOG_FILE:-${LOG_DIR}/${script_name}_${timestamp}.log}
+
+exec > >(tee -a "${LOG_FILE}") 2>&1
+echo "Logging to ${LOG_FILE}"
diff --git a/scripts/platforms/metax/single/longcat_image_t2i.sh b/scripts/platforms/metax/single/longcat_image_t2i.sh
new file mode 100755
index 000000000..2e76365ca
--- /dev/null
+++ b/scripts/platforms/metax/single/longcat_image_t2i.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# LongCat Image T2I Inference Script for MetaX
+# System management interface: mx-smi
+
+lightx2v_path=/data/LightX2V
+model_path=/data/models/LongCat-Image
+
+export PLATFORM="metax_cuda"
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+ --model_cls longcat_image \
+ --task t2i \
+ --model_path $model_path \
+ --config_json ${lightx2v_path}/configs/platforms/metax/single/longcat_image_t2i.json \
+ --prompt "一只小猫躺在沙发上" \
+ --negative_prompt "" \
+ --save_result_path ${lightx2v_path}/save_results/longcat_image_t2i_metax.png \
+ --seed 42
diff --git a/scripts/platforms/metax/single/qwen_image_t2i_2512.sh b/scripts/platforms/metax/single/qwen_image_t2i_2512.sh
new file mode 100755
index 000000000..9898dc278
--- /dev/null
+++ b/scripts/platforms/metax/single/qwen_image_t2i_2512.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# System management interface: mx-smi
+
+# set path firstly
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Qwen-Image-2512
+
+export PLATFORM="metax_cuda"
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/metax/single/logging.sh
+
+# set environment variables
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--model_cls qwen_image \
+--task t2i \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/metax/single/qwen_image_t2i_2512.json \
+--prompt 'A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition, Ultra HD, 4K, cinematic composition.' \
+--negative_prompt " " \
+--save_result_path ${lightx2v_path}/save_results/qwen_image_t2i_2512_metax.png \
+--seed 42
diff --git a/scripts/platforms/metax/single/run_hy15_t2v_480p.sh b/scripts/platforms/metax/single/run_hy15_t2v_480p.sh
new file mode 100755
index 000000000..f551028f5
--- /dev/null
+++ b/scripts/platforms/metax/single/run_hy15_t2v_480p.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# HunyuanVideo 1.5 T2V Inference Script for MetaX
+# System management interface: mx-smi
+
+lightx2v_path=/data/LightX2V
+model_path=/data/models/HunyuanVideo-1.5
+
+export PLATFORM="metax_cuda"
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/metax/single/logging.sh
+
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--seed 123 \
+--model_cls hunyuan_video_1.5 \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/metax/single/hunyuan_video_t2v_480p.json \
+--prompt "A close-up shot captures a scene on a polished, light-colored granite kitchen counter, illuminated by soft natural light from an unseen window. Initially, the frame focuses on a tall, clear glass filled with golden, translucent apple juice standing next to a single, shiny red apple with a green leaf still attached to its stem. The camera moves horizontally to the right. As the shot progresses, a white ceramic plate smoothly enters the frame, revealing a fresh arrangement of about seven or eight more apples, a mix of vibrant reds and greens, piled neatly upon it. A shallow depth of field keeps the focus sharply on the fruit and glass, while the kitchen backsplash in the background remains softly blurred. The scene is in a realistic style." \
+--negative_prompt "" \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_hunyuan_video_15_t2v_metax.mp4
diff --git a/scripts/platforms/metax/single/run_ltx2_3_i2av.sh b/scripts/platforms/metax/single/run_ltx2_3_i2av.sh
new file mode 100644
index 000000000..f8b76af09
--- /dev/null
+++ b/scripts/platforms/metax/single/run_ltx2_3_i2av.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# set path and first
+lightx2v_path=/data/LightX2V
+model_path=/data/models/LTX-2
+# AUDIO_PATH=
+IMAGE_PATH=/data/LightX2V/save_results/flux2_dev.png
+IMAGE_STRENGTH=1.0
+
+# export CUDA_VISIBLE_DEVICES=0
+export PLATFORM="metax_cuda"
+export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+# set environment variables
+source "${lightx2v_path}/scripts/base/base.sh"
+
+python -m lightx2v.infer \
+ --model_cls ltx2 \
+ --task i2av \
+ --model_path "${model_path}" \
+ --config_json ${lightx2v_path}/configs/platforms/metax/single/ltx_2_3.json \
+ --image_path "${IMAGE_PATH}" \
+ --image_strength "${IMAGE_STRENGTH}" \
+ --prompt "The crab crawled out and danced." \
+ --negative_prompt "blurry, out of focus, overexposed, underexposed, low contrast, excessive noise, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, disfigured hands, artifacts, inconsistent perspective, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, off-sync audio, AI artifacts." \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_ltx2_i2av.mp4" \
diff --git a/scripts/platforms/metax/single/run_ltx2_3_s2v.sh b/scripts/platforms/metax/single/run_ltx2_3_s2v.sh
new file mode 100755
index 000000000..75079e006
--- /dev/null
+++ b/scripts/platforms/metax/single/run_ltx2_3_s2v.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# LTX-2.3 S2V Inference Script for MetaX
+# System management interface: mx-smi
+
+lightx2v_path=/data/LightX2V
+model_path=/data/models/LTX-2
+AUDIO_PATH=/data/ltx2_s2v_sample.wav
+
+export PLATFORM="metax_cuda"
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/metax/single/logging.sh
+
+source "${lightx2v_path}/scripts/base/base.sh"
+
+python -m lightx2v.infer \
+ --model_cls ltx2 \
+ --task ltx2_s2v \
+ --model_path "${model_path}" \
+ --config_json ${lightx2v_path}/configs/platforms/metax/single/ltx_2_3.json \
+ --audio_path "${AUDIO_PATH}" \
+ --prompt "A person speaks clearly in a quiet room, natural lighting, cinematic medium shot." \
+ --negative_prompt "blurry, out of focus, overexposed, underexposed, low contrast, excessive noise, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, disfigured hands, artifacts, inconsistent perspective, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, off-sync audio, AI artifacts." \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_ltx2_s2v_metax.mp4" \
diff --git a/scripts/platforms/metax/run_wan21_t2v.sh b/scripts/platforms/metax/single/run_wan21_t2v.sh
similarity index 71%
rename from scripts/platforms/metax/run_wan21_t2v.sh
rename to scripts/platforms/metax/single/run_wan21_t2v.sh
index 9ef702223..84dea1a82 100755
--- a/scripts/platforms/metax/run_wan21_t2v.sh
+++ b/scripts/platforms/metax/single/run_wan21_t2v.sh
@@ -1,12 +1,17 @@
#!/bin/bash
# set path firstly
-lightx2v_path=/path/to/LightX2v
-model_path=/path/to/model
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Wan2.1-T2V-1.3B
# export CUDA_VISIBLE_DEVICES=5
export PLATFORM="metax_cuda"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/metax/single/logging.sh
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
@@ -15,7 +20,7 @@ python -m lightx2v.infer \
--model_cls wan2.1 \
--task t2v \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/metax/wan_t2v.json \
+--config_json ${lightx2v_path}/configs/platforms/metax/single/wan_t2v.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
---save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v.mp4
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan21_t2v_metax.mp4
diff --git a/scripts/platforms/metax/run_wan22_t2v.sh b/scripts/platforms/metax/single/run_wan22_t2v.sh
old mode 100644
new mode 100755
similarity index 71%
rename from scripts/platforms/metax/run_wan22_t2v.sh
rename to scripts/platforms/metax/single/run_wan22_t2v.sh
index 6cf17f36c..09deea3ea
--- a/scripts/platforms/metax/run_wan22_t2v.sh
+++ b/scripts/platforms/metax/single/run_wan22_t2v.sh
@@ -1,12 +1,17 @@
#!/bin/bash
# set path firstly
-lightx2v_path=/path/to/LightX2v
-model_path=/path/to/model
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Wan2.2-T2V-A14B
# export CUDA_VISIBLE_DEVICES=5
export PLATFORM="metax_cuda"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/metax/single/logging.sh
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
@@ -15,7 +20,7 @@ python -m lightx2v.infer \
--model_cls wan2.2_moe \
--task t2v \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/metax/wan22_t2v.json \
+--config_json ${lightx2v_path}/configs/platforms/metax/single/wan22_t2v.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
---save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v.mp4
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_t2v_metax.mp4
diff --git a/scripts/platforms/metax/single/run_wan_t2v_sf.sh b/scripts/platforms/metax/single/run_wan_t2v_sf.sh
new file mode 100755
index 000000000..4e2ce1f82
--- /dev/null
+++ b/scripts/platforms/metax/single/run_wan_t2v_sf.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Self-Forcing Wan2.1 T2V Inference Script for MetaX
+# System management interface: mx-smi
+
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Wan2.1-T2V-1.3B
+
+export PLATFORM="metax_cuda"
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/metax/single/logging.sh
+
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--model_cls wan2.1_sf \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/metax/single/wan_t2v_sf.json \
+--prompt 'A stylish woman strolls down a bustling Tokyo street, the warm glow of neon lights and animated city signs casting vibrant reflections. She wears a sleek black leather jacket paired with a flowing red dress and black boots, her black purse slung over her shoulder. Sunglasses perched on her nose and a bold red lipstick add to her confident, casual demeanor. The street is damp and reflective, creating a mirror-like effect that enhances the colorful lights and shadows. Pedestrians move about, adding to the lively atmosphere. The scene is captured in a dynamic medium shot with the woman walking slightly to one side, highlighting her graceful strides.' \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v_sf_metax.mp4
diff --git a/scripts/platforms/metax/single/z_image_turbo_t2i.sh b/scripts/platforms/metax/single/z_image_turbo_t2i.sh
new file mode 100755
index 000000000..472120976
--- /dev/null
+++ b/scripts/platforms/metax/single/z_image_turbo_t2i.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Z-Image Turbo T2I Inference Script for MetaX
+# System management interface: mx-smi
+
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Z-Image-Turbo
+
+export PLATFORM="metax_cuda"
+export CUDA_VISIBLE_DEVICES=0
+export MACA_PATH=${MACA_PATH:-/opt/maca-3.3.0}
+export PATH=${MACA_PATH}/bin:${PATH}
+export LD_LIBRARY_PATH=${MACA_PATH}/lib:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/metax/single/logging.sh
+
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--model_cls z_image \
+--task t2i \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/metax/single/z_image_turbo_t2i.json \
+--prompt 'Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights.' \
+--negative_prompt " " \
+--save_result_path ${lightx2v_path}/save_results/z_image_turbo_metax.png \
+--seed 42 \
+--aspect_ratio "16:9"
diff --git a/scripts/platforms/mlu/qwen_image_i2i_2511.sh b/scripts/platforms/mlu/qwen_image_i2i_2511.sh
deleted file mode 100755
index c54dcb979..000000000
--- a/scripts/platforms/mlu/qwen_image_i2i_2511.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-# System management interface: cnmon
-
-# set path firstly
-lightx2v_path=
-model_path=
-
-export PLATFORM=cambricon_mlu
-export MLU_VISIBLE_DEVICES=0
-export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
-export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
-
-# set environment variables
-source ${lightx2v_path}/scripts/base/base.sh
-
-python -m lightx2v.infer \
- --model_cls qwen_image \
- --task i2i \
- --model_path $model_path \
- --config_json ${lightx2v_path}/configs/platforms/mlu/qwen_image_i2i_2511.json \
- --prompt "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3." \
- --negative_prompt " " \
- --image_path "1.png,2.png,3.png" \
- --save_result_path ${lightx2v_path}/save_results/qwen_image_i2i_2511.png \
- --seed 0
diff --git a/scripts/platforms/mlu/qwen_image_t2i_2512_dist.sh b/scripts/platforms/mlu/qwen_image_t2i_2512_distill_dist.sh
similarity index 100%
rename from scripts/platforms/mlu/qwen_image_t2i_2512_dist.sh
rename to scripts/platforms/mlu/qwen_image_t2i_2512_distill_dist.sh
diff --git a/scripts/platforms/mlu/single/infer_flux2_dev.sh b/scripts/platforms/mlu/single/infer_flux2_dev.sh
new file mode 100644
index 000000000..1ccec16f2
--- /dev/null
+++ b/scripts/platforms/mlu/single/infer_flux2_dev.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Flux2 Dev T2I Inference Script for Cambricon MLU
+# Usage: bash infer_flux2_dev.sh
+
+# set path firstly
+lightx2v_path=/data/LightX2V
+model_path=/data/models/FLUX.2-dev
+
+export PLATFORM=cambricon_mlu
+export MLU_VISIBLE_DEVICES=0
+export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
+export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+
+
+source ${lightx2v_path}/scripts/platforms/mlu/logging.sh
+
+# set environment variables
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+ --model_cls flux2_dev \
+ --task t2i \
+ --model_path $model_path \
+ --config_json ${lightx2v_path}/configs/platforms/mlu/single/flux2_dev.json \
+ --prompt 'Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text "BFL Diffusers" on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom.' \
+ --save_result_path ${lightx2v_path}/save_results/flux2_dev_mlu.png \
+ --seed 42
diff --git a/scripts/platforms/mlu/single/logging.sh b/scripts/platforms/mlu/single/logging.sh
new file mode 100755
index 000000000..b97fdd58e
--- /dev/null
+++ b/scripts/platforms/mlu/single/logging.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+LOG_DIR=${LOG_DIR:-${lightx2v_path}/logs/platforms/mlu/single}
+mkdir -p "${LOG_DIR}"
+
+script_name=$(basename "$0" .sh)
+timestamp=$(date +"%Y%m%d_%H%M%S")
+LOG_FILE=${LOG_FILE:-${LOG_DIR}/${script_name}_${timestamp}.log}
+
+exec > >(tee -a "${LOG_FILE}") 2>&1
+echo "Logging to ${LOG_FILE}"
diff --git a/scripts/platforms/mlu/single/longcat_image_t2i.sh b/scripts/platforms/mlu/single/longcat_image_t2i.sh
new file mode 100644
index 000000000..c15bf2bff
--- /dev/null
+++ b/scripts/platforms/mlu/single/longcat_image_t2i.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# LongCat Image T2I Inference Script for Cambricon MLU
+# Usage: bash longcat_image_t2i.sh
+
+# set path firstly
+lightx2v_path=/data/LightX2V
+model_path=/data/models/LongCat-Image
+
+export PLATFORM=cambricon_mlu
+export MLU_VISIBLE_DEVICES=0
+export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
+export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
+source ${lightx2v_path}/scripts/platforms/mlu/logging.sh
+
+# set environment variables
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+ --model_cls longcat_image \
+ --task t2i \
+ --model_path $model_path \
+ --config_json ${lightx2v_path}/configs/platforms/mlu/single/longcat_image_t2i.json \
+ --prompt "一只小猫躺在沙发上" \
+ --negative_prompt "" \
+ --save_result_path ${lightx2v_path}/save_results/longcat_image_t2i_mlu.png \
+ --seed 42
diff --git a/scripts/platforms/mlu/qwen_image_t2i_2512.sh b/scripts/platforms/mlu/single/qwen_image_t2i_2512.sh
similarity index 79%
rename from scripts/platforms/mlu/qwen_image_t2i_2512.sh
rename to scripts/platforms/mlu/single/qwen_image_t2i_2512.sh
index 628b7e943..e95a6058e 100755
--- a/scripts/platforms/mlu/qwen_image_t2i_2512.sh
+++ b/scripts/platforms/mlu/single/qwen_image_t2i_2512.sh
@@ -3,8 +3,8 @@
# System management interface: cnmon
# set path firstly
-lightx2v_path=/root/yongyang3/LightX2V
-model_path=/root/wushuo/models/Qwen/Qwen-Image-2512
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Qwen-Image-2512
export PLATFORM=cambricon_mlu
export MLU_VISIBLE_DEVICES=0
@@ -12,14 +12,15 @@ export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
# set environment variables
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls qwen_image \
--task t2i \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/mlu/qwen_image_t2i_2512_distill.json \
+--config_json ${lightx2v_path}/configs/platforms/mlu/single/qwen_image_t2i_2512.json \
--prompt 'A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition, Ultra HD, 4K, cinematic composition.' \
--negative_prompt " " \
---save_result_path ${lightx2v_path}/save_results/qwen_image_t2i_2512_distill.png \
+--save_result_path ${lightx2v_path}/save_results/qwen_image_t2i_2512_mlu.png \
--seed 42
diff --git a/scripts/platforms/mlu/single/run_hy15_t2v_480p.sh b/scripts/platforms/mlu/single/run_hy15_t2v_480p.sh
new file mode 100644
index 000000000..8a864ec45
--- /dev/null
+++ b/scripts/platforms/mlu/single/run_hy15_t2v_480p.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# set path firstly
+lightx2v_path=/data/LightX2V
+model_path=/data/models/HunyuanVideo-1.5
+
+export PLATFORM=cambricon_mlu
+export MLU_VISIBLE_DEVICES=0
+export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
+export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
+source ${lightx2v_path}/scripts/platforms/mlu/logging.sh
+
+# set environment variables
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+--seed 123 \
+--model_cls hunyuan_video_1.5 \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/mlu/single/hunyuan_video_t2v_480p.json \
+--prompt "A close-up shot captures a scene on a polished, light-colored granite kitchen counter, illuminated by soft natural light from an unseen window. Initially, the frame focuses on a tall, clear glass filled with golden, translucent apple juice standing next to a single, shiny red apple with a green leaf still attached to its stem. The camera moves horizontally to the right. As the shot progresses, a white ceramic plate smoothly enters the frame, revealing a fresh arrangement of about seven or eight more apples, a mix of vibrant reds and greens, piled neatly upon it. A shallow depth of field keeps the focus sharply on the fruit and glass, while the kitchen backsplash in the background remains softly blurred. The scene is in a realistic style." \
+--negative_prompt "" \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_hunyuan_video_15_t2v_mlu.mp4
diff --git a/scripts/platforms/mlu/single/run_ltx2_3_s2v.sh b/scripts/platforms/mlu/single/run_ltx2_3_s2v.sh
new file mode 100644
index 000000000..66c3742dc
--- /dev/null
+++ b/scripts/platforms/mlu/single/run_ltx2_3_s2v.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# set path firstly
+lightx2v_path=/data/LightX2V
+model_path=/data/models/LTX-2
+AUDIO_PATH=/data/ltx2_s2v_sample.wav
+
+export PLATFORM=cambricon_mlu
+export MLU_VISIBLE_DEVICES=0
+export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
+export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
+source ${lightx2v_path}/scripts/platforms/mlu/logging.sh
+
+# set environment variables
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+python -m lightx2v.infer \
+ --model_cls ltx2 \
+ --task ltx2_s2v \
+ --model_path "${model_path}" \
+ --config_json ${lightx2v_path}/configs/platforms/mlu/single/ltx2_3.json \
+ --audio_path "${AUDIO_PATH}" \
+ --prompt "A person speaks clearly in a quiet room, natural lighting, cinematic medium shot." \
+ --negative_prompt "blurry, out of focus, overexposed, underexposed, low contrast, excessive noise, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, disfigured hands, artifacts, inconsistent perspective, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, off-sync audio, AI artifacts." \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_ltx2_s2v_mlu.mp4"
diff --git a/scripts/platforms/mlu/run_wan21_t2v.sh b/scripts/platforms/mlu/single/run_wan21_t2v.sh
similarity index 88%
rename from scripts/platforms/mlu/run_wan21_t2v.sh
rename to scripts/platforms/mlu/single/run_wan21_t2v.sh
index 58fe09114..d5ef8304b 100755
--- a/scripts/platforms/mlu/run_wan21_t2v.sh
+++ b/scripts/platforms/mlu/single/run_wan21_t2v.sh
@@ -12,13 +12,14 @@ export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
# set environment variables
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls wan2.1 \
--task t2v \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/mlu/wan_t2v.json \
+--config_json ${lightx2v_path}/configs/platforms/mlu/single/wan_t2v.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v.mp4
diff --git a/scripts/platforms/mlu/single/run_wan22_moe_t2v.sh b/scripts/platforms/mlu/single/run_wan22_moe_t2v.sh
new file mode 100644
index 000000000..104a4fae2
--- /dev/null
+++ b/scripts/platforms/mlu/single/run_wan22_moe_t2v.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# set path firstly
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Wan2.2-T2V-A14B
+
+export PLATFORM=cambricon_mlu
+export MLU_VISIBLE_DEVICES=0
+export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
+export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+
+source ${lightx2v_path}/scripts/platforms/mlu/logging.sh
+
+# set environment variables
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+--model_cls wan2.2_moe \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/mlu/single/wan_moe_t2v.json \
+--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
+--negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_t2v_mlu.mp4
diff --git a/scripts/platforms/mlu/single/run_wan_t2v_sf.sh b/scripts/platforms/mlu/single/run_wan_t2v_sf.sh
new file mode 100644
index 000000000..e44e08f0d
--- /dev/null
+++ b/scripts/platforms/mlu/single/run_wan_t2v_sf.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# System management interface: cnmon
+
+# set path firstly
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Wan2.1-T2V-1.3B
+
+export PLATFORM=cambricon_mlu
+export MLU_VISIBLE_DEVICES=0
+export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
+export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
+source ${lightx2v_path}/scripts/platforms/mlu/logging.sh
+
+# set environment variables
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+--model_cls wan2.1_sf \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/mlu/single/wan_t2v_sf.json \
+--prompt 'A stylish woman strolls down a bustling Tokyo street, the warm glow of neon lights and animated city signs casting vibrant reflections. She wears a sleek black leather jacket paired with a flowing red dress and black boots, her black purse slung over her shoulder. Sunglasses perched on her nose and a bold red lipstick add to her confident, casual demeanor. The street is damp and reflective, creating a mirror-like effect that enhances the colorful lights and shadows. Pedestrians move about, adding to the lively atmosphere. The scene is captured in a dynamic medium shot with the woman walking slightly to one side, highlighting her graceful strides.' \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v_sf_mlu.mp4
diff --git a/scripts/platforms/mlu/z_image_turbo_t2i.sh b/scripts/platforms/mlu/single/z_image_turbo_t2i.sh
old mode 100755
new mode 100644
similarity index 69%
rename from scripts/platforms/mlu/z_image_turbo_t2i.sh
rename to scripts/platforms/mlu/single/z_image_turbo_t2i.sh
index e3e09fa00..eb2132ab9
--- a/scripts/platforms/mlu/z_image_turbo_t2i.sh
+++ b/scripts/platforms/mlu/single/z_image_turbo_t2i.sh
@@ -3,24 +3,29 @@
# System management interface: cnmon
# set path firstly
-lightx2v_path=/root/yongyang3/LightX2V
-model_path=/root/wushuo/models/Tongyi-MAI/Z-Image-Turbo
+lightx2v_path=/data/LightX2V
+model_path=/data/models/Z-Image-Turbo
export PLATFORM=cambricon_mlu
export MLU_VISIBLE_DEVICES=0
export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+source "${lightx2v_path}/scripts/platforms/mlu/single/logging.sh"
+source ${lightx2v_path}/scripts/platforms/mlu/logging.sh
+
# set environment variables
source ${lightx2v_path}/scripts/base/base.sh
+mkdir -p ${lightx2v_path}/save_results
+
python -m lightx2v.infer \
--model_cls z_image \
--task t2i \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/mlu/z_image_turbo_t2i.json \
+--config_json ${lightx2v_path}/configs/platforms/mlu/single/z_image_turbo_t2i.json \
--prompt 'Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights.' \
--negative_prompt " " \
---save_result_path ${lightx2v_path}/save_results/z_image_turbo.png \
+--save_result_path ${lightx2v_path}/save_results/z_image_turbo_mlu.png \
--seed 42 \
--aspect_ratio "16:9"
diff --git a/scripts/platforms/nvidia/dist/infer_flux2_dev_tp8.sh b/scripts/platforms/nvidia/dist/infer_flux2_dev_tp8.sh
new file mode 100755
index 000000000..03977d986
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/infer_flux2_dev_tp8.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Flux2 Dev T2I 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/black-forest-labs/FLUX.2-dev}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls flux2_dev \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/flux2_dev_tp8.json" \
+ --prompt 'Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text "BFL Diffusers" on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom.' \
+ --save_result_path "${lightx2v_path}/save_results/flux2_dev_tp8.png" \
+ --seed 42
diff --git a/scripts/platforms/nvidia/dist/logging.sh b/scripts/platforms/nvidia/dist/logging.sh
new file mode 100755
index 000000000..5a55cef0a
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/logging.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+LOG_DIR=${LOG_DIR:-${lightx2v_path}/logs/platforms/nvidia/dist}
+mkdir -p "${LOG_DIR}"
+
+script_name=$(basename "$0" .sh)
+timestamp=$(date +"%Y%m%d_%H%M%S")
+LOG_FILE=${LOG_FILE:-${LOG_DIR}/${script_name}_${timestamp}.log}
+
+exec > >(tee -a "${LOG_FILE}") 2>&1
+echo "Logging to ${LOG_FILE}"
diff --git a/scripts/platforms/nvidia/dist/longcat_image_t2i.sh b/scripts/platforms/nvidia/dist/longcat_image_t2i.sh
new file mode 100755
index 000000000..570e1ce4d
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/longcat_image_t2i.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# LongCat Image T2I 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/LongCat-Image}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls longcat_image \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/longcat_image_t2i_dist8.json" \
+ --prompt "一只小猫躺在沙发上" \
+ --negative_prompt "" \
+ --save_result_path "${lightx2v_path}/save_results/longcat_image_t2i_dist8.png" \
+ --seed 42
diff --git a/scripts/platforms/nvidia/dist/qwen_image_t2i_2512.sh b/scripts/platforms/nvidia/dist/qwen_image_t2i_2512.sh
new file mode 100755
index 000000000..6278bd3f3
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/qwen_image_t2i_2512.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Qwen Image T2I 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/Qwen-Image-2512}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls qwen_image \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/qwen_image_t2i_2512_dist8.json" \
+ --prompt 'A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition, Ultra HD, 4K, cinematic composition.' \
+ --negative_prompt " " \
+ --save_result_path "${lightx2v_path}/save_results/qwen_image_t2i_2512_dist8.png" \
+ --seed 42
diff --git a/scripts/platforms/nvidia/dist/run_hy15_t2v_480p.sh b/scripts/platforms/nvidia/dist/run_hy15_t2v_480p.sh
new file mode 100755
index 000000000..f29cb9103
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/run_hy15_t2v_480p.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# HunyuanVideo 1.5 T2V 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/HunyuanVideo-1.5}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --seed 123 \
+ --model_cls hunyuan_video_1.5 \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist_8/hunyuan_video_t2v_480p.json" \
+ --prompt "A close-up shot captures a scene on a polished, light-colored granite kitchen counter, illuminated by soft natural light from an unseen window. Initially, the frame focuses on a tall, clear glass filled with golden, translucent apple juice standing next to a single, shiny red apple with a green leaf still attached to its stem. The camera moves horizontally to the right. As the shot progresses, a white ceramic plate smoothly enters the frame, revealing a fresh arrangement of about seven or eight more apples, a mix of vibrant reds and greens, piled neatly upon it. A shallow depth of field keeps the focus sharply on the fruit and glass, while the kitchen backsplash in the background remains softly blurred. The scene is in a realistic style." \
+ --negative_prompt "" \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_hunyuan_video_15_t2v_dist8.mp4"
diff --git a/scripts/platforms/nvidia/dist/run_ltx2_3_s2v_tp8.sh b/scripts/platforms/nvidia/dist/run_ltx2_3_s2v_tp8.sh
new file mode 100755
index 000000000..55f0a8da2
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/run_ltx2_3_s2v_tp8.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# LTX-2 S2V 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/LTX-2}
+AUDIO_PATH=${AUDIO_PATH:-/data/nvme1/wushuo/ltx2_s2v_sample.wav}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls ltx2 \
+ --task ltx2_s2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/ltx2_3_tp8.json" \
+ --audio_path "${AUDIO_PATH}" \
+ --prompt "A person speaks clearly in a quiet room, natural lighting, cinematic medium shot." \
+ --negative_prompt "blurry, out of focus, overexposed, underexposed, low contrast, excessive noise, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, disfigured hands, artifacts, inconsistent perspective, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, off-sync audio, AI artifacts." \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_ltx2_s2v_dist8.mp4"
diff --git a/scripts/platforms/nvidia/dist/run_wan21_t2v.sh b/scripts/platforms/nvidia/dist/run_wan21_t2v.sh
new file mode 100755
index 000000000..2f1ace90e
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/run_wan21_t2v.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Wan2.1 T2V 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/Wan2.1-T2V-1.3B}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls wan2.1 \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/wan_t2v_dist8.json" \
+ --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
+ --negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_wan_t2v_dist8.mp4"
diff --git a/scripts/platforms/nvidia/dist/run_wan22_moe_t2v.sh b/scripts/platforms/nvidia/dist/run_wan22_moe_t2v.sh
new file mode 100755
index 000000000..084566a28
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/run_wan22_moe_t2v.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Wan2.2 MoE T2V 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/Wan2.2-T2V-A14B}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls wan2.2_moe \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/wan_moe_t2v_dist8.json" \
+ --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
+ --negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_wan22_moe_t2v_dist8.mp4"
diff --git a/scripts/platforms/nvidia/dist/run_wan_t2v_sf.sh b/scripts/platforms/nvidia/dist/run_wan_t2v_sf.sh
new file mode 100755
index 000000000..5daff84bc
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/run_wan_t2v_sf.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Wan2.1 Self-Forcing T2V 8-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/Wan2.1-T2V-1.3B}
+gpus=${GPUS:-8}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls wan2.1_sf \
+ --task t2v \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/wan_t2v_sf_dist8.json" \
+ --prompt 'A stylish woman strolls down a bustling Tokyo street, the warm glow of neon lights and animated city signs casting vibrant reflections. She wears a sleek black leather jacket paired with a flowing red dress and black boots, her black purse slung over her shoulder. Sunglasses perched on her nose and a bold red lipstick add to her confident, casual demeanor. The street is damp and reflective, creating a mirror-like effect that enhances the colorful lights and shadows. Pedestrians move about, adding to the lively atmosphere. The scene is captured in a dynamic medium shot with the woman walking slightly to one side, highlighting her graceful strides.' \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_wan_t2v_sf_dist8.mp4"
diff --git a/scripts/platforms/nvidia/dist/z_image_turbo_t2i.sh b/scripts/platforms/nvidia/dist/z_image_turbo_t2i.sh
new file mode 100755
index 000000000..839ae93ce
--- /dev/null
+++ b/scripts/platforms/nvidia/dist/z_image_turbo_t2i.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Z-Image Turbo T2I 2-GPU Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=${LIGHTX2V_PATH:-/data/nvme1/wushuo/LightX2V}
+model_path=${MODEL_PATH:-/data/nvme1/wushuo/hf_models/models/Z-Image-Turbo}
+gpus=${GPUS:-2}
+
+export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-4,5}"
+
+source "${lightx2v_path}/scripts/platforms/nvidia/dist/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+mkdir -p "${lightx2v_path}/save_results"
+
+torchrun --nproc_per_node="${gpus}" -m lightx2v.infer \
+ --model_cls z_image \
+ --task t2i \
+ --model_path "${model_path}" \
+ --config_json "${lightx2v_path}/configs/platforms/nvidia/dist/z_image_turbo_t2_dist2.json" \
+ --prompt 'Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights.' \
+ --negative_prompt " " \
+ --save_result_path "${lightx2v_path}/save_results/z_image_turbo_dist2.png" \
+ --seed 42 \
+ --aspect_ratio "16:9"
diff --git a/scripts/platforms/nvidia/single/infer_flux2_dev.sh b/scripts/platforms/nvidia/single/infer_flux2_dev.sh
new file mode 100755
index 000000000..81be7888d
--- /dev/null
+++ b/scripts/platforms/nvidia/single/infer_flux2_dev.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Flux2 Dev T2I Inference Script for NVIDIA
+# System management interface: nvidia-smi
+
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/black-forest-labs/FLUX.2-dev
+
+export CUDA_VISIBLE_DEVICES=0
+
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
+source ${lightx2v_path}/scripts/base/base.sh
+
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+ --model_cls flux2_dev \
+ --task t2i \
+ --model_path $model_path \
+ --config_json ${lightx2v_path}/configs/platforms/nvidia/single/flux2_dev.json \
+ --prompt 'Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text "BFL Diffusers" on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom.' \
+ --save_result_path ${lightx2v_path}/save_results/flux2_dev.png \
+ --seed 42
diff --git a/scripts/platforms/nvidia/single/logging.sh b/scripts/platforms/nvidia/single/logging.sh
new file mode 100644
index 000000000..afccbb518
--- /dev/null
+++ b/scripts/platforms/nvidia/single/logging.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+LOG_DIR=${LOG_DIR:-${lightx2v_path}/logs/platforms/nvidia}
+mkdir -p "${LOG_DIR}"
+
+script_name=$(basename "$0" .sh)
+timestamp=$(date +"%Y%m%d_%H%M%S")
+LOG_FILE=${LOG_FILE:-${LOG_DIR}/${script_name}_${timestamp}.log}
+
+exec > >(tee -a "${LOG_FILE}") 2>&1
+echo "Logging to ${LOG_FILE}"
diff --git a/scripts/platforms/nvidia/single/longcat_image_t2i.sh b/scripts/platforms/nvidia/single/longcat_image_t2i.sh
new file mode 100755
index 000000000..b6ea6000a
--- /dev/null
+++ b/scripts/platforms/nvidia/single/longcat_image_t2i.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# LongCat Image T2I Inference Script
+# System management interface: nvidia-smi
+
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/LongCat-Image
+
+export CUDA_VISIBLE_DEVICES=0
+
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
+source ${lightx2v_path}/scripts/base/base.sh
+
+# Create output directory
+mkdir -p ${lightx2v_path}/save_results
+
+python -m lightx2v.infer \
+ --model_cls longcat_image \
+ --task t2i \
+ --model_path $model_path \
+ --config_json ${lightx2v_path}/configs/platforms/nvidia/single/longcat_image_t2i.json \
+ --prompt "一只小猫躺在沙发上" \
+ --negative_prompt "" \
+ --save_result_path ${lightx2v_path}/save_results/longcat_image_t2i.png \
+ --seed 42
diff --git a/scripts/platforms/nvidia/qwen_image_i2i_2511.sh b/scripts/platforms/nvidia/single/qwen_image_i2i_2511.sh
similarity index 68%
rename from scripts/platforms/nvidia/qwen_image_i2i_2511.sh
rename to scripts/platforms/nvidia/single/qwen_image_i2i_2511.sh
index 46a7917cb..6ebf3e7b4 100755
--- a/scripts/platforms/nvidia/qwen_image_i2i_2511.sh
+++ b/scripts/platforms/nvidia/single/qwen_image_i2i_2511.sh
@@ -3,19 +3,20 @@
# System management interface: nvidia-smi
# set path firstly
-lightx2v_path=
-model_path=
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/Qwen-Image-2512
export CUDA_VISIBLE_DEVICES=0
# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls qwen_image \
--task i2i \
--model_path $model_path \
- --config_json ${lightx2v_path}/configs/platforms/nvidia/qwen_image_i2i_2511.json \
+ --config_json ${lightx2v_path}/configs/platforms/nvidia/single/qwen_image_i2i_2511.json \
--prompt "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3." \
--negative_prompt " " \
--image_path "1.png,2.png,3.png" \
diff --git a/scripts/platforms/metax/qwen_image_t2i_2512.sh b/scripts/platforms/nvidia/single/qwen_image_t2i_2512.sh
similarity index 70%
rename from scripts/platforms/metax/qwen_image_t2i_2512.sh
rename to scripts/platforms/nvidia/single/qwen_image_t2i_2512.sh
index 1fbb62901..b096c2eb2 100755
--- a/scripts/platforms/metax/qwen_image_t2i_2512.sh
+++ b/scripts/platforms/nvidia/single/qwen_image_t2i_2512.sh
@@ -1,22 +1,22 @@
#!/bin/bash
-# System management interface: mx-smi
+# System management interface: nvidia-smi
# set path firstly
-lightx2v_path=
-model_path=
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/Qwen-Image-2512
-export PLATFORM="metax_cuda"
export CUDA_VISIBLE_DEVICES=0
# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls qwen_image \
--task t2i \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/qwen_image/qwen_image_t2i_2512.json \
+--config_json ${lightx2v_path}/configs/platforms/nvidia/single/qwen_image_t2i_2512.json \
--prompt 'A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition, Ultra HD, 4K, cinematic composition.' \
--negative_prompt " " \
--save_result_path ${lightx2v_path}/save_results/qwen_image_t2i_2512.png \
diff --git a/scripts/platforms/nvidia/single/run_hy15_t2v_480p.sh b/scripts/platforms/nvidia/single/run_hy15_t2v_480p.sh
new file mode 100755
index 000000000..4ffe3516a
--- /dev/null
+++ b/scripts/platforms/nvidia/single/run_hy15_t2v_480p.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# System management interface: nvidia-smi
+
+# set path firstly
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/HunyuanVideo-1.5
+
+export CUDA_VISIBLE_DEVICES=0
+
+# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--seed 123 \
+--model_cls hunyuan_video_1.5 \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/nvidia/single/hunyuan_video_t2v_480p.json \
+--prompt "A close-up shot captures a scene on a polished, light-colored granite kitchen counter, illuminated by soft natural light from an unseen window. Initially, the frame focuses on a tall, clear glass filled with golden, translucent apple juice standing next to a single, shiny red apple with a green leaf still attached to its stem. The camera moves horizontally to the right. As the shot progresses, a white ceramic plate smoothly enters the frame, revealing a fresh arrangement of about seven or eight more apples, a mix of vibrant reds and greens, piled neatly upon it. A shallow depth of field keeps the focus sharply on the fruit and glass, while the kitchen backsplash in the background remains softly blurred. The scene is in a realistic style." \
+--negative_prompt "" \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_hunyuan_video_15_t2v.mp4
diff --git a/scripts/platforms/nvidia/single/run_ltx2_3_s2v.sh b/scripts/platforms/nvidia/single/run_ltx2_3_s2v.sh
new file mode 100755
index 000000000..bc6cb56d6
--- /dev/null
+++ b/scripts/platforms/nvidia/single/run_ltx2_3_s2v.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# System management interface: nvidia-smi
+
+# set path and first
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/LTX-2
+AUDIO_PATH=/data/nvme1/wushuo/ltx2_s2v_sample.wav
+
+export CUDA_VISIBLE_DEVICES=0
+
+# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
+source "${lightx2v_path}/scripts/base/base.sh"
+
+python -m lightx2v.infer \
+ --model_cls ltx2 \
+ --task ltx2_s2v \
+ --model_path "${model_path}" \
+ --config_json ${lightx2v_path}/configs/platforms/nvidia/single/ltx2_3.json \
+ --audio_path "${AUDIO_PATH}" \
+ --prompt "A person speaks clearly in a quiet room, natural lighting, cinematic medium shot." \
+ --negative_prompt "blurry, out of focus, overexposed, underexposed, low contrast, excessive noise, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, disfigured hands, artifacts, inconsistent perspective, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, off-sync audio, AI artifacts." \
+ --save_result_path "${lightx2v_path}/save_results/output_lightx2v_ltx2_s2v.mp4"
diff --git a/scripts/platforms/nvidia/run_wan21_t2v.sh b/scripts/platforms/nvidia/single/run_wan21_t2v.sh
similarity index 78%
rename from scripts/platforms/nvidia/run_wan21_t2v.sh
rename to scripts/platforms/nvidia/single/run_wan21_t2v.sh
index b0e518654..53c011a47 100755
--- a/scripts/platforms/nvidia/run_wan21_t2v.sh
+++ b/scripts/platforms/nvidia/single/run_wan21_t2v.sh
@@ -3,19 +3,20 @@
# System management interface: nvidia-smi
# set path firstly
-lightx2v_path=
-model_path=
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/Wan2.1-T2V-1.3B
export CUDA_VISIBLE_DEVICES=0
# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
source ${lightx2v_path}/scripts/base/base.sh
python -m lightx2v.infer \
--model_cls wan2.1 \
--task t2v \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/nvidia/wan_t2v.json \
+--config_json ${lightx2v_path}/configs/platforms/nvidia/single/wan_t2v.json \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative_prompt "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v.mp4
diff --git a/scripts/platforms/nvidia/single/run_wan22_moe_t2v.sh b/scripts/platforms/nvidia/single/run_wan22_moe_t2v.sh
new file mode 100755
index 000000000..f40446964
--- /dev/null
+++ b/scripts/platforms/nvidia/single/run_wan22_moe_t2v.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# System management interface: nvidia-smi
+
+# set path firstly
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/Wan2.2-T2V-A14B
+
+export CUDA_VISIBLE_DEVICES=1
+
+# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--model_cls wan2.2_moe \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/nvidia/single/wan_moe_t2v.json \
+--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
+--negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_t2v.mp4
diff --git a/scripts/platforms/nvidia/single/run_wan_t2v_sf.sh b/scripts/platforms/nvidia/single/run_wan_t2v_sf.sh
new file mode 100755
index 000000000..4bae9f284
--- /dev/null
+++ b/scripts/platforms/nvidia/single/run_wan_t2v_sf.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# System management interface: nvidia-smi
+
+# set path firstly
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/Wan2.1-T2V-1.3B
+
+export CUDA_VISIBLE_DEVICES=0
+
+# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
+source ${lightx2v_path}/scripts/base/base.sh
+
+python -m lightx2v.infer \
+--model_cls wan2.1_sf \
+--task t2v \
+--model_path $model_path \
+--config_json ${lightx2v_path}/configs/platforms/nvidia/single/wan_t2v_sf.json \
+--prompt 'A stylish woman strolls down a bustling Tokyo street, the warm glow of neon lights and animated city signs casting vibrant reflections. She wears a sleek black leather jacket paired with a flowing red dress and black boots, her black purse slung over her shoulder. Sunglasses perched on her nose and a bold red lipstick add to her confident, casual demeanor. The street is damp and reflective, creating a mirror-like effect that enhances the colorful lights and shadows. Pedestrians move about, adding to the lively atmosphere. The scene is captured in a dynamic medium shot with the woman walking slightly to one side, highlighting her graceful strides.' \
+--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan_t2v_sf.mp4
diff --git a/scripts/platforms/mlu/z_image_turbo_t2i_dist.sh b/scripts/platforms/nvidia/single/z_image_turbo_t2i.sh
similarity index 55%
rename from scripts/platforms/mlu/z_image_turbo_t2i_dist.sh
rename to scripts/platforms/nvidia/single/z_image_turbo_t2i.sh
index b6663f4be..efb81b264 100755
--- a/scripts/platforms/mlu/z_image_turbo_t2i_dist.sh
+++ b/scripts/platforms/nvidia/single/z_image_turbo_t2i.sh
@@ -1,26 +1,24 @@
#!/bin/bash
-# System management interface: cnmon
+# System management interface: nvidia-smi
# set path firstly
-lightx2v_path=/root/yongyang3/LightX2V
-model_path=/root/wushuo/models/Tongyi-MAI/Z-Image-Turbo
+lightx2v_path=/data/nvme1/wushuo/LightX2V
+model_path=/data/nvme1/wushuo/hf_models/models/Z-Image-Turbo
-export PLATFORM=cambricon_mlu
-export MLU_VISIBLE_DEVICES=0,1
-export PYTORCH_MLU_ALLOC_CONF=expandable_segments:True
-export LD_LIBRARY_PATH=/usr/local/neuware/lib64:${LD_LIBRARY_PATH}
+export CUDA_VISIBLE_DEVICES=0
# set environment variables
+source "${lightx2v_path}/scripts/platforms/nvidia/logging.sh"
source ${lightx2v_path}/scripts/base/base.sh
-torchrun --nproc_per_node=2 -m lightx2v.infer \
+python -m lightx2v.infer \
--model_cls z_image \
--task t2i \
--model_path $model_path \
---config_json ${lightx2v_path}/configs/platforms/mlu/z_image_turbo_t2i_dist.json \
+--config_json ${lightx2v_path}/configs/platforms/nvidia/single/z_image_turbo_t2i.json \
--prompt 'Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights.' \
--negative_prompt " " \
---save_result_path ${lightx2v_path}/save_results/z_image_turbo_dist.png \
+--save_result_path ${lightx2v_path}/save_results/z_image_turbo.png \
--seed 42 \
--aspect_ratio "16:9"