Views
No views yet
pip install git+https://github.com/Disty0/sdnq1import torch
2import diffusers
3from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
4
5device = "xpu" if hasattr(torch,"xpu") and torch.xpu.is_available() else "mps" if hasattr(torch,"mps") and hasattr(torch.mps, "is_available") and torch.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu"
6
7pipe = diffusers.StableDiffusionXLPipeline.from_pretrained("Disty0/NoobAI-XL-Vpred-v1.0-SDNQ-uint4-svd-r128", torch_dtype=torch.bfloat16)
8pipe = pipe.to(device)
9
10prompt = "masterpiece, best quality, artist:john_kafka, artist:nixeu, artist:quasarcake, chromatic aberration, film grain, horror (theme), limited palette, x-shaped pupils, high contrast, color contrast, cold colors, arlecchino (genshin impact), black theme, gritty, graphite (medium)"
11negative_prompt = "nsfw, worst quality, old, early, low quality, lowres, signature, username, logo, bad hands, mutated hands, mammal, anthro, furry, ambiguous form, feral, semi-anthro"
12
13image = pipe(
14 prompt=prompt,
15 negative_prompt=negative_prompt,
16 width=832,
17 height=1216,
18 num_inference_steps=28,
19 guidance_scale=3.5,
20 generator=torch.Generator().manual_seed(42),
21).images[0]
22image.save("noobai-xl-vpred-v1.0-sdnq-uint4-svd-r128.png")| Quantization | Model Size | Visualization |
|---|---|---|
| Original BF16 | 5.14 GB | ![]() |
| SDNQ UINT4 | 2.56 GB | ![]() |