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 1024x1024 \ # HxW (e.g. 1024x1024); a single number means square
--steps 8 \ # denoising steps (2-12)
--seed 42 \ # random seed
--num-images 2 \ # generate several; each is saved as soon as it finishes
--output out.png \ # output file (prefix for multiple: out_0.png, out_1.png, ...)
--backend metal # auto | metal | cpu
Size notes:
- Official Z-Image range is 512x512 .. 2048x2048 (any aspect ratio), both sides multiples of 16.
- The current released MNN model is exported for 1024x1024; other resolutions require a dynamic-shape model (in progress).
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.
Metadata
Release files for zimage-mnn 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zimage_mnn-0.1.4.tar.gz | 1.7 MB | Without provenance | Details for zimage_mnn-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zimage_mnn-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for zimage_mnn-0.1.4-py3-none-any.whl |
Total release size: 3.4 MB
Release files / zimage_mnn-0.1.4.tar.gz
| Download URL | zimage_mnn-0.1.4.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b643b22a32fd02d32cff93a09611e4ed15e094b7a9cbdf8b8cbf01ea268c2c5a
|
|
BLAKE2b-256 checksum How to use checksums |
db3496a0a277552cfefd3786306ae70db30c3fd516b9836a4148d528ce18b980
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / zimage_mnn-0.1.4-py3-none-any.whl
| Download URL | zimage_mnn-0.1.4-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9799c67419486993c428290d4fc0ffd141a7654b529aefd50fd990f84c26d595
|
|
BLAKE2b-256 checksum How to use checksums |
33def16c41d85b663cab17f42e54d6e908f56a0e22c5cda9a6c12d27b8d59e08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for zimage-mnn 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.