Diffusers 原生支持 Nunchaku 4-bit 扩散推理
Bringing Nunchaku 4-bit Diffusion Inference to Diffusers
Hugging Face 在 Diffusers 中引入 Nunchaku Lite,可直接用 from_pretrained() 加载 Nunchaku 量化检查点,无需本地编译 CUDA 或单独推理引擎。
Diffusers 原生接入 Nunchaku 4-bit 推理,读者可据此判断消费级显卡跑扩散模型的显存与延迟变化。
深读指南
适合谁读:关注扩散模型推理优化、量化部署与 Diffusers 生态的工程师和研究者,尤其是希望在消费级 GPU 上运行大型文生图/视频模型的开发者。
Nunchaku Lite 让 Diffusers 能以普通 from_pretrained() 方式加载 Nunchaku 量化检查点,无需自定义 pipeline 或本地编译 CUDA 内核。
loading a Nunchaku checkpoint is as simple as calling from_pretrained() , with no local CUDA compilation required
SVDQuant 同时量化权重和激活(W4A4),把激活离群值转移到权重中的低秩分支,从而在降低显存的同时加速去噪循环。
It runs the main transformer layers with 4-bit weights and activations (W4A4), reducing memory while also speeding up the denoising loop.
Nunchaku Lite 可与 torch.compile、量化文本编码器和 offloading 等 Diffusers 优化组合,进一步提升速度并降低峰值显存。
Nunchaku Lite can be combined with other Diffusers memory and speed optimizations.
局限与前提:文中基准数据来自特定硬件(RTX PRO 6000/RTX 5090)和特定模型(ERNIE-Image-Turbo),未覆盖所有架构;Nunchaku Lite 缺少架构特定的融合内核,速度提升有限;NVFP4 需要 Blackwell GPU,Volta 和 Hopper 暂不支持 4-bit 内核;涉及 QKV 融合等结构重写时,通用路径无法自动推断,需要模型特定的 target config 和运行时适配器。
对照原文阅读来源:Hugging Face Blog · huggingface.co