mirror of
https://git.datalinker.icu/ali-vilab/TeaCache
synced 2025-12-09 12:54:23 +08:00
51 lines
2.6 KiB
Markdown
51 lines
2.6 KiB
Markdown
<!-- ## **TeaCache4LuminaT2X** -->
|
|
# TeaCache4Lumina2
|
|
|
|
[TeaCache](https://github.com/LiewFeng/TeaCache) can speedup [Lumina-Image-2.0](https://github.com/Alpha-VLLM/Lumina-Image-2.0) without much visual quality degradation, in a training-free manner. The following image shows the results generated by TeaCache-Lumina-Image-2.0 with various rel_l1_thresh values: 0 (original), 0.2 (1.25x speedup), 0.3 (1.5625x speedup), 0.4 (2.0833x speedup), 0.5 (2.5x speedup).
|
|
|
|
<p align="center">
|
|
<img src="https://github.com/user-attachments/assets/d2c87b99-e4ac-4407-809a-caf9750f41ef" width="150" style="margin: 5px;">
|
|
<img src="https://github.com/user-attachments/assets/411ff763-9c31-438d-8a9b-3ec5c88f6c27" width="150" style="margin: 5px;">
|
|
<img src="https://github.com/user-attachments/assets/e57dfb60-a07f-4e17-837e-e46a69d8b9c0" width="150" style="margin: 5px;">
|
|
<img src="https://github.com/user-attachments/assets/6e3184fe-e31a-452c-a447-48d4b74fcc10" width="150" style="margin: 5px;">
|
|
<img src="https://github.com/user-attachments/assets/d6a52c4c-bd22-45c0-9f40-00a2daa85fc8" width="150" style="margin: 5px;">
|
|
</p>
|
|
|
|
## 📈 Inference Latency Comparisons on a single 4090 (step 50)
|
|
|
|
|
|
| Lumina-Image-2.0 | TeaCache (0.2) | TeaCache (0.3) | TeaCache (0.4) | TeaCache (0.5) |
|
|
|:-------------------------:|:---------------------------:|:--------------------:|:---------------------:|:---------------------:|
|
|
| ~25 s | ~20 s | ~16 s | ~12 s | ~10 s |
|
|
|
|
## Installation
|
|
|
|
```shell
|
|
pip install --upgrade diffusers[torch] transformers protobuf tokenizers sentencepiece
|
|
pip install flash-attn --no-build-isolation
|
|
```
|
|
|
|
## Usage
|
|
|
|
You can modify the thresh in line 154 to obtain your desired trade-off between latency and visul quality. For single-gpu inference, you can use the following command:
|
|
|
|
```bash
|
|
python teacache_lumina2.py
|
|
```
|
|
|
|
## Citation
|
|
If you find TeaCache is useful in your research or applications, please consider giving us a star 🌟 and citing it by the following BibTeX entry.
|
|
|
|
```
|
|
@article{liu2024timestep,
|
|
title={Timestep Embedding Tells: It's Time to Cache for Video Diffusion Model},
|
|
author={Liu, Feng and Zhang, Shiwei and Wang, Xiaofeng and Wei, Yujie and Qiu, Haonan and Zhao, Yuzhong and Zhang, Yingya and Ye, Qixiang and Wan, Fang},
|
|
journal={arXiv preprint arXiv:2411.19108},
|
|
year={2024}
|
|
}
|
|
```
|
|
|
|
## Acknowledgements
|
|
|
|
We would like to thank the contributors to the [Lumina-Image-2.0](https://github.com/Alpha-VLLM/Lumina-Image-2.0) and [Diffusers](https://github.com/huggingface/diffusers).
|