HuggingFace镜像/Wan2.2-TI2V-5B-Diffusers
模型介绍文件和版本分析

Wan2.2

💜 Wan    |    🖥️ GitHub    |   🤗 Hugging Face   |   🤖 ModelScope   |    📑 技术报告    |    📑 博客    |   💬 微信交流群   |    📖 Discord  


Wan: Open and Advanced Large-Scale Video Generative Models

我们非常荣幸地推出Wan2.2,这是我们基础视频模型的重大升级版本。在Wan2.2中,我们重点融入了以下创新特性:

  • 👍 高效MoE架构:Wan2.2在视频扩散模型中引入了混合专家(Mixture-of-Experts, MoE)架构。通过使用专门的强大专家模型分离跨时间步的去噪过程,在保持相同计算成本的同时,显著提升了整体模型容量。

  • 👍 电影级美学效果:Wan2.2整合了精心筛选的美学数据,并附带了关于光线、构图、对比度、色调等的详细标签。这使得电影风格生成更加精准可控,有助于创建符合个性化美学偏好的视频内容。

  • 👍 复杂动作生成能力:与Wan2.1相比,Wan2.2的训练数据规模大幅增加,图像数据量提升65.6%,视频数据量提升83.2%。这种数据扩展显著增强了模型在动作、语义和美学等多个维度的泛化能力,在所有开源和闭源模型中均达到顶尖性能水平。

  • 👍 高效高清混合TI2V:Wan2.2开源了一个5B模型,该模型基于我们先进的Wan2.2-VAE构建,实现了16×16×4的压缩比。此模型支持720P分辨率、24fps帧率的文本到视频(text-to-video)和图像到视频(image-to-video)生成,并且可以在消费级显卡(如4090)上运行。它是目前速度最快的720P@24fps模型之一,能够同时满足工业界应用和学术界研究的需求。

本仓库包含我们的TI2V-5B模型,该模型基于先进的Wan2.2-VAE构建,实现了16×16×4的压缩比。此模型支持720P分辨率、24fps帧率的文本到视频和图像到视频生成,并且可以在单张消费级GPU(如4090)上运行。它是目前可用的速度最快的720P@24fps模型之一,能够满足工业应用和学术研究的双重需求。

视频演示

您的浏览器不支持视频标签。

🔥 最新动态!!

  • 2025年7月28日:👋 我们已发布 Wan2.2 的推理代码和模型权重。

社区成果

如果您的研究或项目基于 Wan2.1 或 Wan2.2 开发,欢迎与我们分享,以便我们向更广泛的社区展示您的成果。

📑 待办清单

  • Wan2.2 文本生成视频
    • A14B 和 14B 模型的多 GPU 推理代码
    • A14B 和 14B 模型的检查点
    • ComfyUI 集成
    • Diffusers 集成
  • Wan2.2 图像生成视频
    • A14B 模型的多 GPU 推理代码
    • A14B 模型的检查点
    • ComfyUI 集成
    • Diffusers 集成
  • Wan2.2 文本-图像生成视频
    • 5B 模型的多 GPU 推理代码
    • 5B 模型的检查点
    • ComfyUI 集成
    • Diffusers 集成

运行 Wan2.2

安装

克隆仓库:

git clone https://github.com/Wan-Video/Wan2.2.git
cd Wan2.2

安装依赖项:

# Ensure torch >= 2.4.0
pip install -r requirements.txt

模型下载

模型名称下载链接描述信息
T2V-A14B🤗 Huggingface 🤖 ModelScope文本转视频MoE模型,支持480P和720P
I2V-A14B🤗 Huggingface 🤖 ModelScope图像转视频MoE模型,支持480P和720P
TI2V-5B🤗 Huggingface 🤖 ModelScope高压缩VAE,文本转视频+图像转视频,支持720P

💡注意: TI2V-5B模型支持以24 FPS生成720P视频。

使用huggingface-cli下载模型:

pip install "huggingface_hub[cli]"
huggingface-cli download Wan-AI/Wan2.2-TI2V-5B --local-dir ./Wan2.2-TI2V-5B

使用 modelscope-cli 下载模型:

pip install modelscope
modelscope download Wan-AI/Wan2.2-TI2V-5B --local_dir ./Wan2.2-TI2V-5B

运行文本-图像转视频生成

本仓库支持Wan2.2-TI2V-5B文本-图像转视频模型,并可支持720P分辨率的视频生成。

  • 单GPU文本转视频推理
python generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./Wan2.2-TI2V-5B --offload_model True --convert_model_dtype --t5_cpu --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage"

💡与其他任务不同,文本-图像转视频任务的720P分辨率为1280*704或704*1280。

此命令可在至少24GB显存的GPU上运行(例如,RTX 4090 GPU)。

💡如果在至少80GB显存的GPU上运行,可以移除--offload_model True、--convert_model_dtype和--t5_cpu选项以加快执行速度。

  • 单GPU图像转视频推理
python generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./Wan2.2-TI2V-5B --offload_model True --convert_model_dtype --t5_cpu --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."

💡若配置了image参数,则为Image-to-Video生成;否则默认进行Text-to-Video生成。

💡与Image-to-Video类似,size参数表示生成视频的区域,其宽高比遵循原始输入图像的宽高比。

  • 采用FSDP + DeepSpeed Ulysses的多GPU推理
torchrun --nproc_per_node=8 generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./Wan2.2-TI2V-5B --dit_fsdp --t5_fsdp --ulysses_size 8 --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."

提示词扩展的流程可参考此处。

  • 使用 Diffusers 运行
import torch
import numpy as np
from diffusers import WanPipeline, AutoencoderKLWan, WanTransformer3DModel, UniPCMultistepScheduler
from diffusers.utils import export_to_video, load_image

dtype = torch.bfloat16
device = "cuda"

model_id = "Wan-AI/Wan2.2-TI2V-5B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=dtype)
pipe.to(device)

height = 704
width = 1280
num_frames = 121
num_inference_steps = 50
guidance_scale = 5.0


prompt = "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
negative_prompt = "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"

output = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    height=height,
    width=width,
    num_frames=num_frames,
    guidance_scale=guidance_scale,
    num_inference_steps=num_inference_steps,
).frames[0]
export_to_video(output, "5bit2v_output.mp4", fps=24)

💡注意:此模型需要当前仅在 diffusers 主分支中提供的功能。PyPI 上的最新稳定版本尚未包含这些更新。 如需使用此模型,请从源代码安装该库:

pip install git+https://github.com/huggingface/diffusers    

不同 GPU 上的计算效率

我们在下表中测试了不同 Wan2.2 模型在不同 GPU 上的计算效率。结果以 总时间(秒)/ 峰值 GPU 内存(GB) 的格式呈现。

本表格中测试的参数设置如下: (1) 多 GPU:14B:--ulysses_size 4/8 --dit_fsdp --t5_fsdp,5B:--ulysses_size 4/8 --offload_model True --convert_model_dtype --t5_cpu;单 GPU:14B:--offload_model True --convert_model_dtype,5B:--offload_model True --convert_model_dtype --t5_cpu (--convert_model_dtype 将模型参数类型转换为 config.param_dtype); (2) 分布式测试利用内置的 FSDP 和 Ulysses 实现,并在 Hopper 架构 GPU 上部署了 FlashAttention3; (3) 测试运行时未使用 --use_prompt_extend 标志; (4) 报告的结果是预热阶段后多次采样的平均值。


Wan2.2 介绍

Wan2.2 在 Wan2.1 的基础上,在生成质量和模型能力方面有显著提升。此次升级由一系列关键技术创新驱动,主要包括混合专家(Mixture-of-Experts,MoE)架构、升级的训练数据以及高压缩视频生成。

(1)混合专家(Mixture-of-Experts,MoE)架构

Wan2.2 将混合专家(Mixture-of-Experts,MoE)架构引入视频生成扩散模型。MoE 在大型语言模型中已被广泛验证为一种高效的方法,能够在几乎不增加推理成本的情况下增加模型总参数量。在 Wan2.2 中,A14B 模型系列采用了专为扩散模型去噪过程设计的双专家方案:一个是用于早期阶段的高噪声专家,专注于整体布局;另一个是用于后期阶段的低噪声专家,负责优化视频细节。每个专家模型拥有约 14B 参数,因此总参数量达到 27B,但每一步的激活参数仅为 14B,使得推理计算量和 GPU 内存占用几乎保持不变。

