--- license: apache-2.0 pipeline_tag: text-to-video --- # Wan2.2 ๐ Wan | ๐ฅ๏ธ GitHub | ๐ค Hugging Face | ๐ค ModelScope | ๐ Technical Report | ๐ Blog | ๐ฌ WeChat Group | ๐ Discord ----- [**Wan: Open and Advanced Large-Scale Video Generative Models**](https://arxiv.org/abs/2503.20314) 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: - ๐ **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. - ๐ **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. - ๐ **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. - ๐ **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. 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. ## Video Demos Your browser does not support the video tag. ## ๐ฅ Latest News!! * Jul 28, 2025: ๐ We've released the inference code and model weights of **Wan2.2**. ## Community Works 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. ## ๐ Todo List - Wan2.2 Text-to-Video - [x] Multi-GPU Inference code of the A14B and 14B models - [x] Checkpoints of the A14B and 14B models - [x] ComfyUI integration - [x] Diffusers integration - Wan2.2 Image-to-Video - [x] Multi-GPU Inference code of the A14B model - [x] Checkpoints of the A14B model - [x] ComfyUI integration - [x] Diffusers integration - Wan2.2 Text-Image-to-Video - [x] Multi-GPU Inference code of the 5B model - [x] Checkpoints of the 5B model - [x] ComfyUI integration - [x] Diffusers integration ## Run Wan2.2 #### Installation Clone the repo: ```sh git clone https://github.com/Wan-Video/Wan2.2.git cd Wan2.2 ``` Install dependencies: ```sh # Ensure torch >= 2.4.0 pip install -r requirements.txt ``` #### Model Download | Models | Download Links | Description | |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-------------| | 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 | | 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 | | 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 | > ๐กNote: > The TI2V-5B model supports 720P video generation at **24 FPS**. Download models using huggingface-cli: ``` sh 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: ``` sh 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](#2-using-prompt-extention) step. - Single-GPU inference ``` sh 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. - Multi-GPU inference using FSDP + DeepSpeed Ulysses We use [PyTorch FSDP](https://docs.pytorch.org/docs/stable/fsdp.html) and [DeepSpeed Ulysses](https://arxiv.org/abs/2309.14509) to accelerate inference. ``` sh 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: - Use the Dashscope API for extension. - 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)). - 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). - Use the `qwen-plus` model for text-to-video tasks and `qwen-vl-max` for image-to-video tasks. - You can modify the model used for extension with the parameter `--prompt_extend_model`. For example: ```sh 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' ``` - Using a local model for extension. - 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. - 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`. - For image-to-video tasks, you can use models like `Qwen/Qwen2.5-VL-7B-Instruct` and `Qwen/Qwen2.5-VL-3B-Instruct`. - Larger models generally provide better extension results but require more GPU memory. - 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: ``` sh 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' ``` - Running with Diffusers ```py import torch import numpy as np from diffusers import WanPipeline, AutoencoderKLWan from diffusers.utils import export_to_video, load_image dtype = torch.bfloat16 device = "cuda:2" vae = AutoencoderKLWan.from_pretrained("Wan-AI/Wan2.2-T2V-A14B-Diffusers", subfolder="vae", torch_dtype=torch.float32) pipe = WanPipeline.from_pretrained("Wan-AI/Wan2.2-T2V-A14B-Diffusers", vae=vae, torch_dtype=dtype) pipe.to(device) height = 720 width = 1280 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=81, guidance_scale=4.0, guidance_scale_2=3.0, num_inference_steps=40, ).frames[0] export_to_video(output, "t2v_out.mp4", fps=16) ``` > ๐ก**Note**:This model requires features that are currently available only in the main branch of diffusers. The latest stable release on PyPI does not yet include these updates. > To use this model, please install the library from source: > ``` > pip install git+https://github.com/huggingface/diffusers > ``` ## Computational Efficiency on Different GPUs 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)**. > The parameter settings for the tests presented in this table are as follows: > (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` (--convert_model_dtype converts model parameter types to config.param_dtype); > (2) The distributed testing utilizes the built-in FSDP and Ulysses implementations, with FlashAttention3 deployed on Hopper architecture GPUs; > (3) Tests were run without the `--use_prompt_extend` flag; > (4) Reported results are the average of multiple samples taken after the warm-up phase. ------- ## Introduction of Wan2.2 **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. ##### (1) Mixture-of-Experts (MoE) Architecture 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. The transition point between the two experts is determined by the signal-to-noise ratio...