通义万相 Wan2.2,系阿里于2025年7月28日开源的视频生成模型。通义万相2.2在视频生成扩散模型中引入MoE架构,解决了视频生成处理Token过长导致的计算资源消耗大问题。2025年7月28日,阿里开源视频生成模型:通义万相 Wan2.2。 通义万相2.2在视频生成扩散模型中引入MoE架构,解决了视频生成处理Token过长导致的计算资源消耗大问题。Wan2.2-T2V-A14B、Wan2.2-I2V-A14B两款模型均由高噪声专家模型和低噪专家模型组成,分别负责视频的整体布局和细节完善,在同参数规模下,可节省约50%的计算资源消耗,在模型能力上,通义万相2.2在复杂运动生成、人物交互、美学表达、复杂运动等维度上也取得了显著提升。 Wan2.2首创「电影美学控制系统」,光影、色彩、构图、微表情等能力媲美专业电影水平。例如,用户输入「黄昏」、「柔光」、「边缘光」、「暖色调」「中心构图」等关键词,模型可自动生成金色的落日余晖的浪漫画面;使用「冷色调」、「硬光」、「平衡图」、「低角度」的组合,则可以生成接近科幻片的画面效果
# 增加软件包可执行权限,{version}表示软件版本号,{arch}表示CPU架构,{soc}表示昇腾AI处理器的版本。
chmod +x ./Ascend-cann-toolkit_{version}_linux-{arch}.run
chmod +x ./Ascend-cann-kernels-{soc}_{version}_linux.run
# 校验软件包安装文件的一致性和完整性
./Ascend-cann-toolkit_{version}_linux-{arch}.run --check
./Ascend-cann-kernels-{soc}_{version}_linux.run --check
# 安装
./Ascend-cann-toolkit_{version}_linux-{arch}.run --install
./Ascend-cann-kernels-{soc}_{version}_linux.run --install
# 设置环境变量
source /usr/local/Ascend/ascend-toolkit/set_env.sh# 增加软件包可执行权限,{version}表示软件版本号,{arch}表示CPU架构。
chmod +x ./Ascend-mindie_${version}_linux-${arch}.run
./Ascend-mindie_${version}_linux-${arch}.run --check
# 方式一:默认路径安装
./Ascend-mindie_${version}_linux-${arch}.run --install
# 设置环境变量
cd /usr/local/Ascend/mindie && source set_env.sh
# 方式二:指定路径安装
./Ascend-mindie_${version}_linux-${arch}.run --install-path=${AieInstallPath}
# 设置环境变量
cd ${AieInstallPath}/mindie && source set_env.sh下载 pytorch_v{pytorchversion}_py{pythonversion}.tar.gz
tar -xzvf pytorch_v{pytorchversion}_py{pythonversion}.tar.gz
# 解压后,会有whl包
pip install torch_npu-{pytorchversion}.xxxx.{arch}.whlWan2.2-T2V-A14B
https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B/tree/main
Wan2.2-I2V-A14B
https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B/tree/main
Wan2.2-TI2V-5B
https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B/tree/mainWan2.2 支持分辨率说明
Wan2.2-T2V-A14B:720x1280,1280x720,480x832,832x480
Wan2.2-I2V-A14B:720x1280,1280x720,480x832,832x480
Wan2.2-TI2V-5B:704x1280,1280x704
# 1. 下载代码
git clone https://modelers.cn/MindIE/Wan2.2.git
# 2. python相关依赖安装
pip install diffusers==0.35.1
pip install transformers==4.52.4
pip install yunchang==0.6.0等价优化
model_base="./Wan2.2-T2V-A14B/"
export ALGO=0
export PYTORCH_NPU_ALLOC_CONF='expandable_segments:True'
export TASK_QUEUE_ENABLE=2
export CPU_AFFINITY_CONF=1
export TOKENIZERS_PARALLELISM=false
torchrun --nproc_per_node=8 --master_port=23459 generate.py \
--task t2v-A14B \
--ckpt_dir ${model_base} \
--size 1280*720 \
--frame_num 81 \
--sample_steps 40 \
--dit_fsdp \
--t5_fsdp \
--cfg_size 2 \
--ulysses_size 4 \
--vae_parallel \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--base_seed 0其中,参数详细描述如下:
等价优化
model_base="./Wan2.2-I2V-A14B/"
export ALGO=0
export PYTORCH_NPU_ALLOC_CONF='expandable_segments:True'
export TASK_QUEUE_ENABLE=2
export CPU_AFFINITY_CONF=1
export TOKENIZERS_PARALLELISM=false
torchrun --nproc_per_node=8 generate.py \
--task i2v-A14B \
--ckpt_dir ${model_base} \
--size 1280*720 \
--frame_num 81 \
--sample_steps 40 \
--dit_fsdp \
--t5_fsdp \
--cfg_size 2 \
--ulysses_size 4 \
--vae_parallel \
--image examples/i2v_input.JPG \
--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." \
--base_seed 0其中,参数详细描述如下:
等价优化
model_base="./Wan2.2-TI2V-5B/"
export ALGO=0
export PYTORCH_NPU_ALLOC_CONF='expandable_segments:True'
export TASK_QUEUE_ENABLE=2
export CPU_AFFINITY_CONF=1
export TOKENIZERS_PARALLELISM=false
python generate.py \
--task ti2v-5B \
--ckpt_dir ${model_base} \
--size 1280*704 \
--frame_num 121 \
--sample_steps 50 \
--image examples/i2v_input.JPG \
--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." \
--offload_model False \
--base_seed 0其中,参数详细描述如下: