Wan2.2 README

The project's README from github.com/Wan-Video/Wan2.2. As one markdown file: README.md.

Wan2.2

💜 Wan    |    🖥️ GitHub    |   🤗 Hugging Face   |   🤖 ModelScope   |    📑 Paper    |    📑 Blog    |    💬 Discord  
📕 使用指南(中文)   |    📘 User Guide(English)   |   💬 WeChat(微信)  


Wan: Open and Advanced Large-Scale Video Generative Models

We are excited to introduce Wan2.2, a major upgrade to our foundational video models. With Wan2.2, we have focused on incorporating the following innovations:

Video Demos

🔥 Latest News!!

Community Works

If your research or project builds upon Wan2.1 or Wan2.2, and you would like more people to see it, please inform us.

📑 Todo List

Run Wan2.2

Installation

Clone the repo:

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

Install dependencies:

# Ensure torch >= 2.4.0
# If the installation of `flash_attn` fails, try installing the other packages first and install `flash_attn` last
pip install -r requirements.txt
# If you want to use CosyVoice to synthesize speech for Speech-to-Video Generation, please install requirements_s2v.txt additionally
pip install -r requirements_s2v.txt

Model Download

Models Download Links Description
T2V-A14B 🤗 Huggingface 🤖 ModelScope Text-to-Video MoE model, supports 480P & 720P
I2V-A14B 🤗 Huggingface 🤖 ModelScope Image-to-Video MoE model, supports 480P & 720P
TI2V-5B 🤗 Huggingface 🤖 ModelScope High-compression VAE, T2V+I2V, supports 720P
S2V-14B 🤗 Huggingface 🤖 ModelScope Speech-to-Video model, supports 480P & 720P
Animate-14B 🤗 Huggingface 🤖 ModelScope Character animation and replacement

💡Note: The TI2V-5B model supports 720P video generation at 24 FPS.

Download models using huggingface-cli:

pip install "huggingface_hub[cli]"
huggingface-cli download Wan-AI/Wan2.2-T2V-A14B --local-dir ./Wan2.2-T2V-A14B

Download models using modelscope-cli:

pip install modelscope
modelscope download Wan-AI/Wan2.2-T2V-A14B --local_dir ./Wan2.2-T2V-A14B

Run Text-to-Video Generation

This repository supports the Wan2.2-T2V-A14B Text-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.

(1) Without Prompt Extension

To facilitate implementation, we will start with a basic version of the inference process that skips the prompt extension step.

python generate.py  --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --offload_model True --convert_model_dtype --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."

💡 This command can run on a GPU with at least 80GB VRAM.

💡If you encounter OOM (Out-of-Memory) issues, you can use the --offload_model True, --convert_model_dtype and --t5_cpu options to reduce GPU memory usage.

torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
(2) Using Prompt Extension

Extending the prompts can effectively enrich the details in the generated videos, further enhancing the video quality. Therefore, we recommend enabling prompt extension. We provide the following two methods for prompt extension:

DASH_API_KEY=your_key torchrun --nproc_per_node=8 generate.py  --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage" --use_prompt_extend --prompt_extend_method 'dashscope' --prompt_extend_target_lang 'zh'
torchrun --nproc_per_node=8 generate.py  --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage" --use_prompt_extend --prompt_extend_method 'local_qwen' --prompt_extend_target_lang 'zh'

Run Image-to-Video Generation

This repository supports the Wan2.2-I2V-A14B Image-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.

python generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-I2V-A14B --offload_model True --convert_model_dtype --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."

This command can run on a GPU with at least 80GB VRAM.

💡For the Image-to-Video task, the size parameter represents the area of the generated video, with the aspect ratio following that of the original input image.

torchrun --nproc_per_node=8 generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-I2V-A14B --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --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."
DASH_API_KEY=your_key torchrun --nproc_per_node=8 generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-I2V-A14B --prompt '' --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --use_prompt_extend --prompt_extend_method 'dashscope'

💡The model can generate videos solely from the input image. You can use prompt extension to generate prompt from the image.

The process of prompt extension can be referenced here.

Run Text-Image-to-Video Generation

This repository supports the Wan2.2-TI2V-5B Text-Image-to-Video model and can support video generation at 720P resolutions.

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"

💡Unlike other tasks, the 720P resolution of the Text-Image-to-Video task is 1280*704 or 704*1280.

This command can run on a GPU with at least 24GB VRAM (e.g, RTX 4090 GPU).

💡If you are running on a GPU with at least 80GB VRAM, you can remove the --offload_model True, --convert_model_dtype and --t5_cpu options to speed up execution.

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."

💡If the image parameter is configured, it is an Image-to-Video generation; otherwise, it defaults to a Text-to-Video generation.

💡Similar to Image-to-Video, the size parameter represents the area of the generated video, with the aspect ratio following that of the original input image.

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

Wan2.2 (Wan-Video/Wan2.2)

Searching Database…

18.1K ·GitHub
这是什么?一套开源的大规模视频生成模型系列:支持文生视频、图生视频、语音生成视频和角色动画,推理代码和模型权重均以 Apache-2.0 协议发布。
这是一个模型还是一整个系列?共五条产品线:T2V-A14B 和 I2V-A14B(用于文生视频和图生视频的 MoE 模型)、TI2V-5B(支持文本+图像联合输入)、S2V-14B(语音生成视频),以及 Animate-14B(角色动画与角色替换)。
怎么把它跑起来?克隆仓库,安装 Python 依赖,用 huggingface-cli 或 modelscope-cli 从 HuggingFace 或 ModelScope 下载所选模型的权重,然后带上你的任务、尺寸和提示词运行 generate.py。
必须要有 Dashscope API 密钥才能用吗?不一定:提示词扩展(用来润色提示词、提升视频质量)是可选的——可以调用 Dashscope API(需要设置 dashscope.apikey),也可以用 Qwen2.5-14B-Instruct 这类本地 Qwen 模型。
80GB 显存的要求太苛刻了,有办法绕开吗?有——如果出现显存不足(OOM),可以用 --offloadmodel True、--convertmodeldtype 和 --t5cpu 这些选项来降低显存占用,或者用 FSDP 加 DeepSpeed Ulysses 把推理分散到多张卡上。
需要很顶级的显卡才能跑吗?14B 的模型需要单张显存至少 80GB 的 GPU;面向普通用户的选项是 TI2V-5B,一张 RTX 4090 这样的 24GB 显卡就能跑。
Wan2.2 里的 MoE 技巧是什么?它把混合专家(Mixture-of-Experts)架构引入了视频扩散模型:由不同的专家模型分别负责不同的去噪时间步,在计算成本不变的情况下扩大了模型的总容量。
它和 Wan2.1 有什么不同?除了 MoE 架构以及针对光影、构图和色调的电影级美学标签之外,它的训练数据多了 65.6% 的图像和 83.2% 的视频,在动态表现、语义理解 and 美感上都有提升。
一定要用这些脚本吗,还是能在 ComfyUI 里用?ComfyUI 和 HuggingFace Diffusers 都集成了全部任务线,5B 模型在 HuggingFace Space 上还有在线演示;Kijai 的 WanVideoWrapper 也是社区里很受欢迎的替代方案。
Wan2.2-Animate 能做什么?Animate-14B 是一个统一的角色动画与角色替换模型:它能把你提供的驱动视频中的整体动作和面部表情复刻到你指定的角色身上。
Creator
Wan-Video
Size
8.2 MB
Stars
18.1K
Updated
CommitSep 21
Age
1y
Commits · 90 Days