[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-114988":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":15,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":13,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":31,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":14,"lastSyncTime":35,"discoverSource":36},114988,"h3-image-mlx","Anionex\u002Fh3-image-mlx","Anionex","Faster local MiniMax H3 Image generation and editing on Apple Silicon with MLX, with ultra-low ram","",null,"Python",93,11,2,1,0,19,56.64,"Apache License 2.0",false,"main",[23,24,25,26,27,28,29,30],"apple-silicon","diffusion-transformer","image-editing","local-inference","minimax-h3-image","mlx","quantization","text-to-image","2026-11-21 09:59:17","2026-11-22 20:03:34","\n\n![H3 Image MLX in liquid-glass lettering on a blue gradient](assets\u002Fhero.jpg)\n\n\u003Cp align=\"center\">\u003Cem>This banner was generated end to end with MiniMax H3 Image using \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FAnionex\u002Fh3-image-mlx\">H3 Image MLX\u003C\u002Fa>.\u003C\u002Fem>\u003C\u002Fp>\n\u003Cp align=\"center\">If you find this repository useful, feel free to 🌟 &amp; fork~\u003C\u002Fp>\n\n# H3 Image MLX\n**English** · [简体中文](README.zh-CN.md)\n\n[![Follow @anion_ex on X](https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?label=&message=%40anion_ex&color=171717&style=flat-square&logo=x&logoColor=white)](https:\u002F\u002Fx.com\u002Fanion_ex)\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fh3-image-mlx?include_prereleases&style=flat-square)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fh3-image-mlx\u002F)\n[![Requires Python 3.11 or newer](https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?label=Python&message=3.11%2B&color=3776AB&style=flat-square&logo=python&logoColor=white)](pyproject.toml)\n[![Package license: Apache-2.0 AND MIT](https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?label=License&message=Apache-2.0%20AND%20MIT&color=326790&style=flat-square)](pyproject.toml)\n\n\n\n\n\n[Quick start](#generate-your-first-image) · [Image editing](#edit-with-reference-images) · [How it works](#how-it-works) · [Benchmarks](#benchmark-results) · [Usage](docs\u002FUSAGE.md) · [Performance](docs\u002FPERFORMANCE.md)\n\nGenerate and edit images on an Apple Silicon Mac with MiniMax H3 Image. Optimized for fast inference, with 4K generation using around 7 GB of peak inference-process memory. Available through a CLI and Python API, ready to use out of the box.\n\n## Recent updates\n\n| Release | Intended hardware and mode | What changed | Measured hardware and median time |\n| --- | --- | --- | --- |\n| 0.1.0a9 | M1–M4 on macOS earlier than 26.4, portable INT8 | Tiled Metal projections speed up streamed INT8. | M4 Pro, 1024×1024: 250.55 → **101.56 s** (59.5% less time). |\n| 0.1.0a8 | M5 family, resident W8A8 | Resident inference overlaps weight loading with GPU work and uses wider W8A8 tiles. | M5 Pro, 1024×1024: 26.49 → **18.93 s** (28.5% less time). |\n| 0.1.0a7 | M1–M4, or M5 with `--backend portable`; macOS 26.4+ and a successful GPU integer TensorOps check | The portable backend uses INT8 TensorOps for larger matrix multiplications. | M5 Pro, 1024×1024: 141.84 → **41.13 s** (71.0% less time). |\n| 0.1.0a6 | M1–M4 with streamed INT8, or M5 with `--backend portable` and streamed INT8 | Streamed inference prefetches the next block while the GPU processes the current one. | M5 Pro, portable backend, 512×512: 124.28 → **56.40 s** (54.6% less time). |\n\nEach row compares two versions on the same machine with the same six-step sampler. [Test conditions and raw data](BENCHMARKS.md)\n\n## Highlights\n\n- **Native Apple Silicon inference.** Built on MLX to take advantage of your Mac's compute capabilities, H3 Image runs locally with text-to-image generation and multi-image editing.\n- **W8A8 quantization and Metal acceleration.** Quantized weights reduce memory use. On M1–M4 Macs running macOS earlier than 26.4, a9 automatically uses Metal to accelerate eligible large matrix multiplications. M5 and M6 use W8A8 Metal TensorOps by default.\n- **Staged inference with on-demand block loading.** Each stage runs in a separate process to release its memory on completion. Denoiser weights can be read one block at a time, greatly reducing peak memory usage and leaving more room for other apps.\n- **Overlap weight reads with GPU computation.** Prefetch the next block while evaluating the current one, keeping streaming memory low and reducing time spent waiting for weights. [Enable prefetch and async](#recommended-streaming-acceleration)\n\nIn our 1024×1024 same-machine test, streaming with both switches **matched resident-mode speed**: **23.61 s vs 23.63 s**, with the highest measured process peak falling from **21.18 GB to 3.23 GB — about 85% lower**. Outputs matched pixel for pixel. [Test conditions and results](#streaming-at-resident-speed)\n\n### Benchmark results\n\nOn an M4 Pro running macOS 26.3, a9 cut median 1024×1024 generation time by **59.5%** in streamed INT8 mode.\n\n| Version | Median generation time | Median peak process footprint |\n| --- | ---: | ---: |\n| 0.1.0a8 | 250.55 s | 2.44 GB |\n| 0.1.0a9 | **101.56 s** | **2.30 GB** |\n\n\u003Csub>Three runs per version, interleaved on the same machine. All six PNGs matched byte for byte. [Test conditions and raw data](BENCHMARKS.md#h3-streamed-int8-on-m4-pro)\u003C\u002Fsub>\n\nM5 Pro, resident INT8, 1024×1024: v0.1.0a8 reduced median generation time from **26.49 s to 18.93 s** (28.5%). Median peak process footprint increased from 21.08 GB to 21.67 GB. [Same-machine uncached results](BENCHMARKS.md#h3-native-w8a8-on-m5-pro).\n\n#### Streaming at resident speed\n\nM5 Pro 48 GB, version `0.1.0a3`, 1024×1024, identical weights, prompt and seed, original six-step sampler, no embedding cache.\n\n| Mode | Median generation time | Highest process peak |\n| --- | ---: | ---: |\n| Resident | 23.63 s | 21.18 GB |\n| Streaming | 32.33 s | 2.53 GB |\n| **Streaming + prefetch + async** | **23.61 s** | **3.23 GB** |\n\n\u003Csub>Resident and prefetch+async: five measured runs each; plain streaming: three. Warmups excluded. Memory is the highest kernel-recorded process physical footprint across measured runs, in decimal GB. [Full results and timing ranges](BENCHMARKS.md#streaming-prefetch-and-async) · [Source JSON](benchmarks\u002Fcontrolled\u002F2026-11-12-prefetch\u002Fsummary.json)\u003C\u002Fsub>\n\n#### Same-machine controlled comparison\n\nThe same M5 Pro MacBook (48 GB), weight files, teapot prompt, initial noise and six-step sigma grid. Each group has one warmup and three measured generations.\n\n| Resolution | MLX DiT mode | ComfyUI time (s) | MLX time (s) | Speed ratio | ComfyUI peak (GB) | MLX peak (GB) |\n| --- | --- | ---: | ---: | ---: | ---: | ---: |\n| 1024×1024 | `resident` | 87.15 | 19.90 | **4.38×** | 31.29 | 21.16 |\n| 1024×1024 | `stream` | 87.15 | **28.82** | **3.02×** | 31.29 | **2.53** |\n| 2048×2048 | `resident` | 134.17 | 57.43 | **2.34×** | 38.21 | 22.27 |\n| 2048×2048 | `stream` | 134.17 | **67.06** | **2.00×** | 38.21 | **3.48** |\n| 4096×4096 | `stream` | 570.59 | **317.29** | **1.80×** | 42.31 | **7.18** |\n\n\u003Csub>Time is the median complete generation request. Memory is the kernel-recorded single-process physical-footprint peak, including warmup, in decimal GB. Speed ratio = local ComfyUI time ÷ MLX time.\u003C\u002Fsub>\n\nThis compares complete pipelines: ComfyUI's default text encoder runs on CPU; MLX uses GPU. The main table reproduces the community configuration. The additional native INT8 DiT path, pinned versions and measurement method are in the [full benchmark records](BENCHMARKS.md#controlled-test-setup), with [source JSON](benchmarks\u002Fcontrolled\u002F2026-11-11\u002Fsummary.json) in this repository.\n\n#### Supplementary community measurements\n\n| Device \u002F memory | Pipeline | DiT mode | Resolution | Time (s) | Process peak (GB) | Source |\n| --- | --- | --- | --- | ---: | ---: | --- |\n| \u003Csub>M5 MacBook Air \u002F 16 GB\u003C\u002Fsub> | H3 Image MLX | `stream` | 1024×1024 | **70.51** | **2.48** | [arielfikru](benchmarks\u002Fraw\u002Fteapot-1024-m5-air-16gb.json) |\n| \u003Csub>M5 MacBook Air \u002F 16 GB\u003C\u002Fsub> | H3 Image MLX | `stream` | 2048×2048 | **240.78** | **2.78** | [arielfikru](benchmarks\u002Fraw\u002Fteapot-2048-m5-air-16gb.json) |\n| \u003Csub>M5 Pro Mac mini \u002F 64 GB\u003C\u002Fsub> | ComfyUI + MPS INT8 | — | 1024×1024 | 89.55 | 31.42 | [pratikgx](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fpratikgx\u002Fminimax-h3-image-m5-pro-mac-mini-bench) |\n| \u003Csub>M5 Pro Mac mini \u002F 64 GB\u003C\u002Fsub> | ComfyUI + MPS INT8 | — | 2048×2048 | 164.90 | 36.21 | [pratikgx](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fpratikgx\u002Fminimax-h3-image-m5-pro-mac-mini-bench) |\n| \u003Csub>M5 Pro Mac mini \u002F 64 GB\u003C\u002Fsub> | ComfyUI + MPS INT8 | — | 4096×4096 | 547.31 | 48.78 | [pratikgx](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fpratikgx\u002Fminimax-h3-image-m5-pro-mac-mini-bench) |\n\n\u003Csub>Independent measurements on different machines, retaining contributors' original results. Run counts and measurement methods are in the [full records](BENCHMARKS.md#supplementary-earlier-and-community-results), alongside the earlier M5 Pro runs.\u003C\u002Fsub>\n\n### Generation gallery\n\n[![Six H3 Image MLX examples: a feast, a fox in flight, a celadon tea set, a woodland chapel, a watercolor illustration and a rainy-night watchmaker.](assets\u002Fgeneration-gallery.jpg)](assets\u002Fgeneration-gallery.jpg)\n\nGenerated locally with H3 Image MLX: food, wildlife, product photography, architecture, illustration and a 4K watchmaker portrait. Click the collage to view it at full size.\n\n## Generate your first image\n\nVersion `0.1.0a4` also supports **unquantized BF16 DiT and text-encoder weights**, retaining AdaLN pruning and staged streaming. Select `--precision bf16`; INT8 remains the default. [BF16 download and usage](docs\u002FUSAGE.md#bf16-weights)\n\nUse Python 3.11 or later on a Mac with Metal. Allow 49.30 GB of disk space for a fresh model download. Check the [MiniMax model license](https:\u002F\u002Fhuggingface.co\u002FMiniMaxAI\u002FMiniMax-H3-Image\u002Fblob\u002Fmain\u002FLICENSE) for regional and usage restrictions.\n\n```bash\npython3 -m venv .venv\nsource .venv\u002Fbin\u002Factivate\npython -m pip install 'h3-image-mlx==0.1.0a9'\n\nh3-image-mlx fetch --models .\u002Fmodels\nh3-image-mlx generate --models .\u002Fmodels --output teapot.png \\\n  --prompt 'A yellow enamel teapot and a white cup on a blue wooden table.'\n```\n\nThis writes a 1024×1024 RGB PNG. Set `--width` and `--height` to change the size. Each dimension accepts multiples of 32 from 256 through 4096.\n\n## Recommended streaming acceleration\n\n**Use weight prefetch and asynchronous evaluation together with `--dit-mode stream` to reduce weight-loading waits. Streamed INT8 on the portable backend enables both by default. The W8A8 TensorOps backend uses the explicit switches below.** The six-step sampler stays unchanged. Our 1024×1024 test matched resident-mode speed with about 85% less peak process memory. [Same-machine results](#streaming-at-resident-speed) · [Contributor measurements](docs\u002FPERFORMANCE.md#reported-results)\n\nAvailable from `0.1.0a2`; upgrade and enable both switches for this command:\n\n```bash\npython -m pip install --upgrade 'h3-image-mlx==0.1.0a9'\nH3_ASYNC=1 H3_PREFETCH=1 h3-image-mlx generate \\\n  --models .\u002Fmodels --dit-mode stream --output teapot.png \\\n  --prompt 'A yellow enamel teapot and a white cup on a blue wooden table.'\n```\n\n[Usage guide: CLI, Python and existing weights](docs\u002FUSAGE.md) · [Performance guide: switches, caching and profiling](docs\u002FPERFORMANCE.md)\n\n**Experimental:** optional two-\u002Fthree-step LoRA inference and LoRA-merged INT8 checkpoints are available on GitHub `main`, off by default. [Usage and quality trade-offs](docs\u002FPERFORMANCE.md#experimental-few-step-lora)\n\n## Edit with reference images\n\nTo replace the cup in `teapot.png` with a bird from your own photo, save the photo as `bird.png`. Number the pictures in your prompt in the order you pass them on the command line.\n\n```bash\nh3-image-mlx generate --models .\u002Fmodels --output edit.png \\\n  --reference teapot.png --reference bird.png \\\n  --prompt 'Edit \u003CPicture 1>. Replace the white cup with the bird from \u003CPicture 2>. Keep the teapot and table.'\n```\n\nYou can pass up to 16 references. On an M5 Pro, we completed one- and two-reference edits. The 16-reference test reached the third of six denoising steps before cancellation. [Validation notes](VALIDATION.md)\n\n## How it works\n\nThe pipeline reduces memory use at three levels: between model stages, within the denoiser, and during image decoding.\n\n![H3 Image MLX pipeline: encode the prompt, stream denoiser weights, then decode overlapping image tiles. Each stage releases its model memory before the next starts.](assets\u002Fhow-it-works.jpg)\n\n- **Run one stage at a time.** Text encoding, denoising and VAE decoding run in separate processes. Each saves its intermediate output and exits before the next loads its weights, so the three models do not need to stay in memory together. Editing adds a reference-image VAE encoding stage before denoising.\n- **Keep quantized projections compact.** The runtime reads Comfy-Org's INT8 ConvRot weights directly. Activations are rotated and dynamically quantized to INT8 before quantized linear projections. The portable backend uses a Metal SIMD kernel for small aligned projections and probes for direct INT8 TensorOps on macOS 26.4 or later for longer sequences. Other shapes and devices use tiled MLX operations. Other operations retain their appropriate floating-point precision.\n- **Load denoiser weights as needed.** In `stream` mode, tensors are read from safetensors as each transformer block runs, rather than cached for all six steps. Denoising still operates on the full image's latent sequence. `resident` mode caches weights to reduce repeated reads. The runtime also precomputes the steps' AdaLN modulation values from the compressed curves in Comfy-Org's pruned checkpoint, then releases the setup weights.\n- **Decode in overlapping tiles.** The VAE decodes small groups of latent tiles and blends their overlapping edges into the output image, limiting decoder working memory at high resolutions.\n\nStreaming keeps memory low by reading weights on demand. Prefetch and asynchronous evaluation overlap these reads with GPU work to reduce the time cost. Peak usage still includes activations, attention buffers and image buffers, so resolution and reference-image count matter. See the [benchmark results](#benchmark-results) for the measured trade-off.\n\n## Hardware and memory\n\nM5\u002FM6 select W8A8 Metal TensorOps by default; M1–M4 use the portable MLX backend. Use `--dit-mode stream` for lower memory usage or `--dit-mode resident` to retain denoiser weights between steps. [Hardware validation and automatic mode selection](docs\u002FPERFORMANCE.md#hardware-and-memory)\n\n## Documentation\n\n| Document | Contents |\n| --- | --- |\n| [Usage guide](docs\u002FUSAGE.md) | CLI parameters, reference editing, Python API and existing weights |\n| [Performance guide](docs\u002FPERFORMANCE.md) | Recommended streaming switches, hardware modes, embedding cache and profiling |\n| [Benchmarks](BENCHMARKS.md) | Measurements, environments and source JSON |\n| [Validation notes](VALIDATION.md) | Completed checks and remaining hardware coverage |\n\n## Credits and licenses\n\nMiniMax developed [H3 Image](https:\u002F\u002Fhuggingface.co\u002FMiniMaxAI\u002FMiniMax-H3-Image) and supplies the [VAE configuration](https:\u002F\u002Fhuggingface.co\u002FMiniMaxAI\u002FMiniMax-H3-Image\u002Fblob\u002F492fd8c4eca666f1085f57e30738c1e0d86b3439\u002Fvae\u002Fconfig.json). [Comfy-Org](https:\u002F\u002Fhuggingface.co\u002FComfy-Org\u002FMiniMax-H3-Image) provides the quantized weights. The three W8A8 Metal kernel files come from [mlx-serve](https:\u002F\u002Fgithub.com\u002Fddalcu\u002Fmlx-serve\u002Ftree\u002F9191fbdf697df333cac19ec7a93eaa1098ce3ad5\u002Fsrc\u002Fkernels) and retain their [MIT license](src\u002Fh3_image_mlx\u002Fkernels\u002FLICENSE). This project’s runtime code uses [Apache-2.0](LICENSE).\n\n## About\n\nI'm [anionex](https:\u002F\u002Fanionex.me\u002F), an AI-native developer who once ranked No. 3 on GitHub's global developer trending list, with more than 18.7k stars across my projects. If you would like to follow my future work, [follow me on X](https:\u002F\u002Fx.com\u002Fanion_ex) or [GitHub](https:\u002F\u002Fgithub.com\u002FAnionex).\n","这是一个专为苹果M系列芯片优化的本地图像生成与编辑工具，基于MiniMax H3 Image模型和MLX框架实现轻量高效推理。核心功能包括文本到图像生成、多参考图联合编辑，支持W8A8\u002FINT8量化与Metal加速，在M4 Pro上1024×1024生成仅需约19秒，峰值内存占用低至7GB。适用于Mac用户在无网络、低资源约束下进行离线AI绘图、原型设计或快速视觉内容迭代。","2026-11-24 04:49:59","CREATED_QUERY"]