Text-to-Image
MLX
MiniMax H3
Safetensors
English
apple-silicon
macos
image-to-image
image-editing
image-generation
Instructions to use devin-lai/MiniMax-H3-Image-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use devin-lai/MiniMax-H3-Image-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download devin-lai/MiniMax-H3-Image-mlx --local-dir MiniMax-H3-Image-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Download experiments/gallery_r3.py from devin-lai/MiniMax-H3-Image-mlx: direct link, hf CLI and curl.
- Browser
- Download file 5.07 kB
-
https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/main/experiments/gallery_r3.py
- Command line
-
hf download hf://devin-lai/MiniMax-H3-Image-mlx/experiments/gallery_r3.py
-
curl -L -o gallery_r3.py https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/main/experiments/gallery_r3.py
5.07 kB
| """Assemble actual pipeline outputs without fabricated comparison imagery.""" | |
| import hashlib | |
| import html | |
| import json | |
| from pathlib import Path | |
| from PIL import Image, ImageDraw, ImageFont | |
| def main(): | |
| root = Path("comparisons/optimization-r3") | |
| root.mkdir(parents=True, exist_ok=True) | |
| cases = ["product", "portrait", "holdout-detail", "edit"] | |
| groups = [ | |
| ("Exact Q/K fusion + FC2 tuning", "optimization-r3-qk", "qk-fc2-native-norm"), | |
| ( | |
| "Lossless packed weights + exact tuning", | |
| "optimization-r3-compact", | |
| "qk-fc2-native-norm", | |
| ), | |
| ( | |
| "Full-width fusion: exact pixels, memory tradeoff", | |
| "optimization-r3-deployment", | |
| "qk-fc2", | |
| ), | |
| ] | |
| parts = [ | |
| '<!doctype html><meta charset="utf-8"><title>MiniMax H3: measured comparisons</title><style>body{font:16px system-ui;background:#10151d;color:#e9eff7;margin:24px auto;max-width:1100px;padding:0 18px}a{color:#78d9e8}img{display:block;width:100%;height:auto;margin:8px 0 20px}section{margin:42px 0}p{line-height:1.5}.case{margin-top:28px}</style>', | |
| "<h1>MiniMax H3: measured image comparisons</h1><p>Actual saved model outputs, matched prompts, seeds, canvas and reference inputs. Each linked gallery includes native-resolution crops, vertical stacks, and RGB differences amplified eight times.</p><p>Exact means no additional change relative to the MLX BF16 recipe on these cases. FP32-decoder and CUDA comparisons are linked separately below.</p>", | |
| ] | |
| records = [] | |
| font = ImageFont.truetype("/System/Library/Fonts/Supplemental/Arial.ttf", 21) | |
| for title, folder, variant in groups: | |
| paths = [Path("comparisons") / folder / case / variant for case in cases] | |
| if not all( | |
| (p / "metrics.json").exists() and (p / "grid.png").exists() for p in paths | |
| ): | |
| raise FileNotFoundError(f"Incomplete final gallery: {folder}") | |
| parts.append(f"<section><h2>{html.escape(title)}</h2>") | |
| images = [] | |
| for case, path in zip(cases, paths, strict=True): | |
| rel = Path("..") / folder / case / variant | |
| metrics = json.loads((path / "metrics.json").read_text()) | |
| records.append( | |
| { | |
| "group": title, | |
| "case": case, | |
| "gallery": str(path / "index.html"), | |
| "metrics_sha256": hashlib.sha256( | |
| (path / "metrics.json").read_bytes() | |
| ).hexdigest(), | |
| "grid_sha256": hashlib.sha256( | |
| (path / "grid.png").read_bytes() | |
| ).hexdigest(), | |
| "pixel_identical": all( | |
| r["pixel_identical"] for r in metrics["rows"] | |
| ), | |
| } | |
| ) | |
| parts.append( | |
| f'<h3 class="case">{html.escape(case)}</h3><a href="{rel}/index.html">Full gallery, detail crops and 8× difference</a><a href="{rel}/stack.png"> · vertical stack</a><img loading="lazy" src="{rel}/grid.png" alt="Matched {html.escape(case)} control and candidate images">' | |
| ) | |
| images.append((case, Image.open(path / "grid.png").convert("RGB"))) | |
| width = max(im.width for _, im in images) | |
| canvas = Image.new( | |
| "RGB", (width, sum(im.height + 38 for _, im in images)), (16, 21, 29) | |
| ) | |
| draw = ImageDraw.Draw(canvas) | |
| y = 0 | |
| for case, im in images: | |
| draw.text((12, y + 6), case, font=font, fill="white") | |
| canvas.paste(im, (0, y + 38)) | |
| y += im.height + 38 | |
| stack = root / f"{folder}-all-cases.png" | |
| canvas.save(stack) | |
| parts.append( | |
| f'<p><a href="{stack.name}">Download the four-case comparison stack</a></p></section>' | |
| ) | |
| parts.append( | |
| '<section><h2>Earlier precision-loss examples</h2><p>These are earlier experiments, retained to show actual quality differences. Their timings are not pooled with this campaign.</p><ul><li><a href="../optimization-v2/product/index.html">Quantization, differing fusions and fewer-head product examples</a></li><li><a href="../optimization-v2/portrait/index.html">Portrait precision comparisons</a></li><li><a href="../optimization-v2/decoder-all-product/comparison/index.html">Core ML CPU / GPU / ANE / ALL on the same latent</a></li><li><a href="../optimization-v2/fp32-reference/comparison/index.html">BF16 versus FP32 decoder, same latent</a></li><li><a href="../product-cuda/index.html">Cross-backend CUDA reference; separate quality/settings scope</a></li></ul></section>' | |
| ) | |
| (root / "index.html").write_text("\n".join(parts)) | |
| (root / "gallery.json").write_text(json.dumps(records, indent=2) + "\n") | |
| if not all(r["pixel_identical"] for r in records): | |
| raise ValueError("An advertised exact gallery changes pixels") | |
| print(f"Wrote {len(records)} audited image comparisons and three four-case stacks") | |
| if __name__ == "__main__": | |
| main() | |