File size: 12,979 Bytes
2a9908f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56c03fe
2a9908f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56242cb
 
 
 
 
 
 
 
 
f66acf6
56242cb
 
 
 
7b0c32c
 
 
 
 
 
 
 
7079935
7b0c32c
 
 
 
 
56242cb
2a9908f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301bd8e
2a9908f
 
301bd8e
 
 
 
63d6e39
301bd8e
 
 
63d6e39
301bd8e
 
 
63d6e39
301bd8e
 
 
63d6e39
301bd8e
 
 
2a9908f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301bd8e
f20f580
2a9908f
301bd8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2a9908f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63d6e39
2a9908f
 
 
 
 
 
 
 
 
 
 
 
63d6e39
2a9908f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63d6e39
2a9908f
42dc90d
 
63d6e39
42dc90d
 
2a9908f
 
 
 
 
 
ceaa54f
2a9908f
 
 
2e94ee2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2a9908f
 
 
 
 
 
 
 
 
98ecbfa
2a9908f
 
 
 
 
 
 
98ecbfa
2a9908f
 
 
 
 
 
 
3e95b59
2a9908f
98ecbfa
2a9908f
 
 
 
 
 
 
3e95b59
98ecbfa
2a9908f
 
 
 
 
 
 
 
 
 
63d6e39
 
 
 
2a9908f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301bd8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
---
license: apache-2.0
tags:
  - diffusion-single-file
  - comfyui
  - distillation
  - LoRA
  - video
  - video genration
base_model:
  - Wan-AI/Wan2.2-I2V-A14B
  - Wan-AI/Wan2.2-TI2V-5B
  - Wan-AI/Wan2.1-I2V-14B-720P
pipeline_tags: 
  - image-to-video
  - text-to-video
library_name: diffusers
---
# 🎨 LightVAE

## ⚑ Efficient Video Autoencoder (VAE) Model Collection

*From Official Models to Lightx2v Distilled Optimized Versions - Balancing Quality, Speed and Memory*
![img_lightx2v](https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/tTnp8-ARpj3wGxfo5P55c.png)

---

