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_runtime_guard.py from devin-lai/MiniMax-H3-Image-mlx: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/refs%2Fpr%2F1/tests/test_runtime_guard.py
- Command line
-
hf download hf://devin-lai/MiniMax-H3-Image-mlx@refs/pr/1/tests/test_runtime_guard.py
-
curl -L -o test_runtime_guard.py https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/refs%2Fpr%2F1/tests/test_runtime_guard.py
1.84 kB
| import json | |
| from types import SimpleNamespace | |
| import mlx.core as mx | |
| import pytest | |
| from h3_mlx.config import SIGMAS | |
| from h3_mlx.runtime import Pipeline | |
| def test_path_cache_arguments_can_be_saved_in_inference_json(tmp_path): | |
| pipe = Pipeline(tmp_path, tmp_path, cache_dir=tmp_path / "cache") | |
| record = {"dit": pipe.dit_options, "encoder": pipe.encoder_options} | |
| saved = json.loads(json.dumps(record)) | |
| assert saved["dit"]["cache_dir"] == str(tmp_path / "cache") | |
| assert saved["encoder"]["cache_dir"] == str(tmp_path / "cache") | |
| def test_nonfinite_prediction_is_rejected_before_image_write(tmp_path, monkeypatch): | |
| from h3_mlx import encoder | |
| class FakeEncoder: | |
| def __init__(self, *args, **kwargs): | |
| self.cache_hit = True | |
| self.store = SimpleNamespace(clear=lambda: None) | |
| def encode(self, *args, **kwargs): | |
| return mx.zeros((1, 5120), mx.bfloat16), mx.ones(1, mx.int32) | |
| class BadModel: | |
| bits = None | |
| group_size = 64 | |
| block_limit = 0 | |
| store = SimpleNamespace(fingerprint=lambda: "test") | |
| metrics = {} | |
| refiner_cache_hit = False | |
| def prepare_modulation(self, *args, **kwargs): | |
| pass | |
| def refine(self, x): | |
| return x | |
| def predict(self, rows, *args, **kwargs): | |
| return mx.full(rows.shape, float("nan")) | |
| monkeypatch.setattr(encoder, "TextEncoder", FakeEncoder) | |
| (tmp_path / "pdd_config.json").write_text(json.dumps({"sigmas": SIGMAS})) | |
| pipe = Pipeline(tmp_path, tmp_path) | |
| pipe.model = BadModel() | |
| output = tmp_path / "invalid.png" | |
| with pytest.raises(FloatingPointError, match="original head 0"): | |
| pipe.generate( | |
| "test", width=32, height=32, min_area=1024, rng="mlx", output=output | |
| ) | |
| assert not output.exists() | |