--- base_model: stabilityai/stable-diffusion-xl-base-1.0 base_model_relation: quantized datasets: - test_anime language: - en library_name: diffusers license: openrail++ license_link: https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENSE.md pipeline_tag: text-to-image tags: - text-to-image - SVDQuant - SDXL - Diffusion - Quantization - stable-diffusion - noob - netanoob --- # Model Card for nunchaku-sdxl-noob ![visual](sdxl.png) This repository contains Nunchaku-quantized versions of [stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/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! ## Model Details ### Model Description - **Thanks to** Nunchaku Team (thank [@devgdovg](https://github.com/devgdovg)) - **Model type:** text-to-image - **License:** [openrail++](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENSE.md) - **First version quantized from model:** [neta-art/neta-noob-1.0](https://huggingface.co/neta-art/neta-noob-1.0) ### Model Files - [`svdq-int4_r32-sdxl.safetensors`](./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. ### Model Sources - **Inference Engine:** [nunchaku](https://github.com/nunchaku-tech/nunchaku) - **Quantization Library:** [deepcompressor](https://github.com/nunchaku-tech/deepcompressor) - **Paper:** [SVDQuant: Absorbing Outliers by Low-Rank Components for 4-Bit Diffusion Models](http://arxiv.org/abs/2411.05007) - **Demo:** [svdquant.mit.edu](https://svdquant.mit.edu) - **NoobAI SDXL** [NoobAI](https://huggingface.co/collections/Laxhar/noobai-sdxl-6736dfcb52c60632e5593747) ## Usage - Diffusers Usage: See [sdxl.py](https://github.com/nunchaku-tech/nunchaku/blob/main/examples/v1/sdxl.py) or our [tutorial](https://nunchaku.tech/docs/nunchaku/usage/sdxl.html) for usage. - ComfyUI Usage: Stay tuned! ``` 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") ``` ## Performance ![performance](https://huggingface.co/datasets/nunchaku-tech/cdn/resolve/main/nunchaku/assets/efficiency.jpg) ## Citation ```bibtex @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} } ```