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/r3/trace_audit.py from devin-lai/MiniMax-H3-Image-mlx: direct link, hf CLI and curl.
- Browser
- Download file 2.39 kB
-
https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/main/experiments/r3/trace_audit.py
- Command line
-
hf download hf://devin-lai/MiniMax-H3-Image-mlx/experiments/r3/trace_audit.py
-
curl -L -o trace_audit.py https://huggingface.co/devin-lai/MiniMax-H3-Image-mlx/resolve/main/experiments/r3/trace_audit.py
2.39 kB
| """CPU-only hashes of safetensors payloads, independent of MLX graph execution.""" | |
| import argparse | |
| import hashlib | |
| import json | |
| import struct | |
| from pathlib import Path | |
| def payloads(path): | |
| result = {} | |
| with Path(path).open("rb") as handle: | |
| length = struct.unpack("<Q", handle.read(8))[0] | |
| header = json.loads(handle.read(length)) | |
| start = 8 + length | |
| for name, spec in header.items(): | |
| if name == "__metadata__": | |
| continue | |
| a, b = spec["data_offsets"] | |
| handle.seek(start + a) | |
| result[name] = { | |
| "dtype": spec["dtype"], | |
| "shape": spec["shape"], | |
| "sha256": hashlib.sha256(handle.read(b - a)).hexdigest(), | |
| } | |
| return result | |
| def main(a): | |
| rows = [json.loads(line) for line in Path(a.runs).read_text().splitlines()] | |
| by_case = {} | |
| for row in rows: | |
| case = row["case"] | |
| values = payloads(Path(row["output"]).with_suffix(".trace.safetensors")) | |
| if case not in by_case: | |
| if row["variant"] != "control": | |
| raise ValueError("Control must precede candidate for each case") | |
| by_case[case] = values | |
| reference = by_case[case] | |
| row["trace_identity"] = values == reference | |
| row["different_trace_tensors"] = [ | |
| k | |
| for k in sorted(set(values) | set(reference)) | |
| if values.get(k) != reference.get(k) | |
| ] | |
| row["trace_tensor_sha256"] = {k: v["sha256"] for k, v in values.items()} | |
| Path(a.output).write_text(json.dumps(rows, indent=2) + "\n") | |
| print( | |
| json.dumps( | |
| { | |
| "runs": len(rows), | |
| "all_trace_identical": all(r["trace_identity"] for r in rows), | |
| "mismatches": [ | |
| { | |
| k: r[k] | |
| for k in ("case", "variant", "phase", "different_trace_tensors") | |
| } | |
| for r in rows | |
| if not r["trace_identity"] | |
| ], | |
| }, | |
| indent=2, | |
| ) | |
| ) | |
| if __name__ == "__main__": | |
| p = argparse.ArgumentParser(description=__doc__) | |
| p.add_argument("--runs", default="outputs/optimization-r3/runs.jsonl") | |
| p.add_argument("--output", default="reports/optimization-r3/trace-audit.json") | |
| main(p.parse_args()) | |