Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zimage_mnn-0.1.4.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zimage_mnn-0.1.4-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file zimage_mnn-0.1.4.tar.gz.

File metadata

  • Download URL: zimage_mnn-0.1.4.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

Hashes for zimage_mnn-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b643b22a32fd02d32cff93a09611e4ed15e094b7a9cbdf8b8cbf01ea268c2c5a
MD5 e0c0846a8d6e261c5dff2093c70f224c
BLAKE2b-256 db3496a0a277552cfefd3786306ae70db30c3fd516b9836a4148d528ce18b980

See more details on using hashes here.

File details

Details for the file zimage_mnn-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: zimage_mnn-0.1.4-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

Hashes for zimage_mnn-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9799c67419486993c428290d4fc0ffd141a7654b529aefd50fd990f84c26d595
MD5 9b41c3cbb39314fbcf642c1d5b5c97cd
BLAKE2b-256 33def16c41d85b663cab17f42e54d6e908f56a0e22c5cda9a6c12d27b8d59e08

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 files

0.1.3

1 file

0.1.2

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page