Downloads · 30 days
19
20% of all-time downloads
Thekingbalxd/z-image
z-image is a text-to-image model from Thekingbalxd. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as apache-2.0.
4 bit (UINT4 with SVD rank 32) quantization of Tongyi-MAI/Z-Image-Turbo using SDNQ.
Downloads · 30 days
19
20% of all-time downloads
All-time downloads
97
Public
Parameters
3.3B
6.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.5 GB · 100%
How the weights are stored.
U83.1B · 94%
From the Hugging Face model README
4 bit (UINT4 with SVD rank 32) quantization of Tongyi-MAI/Z-Image-Turbo using SDNQ.
Usage:
pip install sdnq
import torch
import diffusers
from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
from sdnq.common import use_torch_compile as triton_is_available
from sdnq.loader import apply_sdnq_options_to_model
pipe = diffusers.ZImagePipeline.from_pretrained("Disty0/Z-Image-Turbo-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
# Enable INT8 MatMul for AMD, Intel ARC and Nvidia GPUs:
if triton_is_available and (torch.cuda.is_available() or torch.xpu.is_available()):
pipe.transformer = apply_sdnq_options_to_model(pipe.transformer, use_quantized_matmul=True)
pipe.text_encoder = apply_sdnq_options_to_model(pipe.text_encoder, use_quantized_matmul=True)
pipe.transformer = torch.compile(pipe.transformer) # optional for faster speeds
pipe.enable_model_cpu_offload()
prompt = "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."
image = pipe(
prompt=prompt,
height=1024,
width=1024,
num_inference_steps=9,
guidance_scale=0.0,
generator=torch.manual_seed(42),
).images[0]
image.save("z-image-turbo-sdnq-uint4-svd-r32.png")
Original BF16 vs SDNQ quantization comparison:
| Quantization | Model Size | Visualization |
|---|---|---|
| Original BF16 | 12.3 GB | ![]() |
| SDNQ UINT4 | 3.5 GB | ![]() |