liuyuyuil commited on
Commit
1457bb8
ยท
verified ยท
1 Parent(s): e6aede1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +269 -258
README.md CHANGED
@@ -1,258 +1,269 @@
1
- # Wan2.1
2
-
3
- <p align="center">
4
- <img src="assets/logo.png" width="400"/>
5
- <p>
6
-
7
- <p align="center">
8
- ๐Ÿ’œ <a href=""><b>Wan</b></a> &nbsp&nbsp ๏ฝœ &nbsp&nbsp ๐Ÿ–ฅ๏ธ <a href="https://github.com/Wan-Video/Wan2.1">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="">Paper (Coming soon)</a> &nbsp&nbsp | &nbsp&nbsp ๐Ÿ“‘ <a href="https://wanxai.com">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/p5XbdQV7">Discord</a>&nbsp&nbsp
9
- <br>
10
-
11
- -----
12
-
13
- [**Wan: Open and Advanced Large-Scale Video Generative Models**]() <be>
14
-
15
- In this repository, we present **Wan2.1**, a comprehensive and open suite of video foundation models that pushes the boundaries of video generation. **Wan2.1** offers these key features:
16
- - ๐Ÿ‘ **SOTA Performance**: **Wan2.1** consistently outperforms existing open-source models and state-of-the-art commercial solutions across multiple benchmarks.
17
- - ๐Ÿ‘ **Supports Consumer-grade GPUs**: The T2V-1.3B model requires only 8.19 GB VRAM, making it compatible with almost all consumer-grade GPUs. It can generate a 5-second 480P video on an RTX 4090 in about 4 minutes (without optimization techniques like quantization). Its performance is even comparable to some closed-source models.
18
- - ๐Ÿ‘ **Multiple Tasks**: **Wan2.1** excels in Text-to-Video, Image-to-Video, Video Editing, Text-to-Image, and Video-to-Audio, advancing the field of video generation.
19
- - ๐Ÿ‘ **Visual Text Generation**: **Wan2.1** is the first video model capable of generating both Chinese and English text, featuring robust text generation that enhances its practical applications.
20
- - ๐Ÿ‘ **Powerful Video VAE**: **Wan-VAE** delivers exceptional efficiency and performance, encoding and decoding 1080P videos of any length while preserving temporal information, making it an ideal foundation for video and image generation.
21
-
22
-
23
- This repository contains our I2V-14B model, which is capable of generating 720P high-definition videos. After thousands of rounds of human evaluations, this model has outperformed both closed-source and open-source alternatives, achieving state-of-the-art performance.
24
-
25
-
26
- ## Video Demos
27
-
28
- <div align="center">
29
- <video width="80%" controls>
30
- <source src="https://cloud.video.taobao.com/vod/Jth64Y7wNoPcJki_Bo1ZJTDBvNjsgjlVKsNs05Fqfps.mp4" type="video/mp4">
31
- Your browser does not support the video tag.
32
- </video>
33
- </div>
34
-
35
- ## ๐Ÿ”ฅ Latest News!!
36
-
37
- * Feb 25, 2025: ๐Ÿ‘‹ We've released the inference code and weights of Wan2.1.
38
-
39
-
40
- ## ๐Ÿ“‘ Todo List
41
- - Wan2.1 Text-to-Video
42
- - [x] Multi-GPU Inference code of the 14B and 1.3B models
43
- - [x] Checkpoints of the 14B and 1.3B models
44
- - [x] Gradio demo
45
- - [ ] Diffusers integration
46
- - [ ] ComfyUI integration
47
- - Wan2.1 Image-to-Video
48
- - [x] Multi-GPU Inference code of the 14B model
49
- - [x] Checkpoints of the 14B model
50
- - [x] Gradio demo
51
- - [ ] Diffusers integration
52
- - [ ] ComfyUI integration
53
-
54
-
55
- ## Quickstart
56
-
57
- #### Installation
58
- Clone the repo:
59
- ```
60
- git clone https://github.com/Wan-Video/Wan2.1.git
61
- cd Wan2.1
62
- ```
63
-
64
- Install dependencies:
65
- ```
66
- # Ensure torch >= 2.4.0
67
- pip install -r requirements.txt
68
- ```
69
-
70
-
71
- #### Model Download
72
-
73
- | Models | Download Link | Notes |
74
- | --------------|-------------------------------------------------------------------------------|-------------------------------|
75
- | T2V-14B | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-T2V-14B) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-T2V-14B) | Supports both 480P and 720P
76
- | I2V-14B-720P | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-720P) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-I2V-14B-720P) | Supports 720P
77
- | I2V-14B-480P | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-480P) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-I2V-14B-480P) | Supports 480P
78
- | T2V-1.3B | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-T2V-1.3B) | Supports 480P
79
-
80
- > ๐Ÿ’กNote: The 1.3B model is capable of generating videos at 720P resolution. However, due to limited training at this resolution, the results are generally less stable compared to 480P. For optimal performance, we recommend using 480P resolution.
81
-
82
-
83
- Download models using huggingface-cli:
84
- ```
85
- pip install "huggingface_hub[cli]"
86
- huggingface-cli download Wan-AI/Wan2.1-I2V-14B-720P --local-dir ./Wan2.1-I2V-14B-720P
87
- ```
88
-
89
-
90
- #### Run Image-to-Video Generation
91
-
92
- Similar to Text-to-Video, Image-to-Video is also divided into processes with and without the prompt extension step. The specific parameters and their corresponding settings are as follows:
93
- <table>
94
- <thead>
95
- <tr>
96
- <th rowspan="2">Task</th>
97
- <th colspan="2">Resolution</th>
98
- <th rowspan="2">Model</th>
99
- </tr>
100
- <tr>
101
- <th>480P</th>
102
- <th>720P</th>
103
- </tr>
104
- </thead>
105
- <tbody>
106
- <tr>
107
- <td>i2v-14B</td>
108
- <td style="color: green;">โŒ</td>
109
- <td style="color: green;">โœ”๏ธ</td>
110
- <td>Wan2.1-I2V-14B-720P</td>
111
- </tr>
112
- <tr>
113
- <td>i2v-14B</td>
114
- <td style="color: green;">โœ”๏ธ</td>
115
- <td style="color: red;">โŒ</td>
116
- <td>Wan2.1-T2V-14B-480P</td>
117
- </tr>
118
- </tbody>
119
- </table>
120
-
121
-
122
- ##### (1) Without Prompt Extention
123
-
124
- - Single-GPU inference
125
- ```
126
- python generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --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."
127
- ```
128
-
129
- > ๐Ÿ’ก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.
130
-
131
- - Multi-GPU inference using FSDP + xDiT USP
132
-
133
- ```
134
- pip install "xfuser>=0.4.1"
135
- torchrun --nproc_per_node=8 generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --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."
136
- ```
137
-
138
- ##### (2) Using Prompt Extention
139
-
140
-
141
- Run with local prompt extention using `Qwen/Qwen2.5-VL-7B-Instruct`:
142
- ```
143
- python generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --image examples/i2v_input.JPG --use_prompt_extend --prompt_extend_model Qwen/Qwen2.5-VL-7B-Instruct --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."
144
- ```
145
-
146
- Run with remote prompt extention using `dashscope`:
147
- ```
148
- DASH_API_KEY=your_key python generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --image examples/i2v_input.JPG --use_prompt_extend --prompt_extend_method 'dashscope' --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."
149
- ```
150
-
151
- ##### (3) Runing local gradio
152
-
153
- ```
154
- cd gradio
155
- # if one only uses 480P model in gradio
156
- DASH_API_KEY=your_key python i2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir_480p ./Wan2.1-I2V-14B-480P
157
-
158
- # if one only uses 720P model in gradio
159
- DASH_API_KEY=your_key python i2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir_720p ./Wan2.1-I2V-14B-720P
160
-
161
- # if one uses both 480P and 720P models in gradio
162
- DASH_API_KEY=your_key python i2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir_480p ./Wan2.1-I2V-14B-480P --ckpt_dir_720p ./Wan2.1-I2V-14B-720P
163
- ```
164
-
165
-
166
- ## Manual Evaluation
167
-
168
- We conducted extensive manual evaluations to evaluate the performance of the Image-to-Video model, and the results are presented in the table below. The results clearly indicate that **Wan2.1** outperforms both closed-source and open-source models.
169
-
170
- <div align="center">
171
- <img src="assets/i2v_res.png" alt="" style="width: 80%;" />
172
- </div>
173
-
174
-
175
- ## Computational Efficiency on Different GPUs
176
-
177
- We test the computational efficiency of different **Wan2.1** models on different GPUs in the following table. The results are presented in the format: **Total time (s) / peak GPU memory (GB)**.
178
-
179
-
180
- <div align="center">
181
- <img src="assets/comp_effic.png" alt="" style="width: 80%;" />
182
- </div>
183
-
184
- > The parameter settings for the tests presented in this table are as follows:
185
- > (1) For the 1.3B model on 8 GPUs, set `--ring_size 8` and `--ulysses_size 1`;
186
- > (2) For the 14B model on 1 GPU, use `--offload_model True`;
187
- > (3) For the 1.3B model on a single 4090 GPU, set `--offload_model True --t5_cpu`;
188
- > (4) For all testings, no prompt extension was applied, meaning `--use_prompt_extend` was not enabled.
189
-
190
- -------
191
-
192
- ## Introduction of Wan2.1
193
-
194
- **Wan2.1** is designed on the mainstream diffusion transformer paradigm, achieving significant advancements in generative capabilities through a series of innovations. These include our novel spatio-temporal variational autoencoder (VAE), scalable training strategies, large-scale data construction, and automated evaluation metrics. Collectively, these contributions enhance the modelโ€™s performance and versatility.
195
-
196
-
197
- ##### (1) 3D Variational Autoencoders
198
- We propose a novel 3D causal VAE architecture, termed **Wan-VAE** specifically designed for video generation. By combining multiple strategies, we improve spatio-temporal compression, reduce memory usage, and ensure temporal causality. **Wan-VAE** demonstrates significant advantages in performance efficiency compared to other open-source VAEs. Furthermore, our **Wan-VAE** can encode and decode unlimited-length 1080P videos without losing historical temporal information, making it particularly well-suited for video generation tasks.
199
-
200
-
201
- <div align="center">
202
- <img src="assets/video_vae_res.jpg" alt="" style="width: 80%;" />
203
- </div>
204
-
205
-
206
- ##### (2) Video Diffusion DiT
207
-
208
- **Wan2.1** is designed using the Flow Matching framework within the paradigm of mainstream Diffusion Transformers. Our model's architecture uses the T5 Encoder to encode multilingual text input, with cross-attention in each transformer block embedding the text into the model structure. Additionally, we employ an MLP with a Linear layer and a SiLU layer to process the input time embeddings and predict six modulation parameters individually. This MLP is shared across all transformer blocks, with each block learning a distinct set of biases. Our experimental findings reveal a significant performance improvement with this approach at the same parameter scale.
209
-
210
- <div align="center">
211
- <img src="assets/video_dit_arch.jpg" alt="" style="width: 80%;" />
212
- </div>
213
-
214
-
215
- | Model | Dimension | Input Dimension | Output Dimension | Feedforward Dimension | Frequency Dimension | Number of Heads | Number of Layers |
216
- |--------|-----------|-----------------|------------------|-----------------------|---------------------|-----------------|------------------|
217
- | 1.3B | 1536 | 16 | 16 | 8960 | 256 | 12 | 30 |
218
- | 14B | 5120 | 16 | 16 | 13824 | 256 | 40 | 40 |
219
-
220
-
221
-
222
- ##### Data
223
-
224
- We curated and deduplicated a candidate dataset comprising a vast amount of image and video data. During the data curation process, we designed a four-step data cleaning process, focusing on fundamental dimensions, visual quality and motion quality. Through the robust data processing pipeline, we can easily obtain high-quality, diverse, and large-scale training sets of images and videos.
225
-
226
- ![figure1](assets/data_for_diff_stage.jpg "figure1")
227
-
228
-
229
- ##### Comparisons to SOTA
230
- We compared **Wan2.1** with leading open-source and closed-source models to evaluate the performace. Using our carefully designed set of 1,035 internal prompts, we tested across 14 major dimensions and 26 sub-dimensions. We then compute the total score by performing a weighted calculation on the scores of each dimension, utilizing weights derived from human preferences in the matching process. The detailed results are shown in the table below. These results demonstrate our model's superior performance compared to both open-source and closed-source models.
231
-
232
- ![figure1](assets/vben_vs_sota.png "figure1")
233
-
234
-
235
- ## Citation
236
- If you find our work helpful, please cite us.
237
-
238
- ```
239
- @article{wan2.1,
240
- title = {Wan: Open and Advanced Large-Scale Video Generative Models},
241
- author = {Wan Team},
242
- journal = {},
243
- year = {2025}
244
- }
245
- ```
246
-
247
- ## License Agreement
248
- The models in this repository are licensed under the Apache 2.0 License. We claim no rights over the your generate 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).
249
-
250
-
251
- ## Acknowledgements
252
-
253
- 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.
254
-
255
-
256
-
257
- ## Contact Us
258
- If you would like to leave a message to our research or product teams, feel free to join our [Discord](https://discord.gg/p5XbdQV7) or [WeChat groups](https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg)!
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ pipeline_tag: image-to-video
7
+ library_name: diffusers
8
+ tags:
9
+ - video
10
+ - video genration
11
+ ---
12
+ # Wan2.1
13
+
14
+ <p align="center">
15
+ <img src="assets/logo.png" width="400"/>
16
+ <p>
17
+
18
+ <p align="center">
19
+ ๐Ÿ’œ <a href=""><b>Wan</b></a> &nbsp&nbsp ๏ฝœ &nbsp&nbsp ๐Ÿ–ฅ๏ธ <a href="https://github.com/Wan-Video/Wan2.1">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="">Paper (Coming soon)</a> &nbsp&nbsp | &nbsp&nbsp ๐Ÿ“‘ <a href="https://wanxai.com">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/p5XbdQV7">Discord</a>&nbsp&nbsp
20
+ <br>
21
+
22
+ -----
23
+
24
+ [**Wan: Open and Advanced Large-Scale Video Generative Models**]() <be>
25
+
26
+ In this repository, we present **Wan2.1**, a comprehensive and open suite of video foundation models that pushes the boundaries of video generation. **Wan2.1** offers these key features:
27
+ - ๐Ÿ‘ **SOTA Performance**: **Wan2.1** consistently outperforms existing open-source models and state-of-the-art commercial solutions across multiple benchmarks.
28
+ - ๐Ÿ‘ **Supports Consumer-grade GPUs**: The T2V-1.3B model requires only 8.19 GB VRAM, making it compatible with almost all consumer-grade GPUs. It can generate a 5-second 480P video on an RTX 4090 in about 4 minutes (without optimization techniques like quantization). Its performance is even comparable to some closed-source models.
29
+ - ๐Ÿ‘ **Multiple Tasks**: **Wan2.1** excels in Text-to-Video, Image-to-Video, Video Editing, Text-to-Image, and Video-to-Audio, advancing the field of video generation.
30
+ - ๐Ÿ‘ **Visual Text Generation**: **Wan2.1** is the first video model capable of generating both Chinese and English text, featuring robust text generation that enhances its practical applications.
31
+ - ๐Ÿ‘ **Powerful Video VAE**: **Wan-VAE** delivers exceptional efficiency and performance, encoding and decoding 1080P videos of any length while preserving temporal information, making it an ideal foundation for video and image generation.
32
+
33
+
34
+ This repository contains our I2V-14B model, which is capable of generating 720P high-definition videos. After thousands of rounds of human evaluations, this model has outperformed both closed-source and open-source alternatives, achieving state-of-the-art performance.
35
+
36
+
37
+ ## Video Demos
38
+
39
+ <div align="center">
40
+ <video width="80%" controls>
41
+ <source src="https://cloud.video.taobao.com/vod/Jth64Y7wNoPcJki_Bo1ZJTDBvNjsgjlVKsNs05Fqfps.mp4" type="video/mp4">
42
+ Your browser does not support the video tag.
43
+ </video>
44
+ </div>
45
+
46
+ ## ๐Ÿ”ฅ Latest News!!
47
+
48
+ * Feb 25, 2025: ๐Ÿ‘‹ We've released the inference code and weights of Wan2.1.
49
+
50
+
51
+ ## ๐Ÿ“‘ Todo List
52
+ - Wan2.1 Text-to-Video
53
+ - [x] Multi-GPU Inference code of the 14B and 1.3B models
54
+ - [x] Checkpoints of the 14B and 1.3B models
55
+ - [x] Gradio demo
56
+ - [ ] Diffusers integration
57
+ - [ ] ComfyUI integration
58
+ - Wan2.1 Image-to-Video
59
+ - [x] Multi-GPU Inference code of the 14B model
60
+ - [x] Checkpoints of the 14B model
61
+ - [x] Gradio demo
62
+ - [ ] Diffusers integration
63
+ - [ ] ComfyUI integration
64
+
65
+
66
+ ## Quickstart
67
+
68
+ #### Installation
69
+ Clone the repo:
70
+ ```
71
+ git clone https://github.com/Wan-Video/Wan2.1.git
72
+ cd Wan2.1
73
+ ```
74
+
75
+ Install dependencies:
76
+ ```
77
+ # Ensure torch >= 2.4.0
78
+ pip install -r requirements.txt
79
+ ```
80
+
81
+
82
+ #### Model Download
83
+
84
+ | Models | Download Link | Notes |
85
+ | --------------|-------------------------------------------------------------------------------|-------------------------------|
86
+ | T2V-14B | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-T2V-14B) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-T2V-14B) | Supports both 480P and 720P
87
+ | I2V-14B-720P | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-720P) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-I2V-14B-720P) | Supports 720P
88
+ | I2V-14B-480P | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-480P) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-I2V-14B-480P) | Supports 480P
89
+ | T2V-1.3B | ๐Ÿค— [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B) ๐Ÿค– [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-T2V-1.3B) | Supports 480P
90
+
91
+ > ๐Ÿ’กNote: The 1.3B model is capable of generating videos at 720P resolution. However, due to limited training at this resolution, the results are generally less stable compared to 480P. For optimal performance, we recommend using 480P resolution.
92
+
93
+
94
+ Download models using huggingface-cli:
95
+ ```
96
+ pip install "huggingface_hub[cli]"
97
+ huggingface-cli download Wan-AI/Wan2.1-I2V-14B-720P --local-dir ./Wan2.1-I2V-14B-720P
98
+ ```
99
+
100
+
101
+ #### Run Image-to-Video Generation
102
+
103
+ Similar to Text-to-Video, Image-to-Video is also divided into processes with and without the prompt extension step. The specific parameters and their corresponding settings are as follows:
104
+ <table>
105
+ <thead>
106
+ <tr>
107
+ <th rowspan="2">Task</th>
108
+ <th colspan="2">Resolution</th>
109
+ <th rowspan="2">Model</th>
110
+ </tr>
111
+ <tr>
112
+ <th>480P</th>
113
+ <th>720P</th>
114
+ </tr>
115
+ </thead>
116
+ <tbody>
117
+ <tr>
118
+ <td>i2v-14B</td>
119
+ <td style="color: green;">โŒ</td>
120
+ <td style="color: green;">โœ”๏ธ</td>
121
+ <td>Wan2.1-I2V-14B-720P</td>
122
+ </tr>
123
+ <tr>
124
+ <td>i2v-14B</td>
125
+ <td style="color: green;">โœ”๏ธ</td>
126
+ <td style="color: red;">โŒ</td>
127
+ <td>Wan2.1-T2V-14B-480P</td>
128
+ </tr>
129
+ </tbody>
130
+ </table>
131
+
132
+
133
+ ##### (1) Without Prompt Extention
134
+
135
+ - Single-GPU inference
136
+ ```
137
+ python generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --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."
138
+ ```
139
+
140
+ > ๐Ÿ’ก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.
141
+
142
+ - Multi-GPU inference using FSDP + xDiT USP
143
+
144
+ ```
145
+ pip install "xfuser>=0.4.1"
146
+ torchrun --nproc_per_node=8 generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --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."
147
+ ```
148
+
149
+ ##### (2) Using Prompt Extention
150
+
151
+
152
+ Run with local prompt extention using `Qwen/Qwen2.5-VL-7B-Instruct`:
153
+ ```
154
+ python generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --image examples/i2v_input.JPG --use_prompt_extend --prompt_extend_model Qwen/Qwen2.5-VL-7B-Instruct --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."
155
+ ```
156
+
157
+ Run with remote prompt extention using `dashscope`:
158
+ ```
159
+ DASH_API_KEY=your_key python generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --image examples/i2v_input.JPG --use_prompt_extend --prompt_extend_method 'dashscope' --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."
160
+ ```
161
+
162
+ ##### (3) Runing local gradio
163
+
164
+ ```
165
+ cd gradio
166
+ # if one only uses 480P model in gradio
167
+ DASH_API_KEY=your_key python i2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir_480p ./Wan2.1-I2V-14B-480P
168
+
169
+ # if one only uses 720P model in gradio
170
+ DASH_API_KEY=your_key python i2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir_720p ./Wan2.1-I2V-14B-720P
171
+
172
+ # if one uses both 480P and 720P models in gradio
173
+ DASH_API_KEY=your_key python i2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir_480p ./Wan2.1-I2V-14B-480P --ckpt_dir_720p ./Wan2.1-I2V-14B-720P
174
+ ```
175
+
176
+
177
+ ## Manual Evaluation
178
+
179
+ We conducted extensive manual evaluations to evaluate the performance of the Image-to-Video model, and the results are presented in the table below. The results clearly indicate that **Wan2.1** outperforms both closed-source and open-source models.
180
+
181
+ <div align="center">
182
+ <img src="assets/i2v_res.png" alt="" style="width: 80%;" />
183
+ </div>
184
+
185
+
186
+ ## Computational Efficiency on Different GPUs
187
+
188
+ We test the computational efficiency of different **Wan2.1** models on different GPUs in the following table. The results are presented in the format: **Total time (s) / peak GPU memory (GB)**.
189
+
190
+
191
+ <div align="center">
192
+ <img src="assets/comp_effic.png" alt="" style="width: 80%;" />
193
+ </div>
194
+
195
+ > The parameter settings for the tests presented in this table are as follows:
196
+ > (1) For the 1.3B model on 8 GPUs, set `--ring_size 8` and `--ulysses_size 1`;
197
+ > (2) For the 14B model on 1 GPU, use `--offload_model True`;
198
+ > (3) For the 1.3B model on a single 4090 GPU, set `--offload_model True --t5_cpu`;
199
+ > (4) For all testings, no prompt extension was applied, meaning `--use_prompt_extend` was not enabled.
200
+
201
+ -------
202
+
203
+ ## Introduction of Wan2.1
204
+
205
+ **Wan2.1** is designed on the mainstream diffusion transformer paradigm, achieving significant advancements in generative capabilities through a series of innovations. These include our novel spatio-temporal variational autoencoder (VAE), scalable training strategies, large-scale data construction, and automated evaluation metrics. Collectively, these contributions enhance the modelโ€™s performance and versatility.
206
+
207
+
208
+ ##### (1) 3D Variational Autoencoders
209
+ We propose a novel 3D causal VAE architecture, termed **Wan-VAE** specifically designed for video generation. By combining multiple strategies, we improve spatio-temporal compression, reduce memory usage, and ensure temporal causality. **Wan-VAE** demonstrates significant advantages in performance efficiency compared to other open-source VAEs. Furthermore, our **Wan-VAE** can encode and decode unlimited-length 1080P videos without losing historical temporal information, making it particularly well-suited for video generation tasks.
210
+
211
+
212
+ <div align="center">
213
+ <img src="assets/video_vae_res.jpg" alt="" style="width: 80%;" />
214
+ </div>
215
+
216
+
217
+ ##### (2) Video Diffusion DiT
218
+
219
+ **Wan2.1** is designed using the Flow Matching framework within the paradigm of mainstream Diffusion Transformers. Our model's architecture uses the T5 Encoder to encode multilingual text input, with cross-attention in each transformer block embedding the text into the model structure. Additionally, we employ an MLP with a Linear layer and a SiLU layer to process the input time embeddings and predict six modulation parameters individually. This MLP is shared across all transformer blocks, with each block learning a distinct set of biases. Our experimental findings reveal a significant performance improvement with this approach at the same parameter scale.
220
+
221
+ <div align="center">
222
+ <img src="assets/video_dit_arch.jpg" alt="" style="width: 80%;" />
223
+ </div>
224
+
225
+
226
+ | Model | Dimension | Input Dimension | Output Dimension | Feedforward Dimension | Frequency Dimension | Number of Heads | Number of Layers |
227
+ |--------|-----------|-----------------|------------------|-----------------------|---------------------|-----------------|------------------|
228
+ | 1.3B | 1536 | 16 | 16 | 8960 | 256 | 12 | 30 |
229
+ | 14B | 5120 | 16 | 16 | 13824 | 256 | 40 | 40 |
230
+
231
+
232
+
233
+ ##### Data
234
+
235
+ We curated and deduplicated a candidate dataset comprising a vast amount of image and video data. During the data curation process, we designed a four-step data cleaning process, focusing on fundamental dimensions, visual quality and motion quality. Through the robust data processing pipeline, we can easily obtain high-quality, diverse, and large-scale training sets of images and videos.
236
+
237
+ ![figure1](assets/data_for_diff_stage.jpg "figure1")
238
+
239
+
240
+ ##### Comparisons to SOTA
241
+ We compared **Wan2.1** with leading open-source and closed-source models to evaluate the performace. Using our carefully designed set of 1,035 internal prompts, we tested across 14 major dimensions and 26 sub-dimensions. We then compute the total score by performing a weighted calculation on the scores of each dimension, utilizing weights derived from human preferences in the matching process. The detailed results are shown in the table below. These results demonstrate our model's superior performance compared to both open-source and closed-source models.
242
+
243
+ ![figure1](assets/vben_vs_sota.png "figure1")
244
+
245
+
246
+ ## Citation
247
+ If you find our work helpful, please cite us.
248
+
249
+ ```
250
+ @article{wan2.1,
251
+ title = {Wan: Open and Advanced Large-Scale Video Generative Models},
252
+ author = {Wan Team},
253
+ journal = {},
254
+ year = {2025}
255
+ }
256
+ ```
257
+
258
+ ## License Agreement
259
+ The models in this repository are licensed under the Apache 2.0 License. We claim no rights over the your generate 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).
260
+
261
+
262
+ ## Acknowledgements
263
+
264
+ 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.
265
+
266
+
267
+
268
+ ## Contact Us
269
+ If you would like to leave a message to our research or product teams, feel free to join our [Discord](https://discord.gg/p5XbdQV7) or [WeChat groups](https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg)!