Wan2.1 README

The project's README from github.com/Wan-Video/Wan2.1. As one markdown file: README.md.

Wan2.1

💜 Wan    |    🖥️ GitHub    |   🤗 Hugging Face   |   🤖 ModelScope   |    📑 Technical Report    |    📑 Blog    |   💬 WeChat Group   |    📖 Discord  


Wan: Open and Advanced Large-Scale Video Generative Models

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:

Video Demos

🔥 Latest News!!

Community Works

If your work has improved Wan2.1 and you would like more people to see it, please inform us.

📑 Todo List

Quickstart

Installation

Clone the repo:

git clone https://github.com/Wan-Video/Wan2.1.git
cd Wan2.1

Install dependencies:

# Ensure torch >= 2.4.0
pip install -r requirements.txt

Model Download

Models Download Link Notes
T2V-14B 🤗 Huggingface 🤖 ModelScope Supports both 480P and 720P
I2V-14B-720P 🤗 Huggingface 🤖 ModelScope Supports 720P
I2V-14B-480P 🤗 Huggingface 🤖 ModelScope Supports 480P
T2V-1.3B 🤗 Huggingface 🤖 ModelScope Supports 480P
FLF2V-14B 🤗 Huggingface 🤖 ModelScope Supports 720P
VACE-1.3B 🤗 Huggingface 🤖 ModelScope Supports 480P
VACE-14B 🤗 Huggingface 🤖 ModelScope Supports both 480P and 720P

💡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.
  • 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.

Download models using huggingface-cli:

pip install "huggingface_hub[cli]"
huggingface-cli download Wan-AI/Wan2.1-T2V-14B --local-dir ./Wan2.1-T2V-14B

Download models using modelscope-cli:

pip install modelscope
modelscope download Wan-AI/Wan2.1-T2V-14B --local_dir ./Wan2.1-T2V-14B

Run Text-to-Video Generation

This repository supports two Text-to-Video models (1.3B and 14B) and two resolutions (480P and 720P). The parameters and configurations for these models are as follows:

