Skip to content

Lin#864

Merged
helloyongyang merged 40 commits intomainfrom
lin
Feb 3, 2026
Merged

Lin#864
helloyongyang merged 40 commits intomainfrom
lin

Conversation

@Lihuang-a
Copy link
Contributor

update wan21 doc

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Lihuang-a, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Wan2.1 model ecosystem by integrating new distilled model configurations and providing comprehensive documentation. The changes enable users to leverage FP8 quantization and Lora adaptations for improved performance and flexibility in image-to-video and text-to-video generation, with detailed performance metrics now available in the updated beginner's guide.

Highlights

  • New Model Configurations: Introduced six new JSON configuration files for Wan2.1 distilled models, covering both image-to-video (i2v) and text-to-video (t2v) tasks. These configurations include settings for FP8 quantization, Lora, and merged Lora models, all optimized for 4-step inference.
  • Updated Documentation: The Chinese beginner's guide (Wan21-14B.md) has been significantly expanded to detail various inference methods: single-card, single-card offload, and multi-card parallel inference. It now includes performance benchmarks (runtime and peak memory usage) for the new Wan2.1-T2V-14B and Wan2.1-I2V-14B models under these different scenarios.
  • New and Updated Inference Scripts: Added new shell scripts to facilitate running the newly introduced FP8 and merged Lora configurations for both i2v and t2v tasks. Existing scripts for Lora configurations were updated to correctly reference the new configuration paths and use the wan2.1_distill model class.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • configs/wan21/wan_i2v_distill_fp8_4step_cfg.json
    • Added new configuration for i2v distillation with FP8 quantization.
  • configs/wan21/wan_i2v_distill_lora_4step_cfg.json
    • Added new configuration for i2v distillation with Lora.
  • configs/wan21/wan_i2v_distill_model_4step_cfg.json
    • Added new configuration for i2v distillation with a merged Lora model.
  • configs/wan21/wan_t2v_distill_fp8_4step_cfg.json
    • Added new configuration for t2v distillation with FP8 quantization.
  • configs/wan21/wan_t2v_distill_lora_4step_cfg.json
    • Added new configuration for t2v distillation with Lora.
  • configs/wan21/wan_t2v_distill_model_4step_cfg.json
    • Added new configuration for t2v distillation with a merged Lora model.
  • examples/BeginnerGuide/ZH_CN/Wan21-14B.md
    • Expanded the guide to detail single-card, single-card offload, and multi-card parallel inference methods for running Wan21-14B models.
    • Added performance benchmarks (runtime and peak memory usage) for various Wan2.1-T2V-14B and Wan2.1-I2V-14B models under different inference scenarios.
    • Updated section headings for clarity and structure.
    • Corrected a comment in the Python code generation section.
  • scripts/wan/run_wan_i2v_distill_fp8_4step_cfg.sh
    • Added a new script to run i2v distillation with FP8 quantization.
  • scripts/wan/run_wan_i2v_distill_lora_4step_cfg.sh
    • Updated the config JSON path and save result path to align with new configurations.
  • scripts/wan/run_wan_i2v_distill_lora_4step_cfg_ulysses.sh
    • Changed the model class from wan2.1 to wan2.1_distill for consistency.
  • scripts/wan/run_wan_i2v_distill_model_4step_cfg.sh
    • Added a new script to run i2v distillation with a merged Lora model.
  • scripts/wan/run_wan_i2v_distill_model_4step_cfg_ulysses.sh
    • Changed the model class from wan2.1 to wan2.1_distill for consistency.
  • scripts/wan/run_wan_t2v_distill_fp8_4step_cfg.sh
    • Added a new script to run t2v distillation with FP8 quantization.
  • scripts/wan/run_wan_t2v_distill_fp8_4step_cfg_ulysses.sh
    • Changed the model class from wan2.1 to wan2.1_distill for consistency.
  • scripts/wan/run_wan_t2v_distill_lora_4step_cfg.sh
    • Updated the config JSON path to align with new configurations.
  • scripts/wan/run_wan_t2v_distill_lora_4step_cfg_ulysses.sh
    • Changed the model class from wan2.1 to wan2.1_distill for consistency.
  • scripts/wan/run_wan_t2v_distill_model_4step_cfg.sh
    • Added a new script to run t2v distillation with a merged Lora model.
  • scripts/wan/run_wan_t2v_distill_model_4step_cfg_ulysses.sh
    • Changed the model class from wan2.1 to wan2.1_distill for consistency.
Activity
  • The pull request was initiated by Lihuang-a with a minimal title 'Lin' and description 'update wan21 doc'.
  • New configuration files and inference scripts were added, and existing scripts were modified to support new Wan2.1 distilled models.
  • The Chinese beginner's guide was updated to include detailed instructions and performance benchmarks for the new model configurations and inference modes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds new configurations, scripts, and documentation for wan21 models, introducing new inference options. My review focuses on improving maintainability and correctness. I've identified several instances of hardcoded absolute paths in new configuration files and shell scripts that should be made more portable. I also found a critical configuration mismatch in one of the new scripts regarding GPU settings and torchrun usage. Additionally, there are some minor typos and structural issues in the updated documentation that I've suggested corrections for.

Comment on lines 7 to 12
export CUDA_VISIBLE_DEVICES=0

# set environment variables
source ${lightx2v_path}/scripts/base/base.sh

