Skip to content

add wan22 extreme i2v#1125

Merged
helloyongyang merged 2 commits into
mainfrom
wan22
Jun 6, 2026
Merged

add wan22 extreme i2v#1125
helloyongyang merged 2 commits into
mainfrom
wan22

Conversation

@chengtao-lv

Copy link
Copy Markdown
Contributor

No description provided.

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

Copy link
Copy Markdown
Contributor

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 introduces support for the image-to-video (I2V) variant of the Wan 2.2 14B model, adding a new configuration file and an execution script for extreme distillation with NVFP4 quantization and sparse attention. The review feedback suggests improving the robustness of the bash script by auto-detecting paths, validating inputs, and quoting variables. Additionally, it recommends replacing placeholder checkpoint paths in the configuration file with standard default filenames to avoid forcing users to modify tracked files.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +3 to +20
# set path firstly
lightx2v_path=
model_path=

export CUDA_VISIBLE_DEVICES=0

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

python -m lightx2v.infer \
--model_cls wan2.2_moe_distill \
--task i2v \
--model_path $model_path \
--config_json ${lightx2v_path}/configs/wan22/wan_moe_i2v_distill_nvfp4_sparse_attn.json \
--prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside." \
--negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--image_path ${lightx2v_path}/assets/inputs/imgs/img_0.jpg \
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_i2v_extreme.mp4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Bash Script Robustness and Usability Improvements

  1. Auto-detect lightx2v_path: Instead of leaving lightx2v_path empty (which requires manual user configuration and will fail if run directly), we can automatically resolve it relative to the script's location using dirname.
  2. Validate model_path: Add a check to ensure model_path is set before executing the command, providing a clear error message if it is empty.
  3. Double-quote variables: Quote all variables (e.g., "$model_path", "${lightx2v_path}") to prevent word splitting and argument parsing bugs (e.g., if paths contain spaces or are empty).
# set path firstly
lightx2v_path=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../../.. && pwd)
model_path=""

if [ -z "$model_path" ]; then
    echo "Error: Please set model_path to your Wan2.2 model directory before running."
    exit 1
fi

export CUDA_VISIBLE_DEVICES=0

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

python -m lightx2v.infer \
  --model_cls wan2.2_moe_distill \
  --task i2v \
  --model_path "$model_path" \
  --config_json "${lightx2v_path}/configs/wan22/wan_moe_i2v_distill_nvfp4_sparse_attn.json" \
  --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside." \
  --negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
  --image_path "${lightx2v_path}/assets/inputs/imgs/img_0.jpg" \
  --save_result_path "${lightx2v_path}/save_results/output_lightx2v_wan22_moe_i2v_extreme.mp4"

Comment on lines +34 to +35
"high_noise_quantized_ckpt": "path to i2v high_nvfp4.safetensors",
"low_noise_quantized_ckpt": "path to i2v low_nvfp4.safetensors",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid Placeholder Paths in Tracked Config Files

Using placeholder strings like "path to i2v high_nvfp4.safetensors" forces users to modify tracked configuration files, which dirties the git workspace.

If these files are expected to be located inside the model_path directory, consider using standard default filenames (e.g., "high_nvfp4.safetensors" and "low_nvfp4.safetensors") so they can be resolved automatically without manual edits.

Suggested change
"high_noise_quantized_ckpt": "path to i2v high_nvfp4.safetensors",
"low_noise_quantized_ckpt": "path to i2v low_nvfp4.safetensors",
"high_noise_quantized_ckpt": "high_nvfp4.safetensors",
"low_noise_quantized_ckpt": "low_nvfp4.safetensors",

@helloyongyang helloyongyang merged commit 58156d4 into main Jun 6, 2026
2 checks passed
@helloyongyang helloyongyang deleted the wan22 branch June 6, 2026 04:37
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