两个专家之间的切换点由信噪比(SNR)决定,该指标随着去噪步骤 ttt 的增加而单调递减。在去噪过程开始时,ttt 较大,噪声水平较高,因此 SNR 处于最小值,记为 SNRmin{SNR}_{min}SNRmin​。在这个阶段,高噪声专家被激活。我们定义一个对应于 SNRmin{SNR}_{min}SNRmin​ 一半的阈值步骤 tmoe{t}_{moe}tmoe​,当 t<tmoet<{t}_{moe}t<tmoe​ 时切换到低噪声专家。

为了验证 MoE 架构的有效性,我们基于验证损失曲线比较了四种设置。基线 Wan2.1 模型未采用 MoE 架构。在基于 MoE 的变体中,Wan2.1 & High-Noise Expert 将 Wan2.1 模型复用为低噪声专家,同时使用 Wan2.2 的高噪声专家;而 Wan2.1 & Low-Noise Expert 则将 Wan2.1 作为高噪声专家,并采用 Wan2.2 的低噪声专家。Wan2.2 (MoE)(我们的最终版本)实现了最低的验证损失,表明其生成的视频分布最接近真实数据,并表现出更优的收敛性。

(2)高效高清混合 TI2V

为了实现更高效的部署,Wan2.2 还探索了高压缩设计。除了 27B 的 MoE 模型外,还发布了 5B 的密集模型,即 TI2V-5B。它由高压缩的 Wan2.2-VAE 提供支持,实现了 T×H×WT\times H\times WT×H×W 为 4×16×164\times16\times164×16×16 的压缩比,将整体压缩率提高到 64,同时保持高质量的视频重建。通过额外的分块层,TI2V-5B 的总压缩比达到 4×32×324\times32\times324×32×32。在没有特定优化的情况下,TI2V-5B 在单个消费级 GPU 上可以在 9 分钟内生成 5 秒的 720P 视频,跻身最快的 720P@24fps 视频生成模型之列。该模型还在一个统一的框架内原生支持文本到视频和图像到视频任务,涵盖学术研究和实际应用。

与 SOTA 的比较

我们在新的 Wan-Bench 2.0 上,将 Wan2.2 与领先的闭源商业模型进行了比较,从多个关键维度评估性能。结果表明,Wan2.2 相较于这些领先模型取得了更优异的性能。

引用说明

如果您觉得我们的工作对您有所帮助,请引用我们的成果。

@article{wan2025,
      title={Wan: Open and Advanced Large-Scale Video Generative Models}, 
      author={Team Wan and Ang Wang and Baole Ai and Bin Wen and Chaojie Mao and Chen-Wei Xie and Di Chen and Feiwu Yu and Haiming Zhao and Jianxiao Yang and Jianyuan Zeng and Jiayu Wang and Jingfeng Zhang and Jingren Zhou and Jinkai Wang and Jixuan Chen and Kai Zhu and Kang Zhao and Keyu Yan and Lianghua Huang and Mengyang Feng and Ningyi Zhang and Pandeng Li and Pingyu Wu and Ruihang Chu and Ruili Feng and Shiwei Zhang and Siyang Sun and Tao Fang and Tianxing Wang and Tianyi Gui and Tingyu Weng and Tong Shen and Wei Lin and Wei Wang and Wei Wang and Wenmeng Zhou and Wente Wang and Wenting Shen and Wenyuan Yu and Xianzhong Shi and Xiaoming Huang and Xin Xu and Yan Kou and Yangyu Lv and Yifei Li and Yijing Liu and Yiming Wang and Yingya Zhang and Yitong Huang and Yong Li and You Wu and Yu Liu and Yulin Pan and Yun Zheng and Yuntao Hong and Yupeng Shi and Yutong Feng and Zeyinzi Jiang and Zhen Han and Zhi-Fan Wu and Ziyu Liu},
      journal = {arXiv preprint arXiv:2503.20314},
      year={2025}
}

许可协议

本仓库中的模型采用 Apache 2.0 许可协议授权。对于您生成的内容,我们不主张任何权利,您可自由使用这些内容,但需确保您的使用符合本许可协议的规定。您对模型的使用承担全部责任,不得分享任何违反适用法律、对个人或群体造成伤害、传播用于伤害目的的个人信息、散布虚假信息或针对弱势群体的内容。有关限制的完整列表以及您的权利详情,请参阅许可协议全文。

致谢

我们要感谢 SD3、Qwen、umt5-xxl、diffusers 和 HuggingFace 仓库的贡献者们所做的开源研究工作。

联系我们

如果您想给我们的研究团队或产品团队留言,欢迎加入我们的 Discord 或 微信群!