Views
No views yet
Ported by Mrbizarro · MIT licensed · published to mlx-community
mlx-vlm's Qwen3-VL backbone (vision tower, decoder layers, mrope-3D)t_embedder1, x_embedder, final_layer2)FlashFlowMatchEulerDiscreteScheduler and the unified-token-sequence buildersample_outputs/hero/.| Variant | Repo | Backbone size | RAM (1024) | Quality |
|---|---|---|---|---|
| BF16 (this repo) | mlx-community/HiDream-O1-Image-Dev-mlx-bf16 | 17.5 GB | 16 GB | ✅ Clean across all trained dims |
| Q8 | mlx-community/HiDream-O1-Image-Dev-mlx-q8 | 10 GB | 11.5 GB | ⚠ Clean at square dims, grid at non-square |
| Q6 | mlx-community/HiDream-O1-Image-Dev-mlx-q6 | 8 GB | 8.5 GB | ⚠ Clean at square dims, grid at non-square |
torch_dtype=torch.float32 + autocast(bfloat16) precision and is the only quant clean across all trained dimensions.1# Clone the repo (code, docs, samples)
2hf download mlx-community/HiDream-O1-Image-Dev-mlx-bf16 --local-dir hidream-o1-mlx
3cd hidream-o1-mlx
4
5# Set up the venv
6uv venv --python 3.11
7uv pip install -r requirements.txt
8
9# Generate (model files are at the repo root — pass --model-path .)
10.venv/bin/python scripts/hidream_o1/generate_hidream_o1_mlx.py \
11 --model-path . \
12 --prompt "your prompt here" \
13 --output out.png1git clone https://huggingface.co/mlx-community/HiDream-O1-Image-Dev-mlx-bf16
2cd HiDream-O1-Image-Dev-mlx-bf16
3uv venv --python 3.11
4uv pip install -r requirements.txt
5
6# Convert the upstream HF weights to MLX BF16 (~5 minutes, requires ~50 GB free disk)
7.venv/bin/python scripts/hidream_o1/convert_hidream_o1_to_mlx.py \
8 --hf-source HiDream-ai/HiDream-O1-Image-Dev \
9 --out-dir mlx_models/hidream-o1-dev-bf16 \
10 --bits 161# Single image, default 1024×1024 BF16
2.venv/bin/python scripts/hidream_o1/generate_hidream_o1_mlx.py \
3 --model-path mlx_models/hidream-o1-dev-bf16 \
4 --prompt "your prompt here" \
5 --output sample_outputs/whatever.png \
6 --seed 42
7
8# Higher resolution (2048×2048 = upstream default)
9.venv/bin/python scripts/hidream_o1/generate_hidream_o1_mlx.py \
10 --model-path mlx_models/hidream-o1-dev-bf16 \
11 --prompt "..." \
12 --width 2048 --height 2048 \
13 --output sample_outputs/big.png
14
15# Vertical / cinema (auto-snaps to nearest trained ratio)
16.venv/bin/python scripts/hidream_o1/generate_hidream_o1_mlx.py \
17 --model-path mlx_models/hidream-o1-dev-bf16 \
18 --prompt "..." \
19 --width 1440 --height 2560 \
20 --output sample_outputs/portrait.png
21
22# Instruction-based edit (one ref image)
23.venv/bin/python scripts/hidream_o1/generate_hidream_o1_mlx.py \
24 --model-path mlx_models/hidream-o1-dev-bf16 \
25 --prompt "change the chef's white jacket to a bright red chef jacket, same kitchen, same pose, photorealistic" \
26 --output sample_outputs/edit_red_jacket.png \
27 --ref-images /path/to/chef.jpg \
28 --seed 42
29
30# Multi-reference subject personalization (2-3 refs)
31.venv/bin/python scripts/hidream_o1/generate_hidream_o1_mlx.py \
32 --model-path mlx_models/hidream-o1-dev-bf16 \
33 --prompt "the person from reference 1 standing in the location from reference 2, golden hour, photorealistic" \
34 --output sample_outputs/multi_ref.png \
35 --ref-images /path/to/person.jpg /path/to/place.jpg \
36 --seed 422048×2048, 2304×1728, 1728×2304, 2560×1440, 1440×2560,
2496×1664, 1664×2496, 3104×1312, 1312×3104, 2304×1792, 1792×2304masterpiece, best quality (community-found responder phrase)Leica M6 with Kodak Tri-X 400, Pentax K1000 + Cinestill 800T, Hasselblad H6D medium formatguidance_scale=0.0 so negative prompts have no effect — push positive prompts harder instead.hidream-o1-mlx/
├── README.md (this file)
├── LICENSE (MIT)
├── requirements.txt (mlx-vlm 0.5.0, transformers 5.8+, deps)
├── scripts/hidream_o1/
│ ├── convert_hidream_o1_to_mlx.py (HF → MLX, BF16 / Q4 / Q6 / Q8)
│ ├── generate_hidream_o1_mlx.py (T2I generator + experimental edit/multi-ref)
│ ├── hidream_model.py (custom heads + forward_generation)
│ ├── pipeline_helpers.py (T2I sample, mrope, mask, patchify)
│ └── flow_match.py (FlashFlowMatchScheduler in MLX)
├── docs/
│ ├── EVALUATION.md (perf + quality findings, A/B vs mflux)
│ ├── HIDREAM_O1_MLX_PORT_REPORT.md (architecture + weight conversion details)
│ └── PHOSPHENE_INTEGRATION_PLAN.md (how it slots into a host app)
├── sample_outputs/ (gallery)
└── mlx_models/ (where converted weights land)| Resolution | Per step | Total (28 steps) | Peak RAM |
|---|---|---|---|
| 1024×1024 | 2.4 s | 67 s | 16 GB |
| 1440×2560 | 4.5 s | 127 s | 16 GB |
| 2048×2048 | 6.7 s | 187 s | 16 GB |
| 3104×1312 | 7.6 s | 213 s | 16 GB |
mx.compile gives 0% speedup — the inference loop is bandwidth-bound on the 36-layer BF16 decoder. To go faster you'd need a smaller distillation (none public) or text-cache reuse across denoising steps.--ref-images flag with multiple paths1@misc{hidream-o1-image,
2 author = {HiDream-ai},
3 title = {HiDream-O1-Image: Pixel-Level Unified Transformer},
4 year = {2026},
5 url = {https://github.com/HiDream-ai/HiDream-O1-Image}
6}