arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.02540cs.CV
收藏

ViDiT-Q:面向图像与视频生成的扩散Transformer高效精准量化

ViDiT-Q: Efficient and Accurate Quantization of Diffusion Transformers for Image and Video Generation

Tsinghua University(清华大学);Infinigence AI(智源人工智能);Microsoft(微软公司);Shanghai Jiaotong University(上海交通大学)

Tianchen Zhao, Tongcheng Fang, Haofeng Huang, Enshu Liu, Rui Wan, Widyadewi Soedarmadji, Shiyao Li, Zinan Lin, Guohao Dai, Shengen Yan, Huazhong Yang, Xuefei Ning, Yu Wang

AI总结:

针对扩散Transformer量化在文生图、文生视频任务中的误差问题,提出定制化量化方案ViDiT-Q,实现低精度量化下的效果保留,同时带来显著的内存节省与推理加速。

摘要:

扩散Transformer已在视觉生成任务中展现出卓越性能,例如根据文本指令生成逼真的图像或视频。然而,更大的模型规模以及视频生成的多帧处理会导致计算与内存成本上升,给边缘设备上的实际部署带来挑战。训练后量化(PTQ)是降低内存成本与计算复杂度的有效方法。在对扩散Transformer进行量化时,我们发现现有量化方法应用于文本到图像及视频任务时存在诸多挑战。为解决这些问题,我们首先系统分析了量化误差的来源,总结出DiT(扩散Transformer)量化面临的独特挑战。据此,我们设计了一种改进的量化方案:ViDiT-Q(视频与图像扩散Transformer量化),专门针对DiT模型定制。我们在多种文本到图像及视频模型上验证了ViDiT-Q的有效性,实现了W8A8和W4A8量化,且视觉质量与指标的退化可忽略不计。此外,我们实现了高效的GPU内核,实际可节省2-2.5倍内存,并实现1.4-1.7倍的端到端延迟加速。

英文摘要:

Diffusion transformers have demonstrated remarkable performance in visual generation tasks, such as generating realistic images or videos based on textual instructions. However, larger model sizes and multi-frame processing for video generation lead to increased computational and memory costs, posing challenges for practical deployment on edge devices. Post-Training Quantization (PTQ) is an effective method for reducing memory costs and computational complexity. When quantizing diffusion transformers, we find that existing quantization methods face challenges when applied to text-to-image and video tasks. To address these challenges, we begin by systematically analyzing the source of quantization error and conclude with the unique challenges posed by DiT quantization. Accordingly, we design an improved quantization scheme: ViDiT-Q (Video & Image Diffusion Transformer Quantization), tailored specifically for DiT models. We validate the effectiveness of ViDiT-Q across a variety of text-to-image and video models, achieving W8A8 and W4A8 with negligible degradation in visual quality and metrics. Additionally, we implement efficient GPU kernels to achieve practical 2-2.5x memory saving and a 1.4-1.7x end-to-end latency speedup.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