zimage-mnn
Run Z-Image-Turbo text-to-image locally with MNN — optimized for Apple Silicon (Metal) with a CPU fallback.
The 12.3B-parameter DiT is quantized to int8 weights and runs the full pipeline (text encoder → 8-step denoiser → VAE) entirely on-device. No cloud calls.
Install & run (one line)
uvx zimage-mnn "a cute cat sitting on a windowsill"
Models (~11 GB) download automatically on first run and are cached in ~/.cache/zimage_mnn.
CLI usage
# basic
uvx zimage-mnn "a red sports car on a coastal highway"
# options
uvx zimage-mnn "a panda eating bamboo" \
--size 1024 \ # resolution (multiple of 16; model tuned for 1024)
--steps 8 \ # denoising steps (2-12)
--seed 42 \ # random seed
--num-images 2 \ # generate several (seed increments)
--output out.png \ # output file / prefix
--backend metal # auto | metal | cpu
HTTP API
uvx zimage-mnn --api --port 8000
curl -X POST http://127.0.0.1:8000/generate \
-H "Content-Type: application/json" \
-d '{"prompt":"a cute cat","size":1024,"steps":8,"seed":42}' \
-o cat.png
GET /health returns {"status":"ok"}.
Python API
from zimage_mnn import ZImageMNNPipeline
pipe = ZImageMNNPipeline.from_pretrained() # downloads models
image = pipe("a cute cat", size=1024, steps=8, seed=42)
image.save("cat.png")
images = pipe.generate("a dog", num_images=3, seed=7)
Performance (Apple M5 Pro, 1024×1024, 8 steps)
| Backend | per step | end-to-end |
|---|---|---|
| Metal (fp32, int8 weights) | ~13 s | ~2 min |
| CPU (int8, 12 threads) | ~27 s | ~4 min |
Quality matches the original PyTorch pipeline (single-step cosine ≈ 0.9996).
Requirements
- Python ≥ 3.9
- macOS with Apple Silicon recommended (Metal). CPU works anywhere but is slower.
- ~16 GB RAM recommended; ~11 GB disk for the models.
License
Apache-2.0. Model weights derive from Tongyi-MAI/Z-Image-Turbo — see its license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zimage_mnn-0.1.2.tar.gz.
File metadata
- Download URL: zimage_mnn-0.1.2.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2745ca154946d5935cafeb3db286816c545fb94cba3ec610ab2ff7cbd45d2654
|
|
| MD5 |
5e259cf7e6d08aca104b2e20c59b0f69
|
|
| BLAKE2b-256 |
46e93bb43a40fc4adefb1747b30c4b3d8c43593af5c41bdfee0d80e50c0040ee
|
File details
Details for the file zimage_mnn-0.1.2-py3-none-any.whl.
File metadata
- Download URL: zimage_mnn-0.1.2-py3-none-any.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e90bc056fc5a6b1c695211ceecf8379434653c25d209d2251846b9c1f69954
|
|
| MD5 |
0954aa8c47676405a84eb31a9ed216e9
|
|
| BLAKE2b-256 |
f56a98ea664fd8a0f21195f0c4d18de7a349928981bbe4dcc6b225d1f9815c12
|