SVDQunat: Absorbing Outliers by Low-Rank Components for 4-Bit Diffusion Models
Paper • 2411.05007 • Published • 24
This repository contains Nunchaku-quantized versions of stable-diffusion-xl-base-1.0, designed to generate high-quality images from text prompts. It is optimized for efficient inference while maintaining minimal loss in performance.
No recent news. Stay tuned for updates!
svdq-int4_r32-sdxl.safetensors: SVDQuant quantized INT4 NETA NOOB SDXL model. For users with non-Blackwell GPUs (pre-50-series). Test Version with only 30 samples.import time
import torch
from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
from nunchaku.models.unets.unet_sdxl import NunchakuSDXLUNet2DConditionModel
if __name__ == "__main__":
unet = NunchakuSDXLUNet2DConditionModel.from_pretrained(
"heziiiii/nunchaku-sdxl-noob/svdq-int4_r32-netanoob-v0.0.1.safetensors"
)
pipeline = StableDiffusionXLPipeline.from_pretrained(
"neta-art/neta-noob-1.0",
unet=unet,
use_safetensors=True,
torch_dtype=torch.bfloat16,
).to("cuda")
# Euler A
# pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipeline.scheduler.config)
prompt = "1girl, animal ears, cat ears, tail, cat tail, red collar, cat girl, animal collar, collar, animal ear fluff, shirt, solo, long hair, stuffed toy, stuffed animal, rain, blunt bangs, wooden floor, aqua eyes, t-shirt, blonde hair, indoors, clothes writing, sitting, looking at viewer, white shirt, seiza, open mouth, barefoot, green eyes, between legs, off shoulder, :o, light brown hair, print shirt, full body, looking up, short sleeves"
negative_prompt = "bad quality, low quality, low resolution, text, error, cropped, jpeg artifacts, signature, watermark, username, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"
start_time = time.time()
# negative_prompt = "ugly, disfigured, deformed, blurry, low quality, low resolution, text, error, cropped, jpeg artifacts, signature, watermark, username, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"
image = pipeline(prompt=prompt, negative_prompt=negative_prompt,
height=1024,
width=1024,
guidance_scale=7.0, num_inference_steps=28).images[0]
end_time = time.time()
print(f"Time taken: {end_time - start_time} seconds")
image.save("sdxl.png")
@inproceedings{
li2024svdquant,
title={SVDQuant: Absorbing Outliers by Low-Rank Components for 4-Bit Diffusion Models},
author={Li*, Muyang and Lin*, Yujun and Zhang*, Zhekai and Cai, Tianle and Li, Xiuyu and Guo, Junxian and Xie, Enze and Meng, Chenlin and Zhu, Jun-Yan and Han, Song},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025}
}
Base model
stabilityai/stable-diffusion-xl-base-1.0