File size: 7,359 Bytes
90ed8f9 3f8971c 90ed8f9 ec10712 6b227b8 f39cbbd ec10712 6b227b8 ec10712 6b227b8 ec10712 6b227b8 ec10712 8ea1b3c ec10712 8ea1b3c ec10712 b645ef0 ec10712 6b227b8 ec10712 6b227b8 ec10712 6b227b8 ec10712 6b227b8 ec10712 6b227b8 |
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 |
---
license: apache-2.0
tags:
- diffusion-single-file
- comfyui
- distillation
- video
- video genration
base_model:
- tencent/HunyuanVideo-1.5
pipeline_tags:
- image-to-video
- text-to-video
library_name: diffusers
pipeline_tag: image-to-video
---
# π¬ Hy1.5-Quantized-Models
<img src="https://raw.githubusercontent.com/ModelTC/LightX2V/main/assets/img_lightx2v.png" width="75%" />
---
π€ [HuggingFace](https://huggingface.co/lightx2v/Hy1.5-Quantized-Models) | [GitHub](https://github.com/ModelTC/LightX2V) | [License](https://opensource.org/licenses/Apache-2.0)
---
This repository contains quantized models for HunyuanVideo-1.5 optimized for use with LightX2V. These quantized models significantly reduce memory usage while maintaining high-quality video generation performance.
## π Model List
### DIT (Diffusion Transformer) Models
* **`hy15_720p_i2v_fp8_e4m3_lightx2v.safetensors`** - 720p Image-to-Video quantized DIT model
* **`hy15_720p_t2v_fp8_e4m3_lightx2v.safetensors`** - 720p Text-to-Video quantized DIT model
### Encoder Models
* **`hy15_qwen25vl_llm_encoder_fp8_e4m3_lightx2v.safetensors`** - Quantized text encoder (Qwen2.5-VL LLM Encoder)
## π Quick Start
### Installation
First, install LightX2V:
```bash
pip install -v git+https://github.com/ModelTC/LightX2V.git
```
Or build from source:
```bash
git clone https://github.com/ModelTC/LightX2V.git
cd LightX2V
pip install -v -e .
```
### Download Models
Download the quantized models from this repository:
```bash
# Using git-lfs
git lfs install
git clone https://huggingface.co/lightx2v/Hy1.5-Quantized-Models
# Or download individual files using huggingface-hub
pip install huggingface-hub
python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='lightx2v/Hy1.5-Quantized-Models', filename='hy15_720p_i2v_fp8_e4m3_lightx2v.safetensors', local_dir='./models')"
```
## π» Usage in LightX2V
### Text-to-Video (T2V) Example
```python
from lightx2v import LightX2VPipeline
# Initialize pipeline
pipe = LightX2VPipeline(
model_path="/path/to/hunyuanvideo-1.5/", # Original model path
model_cls="hunyuan_video_1.5",
transformer_model_name="720p_t2v",
task="t2v",
)
# Enable quantization
pipe.enable_quantize(
quant_scheme='fp8-sgl',
dit_quantized=True,
dit_quantized_ckpt="/path/to/hy15_720p_t2v_fp8_e4m3_lightx2v.safetensors",
text_encoder_quantized=True,
text_encoder_quantized_ckpt="/path/to/hy15_qwen25vl_llm_encoder_fp8_e4m3_lightx2v.safetensors",
image_encoder_quantized=False,
)
# Optional: Enable offloading for lower VRAM usage
pipe.enable_offload(
cpu_offload=True,
offload_granularity="block", # For HunyuanVideo-1.5, only "block" is supported
text_encoder_offload=True,
image_encoder_offload=False,
vae_offload=False,
)
# Optional: Use lighttae
pipe.enable_lightvae(
use_tae=True,
tae_path="/path/to/lighttaehy1_5.safetensors",
use_lightvae=False,
vae_path=None,
)
# Create generator
pipe.create_generator(
attn_mode="sage_attn2",
infer_steps=50,
num_frames=121,
guidance_scale=6.0,
sample_shift=9.0,
aspect_ratio="16:9",
fps=24,
)
# Generate video
seed = 123
prompt = "A beautiful sunset over the ocean with waves gently crashing on the shore."
negative_prompt = ""
save_result_path="/path/to/output.mp4"
pipe.generate(
seed=seed,
prompt=prompt,
negative_prompt=negative_prompt,
save_result_path=save_result_path,
)
```
### Image-to-Video (I2V) Example
```python
from lightx2v import LightX2VPipeline
# Initialize pipeline
pipe = LightX2VPipeline(
model_path="/path/to/hunyuanvideo-1.5/", # Original model path
model_cls="hunyuan_video_1.5",
transformer_model_name="720p_i2v",
task="i2v",
)
# Enable quantization
pipe.enable_quantize(
quant_scheme='fp8-sgl',
dit_quantized=True,
dit_quantized_ckpt="/path/to/hy15_720p_i2v_fp8_e4m3_lightx2v.safetensors",
text_encoder_quantized=True,
text_encoder_quantized_ckpt="/path/to/hy15_qwen25vl_llm_encoder_fp8_e4m3_lightx2v.safetensors",
image_encoder_quantized=False,
)
# Optional: Use lighttae
pipe.enable_lightvae(
use_tae=True,
tae_path="/path/to/lighttaehy1_5.safetensors",
use_lightvae=False,
vae_path=None,
)
# Optional: Enable offloading for lower VRAM usage
pipe.enable_offload(
cpu_offload=True,
offload_granularity="block",
text_encoder_offload=True,
image_encoder_offload=False,
vae_offload=False,
)
# Create generator
pipe.create_generator(
attn_mode="sage_attn2",
infer_steps=50,
num_frames=121,
guidance_scale=6.0,
sample_shift=7.0,
fps=24,
)
# Generate video
seed = 42
prompt = "The image comes to life with smooth motion and natural transitions."
negative_prompt = ""
save_result_path="/path/to/output.mp4"
pipe.generate(
seed=seed,
image_path="/path/to/input_image.jpg",
prompt=prompt,
negative_prompt=negative_prompt,
save_result_path=save_result_path,
)
```
## βοΈ Quantization Scheme
These models use **FP8-E4M3** quantization with the **SGL (SGLang) kernel** scheme (`fp8-sgl`). This quantization format provides:
* **Significant memory reduction**: Up to 50% reduction in VRAM usage
* **Maintained quality**: Minimal quality degradation compared to full precision models
* **Faster inference**: Optimized kernels for accelerated computation
### Requirements
To use these quantized models, you need to install the SGL kernel:
```bash
# Requires torch == 2.8.0
pip install sgl-kernel --upgrade
```
Alternatively, you can use VLLM kernels:
```bash
pip install vllm
```
For more details on quantization schemes, please refer to the [LightX2V Quantization Documentation](https://lightx2v-en.readthedocs.io/en/latest/method_tutorials/quantization.html).
## π Performance Benefits
Using quantized models provides:
* **Lower VRAM Requirements**: Enables running on GPUs with less memory (e.g., RTX 4090 24GB)
* **Faster Inference**: Optimized quantized kernels accelerate computation
* **Quality Preservation**: FP8 quantization maintains high visual quality
## π Related Resources
* [LightX2V GitHub Repository](https://github.com/ModelTC/LightX2V)
* [LightX2V Documentation](https://lightx2v-en.readthedocs.io/en/latest/)
* [HunyuanVideo-1.5 Original Model](https://huggingface.co/tencent/HunyuanVideo-1.5)
* [LightX2V Examples](https://github.com/ModelTC/LightX2V/tree/main/examples)
## π Notes
* **Important**: All advanced configurations (including `enable_quantize()`) must be called **before** `create_generator()`, otherwise they will not take effect.
* The original HunyuanVideo-1.5 model weights are still required. These quantized models are used in conjunction with the original model structure.
* For best performance, we recommend using SageAttention 2 (`sage_attn2`) as the attention mode.
## π€ Citation
If you use these quantized models in your research, please cite:
```bibtex
@misc{lightx2v,
author = {LightX2V Contributors},
title = {LightX2V: Light Video Generation Inference Framework},
year = {2025},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/ModelTC/lightx2v}},
}
```
## π License
This model is released under the Apache 2.0 License, same as the original HunyuanVideo-1.5 model.
|