lightx2v commited on
Commit
8bec9b9
·
verified ·
1 Parent(s): 8f04a5a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +312 -1
README.md CHANGED
@@ -8,4 +8,315 @@ tags:
8
  base_model:
9
  - Wan-AI/Wan2.2-I2V-A14B
10
  library_name: diffusers
11
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  base_model:
9
  - Wan-AI/Wan2.2-I2V-A14B
10
  library_name: diffusers
11
+ ---
12
+
13
+ # 🎬 Wan2.2 Distilled LoRA Models
14
+
15
+ ### ⚡ High-Performance Video Generation with 4-Step Inference Using LoRA
16
+
17
+ *LoRA weights extracted from Wan2.2 distilled models - Flexible deployment with excellent generation quality*
18
+
19
+ ![img_lightx2v](https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/tTnp8-ARpj3wGxfo5P55c.png)
20
+
21
+ ---
22
+
23
+ [![🤗 HuggingFace](https://img.shields.io/badge/🤗-HuggingFace-yellow)](https://huggingface.co/lightx2v/Wan2.2-Distill-Loras)
24
+ [![GitHub](https://img.shields.io/badge/GitHub-LightX2V-blue?logo=github)](https://github.com/ModelTC/LightX2V)
25
+ [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](LICENSE)
26
+
27
+ ---
28
+
29
+ ## 🌟 What's Special?
30
+
31
+ <table>
32
+ <tr>
33
+ <td width="50%">
34
+
35
+ ### ⚡ Flexible Deployment
36
+ - **Base Model + LoRA**: Can be combined with base models
37
+ - **Offline Merging**: Pre-merge LoRA into models
38
+ - **Online Loading**: Dynamically load LoRA during inference
39
+ - **Multiple Frameworks**: Supports LightX2V and ComfyUI
40
+
41
+ </td>
42
+ <td width="50%">
43
+
44
+ ### 🎯 Dual Noise Control
45
+ - **High Noise**: More creative, diverse outputs
46
+ - **Low Noise**: More faithful to input, stable outputs
47
+ - Rank 64 LoRA, compact size
48
+
49
+ </td>
50
+ </tr>
51
+ <tr>
52
+ <td width="50%">
53
+
54
+ ### 💾 Storage Efficient
55
+ - **Small LoRA Size**: Significantly smaller than full models
56
+ - **Flexible Combination**: Can be combined with quantization
57
+ - **Easy Sharing**: Convenient for model weight distribution
58
+
59
+ </td>
60
+ <td width="50%">
61
+
62
+ ### 🚀 4-Step Inference
63
+ - **Ultra-Fast Generation**: Generate high-quality videos in just 4 steps
64
+ - **Distillation Acceleration**: Inherits advantages of distilled models
65
+ - **Quality Assurance**: Maintains excellent generation quality
66
+
67
+ </td>
68
+ </tr>
69
+ </table>
70
+
71
+ ---
72
+
73
+ ## 📦 LoRA Model Catalog
74
+
75
+ ### 🎥 Available LoRA Models
76
+
77
+ | Task Type | Noise Level | Model File | Rank | Purpose |
78
+ |:-------:|:--------:|:---------|:----:|:-----|
79
+ | **I2V** | High Noise | `wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors` | 64 | More creative image-to-video |
80
+ | **I2V** | Low Noise | `wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors` | 64 | More stable image-to-video |
81
+
82
+ > 💡 **Note**:
83
+ > - `xxx` in filenames represents version number or timestamp, please check [HuggingFace repository](https://huggingface.co/lightx2v/Wan2.2-Distill-Loras/tree/main) for the latest version
84
+ > - These LoRAs must be used with Wan2.2 base models
85
+
86
+ ---
87
+
88
+ ## 🚀 Usage
89
+
90
+ ### Prerequisites
91
+
92
+ **Base Model**: You need to prepare Wan2.2 I2V base model (original model without distillation)
93
+
94
+ Download base model (choose one):
95
+
96
+ **Method 1: From LightX2V Official Repository (Recommended)**
97
+ ```bash
98
+ # Download high noise base model
99
+ huggingface-cli download lightx2v/Wan2.2-Official-Models \
100
+ wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \
101
+ --local-dir ./models/Wan2.2-Official-Models
102
+
103
+ # Download low noise base model
104
+ huggingface-cli download lightx2v/Wan2.2-Official-Models \
105
+ wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \
106
+ --local-dir ./models/Wan2.2-Official-Models
107
+ ```
108
+
109
+ **Method 2: From Wan-AI Official Repository**
110
+ ```bash
111
+ huggingface-cli download Wan-AI/Wan2.2-I2V-A14B \
112
+ --local-dir ./models/Wan2.2-I2V-A14B
113
+ ```
114
+
115
+ > 💡 **Note**: [lightx2v/Wan2.2-Official-Models](https://huggingface.co/lightx2v/Wan2.2-Official-Models) provides separate high noise and low noise base models, download as needed
116
+
117
+ ### Method 1: LightX2V - Offline LoRA Merging (Recommended ⭐)
118
+
119
+ **Offline LoRA merging provides best performance and supports quantization simultaneously.**
120
+
121
+ #### 1.1 Download LoRA Models
122
+
123
+ ```bash
124
+ # Download both LoRAs (high noise and low noise)
125
+ # Note: xxx represents version number, please check HuggingFace for actual filename
126
+ huggingface-cli download lightx2v/Wan2.2-Distill-Loras \
127
+ wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
128
+ wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
129
+ --local-dir ./loras/
130
+ ```
131
+
132
+ #### 1.2 Merge LoRA (Basic Merging)
133
+
134
+ **Merge LoRA:**
135
+ ```bash
136
+ cd LightX2V/tools/convert
137
+
138
+ # For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/high_noise_model/
139
+ python converter.py \
140
+ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \
141
+ --output /path/to/output/ \
142
+ --output_ext .safetensors \
143
+ --output_name wan2.2_i2v_A14b_high_noise_lightx2v_4step \
144
+ --model_type wan_dit \
145
+ --lora_path /path/to/loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
146
+ --lora_strength 1.0 \
147
+ --single_file
148
+
149
+ # For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/low_noise_model/
150
+ python converter.py \
151
+ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \
152
+ --output /path/to/output/ \
153
+ --output_ext .safetensors \
154
+ --output_name wan2.2_i2v_A14b_low_noise_lightx2v_4step \
155
+ --model_type wan_dit \
156
+ --lora_path /path/to/loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
157
+ --lora_strength 1.0 \
158
+ --single_file
159
+ ```
160
+
161
+ #### 1.3 Merge LoRA + Quantization (Recommended)
162
+
163
+ **Merge LoRA + FP8 Quantization:**
164
+ ```bash
165
+ cd LightX2V/tools/convert
166
+
167
+ # For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/high_noise_model/
168
+ python converter.py \
169
+ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \
170
+ --output /path/to/output/ \
171
+ --output_ext .safetensors \
172
+ --output_name wan2.2_i2v_A14b_high_noise_scaled_fp8_e4m3_lightx2v_4step \
173
+ --model_type wan_dit \
174
+ --lora_path /path/to/loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
175
+ --lora_strength 1.0 \
176
+ --quantized \
177
+ --linear_dtype torch.float8_e4m3fn \
178
+ --non_linear_dtype torch.bfloat16 \
179
+ --single_file
180
+
181
+ # For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/low_noise_model/
182
+ python converter.py \
183
+ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \
184
+ --output /path/to/output/ \
185
+ --output_ext .safetensors \
186
+ --output_name wan2.2_i2v_A14b_low_noise_scaled_fp8_e4m3_lightx2v_4step \
187
+ --model_type wan_dit \
188
+ --lora_path /path/to/loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
189
+ --lora_strength 1.0 \
190
+ --quantized \
191
+ --linear_dtype torch.float8_e4m3fn \
192
+ --non_linear_dtype torch.bfloat16 \
193
+ --single_file
194
+ ```
195
+
196
+ **Merge LoRA + ComfyUI FP8 Format:**
197
+ ```bash
198
+ cd LightX2V/tools/convert
199
+
200
+ # For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/high_noise_model/
201
+ python converter.py \
202
+ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \
203
+ --output /path/to/output/ \
204
+ --output_ext .safetensors \
205
+ --output_name wan2.2_i2v_A14b_high_noise_scaled_fp8_e4m3_lightx2v_4step_comfyui \
206
+ --model_type wan_dit \
207
+ --lora_path /path/to/loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
208
+ --lora_strength 1.0 \
209
+ --quantized \
210
+ --linear_dtype torch.float8_e4m3fn \
211
+ --non_linear_dtype torch.bfloat16 \
212
+ --single_file \
213
+ --comfyui_mode
214
+
215
+ # For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/low_noise_model/
216
+ python converter.py \
217
+ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \
218
+ --output /path/to/output/ \
219
+ --output_ext .safetensors \
220
+ --output_name wan2.2_i2v_A14b_low_noise_scaled_fp8_e4m3_lightx2v_4step_comfyui \
221
+ --model_type wan_dit \
222
+ --lora_path /path/to/loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
223
+ --lora_strength 1.0 \
224
+ --quantized \
225
+ --linear_dtype torch.float8_e4m3fn \
226
+ --non_linear_dtype torch.bfloat16 \
227
+ --single_file \
228
+ --comfyui_mode
229
+ ```
230
+
231
+ > 📝 **Reference Documentation**: For more merging options, see [LightX2V Model Conversion Documentation](https://github.com/ModelTC/LightX2V/blob/main/tools/convert/readme_zh.md)
232
+
233
+ ---
234
+
235
+ ### Method 2: LightX2V - Online LoRA Loading
236
+
237
+ **Online LoRA loading requires no pre-merging, loads dynamically during inference, more flexible.**
238
+
239
+ #### 2.1 Download LoRA Models
240
+
241
+ ```bash
242
+ # Download both LoRAs (high noise and low noise)
243
+ # Note: xxx represents version number, please check HuggingFace for actual filename
244
+ huggingface-cli download lightx2v/Wan2.2-Distill-Loras \
245
+ wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
246
+ wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \
247
+ --local-dir ./loras/
248
+ ```
249
+
250
+ #### 2.2 Use Configuration File
251
+
252
+ Reference configuration file: [wan_moe_i2v_distil_with_lora.json](https://github.com/ModelTC/LightX2V/blob/main/configs/wan22/wan_moe_i2v_distil_with_lora.json)
253
+
254
+ LoRA configuration example in config file:
255
+ ```json
256
+ {
257
+ "lora_configs": [
258
+ {
259
+ "name": "high_noise_model",
260
+ "path": "/path/to/loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors",
261
+ "strength": 1.0
262
+ },
263
+ {
264
+ "name": "low_noise_model",
265
+ "path": "/path/to/loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors",
266
+ "strength": 1.0
267
+ }
268
+ ]
269
+ }
270
+ ```
271
+
272
+ > 💡 **Tip**: Replace `xxx` with actual version number (e.g., `1022`). Check [HuggingFace repository](https://huggingface.co/lightx2v/Wan2.2-Distill-Loras/tree/main) for the latest version
273
+
274
+
275
+ #### 2.3 Run Inference
276
+
277
+ Using [I2V](https://github.com/ModelTC/LightX2V/blob/main/scripts/wan22/run_wan22_moe_i2v_distill.sh) as example:
278
+ ```bash
279
+ cd scripts
280
+ bash wan22/run_wan22_moe_i2v_distill.sh
281
+ ```
282
+
283
+ ### Method 3: ComfyUI
284
+
285
+ Please refer to [workflow](https://huggingface.co/lightx2v/Wan2.2-Distill-Loras/blob/main/wan2.2_i2v_scale_fp8_comfyui_with_lora.json)
286
+
287
+ ## ⚠️ Important Notes
288
+
289
+ 1. **Base Model Requirement**: These LoRAs must be used with Wan2.2-I2V-A14B base model, cannot be used standalone
290
+
291
+ 2. **Other Components**: In addition to DIT model and LoRA, the following are also required at runtime:
292
+ - T5 text encoder
293
+ - CLIP vision encoder
294
+ - VAE encoder/decoder
295
+ - Tokenizer
296
+
297
+ Please refer to [LightX2V Documentation](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/getting_started/model_structure.html) for how to organize complete model directory
298
+
299
+ 3. **Inference Configuration**: When using 4-step inference, configure correct `denoising_step_list`, recommended: `[1000, 750, 500, 250]`
300
+
301
+
302
+ ## 📚 Related Resources
303
+
304
+ ### Documentation Links
305
+ - **LightX2V Quick Start**: [Quick Start Documentation](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/getting_started/quickstart.html)
306
+ - **Model Conversion Tool**: [Conversion Tool Documentation](https://github.com/ModelTC/LightX2V/blob/main/tools/convert/readme_zh.md)
307
+ - **Online LoRA Loading**: [Configuration File Example](https://github.com/ModelTC/LightX2V/blob/main/configs/wan22/wan_moe_i2v_distil_with_lora.json)
308
+ - **Quantization Guide**: [Quantization Documentation](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/method_tutorials/quantization.html)
309
+ - **Model Structure**: [Model Structure Documentation](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/getting_started/model_structure.html)
310
+
311
+ ### Related Models
312
+ - **Distilled Full Models**: [Wan2.2-Distill-Models](https://huggingface.co/lightx2v/Wan2.2-Distill-Models)
313
+ - **Wan2.2 Official Models**: [Wan2.2-Official-Models](https://huggingface.co/lightx2v/Wan2.2-Official-Models) - Contains high noise and low noise base models
314
+ - **Base Model (Wan-AI)**: [Wan2.2-I2V-A14B](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B)
315
+
316
+ ## 🤝 Community & Support
317
+
318
+ - **GitHub Issues**: https://github.com/ModelTC/LightX2V/issues
319
+ - **HuggingFace**: https://huggingface.co/lightx2v/Wan2.2-Distill-Loras
320
+ - **LightX2V Homepage**: https://github.com/ModelTC/LightX2V
321
+
322
+ If you find this project helpful, please give us a ⭐ on [GitHub](https://github.com/ModelTC/LightX2V)