torchrun --nproc_per_node=8 -m lightx2v.infer \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a contradiction in the script's configuration for parallelism. export CUDA_VISIBLE_DEVICES=0 restricts execution to a single GPU, but torchrun --nproc_per_node=8 attempts to launch 8 processes for multi-GPU execution. If this script is intended for single-GPU use, torchrun is not necessary and python -m lightx2v.infer ... should be used instead. If it's for multi-GPU, CUDA_VISIBLE_DEVICES should be set to allow 8 GPUs (e.g., 0,1,2,3,4,5,6,7).

注意:蒸馏模型的model_path为原模型的路径,在 config_json 中填入蒸馏模型路径
使用8张H100,运行时间及使用`watch -n 1 nvidia-smi`观测的峰值显存参考如下:
1. Wan2.1-I2V-14B-480P模型:Total Cost cost 131.553567 seconds;44624MiB
2. 步数蒸馏模型 Lora:Total Total Cost cost 38.337339 seconds;43850MiB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a typo here: Total Total Cost cost. It should probably be Total Cost cost.

Suggested change
2. 步数蒸馏模型 Lora:Total Total Cost cost 38.337339 seconds;43850MiB
2. 步数蒸馏模型 Lora:Total Cost cost 38.337339 seconds;43850MiB

"offload_granularity": "model",
"denoising_step_list": [1000, 750, 500, 250],
"dit_quantized": true,
"dit_quantized_ckpt": "/models/Wan-AI/Wan2.1-Distill-Models/wan2.1_t2v_14b_scaled_fp8_e4m3_lightx2v_4step.safetensors",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The configuration file contains a hardcoded absolute path for the model checkpoint: /models/Wan-AI/Wan2.1-Distill-Models/wan2.1_t2v_14b_scaled_fp8_e4m3_lightx2v_4step.safetensors. This harms portability. Consider using a relative path, a placeholder, or a mechanism to resolve paths at runtime based on user configuration.

"denoising_step_list": [1000, 750, 500, 250],
"lora_configs": [
{
"path": "/models/Wan-AI/Wan2.1-Distill-Loras/wan2.1_t2v_14b_lora_rank64_lightx2v_4step.safetensors",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The configuration file contains a hardcoded absolute path for the model: /models/Wan-AI/Wan2.1-Distill-Loras/wan2.1_t2v_14b_lora_rank64_lightx2v_4step.safetensors. This harms portability. Consider using a relative path, a placeholder, or a mechanism to resolve paths at runtime based on user configuration.

"cpu_offload": false,
"offload_granularity": "model",
"denoising_step_list": [1000, 750, 500, 250],
"dit_original_ckpt": "/models/Wan-AI/Wan2.1-Distill-Models/wan2.1_t2v_14b_lightx2v_4step.safetensors"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The configuration file contains a hardcoded absolute path for the model checkpoint: /models/Wan-AI/Wan2.1-Distill-Models/wan2.1_t2v_14b_lightx2v_4step.safetensors. This harms portability. Consider using a relative path, a placeholder, or a mechanism to resolve paths at runtime based on user configuration.

Comment on lines 4 to 5
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-I2V-14B-480P
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This script contains hardcoded, developer-specific absolute paths for lightx2v_path and model_path. This is not portable and requires every user to edit the file. For consistency with other scripts and better user experience, please remove the hardcoded values. The user can then set them as environment variables before running the script, which is already checked by scripts/base/base.sh.

Suggested change
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-I2V-14B-480P
lightx2v_path=
model_path=

Comment on lines 4 to 5
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-I2V-14B-480P
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This script contains hardcoded, developer-specific absolute paths for lightx2v_path and model_path. This is not portable and requires every user to edit the file. For consistency with other scripts and better user experience, please remove the hardcoded values. The user can then set them as environment variables before running the script, which is already checked by scripts/base/base.sh.

Suggested change
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-I2V-14B-480P
lightx2v_path=
model_path=

"cpu_offload": true,
"offload_granularity": "model",
"denoising_step_list": [1000, 750, 500, 250],
"dit_original_ckpt": "/models/Wan-AI/Wan2.1-Distill-Models/wan2.1_i2v_480p_int8_lightx2v_4step.safetensors"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The configuration file contains a hardcoded absolute path for the model checkpoint: /models/Wan-AI/Wan2.1-Distill-Models/wan2.1_i2v_480p_int8_lightx2v_4step.safetensors. This harms portability. Consider using a relative path, a placeholder, or a mechanism to resolve paths at runtime based on user configuration.

Comment on lines 4 to 5
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-T2V-14B
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This script contains hardcoded, developer-specific absolute paths for lightx2v_path and model_path. This is not portable and requires every user to edit the file. For consistency with other scripts and better user experience, please remove the hardcoded values. The user can then set them as environment variables before running the script, which is already checked by scripts/base/base.sh.

Suggested change
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-T2V-14B
lightx2v_path=
model_path=

Comment on lines 4 to 5
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-T2V-14B
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This script contains hardcoded, developer-specific absolute paths for lightx2v_path and model_path. This is not portable and requires every user to edit the file. For consistency with other scripts and better user experience, please remove the hardcoded values. The user can then set them as environment variables before running the script, which is already checked by scripts/base/base.sh.

Suggested change
lightx2v_path=/data1/yongyang/huangli/tap/LightX2V
model_path=/models/Wan-AI/Wan2.1-T2V-14B
lightx2v_path=
model_path=

@helloyongyang helloyongyang merged commit f1f2f3a into main Feb 3, 2026
2 checks passed
@helloyongyang helloyongyang deleted the lin branch February 3, 2026 13:56
@helloyongyang helloyongyang restored the lin branch February 3, 2026 13:57
@helloyongyang helloyongyang deleted the lin branch February 3, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments