add wan22 extreme i2v#1125
Conversation
There was a problem hiding this comment.
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.
| # 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 |
There was a problem hiding this comment.
Bash Script Robustness and Usability Improvements
- Auto-detect
lightx2v_path: Instead of leavinglightx2v_pathempty (which requires manual user configuration and will fail if run directly), we can automatically resolve it relative to the script's location usingdirname. - Validate
model_path: Add a check to ensuremodel_pathis set before executing the command, providing a clear error message if it is empty. - 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"| "high_noise_quantized_ckpt": "path to i2v high_nvfp4.safetensors", | ||
| "low_noise_quantized_ckpt": "path to i2v low_nvfp4.safetensors", |
There was a problem hiding this comment.
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.
| "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", |
No description provided.