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 tests/test_benchmark.py from devin-lai/MiniMax-H3-Image-mlx: direct link, hf CLI and curl.
- Browser
- Download file 1.9 kB
-
https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/refs%2Fpr%2F1/tests/test_benchmark.py
- Command line
-
hf download hf://devin-lai/MiniMax-H3-Image-mlx@refs/pr/1/tests/test_benchmark.py
-
curl -L -o test_benchmark.py https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/refs%2Fpr%2F1/tests/test_benchmark.py
1.9 kB
| import json | |
| from types import SimpleNamespace | |
| import mlx.core as mx | |
| from h3_mlx import benchmark, runtime | |
| def test_summary_excludes_warmup_and_retains_every_resident_sample( | |
| tmp_path, monkeypatch | |
| ): | |
| calls = [] | |
| cleared = [] | |
| class FakePipeline: | |
| def __init__(self, *args, **kwargs): | |
| assert kwargs["kernel"] == "metal-qk-exact" | |
| assert kwargs["tune_matmul"] is True | |
| def generate(self, prompt, **kwargs): | |
| calls.append(kwargs) | |
| return None, { | |
| "png_sha256": "a" * 64, | |
| "conditioning_cache_hit": len(calls) > 1, | |
| "dit_was_resident": len(calls) > 1, | |
| } | |
| def clear(self): | |
| cleared.append(True) | |
| clock = iter([0.0, 50.0, 50.0, 55.0, 55.0, 62.0]) | |
| monkeypatch.setattr( | |
| benchmark, "time", SimpleNamespace(perf_counter=lambda: next(clock)) | |
| ) | |
| monkeypatch.setattr(runtime, "Pipeline", FakePipeline) | |
| monkeypatch.setattr(runtime, "environment", lambda: {"machine": "test"}) | |
| monkeypatch.setattr(mx, "synchronize", lambda: None) | |
| output = tmp_path / "run" | |
| benchmark.main( | |
| [ | |
| "--model", | |
| "model", | |
| "--text-encoder", | |
| "encoder", | |
| "--prompt", | |
| "test", | |
| "--warmup", | |
| "1", | |
| "--repeats", | |
| "2", | |
| "--output", | |
| str(output), | |
| ] | |
| ) | |
| summary = json.loads((output / "summary.json").read_text()) | |
| assert summary["median_seconds"] == 6.0 | |
| assert [s["wall_seconds"] for s in summary["samples"]] == [50.0, 5.0, 7.0] | |
| assert [s["phase"] for s in summary["samples"]] == [ | |
| "warmup", | |
| "measured", | |
| "measured", | |
| ] | |
| assert all(s["dit_was_resident"] for s in summary["samples"][1:]) | |
| assert all(c["save_trace"] for c in calls) | |
| assert cleared == [True] | |