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…

18K ·GitHub
Что это такое?Семейство крупномасштабных моделей для генерации видео с открытым кодом: генерация видео из текста, из изображения, из речи и анимация персонажей. Код для запуска и веса моделей выпущены под лицензией Apache-2.0.
Это одна модель или целое семейство?Пять линеек: T2V-A14B и I2V-A14B (MoE-модели для генерации видео из текста и из изображения), TI2V-5B для комбинированного ввода текст+изображение, S2V-14B для генерации видео из речи и Animate-14B для анимации и замены персонажей.
Как его запустить?Склонируйте репозиторий, установите зависимости для Python, скачайте веса нужной модели с HuggingFace или ModelScope через huggingface-cli или modelscope-cli, затем запустите generate.py, указав задачу, размер и промпт.
Нужен ли API-ключ Dashscope, чтобы этим пользоваться?Не обязательно: расширение промптов, которое улучшает промпты для более качественного видео, опционально — можно использовать API Dashscope (нужен dashscope.apikey) или локальную модель Qwen, например Qwen2.5-14B-Instruct.
80 ГБ видеопамяти — это много, есть ли способ обойти?Да — если возникает ошибка OOM, можно снизить потребление памяти опциями --offloadmodel True, --convertmodeldtype и --t5cpu, либо распределить инференс по нескольким картам с помощью FSDP и DeepSpeed Ulysses.
Мне нужен мощный GPU, чтобы это запустить?Моделям 14B нужна одна видеокарта минимум с 80 ГБ видеопамяти; вариант для обычных пользователей — TI2V-5B, который работает на карте с 24 ГБ, например RTX 4090.
В чём фишка MoE в Wan2.2?Она приносит Mixture-of-Experts в видеодиффузию: отдельные модели-эксперты отвечают за разные шаги денойзинга, что увеличивает общую ёмкость модели, сохраняя вычислительные затраты на прежнем уровне.
Чем она отличается от Wan2.1?Помимо архитектуры MoE и меток кинематографической эстетики для освещения, композиции и цветовой гаммы, она обучена на 65,6% большем количестве изображений и на 83,2% большем количестве видео, что улучшило движение, семантику и эстетику.
Обязательно использовать эти скрипты, или это работает в ComfyUI?И ComfyUI, и HuggingFace Diffusers поддерживают все линейки задач, а у модели 5B есть хостинговое демо на HuggingFace Space; популярная альтернатива от сообщества — WanVideoWrapper от Kijai.
Что умеет Wan2.2-Animate?Animate-14B — единая модель для анимации и замены персонажей: она переносит общие движения и мимику лица из управляющего видео на персонажа, которого вы ей подаёте.
Creator
Wan-Video
Size
8.2 MB
Stars
18K
Updated
CommitSep 21
Age
1y
Commits · 90 Days