Ming-Image-0.2-Design (MLX)

An unofficial native MLX port of inclusionAI/Ming-Image-0.2-Design for Apple silicon. It covers text-to-image only. Inference is pure MLX: no PyTorch, transformers or diffusers are needed.

All credit for the model goes to inclusionAI. This repository contains converted weights and an independent MLX implementation of the inference path (ming_mlx/). It is not affiliated with or endorsed by inclusionAI.

sample

What's in this repo

component precision notes
BailingMoeV2 text encoder (16B total / 0.8B active MoE) 8-bit (affine, group 64) attention, MLPs and all 256 routed experts; routers, norms and embeddings stay BF16
connector (Qwen2, 1.5B), projections, query tokens BF16
diffusion transformer (6B) BF16 8-bit/4-bit DiT gave no speed-up and hurt quality
Qwen-Image VAE decoder (RGBA) BF16 the 3D causal convs are collapsed exactly to 2D for single frames

The vision tower, the LM head and the VAE encoder are not needed for text-to-image and are not included. Total download is about 30 GB.

Quickstart (macOS, Apple silicon; ≥ 32 GB unified memory for 1024², ≥ 48 GB recommended for 2048²)

pip install -U huggingface_hub   # provides the `hf` CLI
hf download amarck/Ming-Image-0.2-Design-MLX --local-dir Ming-Image-0.2-Design-MLX
cd Ming-Image-0.2-Design-MLX
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python -m ming_mlx.generate --model . --resolution 1024 \
  --prompt 'A red fox reading a book titled "MLX" in a cozy library, warm light' \
  --output-dir outputs --timings

Output is an RGBA PNG. Options:

flag values
--resolution 1024 or 2048; the default is 2048, matching upstream
--steps default 12
--seed default 42
--prompts-file one prompt per line; prompts are encoded first, then the text encoder is freed, so peak memory stays the same as for one image (no reloads)
--no-compile turn off mx.compile

Seeds follow torch.manual_seed semantics and reproduce upstream's PyTorch initial noise, so the same seed gives the same starting point as the CUDA reference. Images are written as image_00.png, image_01.png, …, which overwrites earlier runs in the same --output-dir. Requires Python ≥ 3.10.

Performance (MacBook Pro M5 Max, 128 GB, 12 steps)

upstream PyTorch on MPS (BF16) this repo
s/step at 1024² (short / long / cabin prompt) 1.84 / 2.11 / 2.90 1.31 / 1.37 / 1.88
time per 1024² image (incl. load, encode, decode) 27–37 s 17–24 s
s/step at 2048² 12.6 8.2 (interleaved runs with cooldowns; sustained runs are thermally limited)
memory 65 GiB (1024²), 121 GiB (2048²)¹ **≈ 19 GiB (1024²), 24 GiB (2048²)**²

¹ torch.mps.driver_allocated_memory(), which includes PyTorch's allocator cache. ² mx.get_peak_memory(). The two metrics are not strictly like-for-like.

Speed-ups over a straight port (together about 14% at 1024² and 9% at 2048², measured as interleaved A/B runs):

  • a fused Metal kernel for per-head RMSNorm + 3-axis RoPE
  • the zero-masked alignment padding is dropped instead of masked (exact)
  • mx.compile
  • the text encoder is released after encoding

Fidelity

The port was validated component by component against the upstream PyTorch implementation (CUDA A100 BF16, MPS BF16 and an FP32 reference), feeding each component identical inputs:

  • Exact: token ids, the 3D RoPE position ids, the scheduler, and the seeded noise (|Δ| < 5e-7 vs CUDA).
  • Close:
    • the VAE decoder (50–55 dB PSNR)
    • step-0 DiT velocity (cos ≥ 0.9996 vs CUDA)
    • the connector (cos ≥ 0.99999)
  • Matches FP32: with BF16 removed, the MLX DiT+VAE matches PyTorch FP32 to 38–51 dB over the full 12 steps.
  • Text encoder vs FP32: the shipped 8-bit encoder's final-layer features match FP32 at cosine 0.985–0.995 across the three test prompts (BF16 MLX: 0.988). For comparison, upstream's own BF16 run on CUDA scores 0.897 on the same check.

Individual 12-step BF16 images from any backend (CUDA, MPS, MLX) differ in fine detail. The trajectory is chaotic, so even an exact FP32 run is only 22–25 dB from a CUDA BF16 image. Composition, layout and rendered text agree; see the comparison below (FP32 reference / CUDA BF16 / MPS BF16 / MLX BF16 / this repo).

comparison

Text rendering (OCR exact-match, Apple Vision, 18 target strings over 3 prompts, seed 42): this repo matches the BF16 MLX model at both resolutions (94.4% at 1024², 100% at 2048²). 4-bit variants were rejected because they garble copy. This is a single-seed check, so treat it as a regression canary rather than a benchmark. Separately, on the BF16 weights, the speed optimizations gave OCR results identical to the unoptimized path on every seed tested (8 at 1024², 4 at 2048²).

Limitations

  • Text-to-image only: no image editing or layer decomposition. Square 1024² or 2048² only. CFG 1.0 (the upstream default) only.
  • The learned query tokens in the text encoder are routed on exact score ties in some MoE layers, so their routing can legitimately differ from PyTorch's. The features the DiT consumes still match FP32 to cos ≥ 0.9997.
  • Tested on macOS 26 with MLX 0.32.5 on an M5 Max. Other Apple-silicon chips should work but are untested.

Converting yourself

ming_mlx/convert.py and ming_mlx/quantize.py reproduce this checkpoint from the original weights:

python -m ming_mlx.convert  --src Ming-Image-0.2-Design --dst weights_mlx
python -m ming_mlx.quantize --src weights_mlx --dst weights_mlx_llm8 --llm-bits 8

License

MIT, the same as the original model (LICENSE, © 2026 inclusionAI). The connector and VAE are derived from Qwen2-1.5B and the Qwen-Image VAE (both Apache-2.0) as packaged in the upstream checkpoint. SHA256SUMS covers every file in this repo.

Downloads last month
270
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for amarck/Ming-Image-0.2-Design-MLX

Quantized
(11)
this model