Add pipeline tag and library name
Browse filesThis PR adds a relevant pipeline tag, ensuring people can find the model at https://huggingface.co/models?pipeline_tag=image-to-video&sort=trending.
It also ensures the "how to use" button shows up.
README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
3 |
---
|
|
|
4 |
# Wan2.1
|
5 |
|
6 |
<p align="center">
|
@@ -96,7 +99,9 @@ pip install -r requirements.txt
|
|
96 |
| 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
|
97 |
| FLF2V-14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-FLF2V-14B-720P) 🤖 [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-FLF2V-14B-720P) | Supports 720P
|
98 |
|
99 |
-
> 💡Note:
|
|
|
|
|
100 |
|
101 |
|
102 |
Download models using huggingface-cli:
|
@@ -189,7 +194,7 @@ Extending the prompts can effectively enrich the details in the generated videos
|
|
189 |
|
190 |
- Use the Dashscope API for extension.
|
191 |
- 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)).
|
192 |
-
- 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)
|
193 |
- Use the `qwen-plus` model for text-to-video tasks and `qwen-vl-max` for image-to-video tasks.
|
194 |
- You can modify the model used for extension with the parameter `--prompt_extend_model`. For example:
|
195 |
```sh
|
@@ -437,153 +442,4 @@ python generate.py --task flf2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-FLF2V-14
|
|
437 |
|
438 |
Run with remote prompt extension using `dashscope`:
|
439 |
```
|
440 |
-
DASH_API_KEY=your_key python generate.py --task flf2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-FLF2V-14B-720P --first_frame examples/flf2v_input_first_frame.png --last_frame examples/flf2v_input_last_frame.png --use_prompt_extend --prompt_extend_method 'dashscope' --prompt "CG animation style, a small blue bird takes off from the ground, flapping its wings. The bird’s feathers are delicate, with
|
441 |
-
```
|
442 |
-
|
443 |
-
|
444 |
-
##### (3) Running local gradio
|
445 |
-
|
446 |
-
```sh
|
447 |
-
cd gradio
|
448 |
-
# use 720P model in gradio
|
449 |
-
DASH_API_KEY=your_key python flf2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir_720p ./Wan2.1-FLF2V-14B-720P
|
450 |
-
```
|
451 |
-
|
452 |
-
|
453 |
-
#### Run Text-to-Image Generation
|
454 |
-
|
455 |
-
Wan2.1 is a unified model for both image and video generation. Since it was trained on both types of data, it can also generate images. The command for generating images is similar to video generation, as follows:
|
456 |
-
|
457 |
-
##### (1) Without Prompt Extension
|
458 |
-
|
459 |
-
- Single-GPU inference
|
460 |
-
```sh
|
461 |
-
python generate.py --task t2i-14B --size 1024*1024 --ckpt_dir ./Wan2.1-T2V-14B --prompt '一个朴素端庄的美人'
|
462 |
-
```
|
463 |
-
|
464 |
-
- Multi-GPU inference using FSDP + xDiT USP
|
465 |
-
|
466 |
-
```sh
|
467 |
-
torchrun --nproc_per_node=8 generate.py --dit_fsdp --t5_fsdp --ulysses_size 8 --base_seed 0 --frame_num 1 --task t2i-14B --size 1024*1024 --prompt '一个朴素端庄的美人' --ckpt_dir ./Wan2.1-T2V-14B
|
468 |
-
```
|
469 |
-
|
470 |
-
##### (2) With Prompt Extention
|
471 |
-
|
472 |
-
- Single-GPU inference
|
473 |
-
```sh
|
474 |
-
python generate.py --task t2i-14B --size 1024*1024 --ckpt_dir ./Wan2.1-T2V-14B --prompt '一个朴素端庄的美人' --use_prompt_extend
|
475 |
-
```
|
476 |
-
|
477 |
-
- Multi-GPU inference using FSDP + xDiT USP
|
478 |
-
```sh
|
479 |
-
torchrun --nproc_per_node=8 generate.py --dit_fsdp --t5_fsdp --ulysses_size 8 --base_seed 0 --frame_num 1 --task t2i-14B --size 1024*1024 --ckpt_dir ./Wan2.1-T2V-14B --prompt '一个朴素端庄的美人' --use_prompt_extend
|
480 |
-
```
|
481 |
-
|
482 |
-
|
483 |
-
## Manual Evaluation
|
484 |
-
|
485 |
-
##### (1) Text-to-Video Evaluation
|
486 |
-
|
487 |
-
Through manual evaluation, the results generated after prompt extension are superior to those from both closed-source and open-source models.
|
488 |
-
|
489 |
-
<div align="center">
|
490 |
-
<img src="assets/t2v_res.jpg" alt="" style="width: 80%;" />
|
491 |
-
</div>
|
492 |
-
|
493 |
-
|
494 |
-
##### (2) Image-to-Video Evaluation
|
495 |
-
|
496 |
-
We also 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.
|
497 |
-
|
498 |
-
<div align="center">
|
499 |
-
<img src="assets/i2v_res.png" alt="" style="width: 80%;" />
|
500 |
-
</div>
|
501 |
-
|
502 |
-
|
503 |
-
## Computational Efficiency on Different GPUs
|
504 |
-
|
505 |
-
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)**.
|
506 |
-
|
507 |
-
|
508 |
-
<div align="center">
|
509 |
-
<img src="assets/comp_effic.png" alt="" style="width: 80%;" />
|
510 |
-
</div>
|
511 |
-
|
512 |
-
> The parameter settings for the tests presented in this table are as follows:
|
513 |
-
> (1) For the 1.3B model on 8 GPUs, set `--ring_size 8` and `--ulysses_size 1`;
|
514 |
-
> (2) For the 14B model on 1 GPU, use `--offload_model True`;
|
515 |
-
> (3) For the 1.3B model on a single 4090 GPU, set `--offload_model True --t5_cpu`;
|
516 |
-
> (4) For all testings, no prompt extension was applied, meaning `--use_prompt_extend` was not enabled.
|
517 |
-
|
518 |
-
> 💡Note: T2V-14B is slower than I2V-14B because the former samples 50 steps while the latter uses 40 steps.
|
519 |
-
|
520 |
-
|
521 |
-
-------
|
522 |
-
|
523 |
-
## Introduction of Wan2.1
|
524 |
-
|
525 |
-
**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.
|
526 |
-
|
527 |
-
|
528 |
-
##### (1) 3D Variational Autoencoders
|
529 |
-
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.
|
530 |
-
|
531 |
-
|
532 |
-
<div align="center">
|
533 |
-
<img src="assets/video_vae_res.jpg" alt="" style="width: 80%;" />
|
534 |
-
</div>
|
535 |
-
|
536 |
-
|
537 |
-
##### (2) Video Diffusion DiT
|
538 |
-
|
539 |
-
**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.
|
540 |
-
|
541 |
-
<div align="center">
|
542 |
-
<img src="assets/video_dit_arch.jpg" alt="" style="width: 80%;" />
|
543 |
-
</div>
|
544 |
-
|
545 |
-
|
546 |
-
| Model | Dimension | Input Dimension | Output Dimension | Feedforward Dimension | Frequency Dimension | Number of Heads | Number of Layers |
|
547 |
-
|--------|-----------|-----------------|------------------|-----------------------|---------------------|-----------------|------------------|
|
548 |
-
| 1.3B | 1536 | 16 | 16 | 8960 | 256 | 12 | 30 |
|
549 |
-
| 14B | 5120 | 16 | 16 | 13824 | 256 | 40 | 40 |
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
##### Data
|
554 |
-
|
555 |
-
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.
|
556 |
-
|
557 |
-

|
558 |
-
|
559 |
-
|
560 |
-
##### Comparisons to SOTA
|
561 |
-
We compared **Wan2.1** with leading open-source and closed-source models to evaluate the performance. 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.
|
562 |
-
|
563 |
-

|
564 |
-
|
565 |
-
|
566 |
-
## Citation
|
567 |
-
If you find our work helpful, please cite us.
|
568 |
-
|
569 |
-
```
|
570 |
-
@article{wan2025,
|
571 |
-
title={Wan: Open and Advanced Large-Scale Video Generative Models},
|
572 |
-
author={WanTeam 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},
|
573 |
-
journal = {arXiv preprint arXiv:2503.20314},
|
574 |
-
year={2025}
|
575 |
-
}
|
576 |
-
```
|
577 |
-
|
578 |
-
## License Agreement
|
579 |
-
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).
|
580 |
-
|
581 |
-
|
582 |
-
## Acknowledgements
|
583 |
-
|
584 |
-
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.
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
## Contact Us
|
589 |
-
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)!
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
library_name: diffusers
|
4 |
+
pipeline_tag: image-to-video
|
5 |
---
|
6 |
+
|
7 |
# Wan2.1
|
8 |
|
9 |
<p align="center">
|
|
|
99 |
| 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
|
100 |
| FLF2V-14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.1-FLF2V-14B-720P) 🤖 [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.1-FLF2V-14B-720P) | Supports 720P
|
101 |
|
102 |
+
> 💡Note:
|
103 |
+
> * 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.
|
104 |
+
> * For the first-last frame to video generation, we train our model primarily on Chinese text-video pairs. Therefore, we recommend using Chinese prompt to achieve better results.
|
105 |
|
106 |
|
107 |
Download models using huggingface-cli:
|
|
|
194 |
|
195 |
- Use the Dashscope API for extension.
|
196 |
- 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)).
|
197 |
+
- 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).\
|
198 |
- Use the `qwen-plus` model for text-to-video tasks and `qwen-vl-max` for image-to-video tasks.
|
199 |
- You can modify the model used for extension with the parameter `--prompt_extend_model`. For example:
|
200 |
```sh
|
|
|
442 |
|
443 |
Run with remote prompt extension using `dashscope`:
|
444 |
```
|
445 |
+
DASH_API_KEY=your_key python generate.py --task flf2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-FLF2V-14B-720P --first_frame examples/flf2v_input_first_frame.png --last_frame examples/flf2v_input_last_frame.png --use_prompt_extend --prompt_extend_method 'dashscope' --prompt "CG animation style, a small blue bird takes off from the ground, flapping its wings. The bird’s feathers are delicate, with
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|