Update README.md
Browse files
README.md
CHANGED
|
@@ -56,21 +56,6 @@ If your research or project builds upon [**Wan2.1**](https://github.com/Wan-Vide
|
|
| 56 |
|
| 57 |
|
| 58 |
## 📑 Todo List
|
| 59 |
-
- Wan2.2 Text-to-Video
|
| 60 |
-
- [x] Multi-GPU Inference code of the A14B and 14B models
|
| 61 |
-
- [x] Checkpoints of the A14B and 14B models
|
| 62 |
-
- [x] ComfyUI integration
|
| 63 |
-
- [x] Diffusers integration
|
| 64 |
-
- Wan2.2 Image-to-Video
|
| 65 |
-
- [x] Multi-GPU Inference code of the A14B model
|
| 66 |
-
- [x] Checkpoints of the A14B model
|
| 67 |
-
- [x] ComfyUI integration
|
| 68 |
-
- [x] Diffusers integration
|
| 69 |
-
- Wan2.2 Text-Image-to-Video
|
| 70 |
-
- [x] Multi-GPU Inference code of the 5B model
|
| 71 |
-
- [x] Checkpoints of the 5B model
|
| 72 |
-
- [x] ComfyUI integration
|
| 73 |
-
- [x] Diffusers integration
|
| 74 |
- Wan2.2-S2V Speech-to-Video
|
| 75 |
- [x] Inference code of Wan2.2-S2V
|
| 76 |
- [x] Checkpoints of Wan2.2-S2V-14B
|
|
@@ -105,143 +90,18 @@ pip install -r requirements.txt
|
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
-
> 💡Note:
|
| 109 |
-
> The TI2V-5B model supports 720P video generation at **24 FPS**.
|
| 110 |
-
|
| 111 |
-
|
| 112 |
Download models using huggingface-cli:
|
| 113 |
``` sh
|
| 114 |
pip install "huggingface_hub[cli]"
|
| 115 |
-
huggingface-cli download Wan-AI/Wan2.2-
|
| 116 |
```
|
| 117 |
|
| 118 |
Download models using modelscope-cli:
|
| 119 |
``` sh
|
| 120 |
pip install modelscope
|
| 121 |
-
modelscope download Wan-AI/Wan2.2-
|
| 122 |
-
```
|
| 123 |
-
|
| 124 |
-
#### Run Text-to-Video Generation
|
| 125 |
-
|
| 126 |
-
This repository supports the `Wan2.2-T2V-A14B` Text-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
##### (1) Without Prompt Extension
|
| 130 |
-
|
| 131 |
-
To facilitate implementation, we will start with a basic version of the inference process that skips the [prompt extension](#2-using-prompt-extention) step.
|
| 132 |
-
|
| 133 |
-
- Single-GPU inference
|
| 134 |
-
|
| 135 |
-
``` sh
|
| 136 |
-
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."
|
| 137 |
-
```
|
| 138 |
-
|
| 139 |
-
> 💡 This command can run on a GPU with at least 80GB VRAM.
|
| 140 |
-
|
| 141 |
-
> 💡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.
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
- Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 145 |
-
|
| 146 |
-
We use [PyTorch FSDP](https://docs.pytorch.org/docs/stable/fsdp.html) and [DeepSpeed Ulysses](https://arxiv.org/abs/2309.14509) to accelerate inference.
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
``` sh
|
| 150 |
-
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."
|
| 151 |
-
```
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
##### (2) Using Prompt Extension
|
| 155 |
-
|
| 156 |
-
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:
|
| 157 |
-
|
| 158 |
-
- Use the Dashscope API for extension.
|
| 159 |
-
- 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)).
|
| 160 |
-
- 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).
|
| 161 |
-
- Use the `qwen-plus` model for text-to-video tasks and `qwen-vl-max` for image-to-video tasks.
|
| 162 |
-
- You can modify the model used for extension with the parameter `--prompt_extend_model`. For example:
|
| 163 |
-
```sh
|
| 164 |
-
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'
|
| 165 |
-
```
|
| 166 |
-
|
| 167 |
-
- Using a local model for extension.
|
| 168 |
-
|
| 169 |
-
- 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.
|
| 170 |
-
- 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`.
|
| 171 |
-
- For image-to-video tasks, you can use models like `Qwen/Qwen2.5-VL-7B-Instruct` and `Qwen/Qwen2.5-VL-3B-Instruct`.
|
| 172 |
-
- Larger models generally provide better extension results but require more GPU memory.
|
| 173 |
-
- 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:
|
| 174 |
-
|
| 175 |
-
``` sh
|
| 176 |
-
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'
|
| 177 |
-
```
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
#### Run Image-to-Video Generation
|
| 181 |
-
|
| 182 |
-
This repository supports the `Wan2.2-I2V-A14B` Image-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
- Single-GPU inference
|
| 186 |
-
```sh
|
| 187 |
-
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."
|
| 188 |
-
```
|
| 189 |
-
|
| 190 |
-
> This command can run on a GPU with at least 80GB VRAM.
|
| 191 |
-
|
| 192 |
-
> 💡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.
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
- Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 196 |
-
|
| 197 |
-
```sh
|
| 198 |
-
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."
|
| 199 |
-
```
|
| 200 |
-
|
| 201 |
-
- Image-to-Video Generation without prompt
|
| 202 |
-
|
| 203 |
-
```sh
|
| 204 |
-
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'
|
| 205 |
-
```
|
| 206 |
-
|
| 207 |
-
> 💡The model can generate videos solely from the input image. You can use prompt extension to generate prompt from the image.
|
| 208 |
-
|
| 209 |
-
> The process of prompt extension can be referenced [here](#2-using-prompt-extention).
|
| 210 |
-
|
| 211 |
-
#### Run Text-Image-to-Video Generation
|
| 212 |
-
|
| 213 |
-
This repository supports the `Wan2.2-TI2V-5B` Text-Image-to-Video model and can support video generation at 720P resolutions.
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
- Single-GPU Text-to-Video inference
|
| 217 |
-
```sh
|
| 218 |
-
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"
|
| 219 |
-
```
|
| 220 |
-
|
| 221 |
-
> 💡Unlike other tasks, the 720P resolution of the Text-Image-to-Video task is `1280*704` or `704*1280`.
|
| 222 |
-
|
| 223 |
-
> This command can run on a GPU with at least 24GB VRAM (e.g, RTX 4090 GPU).
|
| 224 |
-
|
| 225 |
-
> 💡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.
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
- Single-GPU Image-to-Video inference
|
| 229 |
-
```sh
|
| 230 |
-
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."
|
| 231 |
-
```
|
| 232 |
-
|
| 233 |
-
> 💡If the image parameter is configured, it is an Image-to-Video generation; otherwise, it defaults to a Text-to-Video generation.
|
| 234 |
-
|
| 235 |
-
> 💡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.
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
- Multi-GPU inference using FSDP + DeepSpeed Ulysses
|
| 239 |
-
|
| 240 |
-
```sh
|
| 241 |
-
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-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
|
| 242 |
```
|
| 243 |
|
| 244 |
-
> The process of prompt extension can be referenced [here](#2-using-prompt-extention).
|
| 245 |
|
| 246 |
#### Run Speech-to-Video Generation
|
| 247 |
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
## 📑 Todo List
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
- Wan2.2-S2V Speech-to-Video
|
| 60 |
- [x] Inference code of Wan2.2-S2V
|
| 61 |
- [x] Checkpoints of Wan2.2-S2V-14B
|
|
|
|
| 90 |
|
| 91 |
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
Download models using huggingface-cli:
|
| 94 |
``` sh
|
| 95 |
pip install "huggingface_hub[cli]"
|
| 96 |
+
huggingface-cli download Wan-AI/Wan2.2-S2V-14B --local-dir ./Wan2.2-S2V-14B
|
| 97 |
```
|
| 98 |
|
| 99 |
Download models using modelscope-cli:
|
| 100 |
``` sh
|
| 101 |
pip install modelscope
|
| 102 |
+
modelscope download Wan-AI/Wan2.2-S2V-14B --local_dir ./Wan2.2-S2V-14B
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
```
|
| 104 |
|
|
|
|
| 105 |
|
| 106 |
#### Run Speech-to-Video Generation
|
| 107 |
|