Downloads · 30 days
0
Abrahamm3r/Z-Image-SDNQ-uint4-svd-r32
Z-Image-SDNQ-uint4-svd-r32 is a text-to-image model from Abrahamm3r. 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.
This is a 4-bit quantized version of Tongyi-MAI/Z-Image using SDNQ (Structured Decomposable Neural Quantization) with SVD decomposition.
Downloads · 30 days
0
Access
Public
Updated Jan 28, 2026
Repo size
11.7 GB
Likes
4
Public
Click a slice to open those files.
.safetensors11.7 GB · 100%
From the Hugging Face model README
This is a 4-bit quantized version of Tongyi-MAI/Z-Image using SDNQ (Structured Decomposable Neural Quantization) with SVD decomposition.
weights_dtype = "uint4" # 4-bit weights
use_svd = True # SVD decomposition enabled
svd_rank = 32 # SVD rank for quality preservation
quantized_matmul_dtype = "int8" # Compute precision
group_size = 0 # Auto group size
import torch
from diffusers import DiffusionPipeline
from sdnq.loader import apply_sdnq_options_to_model
# Load the quantized model
pipe = DiffusionPipeline.from_pretrained(
"YOUR_USERNAME/Z-Image-SDNQ-uint4-svd-r32",
torch_dtype=torch.bfloat16,
trust_remote_code=True
)
# Apply SDNQ configuration
pipe.transformer = apply_sdnq_options_to_model(
pipe.transformer,
use_quantized_matmul=False # Set to False for Windows/No-Triton
)
pipe.text_encoder = apply_sdnq_options_to_model(
pipe.text_encoder,
use_quantized_matmul=False
)
pipe = pipe.to("cuda")
# Generate image
image = pipe(
prompt="a beautiful landscape with mountains and a lake at sunset",
num_inference_steps=30,
guidance_scale=1.0
).images[0]
image.save("output.png")
import torch
from diffusers import DiffusionPipeline
from sdnq.loader import apply_sdnq_options_to_model
# Configuration
WIDTH = 768
HEIGHT = 1344 # 9:16 aspect ratio
PROMPT = "a beautiful landscape with mountains and a lake at sunset, highly detailed, 8k, masterpiece"
STEPS = 30
GUIDANCE = 1.0
# Load model
pipe = DiffusionPipeline.from_pretrained(
"YOUR_USERNAME/Z-Image-SDNQ-uint4-svd-r32",
torch_dtype=torch.bfloat16,
trust_remote_code=True
)
# Configure SDNQ
pipe.transformer = apply_sdnq_options_to_model(
pipe.transformer,
use_quantized_matmul=False
)
pipe.text_encoder = apply_sdnq_options_to_model(
pipe.text_encoder,
use_quantized_matmul=False
)
pipe = pipe.to("cuda")
# Generate
image = pipe(
prompt=PROMPT,
num_inference_steps=STEPS,
guidance_scale=GUIDANCE,
width=WIDTH,
height=HEIGHT
).images[0]
image.save("portrait_9x16.png")
| Aspect Ratio | Resolution | Steps | Guidance Scale |
|---|---|---|---|
| 1:1 (Square) | 768x768 | 30 | 1.0 |
| 16:9 (Landscape) | 1344x768 | 30 | 1.0 |
| 9:16 (Portrait) | 768x1344 | 30 | 1.0 |
| 4:3 | 1024x768 | 30 | 1.0 |
Note: For maximum quality, use 30 steps. For faster generation (lower quality), you can use 4-6 steps.
pip install torch diffusers transformers sdnq
This model uses SDNQ (Structured Decomposable Neural Quantization) which:
from diffusers import DiffusionPipeline
from sdnq.loader import sdnq_post_load_quant, save_sdnq_model
# Load base model
pipe = DiffusionPipeline.from_pretrained(
"Tongyi-MAI/Z-Image",
torch_dtype=torch.bfloat16,
trust_remote_code=True
)
# Apply quantization to transformer
quantized_transformer = sdnq_post_load_quant(
pipe.transformer,
weights_dtype="uint4",
use_svd=True,
svd_rank=32,
quantized_matmul_dtype="int8",
group_size=0
)
pipe.transformer = quantized_transformer
# Save
save_sdnq_model(pipe, "./Z-Image-SDNQ-uint4-svd-r32", is_pipeline=True)
pip install sdnq)If you use this model, please cite the original Z-Image paper:
@article{zimage2024,
title={Z-Image: Efficient Text-to-Image Synthesis},
author={Tongyi-MAI Team},
year={2024}
}
This model inherits the Apache 2.0 license from the base Tongyi-MAI/Z-Image model.