CoolFace
Modelpublic

andrevp/Z-Image-Turbo-MLX-8bit

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
1likes
Model Card

Z-Image-Turbo — MLX (8-bit Quantized)

MLX conversion of Tongyi-MAI/Z-Image-Turbo for Apple Silicon.

This is the 8-bit quantized MLX conversion. Linear layer weights are quantized to 8-bit with group_size=64. VAE remains in float16 to preserve image quality.

Model size: 11.37 GB

All Available MLX Variants

VariantSizeQuantizationLink
Full Precision (fp16)20.54 GBNoneandrevp/Z-Image-Turbo-MLX
8-bit11.37 GB8-bit, group_size=64andrevp/Z-Image-Turbo-MLX-8bit
4-bit6.48 GB4-bit, group_size=64andrevp/Z-Image-Turbo-MLX-4bit
2-bit4.04 GB2-bit, group_size=64andrevp/Z-Image-Turbo-MLX-2bit

About Z-Image-Turbo

Z-Image is an efficient 6B-parameter image generation foundation model using a Scalable Single-Stream Diffusion Transformer (S3-DiT) architecture. Z-Image-Turbo is the distilled variant with only 8 NFEs (Number of Function Evaluations), achieving sub-second inference latency.

Key Features

  • Photorealistic image generation with state-of-the-art quality
  • Bilingual text rendering (English & Chinese)
  • Strong instruction adherence
  • 8-step inference — distilled via Decoupled-DMD + Reinforcement Learning (DMDR)
  • No CFG required — guidance_scale=0.0

Architecture

ComponentArchitectureParameters
Text EncoderQwen3 (36 layers, hidden_size=2560, GQA with 32/8 heads)~7.8 GB (fp16)
TransformerZImageTransformer2DModel (30 layers, dim=3840, 30 heads)~12.3 GB (fp16)
VAEAutoencoderKL (from Flux, 16 latent channels)~160 MB (fp16)
TokenizerQwen2Tokenizer (vocab_size=151,936)
SchedulerFlowMatchEulerDiscreteScheduler

The S3-DiT architecture concatenates text tokens, visual semantic tokens, and image VAE tokens at the sequence level as a unified input stream, maximizing parameter efficiency compared to dual-stream approaches.

Quantization Details

ParameterValue
Bits8
Group Size64
Quantized ComponentsText Encoder (Qwen3), Transformer (ZImageTransformer2DModel)
Non-Quantized ComponentsVAE (AutoencoderKL) — kept at float16 for image quality
Quantized Tensors526 Linear layer weight tensors
MethodMLX group quantization (mlx.core.quantize)

Only 2D weight tensors from Linear layers are quantized. Normalization layers, biases, embeddings, and position encodings remain in float16.

Component Sizes

ComponentOriginal (bf16)This Variant (8-bit Quantized)
Text Encoder7.8 GB~4.6 GB
Transformer24.6 GB~6.6 GB
VAE160 MB160 MB
Total~32.6 GB11.37 GB

Original Model

Original Usage (PyTorch/CUDA)

python
import torch
from diffusers import ZImagePipeline

pipe = ZImagePipeline.from_pretrained(
    "Tongyi-MAI/Z-Image-Turbo",
    torch_dtype=torch.bfloat16,
)
pipe.to("cuda")

prompt = "Young Chinese woman in red Hanfu, intricate embroidery, ancient temple backdrop"

image = pipe(
    prompt=prompt,
    height=1024,
    width=1024,
    num_inference_steps=9,   # Results in 8 DiT forwards
    guidance_scale=0.0,      # No CFG for Turbo models
    generator=torch.Generator("cuda").manual_seed(42),
).images[0]

image.save("example.png")

Conversion Details

  • Converted using MLX {0.30.6} on Apple Silicon
  • Weights converted from bfloat16 to float16
  • SafeTensors format (MLX-compatible)
  • All weight keys preserved and verified
  • VAE kept at float16 across all quantization levels
  • Verified: no NaN/Inf values, all shapes consistent, all index files valid

Citation

bibtex
@article{z-image2025,
    title={Z-Image: An Efficient Image Generation Foundation Model with Scalable Single Stream Diffusion Transformer},
    author={Tongyi MAI Team},
    journal={arXiv preprint arXiv:2511.22699},
    year={2025}
}

@article{decoupled-dmd2025,
    title={Decoupled Consistency Model Distillation},
    author={Liu et al.},
    journal={arXiv preprint arXiv:2511.22677},
    year={2025}
}

@article{dmdr2025,
    title={DMDR: Fusing DMD with Reinforcement Learning},
    author={Jiang et al.},
    journal={arXiv preprint arXiv:2511.13649},
    year={2025}
}