Instructions to use lightx2v/Wan2.1-Distill-Models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use lightx2v/Wan2.1-Distill-Models with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Wan-AI/Wan2.1-T2V-14B,Wan-AI/Wan2.1-I2V-14B-480P,Wan-AI/Wan2.1-I2V-14B-720P", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("lightx2v/Wan2.1-Distill-Models") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Diffusion Single File
How to use lightx2v/Wan2.1-Distill-Models with Diffusion Single File:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
Add paper link, pipeline tag and sample usage
#4
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,25 +1,27 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
| 3 |
tags:
|
| 4 |
- diffusion-single-file
|
| 5 |
- comfyui
|
| 6 |
- distillation
|
| 7 |
- lora
|
| 8 |
- video
|
| 9 |
-
- video
|
| 10 |
-
base_model:
|
| 11 |
-
- Wan-AI/Wan2.1-T2V-14B
|
| 12 |
-
- Wan-AI/Wan2.1-I2V-14B-480P
|
| 13 |
-
- Wan-AI/Wan2.1-I2V-14B-720P
|
| 14 |
-
library_name: diffusers
|
| 15 |
---
|
|
|
|
| 16 |
<div align="center">
|
| 17 |
|
| 18 |
# 🎬 Wan2.1 Distilled Models
|
| 19 |
|
| 20 |
### ⚡ High-Performance Video Generation with 4-Step Inference
|
| 21 |
|
| 22 |
-
*Distillation-accelerated versions of Wan2.1 - Dramatically faster while maintaining exceptional quality*
|
| 23 |
|
| 24 |

|
| 25 |
|
|
@@ -128,7 +130,49 @@ wan2.1_t2v_14b_scaled_fp8_e4m3_lightx2v_4step_comfyui.safetensors # T2V - FP8 C
|
|
| 128 |
|
| 129 |
**LightX2V is a high-performance inference framework optimized for these models, approximately 2x faster than ComfyUI with better quantization accuracy. Highly recommended!**
|
| 130 |
|
| 131 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
1. Download model (720P I2V FP8 example)
|
| 134 |
```bash
|
|
@@ -165,7 +209,7 @@ Choose the appropriate configuration based on your GPU memory:
|
|
| 165 |
|
| 166 |
|
| 167 |
5. Run inference
|
| 168 |
-
```
|
| 169 |
cd scripts
|
| 170 |
bash wan/run_wan_i2v_distill_4step_cfg.sh
|
| 171 |
```
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Wan-AI/Wan2.1-T2V-14B
|
| 4 |
+
- Wan-AI/Wan2.1-I2V-14B-480P
|
| 5 |
+
- Wan-AI/Wan2.1-I2V-14B-720P
|
| 6 |
+
library_name: diffusers
|
| 7 |
license: apache-2.0
|
| 8 |
+
pipeline_tag: text-to-video
|
| 9 |
tags:
|
| 10 |
- diffusion-single-file
|
| 11 |
- comfyui
|
| 12 |
- distillation
|
| 13 |
- lora
|
| 14 |
- video
|
| 15 |
+
- video generation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
---
|
| 17 |
+
|
| 18 |
<div align="center">
|
| 19 |
|
| 20 |
# 🎬 Wan2.1 Distilled Models
|
| 21 |
|
| 22 |
### ⚡ High-Performance Video Generation with 4-Step Inference
|
| 23 |
|
| 24 |
+
*Distillation-accelerated versions of Wan2.1 based on the paper [SGMD: Score Gradient Matching Distillation for Few-Step Video Diffusion Distillation](https://huggingface.co/papers/2605.30116) - Dramatically faster while maintaining exceptional quality*
|
| 25 |
|
| 26 |

|
| 27 |
|
|
|
|
| 130 |
|
| 131 |
**LightX2V is a high-performance inference framework optimized for these models, approximately 2x faster than ComfyUI with better quantization accuracy. Highly recommended!**
|
| 132 |
|
| 133 |
+
### Python Sample Usage
|
| 134 |
+
|
| 135 |
+
```python
|
| 136 |
+
from lightx2v import LightX2VPipeline
|
| 137 |
+
|
| 138 |
+
# Initialize pipeline for Wan2.1 I2V task
|
| 139 |
+
pipe = LightX2VPipeline(
|
| 140 |
+
model_path="lightx2v/Wan2.1-Distill-Models",
|
| 141 |
+
model_cls="wan2.1",
|
| 142 |
+
task="i2v",
|
| 143 |
+
)
|
| 144 |
+
|
| 145 |
+
# Enable offloading to reduce VRAM usage (suitable for consumer GPUs)
|
| 146 |
+
pipe.enable_offload(
|
| 147 |
+
cpu_offload=True,
|
| 148 |
+
offload_granularity="block",
|
| 149 |
+
text_encoder_offload=True,
|
| 150 |
+
image_encoder_offload=False,
|
| 151 |
+
vae_offload=False,
|
| 152 |
+
)
|
| 153 |
+
|
| 154 |
+
# Create generator with 4-step distilled inference
|
| 155 |
+
pipe.create_generator(
|
| 156 |
+
attn_mode="sage_attn2",
|
| 157 |
+
infer_steps=4,
|
| 158 |
+
height=480,
|
| 159 |
+
width=832,
|
| 160 |
+
num_frames=81,
|
| 161 |
+
guidance_scale=5.0,
|
| 162 |
+
sample_shift=5.0,
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
# Generate video
|
| 166 |
+
pipe.generate(
|
| 167 |
+
seed=42,
|
| 168 |
+
image_path="path/to/image.jpg",
|
| 169 |
+
prompt="Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard.",
|
| 170 |
+
negative_prompt="shaking camera, low quality, static",
|
| 171 |
+
save_result_path="output.mp4",
|
| 172 |
+
)
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
#### Quick Start (CLI)
|
| 176 |
|
| 177 |
1. Download model (720P I2V FP8 example)
|
| 178 |
```bash
|
|
|
|
| 209 |
|
| 210 |
|
| 211 |
5. Run inference
|
| 212 |
+
```bash
|
| 213 |
cd scripts
|
| 214 |
bash wan/run_wan_i2v_distill_4step_cfg.sh
|
| 215 |
```
|