[![πŸ€— HuggingFace](https://img.shields.io/badge/πŸ€—-HuggingFace-yellow)](https://huggingface.co/lightx2v)
[![GitHub](https://img.shields.io/badge/GitHub-LightX2V-blue?logo=github)](https://github.com/ModelTC/LightX2V)
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](LICENSE)

---

For VAE, the LightX2V team has conducted a series of deep optimizations, deriving two major series: **LightVAE** and **LightTAE**, which significantly reduce memory consumption and improve inference speed while maintaining high quality.

## πŸ’‘ Core Advantages

<table>
<tr>
<td width="50%">

### πŸ“Š Official VAE
**Features**: Highest Quality ⭐⭐⭐⭐⭐

βœ… Best reconstruction accuracy  
βœ… Complete detail preservation  
❌ Large memory usage (~8-12 GB)  
❌ Slow inference speed

</td>
<td width="50%">

### πŸš€ Open Source TAE Series
**Features**: Fastest Speed ⚑⚑⚑⚑⚑

βœ… Minimal memory usage (~0.4 GB)  
βœ… Extremely fast inference  
❌ Average quality ⭐⭐⭐  
❌ Potential detail loss

</td>
</tr>
<tr>
<td width="50%">

### 🎯 **LightVAE Series** (Our Optimization)
**Features**: Best Balanced Solution βš–οΈ

βœ… Uses **Causal 3D Conv** (same as official)  
βœ… **Quality close to official** ⭐⭐⭐⭐  
βœ… Memory reduced by **~50%** (~4-5 GB)  
βœ… Speed increased by **2-3x**  
βœ… Balances quality, speed, and memory πŸ†

</td>
<td width="50%">

### ⚑ **LightTAE Series** (Our Optimization)
**Features**: Fast Speed + Good Quality πŸ†

βœ… Minimal memory usage (~0.4 GB)  
βœ… Extremely fast inference  
βœ… **Quality close to official** ⭐⭐⭐⭐  
βœ… **Significantly surpasses open source TAE**

</td>
</tr>
</table>

---

## πŸ“¦ Available Models

### 🎯 Wan2.1 Series VAE

| Model Name | Type | Architecture | Description | 
|:--------|:-----|:-----|:-----|
| `Wan2.1_VAE` | Official VAE | Causal Conv3D | Wan2.1 official video VAE model<br>**Highest quality, large memory, slow speed** |
| `taew2_1` | Open Source Small AE | Conv2D | Open source model based on [taeHV](https://github.com/madebyollin/taeHV)<br>**Small memory, fast speed, average quality** |
| **`lighttaew2_1`** | **LightTAE Series** | Conv2D | **Our distilled optimized version based on `taew2_1`**<br>**Small memory, fast speed, quality close to official** ✨ |
| **`lightvaew2_1`** | **LightVAE Series** | Causal Conv3D | **Our pruned 75% on WanVAE2.1 architecture then trained+distilled**<br>**Best balance: high quality + low memory + fast speed** πŸ† |

### 🎯 Wan2.2 Series VAE

| Model Name | Type | Architecture | Description | 
|:--------|:-----|:-----|:-----|
| `Wan2.2_VAE` | Official VAE | Causal Conv3D | Wan2.2 official video VAE model<br>**Highest quality, large memory, slow speed** |
| `taew2_2` | Open Source Small AE | Conv2D | Open source model based on [taeHV](https://github.com/madebyollin/taeHV)<br>**Small memory, fast speed, average quality** |
| **`lighttaew2_2`** | **LightTAE Series** | Conv2D | **Our distilled optimized version based on `taew2_2`**<br>**Small memory, fast speed, quality close to official** ✨ |

---


##  πŸ“Š Wan2.1 Series Performance Comparison
- **Precision**: BF16
- **Test Hardware**: NVIDIA H100

### Video Reconstruction (5s 81-frame video)

|Speed | Wan2.1_VAE | taew2_1 | lighttaew2_1 | lightvaew2_1 |
|:-----|:--------------|:------------|:---------------------|:-------------|
| **Encode Speed** | 4.1721 s | 0.3956 s | 0.3956 s |1.5014s |
| **Decode Speed** | 5.4649 s | 0.2463 s | 0.2463 s | 2.0697s |

|GPU Memory | Wan2.1_VAE | taew2_1 | lighttaew2_1 | lightvaew2_1 |
|:-----|:--------------|:------------|:---------------------|:-------------|
| **Encode Memory** | 8.4954 GB | 0.00858 GB | 0.00858 GB | 4.7631 GB |
| **Decode Memory** | 10.1287 GB | 0.41199 GB | 0.41199 GB | 5.5673 GB |

### Video Generation

Task: s2v(speech to video)  
Model: seko-talk

<table>
<tr>
<td width="25%" align="center">
<strong>Wan2.1_VAE</strong><br>
<video controls autoplay muted width="100%" src="https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/6l-P-3Hr9JKL3xgUyJXWJ.mp4"></video>
</td>
<td width="25%" align="center">
<strong>taew2_1</strong><br>
<video controls autoplay muted width="100%" src="https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/rcVHrCKB4nRAs2VSjJd2d.mp4"></video>
</td>
<td width="25%" align="center">
<strong>lighttaew2_1</strong><br>
<video controls autoplay muted width="100%" src="https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/Wq9p9Z7NDYwaKw4SqVbYT.mp4"></video>
</td>
<td width="25%" align="center">
<strong>lightvaew2_1</strong><br>
<video controls autoplay muted width="100%" src="https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/NpKOzFcvsHzSFfFACzUKP.mp4"></video>
</td>
</tr>
</table>

##  πŸ“Š Wan2.2 Series Performance Comparison
- **Precision**: BF16
- **Test Hardware**: NVIDIA H100

### Video Reconstruction
| Speed | Wan2.2_VAE | taew2_2 | lighttaew2_2 |
|:-----|:--------------|:------------|:---------------------|
| **Encode Speed** | 1.1369s | 0.3499 s | 0.3499 s |
| **Decode Speed** | 3.1268 s | 0.0891 s | 0.0891 s|

| GPU Memory | Wan2.2_VAE | taew2_2 | lighttaew2_2 |
|:-----|:--------------|:------------|:---------------------|
| **Encode Memory** | 6.1991 GB | 0.0064 GB | 0.0064 GB |
| **Decode Memory** | 12.3487 GB | 0.4120 GB | 0.4120 GB |


### Video Generation

Task: t2v(text to video)  
Model: [Wan2.2-TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B)

<table>
<tr>
<td width="33%" align="center">
<strong>Wan2.2_VAE</strong><br>
<video controls autoplay width="95%" src="https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/KUY7Ifz9gFJqDjWga6A53.mp4"></video>
</td>
<td width="33%" align="center">
<strong>taew2_2</strong><br>
<video controls autoplay width="95%" src="https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/OYA8VfNlCv_hBkj_n_OMl.mp4"></video>
</td>
<td width="33%" align="center">
<strong>lighttaew2_2</strong><br>
<video controls autoplay width="95%" src="https://cdn-uploads.huggingface.co/production/uploads/680de13385293771bc57400b/gaHRr6uuAF0NlH4YlMbHO.mp4"></video>
</td>
</tr>
</table>



## 🎯 Model Selection Recommendations

### Selection by Use Case

<table>
<tr>
<td width="33%">

#### πŸ† Pursuing Best Quality
**Recommended**: `Wan2.1_VAE` / `Wan2.2_VAE`

- βœ… Official model, quality ceiling
- βœ… Highest reconstruction accuracy
- βœ… Suitable for final product output
- ⚠️ **Large memory usage** (~8-12 GB)
- ⚠️ **Slow inference speed**

</td>
<td width="33%">

#### βš–οΈ **Best Balance** πŸ†
**Recommended**: **`lightvaew2_1`** 

- βœ… **Uses Causal 3D Conv** (same as official)
- βœ… **Excellent quality**, close to official
- βœ… Memory reduced by **~50%** (~4-5 GB)
- βœ… Speed increased by **2-3x**
- βœ… **Close to official quality** ⭐⭐⭐⭐

**Use Cases**: Daily production, strongly recommended ⭐

</td>
<td width="33%">

#### ⚑ **Speed + Quality Balance** ✨
**Recommended**: **`lighttaew2_1`** / **`lighttaew2_2`**

- βœ… Extremely low memory usage (~0.4 GB)
- βœ… Extremely fast inference
- βœ… **Quality significantly surpasses open source TAE**
- βœ… **Close to official quality** ⭐⭐⭐⭐

**Use Cases**: Development testing, rapid iteration

</td>
</tr>
</table>


### πŸ”₯ Our Optimization Results Comparison

| Comparison | Open Source TAE | **LightTAE (Ours)** | Official VAE | **LightVAE (Ours)** |
|:------|:--------|:---------------------|:---------|:---------------------|
| **Architecture** | Conv2D | Conv2D | Causal Conv3D | Causal Conv3D |
| **Memory Usage** | Minimal (~0.4 GB) | Minimal (~0.4 GB) | Large (~8-12 GB) | Medium (~4-5 GB) |
| **Inference Speed** | Extremely Fast ⚑⚑⚑⚑⚑ | Extremely Fast ⚑⚑⚑⚑⚑ | Slow ⚑⚑ | Fast ⚑⚑⚑⚑ |
| **Generation Quality** | Average ⭐⭐⭐ | **Close to Official** ⭐⭐⭐⭐ | Highest ⭐⭐⭐⭐⭐ |  **Close to Official** ⭐⭐⭐⭐  |

## πŸ“‘ Todo List
  - [x] LightX2V integration
  - [x] ComfyUI integration
  - [ ] Training & Distillation Code
  
## πŸš€ Usage

### Download VAE Models

```bash
# Download Wan2.1 official VAE
huggingface-cli download lightx2v/Autoencoders \
    --local-dir ./models/vae/
```

### πŸ§ͺ  Video Reconstruction Test

We provide a standalone script `vid_recon.py` to test VAE models independently. This script reads a video, encodes it through VAE, then decodes it back to verify the reconstruction quality.

**Script Location**: `LightX2V/lightx2v/models/video_encoders/hf/vid_recon.py`

```bash
git clone https://github.com/ModelTC/LightX2V.git
cd LightX2V
```

**1. Test Official VAE (Wan2.1)**
```bash
python -m lightx2v.models.video_encoders.hf.vid_recon \
    input_video.mp4 \
    --checkpoint ./models/vae/Wan2.1_VAE.pth \
    --model_type vaew2_1 \
    --device cuda \
    --dtype bfloat16
```

**2. Test Official VAE (Wan2.2)**
```bash
python -m lightx2v.models.video_encoders.hf.vid_recon \
    input_video.mp4 \
    --checkpoint ./models/vae/Wan2.2_VAE.pth \
    --model_type vaew2_2 \
    --device cuda \
    --dtype bfloat16
```

**3. Test LightTAE (Wan2.1)**
```bash
python -m lightx2v.models.video_encoders.hf.vid_recon \
    input_video.mp4 \
    --checkpoint ./models/vae/lighttaew2_1.pth \
    --model_type taew2_1 \
    --device cuda \
    --dtype bfloat16
```

**4. Test LightTAE (Wan2.2)**
```bash
python -m lightx2v.models.video_encoders.hf.vid_recon \
    input_video.mp4 \
    --checkpoint ./models/vae/lighttaew2_2.pth \
    --model_type taew2_2 \
    --device cuda \
    --dtype bfloat16
```

**5. Test LightVAE (Wan2.1)**
```bash
python -m lightx2v.models.video_encoders.hf.vid_recon \
    input_video.mp4 \
    --checkpoint ./models/vae/lightvaew2_1.pth \
    --model_type vaew2_1 \
    --device cuda \
    --dtype bfloat16 \
    --use_lightvae
```


**6. Test TAE (Wan2.1)**
```bash
python -m lightx2v.models.video_encoders.hf.vid_recon \
    input_video.mp4 \
    --checkpoint ./models/vae/taew2_1.pth \
    --model_type taew2_1 \
    --device cuda \
    --dtype bfloat16
```

**7. Test TAE (Wan2.2)**
```bash
python -m lightx2v.models.video_encoders.hf.vid_recon \
    input_video.mp4 \
    --checkpoint ./models/vae/taew2_2.pth \
    --model_type taew2_1 \
    --device cuda \
    --dtype bfloat16
```

### Use in LightX2V

Specify the VAE path in the configuration file:


**Using Official VAE Series:**
```json
{

    "vae_path": "./models/vae/Wan2.1_VAE.pth"
}
```

**Using LightVAE Series:**
```json
{
    "use_lightvae": true,
    "vae_path": "./models/vae/lightvaew2_1.pth"
}
```


**Using LightTAE Series:**
```json
{
    "use_tae": true,
    "need_scaled": true,
    "tae_path": "./models/vae/lighttaew2_1.pth"
}
```


**Using TAE Series:**
```json
{
    "use_tae": true,
    "tae_path": "./models/vae/taew2_1.pth"
}
```

Then run the inference script:

```bash
cd LightX2V/scripts
bash wan/run_wan_i2v.sh  # or other inference scripts
```

### Use in ComfyUI

please refer to  https://github.com/ModelTC/ComfyUI-LightVAE

## ⚠️ Important Notes

### 1. Compatibility
- Wan2.1 series VAE only works with Wan2.1 backbone models
- Wan2.2 series VAE only works with Wan2.2 backbone models
- Do not mix different versions of VAE and backbone models

## πŸ“š Related Resources

### Documentation Links
- **LightX2V Quick Start**: [Quick Start Documentation](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/getting_started/quickstart.html)
- **Model Structure Description**: [Model Structure Documentation](https://lightx2v-zhcn.readthedocs.io/zh-cn/latest/getting_started/model_structure.html)
- **taeHV Project**: [GitHub - madebyollin/taeHV](https://github.com/madebyollin/taeHV)

### Related Models
- **Wan2.1 Backbone Models**: [Wan-AI Model Collection](https://huggingface.co/Wan-AI)
- **Wan2.2 Backbone Models**: [Wan-AI/Wan2.2-TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B)
- **LightX2V Optimized Models**: [lightx2v Model Collection](https://huggingface.co/lightx2v)

---

## 🀝 Community & Support

- **GitHub Issues**: https://github.com/ModelTC/LightX2V/issues
- **HuggingFace**: https://huggingface.co/lightx2v
- **LightX2V Homepage**: https://github.com/ModelTC/LightX2V

If you find this project helpful, please give us a ⭐ on [GitHub](https://github.com/ModelTC/LightX2V)