Views
No views yet
pip install sdnq>=0.1.91import torch
2import diffusers
3from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
4
5pipe = diffusers.ZImagePipeline.from_pretrained("Disty0/Z-Image-SDNQ-4bit-dynamic-hadamard-svd-r32", torch_dtype=torch.bfloat16)
6pipe.enable_model_cpu_offload()
7
8# Generate image
9prompt = "Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights."
10negative_prompt = "" # Optional, but would be powerful when you want to remove some unwanted content
11
12image = pipe(
13 prompt=prompt,
14 negative_prompt=negative_prompt,
15 height=1024,
16 width=1024,
17 cfg_normalization=False,
18 num_inference_steps=20,
19 guidance_scale=4,
20 generator=torch.manual_seed(42),
21 callback_on_step_end=callback_func,
22).images[0]
23image.save("z-image-turbo-sdnq-4bit-dynamic-hadamard-svd-r32.png")| Quantization | Model Size | Visualization |
|---|---|---|
| Original BF16 | 20.5 GB | ![]() |
| SDNQ 4bit | 7.4 GB | ![]() |