Task Resolution Model
480P 720P
t2v-14B ✔️ ✔️ Wan2.1-T2V-14B
t2v-1.3B ✔️ ❌ Wan2.1-T2V-1.3B
(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-14B --size 1280*720 --ckpt_dir ./Wan2.1-T2V-14B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."

If you encounter OOM (Out-of-Memory) issues, you can use the --offload_model True and --t5_cpu options to reduce GPU memory usage. For example, on an RTX 4090 GPU:

python generate.py  --task t2v-1.3B --size 832*480 --ckpt_dir ./Wan2.1-T2V-1.3B --offload_model True --t5_cpu --sample_shift 8 --sample_guide_scale 6 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."

💡Note: If you are using the T2V-1.3B model, we recommend setting the parameter --sample_guide_scale 6. The --sample_shift parameter can be adjusted within the range of 8 to 12 based on the performance.

pip install "xfuser>=0.4.1"
torchrun --nproc_per_node=8 generate.py --task t2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-T2V-14B --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 python generate.py  --task t2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-T2V-14B --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'
python generate.py  --task t2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-T2V-14B --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'
(3) Running with Diffusers

You can easily inference Wan2.1-T2V using Diffusers with the following command:

import torch
from diffusers.utils import export_to_video
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler

# Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers
model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
flow_shift = 5.0 # 5.0 for 720P, 3.0 for 480P
scheduler = UniPCMultistepScheduler(prediction_type='flow_prediction', use_flow_sigmas=True, num_train_timesteps=1000, flow_shift=flow_shift)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
pipe.scheduler = scheduler
pipe.to("cuda")

prompt = "A cat and a dog baking a cake together in a kitchen. The cat is carefully measuring flour, while the dog is stirring the batter with a wooden spoon. The kitchen is cozy, with sunlight streaming through the window."
negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"

output = pipe(
     prompt=prompt,
     negative_prompt=negative_prompt,
     height=720,
     width=1280,
     num_frames=81,
     guidance_scale=5.0,
    ).frames[0]
export_to_video(output, "output.mp4", fps=16)

💡Note: Please note that this example does not integrate Prompt Extension and distributed inference. We will soon update with the integrated prompt extension and multi-GPU version of Diffusers.

(4) Running local gradio
cd gradio
# if one uses dashscope’s API for prompt extension
DASH_API_KEY=your_key python t2v_14B_singleGPU.py --prompt_extend_method 'dashscope' --ckpt_dir ./Wan2.1-T2V-14B

# if one uses a local model for prompt extension
python t2v_14B_singleGPU.py --prompt_extend_method 'local_qwen' --ckpt_dir ./Wan2.1-T2V-14B

R

Wan2.1 (Wan-Video/Wan2.1)

Searching Database…

17.2K ·GitHub
Что это такое?Wan2.1 — это открытый набор крупномасштабных моделей для генерации видео: он превращает текст или картинки в видео, а также умеет редактировать видео, генерировать изображения из текста и аудио из видео.
Это веб-сервис, куда я захожу через браузер, или программа, которую я запускаю сам?Запускаете сами: в репозитории лежат веса моделей и Python-код для инференса на вашей видеокарте. Готового онлайн-сервиса здесь нет, хотя Wan2.1 также работает внутри ComfyUI и Diffusers.
Как мне всё запустить?Клонируйте репозиторий, установите Python-зависимости, скачайте модели через huggingface-cli или modelscope-cli, затем запустите приложенный скрипт генерации видео из текста. Есть и альтернативы: локальная Gradio-демка, ComfyUI и Diffusers.
Мне нужен API-ключ или какие-то дополнительные модели?Базовая генерация работает локально без всяких ключей. Необязательный шаг расширения промпта требует либо API-ключ Dashscope (задаётся как DASHAPIKEY), либо локальную модель Qwen на ваш выбор.
О каких подводных камнях стоит знать заранее?Модель 1.3B по-настоящему настроена на 480P — её выдача в 720P нестабильна. Генерация по первому и последнему кадру обучалась в основном на китайских парах, поэтому там лучше всего работают китайские промпты. На видеокартах с малым объёмом памяти могут понадобиться флаги --offloadmodel True и --t5cpu, чтобы избежать ошибок нехватки видеопамяти.
Потянет ли мой игровой компьютер, или нужна серверная видеокарта?Модели 1.3B нужно всего 8,19 ГБ видеопамяти, так что она влезает почти на любую потребительскую видеокарту и делает 5-секундный ролик в 480P примерно за 4 минуты на RTX 4090. Моделям 14B требуется больше памяти.
Какие варианты моделей я могу скачать?Семь моделей: T2V-1.3B (480P) и T2V-14B (480P/720P), I2V-14B в отдельных версиях на 480P и 720P, FLF2V-14B (720P), а также VACE-1.3B и VACE-14B — все доступны на Hugging Face и ModelScope.
Что такое VACE?VACE — выпущенная в мае 2025 года универсальная модель Wan2.1 для создания и редактирования видео, доступная в размерах 1.3B и 14B вместе с кодом для инференса и весами. Она вышла после FLF2V — апрельской модели для генерации видео по первому и последнему кадру.
Работает ли это с промптами на английском?Да, более того, модель умеет даже рендерить читаемый текст на экране — Wan2.1 называют первой видео-моделью, которая генерирует текст и на китайском, и на английском. Исключение только одно — генерация по первому и последнему кадру, которая ориентирована на китайский.
Вокруг Wan2.1 есть целая экосистема?Да, большая: модель уже встроена в ComfyUI и Diffusers, а сторонние проекты добавляют ускорение через TeaCache, квантизацию FP8 и обучение LoRA через DiffSynth-Studio, плюс специализированные модели для виртуальной примерки одежды, анимации по позам и управления движением, построенные поверх Wan2.1.
Creator
Wan-Video
Size
10.1 MB
Stars
17.2K
Updated
CommitMar 05
Age
1y
Commits · 90 Days