Text-to-Video
Wan2.2
Diffusers
Safetensors
StevenZhang commited on
Commit
cf5e2c0
·
verified ·
1 Parent(s): 91640ae

update readme

Browse files
.gitattributes CHANGED
@@ -34,3 +34,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  google/umt5-xxl/tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  google/umt5-xxl/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ assets/comp_effic.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/moe_2.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/performance.png filter=lfs diff=lfs merge=lfs -text
40
+ assets/vae.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,247 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Wan2.2
2
+
3
+ <p align="center">
4
+ <img src="assets/logo.png" width="400"/>
5
+ <p>
6
+
7
+ <p align="center">
8
+ 💜 <a href="https://wan.video"><b>Wan</b></a> &nbsp&nbsp | &nbsp&nbsp 🖥️ <a href="https://github.com/Wan-Video/Wan2.2">GitHub</a> &nbsp&nbsp | &nbsp&nbsp🤗 <a href="https://huggingface.co/Wan-AI/">Hugging Face</a>&nbsp&nbsp | &nbsp&nbsp🤖 <a href="https://modelscope.cn/organization/Wan-AI">ModelScope</a>&nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://arxiv.org/abs/2503.20314">Technical Report</a> &nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://wan.video/welcome?spm=a2ty_o02.30011076.0.0.6c9ee41eCcluqg">Blog</a> &nbsp&nbsp | &nbsp&nbsp💬 <a href="https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg">WeChat Group</a>&nbsp&nbsp | &nbsp&nbsp 📖 <a href="https://discord.gg/AKNgpMK4Yj">Discord</a>&nbsp&nbsp
9
+ <br>
10
+
11
+ -----
12
+
13
+ [**Wan: Open and Advanced Large-Scale Video Generative Models**](https://arxiv.org/abs/2503.20314) <be>
14
+
15
+
16
+ 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:
17
+
18
+ - 👍 **Effective MoE Architecture**: Wan2.2 introduces a Mixture-of-Experts (MoE) architecture into video diffusion models. By separating the denoising process cross timesteps with specialized powerful expert models, this enlarges the overall model capacity while maintaining the same computational cost.
19
+
20
+ - 👍 **Cinematic-level Aesthetics**: Wan2.2 incorporates meticulously curated aesthetic data, complete with detailed labels for lighting, composition, contrast, color tone, and more. This allows for more precise and controllable cinematic style generation, facilitating the creation of videos with customizable aesthetic preferences.
21
+
22
+ - 👍 **Complex Motion Generation**: Compared to Wan2.1, Wan2.2 is trained on a significantly larger data, with +65.6% more images and +83.2% more videos. This expansion notably enhances the model's generalization across multiple dimensions such as motions, semantics, and aesthetics, achieving TOP performance among all open-sourced and closed-sourced models.
23
+
24
+ - 👍 **Efficient High-Definition Hybrid TI2V**: Wan2.2 open-sources a 5B model built with our advanced Wan2.2-VAE that achieves a compression ratio of **16×16×4**. This model supports both text-to-video and image-to-video generation at 720P resolution with 24fps and can also run on consumer-grade graphics cards like 4090. It is one of the fastest **720P@24fps** models currently available, capable of serving both the industrial and academic sectors simultaneously.
25
+
26
+
27
+ This repository contains our T2V-A14B model, which supports generating 5s videos at both 480P and 720P resolutions. Built with a Mixture-of-Experts (MoE) architecture, it delivers outstanding video generation quality. On our new benchmark Wan-Bench 2.0, the model surpasses leading commercial models across most key evaluation dimensions.
28
+
29
+
30
+ ## Video Demos
31
+
32
+ <div align="center">
33
+ <video src="https://cloud.video.taobao.com/vod/NnCd0fC-1eckDUuVBMz43oD_U6mTsPpBwga3wdnAkXA.mp4" width="70%" poster=""> </video>
34
+ </div>
35
+
36
+ ## 🔥 Latest News!!
37
+
38
+ * Jul 28, 2025: 👋 Wan2.1 has been integrated into ComfyUI ([CN](https://docs.comfy.org/zh-CN/tutorials/video/wan/wan2_2) | [EN](https://docs.comfy.org/tutorials/video/wan/wan2_2)). Enjoy!
39
+ * Jul 28, 2025: 👋 Wan2.2's T2V, I2V and TI2V have been integrated into Diffusers ([T2V-A14B](https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers) | [I2V-A14B](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers) | [TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers)). Feel free to give it a try!
40
+ * Jul 28, 2025: 👋 We've released the inference code and model weights of **Wan2.2**.
41
+
42
+
43
+ ## Community Works
44
+ If your research or project builds upon [**Wan2.1**](https://github.com/Wan-Video/Wan2.1) or Wan2.2, we welcome you to share it with us so we can highlight it for the broader community.
45
+
46
+
47
+ ## 📑 Todo List
48
+ - Wan2.2 Text-to-Video
49
+ - [x] Multi-GPU Inference code of the A14B and 14B models
50
+ - [x] Checkpoints of the A14B and 14B models
51
+ - [x] ComfyUI integration
52
+ - [x] Diffusers integration
53
+ - Wan2.2 Image-to-Video
54
+ - [x] Multi-GPU Inference code of the A14B model
55
+ - [x] Checkpoints of the A14B model
56
+ - [x] ComfyUI integration
57
+ - [x] Diffusers integration
58
+ - Wan2.2 Text-Image-to-Video
59
+ - [x] Multi-GPU Inference code of the 5B model
60
+ - [x] Checkpoints of the 5B model
61
+ - [x] ComfyUI integration
62
+ - [x] Diffusers integration
63
+
64
+ ## Run Wan2.2
65
+
66
+ #### Installation
67
+ Clone the repo:
68
+ ```sh
69
+ git clone https://github.com/Wan-Video/Wan2.2.git
70
+ cd Wan2.2
71
+ ```
72
+
73
+ Install dependencies:
74
+ ```sh
75
+ # Ensure torch >= 2.4.0
76
+ # If the installation of `flash_attn` fails, try installing the other packages first and install `flash_attn` last
77
+ pip install -r requirements.txt
78
+ ```
79
+
80
+
81
+ #### Model Download
82
+
83
+
84
+
85
+
86
+ | Models | Download Links | Description |
87
+ |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-------------|
88
+ | T2V-A14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B) 🤖 [ModelScope](https://modelscope.cn/models/Wan-AI/Wan2.2-T2V-A14B) | Text-to-Video MoE model, supports 480P & 720P |
89
+ | I2V-A14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B) 🤖 [ModelScope](https://modelscope.cn/models/Wan-AI/Wan2.2-I2V-A14B) | Image-to-Video MoE model, supports 480P & 720P |
90
+ | TI2V-5B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B) 🤖 [ModelScope](https://modelscope.cn/models/Wan-AI/Wan2.2-TI2V-5B) | High-compression VAE, T2V+I2V, supports 720P |
91
+
92
+
93
+ > 💡Note:
94
+ > The TI2V-5B model supports 720P video generation at **24 FPS**.
95
+
96
+
97
+ Download models using huggingface-cli:
98
+ ``` sh
99
+ pip install "huggingface_hub[cli]"
100
+ huggingface-cli download Wan-AI/Wan2.2-T2V-A14B --local-dir ./Wan2.2-T2V-A14B
101
+ ```
102
+
103
+ Download models using modelscope-cli:
104
+ ``` sh
105
+ pip install modelscope
106
+ modelscope download Wan-AI/Wan2.2-T2V-A14B --local_dir ./Wan2.2-T2V-A14B
107
+ ```
108
+
109
+ #### Run Text-to-Video Generation
110
+
111
+ This repository supports the `Wan2.2-T2V-A14B` Text-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
112
+
113
+
114
+ ##### (1) Without Prompt Extension
115
+
116
+ To facilitate implementation, we will start with a basic version of the inference process that skips the [prompt extension](#2-using-prompt-extention) step.
117
+
118
+ - Single-GPU inference
119
+
120
+ ``` sh
121
+ 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."
122
+ ```
123
+
124
+ > 💡 This command can run on a GPU with at least 80GB VRAM.
125
+
126
+ > 💡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.
127
+
128
+
129
+ - Multi-GPU inference using FSDP + DeepSpeed Ulysses
130
+
131
+ We use [PyTorch FSDP](https://docs.pytorch.org/docs/stable/fsdp.html) and [DeepSpeed Ulysses](https://arxiv.org/abs/2309.14509) to accelerate inference.
132
+
133
+
134
+ ``` sh
135
+ 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."
136
+ ```
137
+
138
+
139
+ ##### (2) Using Prompt Extension
140
+
141
+ 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:
142
+
143
+ - Use the Dashscope API for extension.
144
+ - Apply for a `dashscope.api_key` in advance ([EN](https://www.alibabacloud.com/help/en/model-studio/getting-started/first-api-call-to-qwen) | [CN](https://help.aliyun.com/zh/model-studio/getting-started/first-api-call-to-qwen)).
145
+ - Configure the environment variable `DASH_API_KEY` to specify the Dashscope API key. For users of Alibaba Cloud's international site, you also need to set the environment variable `DASH_API_URL` to 'https://dashscope-intl.aliyuncs.com/api/v1'. For more detailed instructions, please refer to the [dashscope document](https://www.alibabacloud.com/help/en/model-studio/developer-reference/use-qwen-by-calling-api?spm=a2c63.p38356.0.i1).
146
+ - Use the `qwen-plus` model for text-to-video tasks and `qwen-vl-max` for image-to-video tasks.
147
+ - You can modify the model used for extension with the parameter `--prompt_extend_model`. For example:
148
+ ```sh
149
+ 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'
150
+ ```
151
+
152
+ - Using a local model for extension.
153
+
154
+ - By default, the Qwen model on HuggingFace is used for this extension. Users can choose Qwen models or other models based on the available GPU memory size.
155
+ - For text-to-video tasks, you can use models like `Qwen/Qwen2.5-14B-Instruct`, `Qwen/Qwen2.5-7B-Instruct` and `Qwen/Qwen2.5-3B-Instruct`.
156
+ - For image-to-video tasks, you can use models like `Qwen/Qwen2.5-VL-7B-Instruct` and `Qwen/Qwen2.5-VL-3B-Instruct`.
157
+ - Larger models generally provide better extension results but require more GPU memory.
158
+ - You can modify the model used for extension with the parameter `--prompt_extend_model` , allowing you to specify either a local model path or a Hugging Face model. For example:
159
+
160
+ ``` sh
161
+ 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'
162
+ ```
163
+
164
+
165
+ ## Computational Efficiency on Different GPUs
166
+
167
+ We test the computational efficiency of different **Wan2.2** models on different GPUs in the following table. The results are presented in the format: **Total time (s) / peak GPU memory (GB)**.
168
+
169
+
170
+ <div align="center">
171
+ <img src="assets/comp_effic.png" alt="" style="width: 80%;" />
172
+ </div>
173
+
174
+ > The parameter settings for the tests presented in this table are as follows:
175
+ > (1) Multi-GPU: 14B: `--ulysses_size 4/8 --dit_fsdp --t5_fsdp`, 5B: `--ulysses_size 4/8 --offload_model True --convert_model_dtype --t5_cpu`; Single-GPU: 14B: `--offload_model True --convert_model_dtype`, 5B: `--offload_model True --convert_model_dtype --t5_cpu`
176
+ (--convert_model_dtype converts model parameter types to config.param_dtype);
177
+ > (2) The distributed testing utilizes the built-in FSDP and Ulysses implementations, with FlashAttention3 deployed on Hopper architecture GPUs;
178
+ > (3) Tests were run without the `--use_prompt_extend` flag;
179
+ > (4) Reported results are the average of multiple samples taken after the warm-up phase.
180
+
181
+
182
+ -------
183
+
184
+ ## Introduction of Wan2.2
185
+
186
+ **Wan2.2** builds on the foundation of Wan2.1 with notable improvements in generation quality and model capability. This upgrade is driven by a series of key technical innovations, mainly including the Mixture-of-Experts (MoE) architecture, upgraded training data, and high-compression video generation.
187
+
188
+ ##### (1) Mixture-of-Experts (MoE) Architecture
189
+
190
+ Wan2.2 introduces Mixture-of-Experts (MoE) architecture into the video generation diffusion model. MoE has been widely validated in large language models as an efficient approach to increase total model parameters while keeping inference cost nearly unchanged. In Wan2.2, the A14B model series adopts a two-expert design tailored to the denoising process of diffusion models: a high-noise expert for the early stages, focusing on overall layout; and a low-noise expert for the later stages, refining video details. Each expert model has about 14B parameters, resulting in a total of 27B parameters but only 14B active parameters per step, keeping inference computation and GPU memory nearly unchanged.
191
+
192
+ <div align="center">
193
+ <img src="assets/moe_arch.png" alt="" style="width: 90%;" />
194
+ </div>
195
+
196
+ The transition point between the two experts is determined by the signal-to-noise ratio (SNR), a metric that decreases monotonically as the denoising step $t$ increases. At the beginning of the denoising process, $t$ is large and the noise level is high, so the SNR is at its minimum, denoted as ${SNR}_{min}$. In this stage, the high-noise expert is activated. We define a threshold step ${t}_{moe}$ corresponding to half of the ${SNR}_{min}$, and switch to the low-noise expert when $t<{t}_{moe}$.
197
+
198
+ <div align="center">
199
+ <img src="assets/moe_2.png" alt="" style="width: 90%;" />
200
+ </div>
201
+
202
+ To validate the effectiveness of the MoE architecture, four settings are compared based on their validation loss curves. The baseline **Wan2.1** model does not employ the MoE architecture. Among the MoE-based variants, the **Wan2.1 & High-Noise Expert** reuses the Wan2.1 model as the low-noise expert while uses the Wan2.2's high-noise expert, while the **Wan2.1 & Low-Noise Expert** uses Wan2.1 as the high-noise expert and employ the Wan2.2's low-noise expert. The **Wan2.2 (MoE)** (our final version) achieves the lowest validation loss, indicating that its generated video distribution is closest to ground-truth and exhibits superior convergence.
203
+
204
+
205
+ ##### (2) Efficient High-Definition Hybrid TI2V
206
+ To enable more efficient deployment, Wan2.2 also explores a high-compression design. In addition to the 27B MoE models, a 5B dense model, i.e., TI2V-5B, is released. It is supported by a high-compression Wan2.2-VAE, which achieves a $T\times H\times W$ compression ratio of $4\times16\times16$, increasing the overall compression rate to 64 while maintaining high-quality video reconstruction. With an additional patchification layer, the total compression ratio of TI2V-5B reaches $4\times32\times32$. Without specific optimization, TI2V-5B can generate a 5-second 720P video in under 9 minutes on a single consumer-grade GPU, ranking among the fastest 720P@24fps video generation models. This model also natively supports both text-to-video and image-to-video tasks within a single unified framework, covering both academic research and practical applications.
207
+
208
+
209
+ <div align="center">
210
+ <img src="assets/vae.png" alt="" style="width: 80%;" />
211
+ </div>
212
+
213
+
214
+
215
+ ##### Comparisons to SOTAs
216
+ We compared Wan2.2 with leading closed-source commercial models on our new Wan-Bench 2.0, evaluating performance across multiple crucial dimensions. The results demonstrate that Wan2.2 achieves superior performance compared to these leading models.
217
+
218
+
219
+ <div align="center">
220
+ <img src="assets/performance.png" alt="" style="width: 90%;" />
221
+ </div>
222
+
223
+ ## Citation
224
+ If you find our work helpful, please cite us.
225
+
226
+ ```
227
+ @article{wan2025,
228
+ title={Wan: Open and Advanced Large-Scale Video Generative Models},
229
+ 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},
230
+ journal = {arXiv preprint arXiv:2503.20314},
231
+ year={2025}
232
+ }
233
+ ```
234
+
235
+ ## License Agreement
236
+ The models in this repository are licensed under the Apache 2.0 License. We claim no rights over the your generated contents, granting you the freedom to use them while ensuring that your usage complies with the provisions of this license. You are fully accountable for your use of the models, which must not involve sharing any content that violates applicable laws, causes harm to individuals or groups, disseminates personal information intended for harm, spreads misinformation, or targets vulnerable populations. For a complete list of restrictions and details regarding your rights, please refer to the full text of the [license](LICENSE.txt).
237
+
238
+
239
+ ## Acknowledgements
240
+
241
+ We would like to thank the contributors to the [SD3](https://huggingface.co/stabilityai/stable-diffusion-3-medium), [Qwen](https://huggingface.co/Qwen), [umt5-xxl](https://huggingface.co/google/umt5-xxl), [diffusers](https://github.com/huggingface/diffusers) and [HuggingFace](https://huggingface.co) repositories, for their open research.
242
+
243
+
244
+
245
+ ## Contact Us
246
+ If you would like to leave a message to our research or product teams, feel free to join our [Discord](https://discord.gg/AKNgpMK4Yj) or [WeChat groups](https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg)!
247
+
assets/comp_effic.png ADDED

Git LFS Details

  • SHA256: 75ee012dcfb08365bec67a3ec7afc126fc2817f79b9f80e38711792d4770e32b
  • Pointer size: 131 Bytes
  • Size of remote file: 202 kB
assets/logo.png ADDED
assets/moe_2.png ADDED

Git LFS Details

  • SHA256: 4ea471ccb64349bd08bc9a78f336ae000e9ca3b40da9a652b8028b214a8c6093
  • Pointer size: 131 Bytes
  • Size of remote file: 528 kB
assets/moe_arch.png ADDED
assets/performance.png ADDED

Git LFS Details

  • SHA256: 97ef99c13c8ae717a8a11c8d8ec927b69077c647cc6689755d08fc38e7fbb830
  • Pointer size: 131 Bytes
  • Size of remote file: 307 kB
assets/vae.png ADDED

Git LFS Details

  • SHA256: 4aaea5e187f1c5908e15ade5bef24c9fb59882986bc3d2ad75f7fe820f3d772f
  • Pointer size: 131 Bytes
  • Size of remote file: 165 kB