Instructions to use mlx-community/Z-Image-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Z-Image-bf16 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir Z-Image-bf16 mlx-community/Z-Image-bf16
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: mlx
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
license_link: https://huggingface.co/Tongyi-MAI/Z-Image/blob/main/LICENSE
|
| 5 |
+
pipeline_tag: text-to-image
|
| 6 |
+
base_model: Tongyi-MAI/Z-Image
|
| 7 |
+
language: [en, zh]
|
| 8 |
+
tags: [mlx, safetensors, apple-silicon, text-to-image, diffusion, s3-dit, z-image]
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# mlx-community/Z-Image-bf16
|
| 12 |
+
|
| 13 |
+
MLX (bf16) conversion of **[Tongyi-MAI/Z-Image](https://huggingface.co/Tongyi-MAI/Z-Image)** (Apache-2.0) for Apple
|
| 14 |
+
Silicon — a 6.15B single-stream **S3-DiT** text-to-image model (Qwen3-4B thinking-template
|
| 15 |
+
conditioning → single-stream DiT → FLUX.1-dev AE decode). **Base tier**: non-distilled ~28-step with CFG + negative prompts (scheduler shift 6.0) — the quality / LoRA-substrate tier.
|
| 16 |
+
|
| 17 |
+
Standard diffusers-tree snapshot (`transformer/ text_encoder/ vae/ tokenizer/ scheduler/`) with the
|
| 18 |
+
transformer stored at bf16. Loaded by the Swift/MLX port; int8/int4 are produced at load time
|
| 19 |
+
(correct resident footprint — a q4 pipeline ≈ 6 GB fits a 16 GB Mac).
|
| 20 |
+
|
| 21 |
+
## Parity (Swift port vs PyTorch goldens, fp32/CPU stream)
|
| 22 |
+
- Full 6.15B S3-DiT: cosine **≥0.9999999** (both aligned + padded token cases)
|
| 23 |
+
- FLUX.1-dev AE decode: **118 dB** · Qwen3-4B encoder: token ids **exact**, features cosine **1.0000000**
|
| 24 |
+
- Full pipeline e2e: **105–108 dB** (256²/CPU)
|
| 25 |
+
|
| 26 |
+
## Use (Swift / MLXEngine)
|
| 27 |
+
|
| 28 |
+
```swift
|
| 29 |
+
import MLXZImage
|
| 30 |
+
import MLXToolKit
|
| 31 |
+
let package = ZImageTurboT2IPackage(configuration: .turbo(quant: .int4, snapshotPath: "<this repo dir>"))
|
| 32 |
+
try await package.load()
|
| 33 |
+
let r = try await package.run(T2IRequest(prompt: "a lighthouse at dusk, photorealistic",
|
| 34 |
+
width: 1024, height: 1024, seed: 42)) as! T2IResponse
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
Code: https://github.com/xocialize/z-image-swift
|