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 h3_mlx/config.py from devin-lai/MiniMax-H3-Image-mlx: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/main/h3_mlx/config.py
- Command line
-
hf download hf://devin-lai/MiniMax-H3-Image-mlx/h3_mlx/config.py
-
curl -L -o config.py https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/main/h3_mlx/config.py
2.08 kB
| from __future__ import annotations | |
| import json | |
| import math | |
| from dataclasses import dataclass, fields | |
| from pathlib import Path | |
| SIGMAS = ( | |
| 1.0, | |
| 0.9675236940383911, | |
| 0.8875485062599182, | |
| 0.75, | |
| 0.5327739119529724, | |
| 0.23200887441635132, | |
| 0.0, | |
| ) | |
| class DiTConfig: | |
| hidden_size: int = 5376 | |
| num_layers: int = 50 | |
| token_refiner_num_layers: int = 2 | |
| num_attention_heads: int = 56 | |
| attention_head_dim: int = 128 | |
| ffn_hidden_size: int = 14336 | |
| latents_dim: int = 24 | |
| text_dim: int = 5120 | |
| timestep_input_dim: int = 256 | |
| time_embed_dim: int = 2688 | |
| norm_eps: float = 1e-5 | |
| qk_norm_eps: float = 1e-5 | |
| final_norm_eps: float = 1e-5 | |
| def load(cls, path): | |
| data = json.loads(Path(path).read_text()) | |
| if data.get("audio_enabled", False): | |
| raise ValueError("Use the audio-free MiniMax-H3-Image checkpoint") | |
| if tuple(data.get("patch_size", (1, 2, 2))) != (1, 2, 2): | |
| raise ValueError("This image runtime requires patch_size [1,2,2]") | |
| return cls(**{f.name: data[f.name] for f in fields(cls) if f.name in data}) | |
| def canvas_size(width: int, height: int, min_area: int = 4194304): | |
| if isinstance(width, bool) or isinstance(height, bool) or width < 32 or height < 32: | |
| raise ValueError("width and height must be at least 32") | |
| if not 1024 <= min_area <= 16777216: | |
| raise ValueError("min_generation_area must be between 1024 and 16777216") | |
| scale = max(1.0, math.sqrt(min_area / (width * height))) | |
| return tuple(max(32, round(d * scale / 32) * 32) for d in (width, height)) | |
| def load_sigmas(model_path): | |
| data = json.loads((Path(model_path) / "pdd_config.json").read_text()) | |
| sigmas = tuple(float(x) for x in data["sigmas"]) | |
| if len(sigmas) != 7 or sigmas[0] != 1 or sigmas[-1] != 0: | |
| raise ValueError("Expected the native six-step PDD schedule") | |
| if any(a <= b for a, b in zip(sigmas, sigmas[1:], strict=False)): | |
| raise ValueError("PDD sigmas must be strictly decreasing") | |
| return sigmas | |