Skip to content

h3: MiniMax-H3-Image's transformer on Metal from a picture case (tf-h3-image) - #2766

Merged
ashhart merged 8 commits into
mainfrom
lead/h3-image
Nov 21, 2026
Merged

ashhart merged 8 commits into
mainfrom
lead/h3-image

Conversation

@ashhart

@ashhart ashhart commented Nov 10, 2026

Copy link
Copy Markdown
Owner

What this changes

Before: the H3 tools ran clips only. A case without audio was refused (MissingTensor, or H3EmptyMedia for zero audio rows), and every step shared one output head. After: the H3 case reader also admits a picture's case for MiniMax-H3-Image. A picture's case carries no audio tensor and no audio rows, and may hold an output head per step. A new tool, tf-h3-image, runs MiniMax-H3-Image's transformer on Metal from a picture case. It makes the canvas, the distilled schedule, each row's 3D position and rotary table, the dense tile map and the AdaLN tables natively. It then runs the six steps, each first on the reference's own input (teacher-forced) and gated, then from the noise. A clip's case is read and run as before: the same tensors, the same dispatches and the same errors.

  • Issue: n/a. The maintainer asked for MiniMax-H3-Image directly. The gate is fixed in docs/recipes/minimax-h3-image-metal.md and under Receipt below. The behaviour was adapted clean-room:
    • A reader studied vLLM-Omni's open MiniMax-H3-Image pull request ([Model] Add MiniMax-H3-Image text-to-image and image editing vllm-project/vllm-omni#10120 at efecc3717c) and SGLang's merged support, and wrote a behavioural spec in prose.
    • This change was built from that spec, the checkpoint's own configs and headers, and the H3 family. No upstream code was read by the builder or copied.
    • copy_scan against hashes of every upstream file read finds no run of 12 or more tokens, in the whole diff or in any new file.
  • Stacked on: main (14dea6c6ad).
  • atc overlap --json: the snapshot reports itself incomplete (its PR and file limits). 9 pull requests are clean, the rest untested, and none conflicts. No open pull request touches zig/src/families/h3/, zig/build/h3_host.zig or the H3 recipe. Of the 36 open pull requests that edit zig/build/metal_targets.zig, each head merges with this branch exactly as it merges with main: 7 clean, and 29 that already conflict with main.

Checks on this head

  • Head commit: 9692b83d53 on main 14dea6c6ad.
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 386 on the base and 386 on this head, 0 new. tools/pr_check.py: 0 errors. Its one advisory warning is the Unreleased line, which is in the lead's lines file for this PR.
  • Tests run, with the command and pass, fail and skip counts:
    • zig build test-h3-geometry test-h3-modulation-bf16 compile-h3-host --summary all: 57 passed, 0 failed, 0 skipped. That is 56 H3 host tests (21 of them new) plus the modulation rounding test.
    • The three picture-admission tests fail against main's geometry.zig, with MissingTensor and H3EmptyMedia. The other new tests exercise functions main does not have.
    • An existing test caught a clip case's error changing for a rank-3 video_out.weight. Clips now keep H3BadTensorShape; only a picture's case reads rank 3 as step heads.
    • zig build compile-h3-library: builds. zig fmt --check on the changed Zig and git diff --check: clean.
  • CI: started on this head; I will read its result and fix anything this change caused.
  • Not run, and why:
    • tf-h3-image on a device. It needs an M5's tensor units, as tf-h3-dit does, and the Mac these checks ran on has no Metal compiler: main's tf-h3-dit build fails there the same way.
    • The reference comparison. It needs the weights; see the device cells below.

Receipt

  • Main against branch: cells and numbers, or why they can't be run: n/a for speed. This is a denoiser tool beside the engine and reaches no token path. The clip tool's dispatches are unchanged: the two new guards skip audio's projections only when a case has no audio rows, which main refused.
  • Boxes it reaches: Metal with tensor units (M5), through tf-h3-image. The H3 clip tool is unchanged.
  • New switch? None. This adds a tool and a case kind.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: 9692b83d53, Zig 0.17.0, host checks on an M3 Ultra under macOS. MiniMaxAI/MiniMax-H3-Image configs and headers at 492fd8c4ec: transformer/, the pdd files and model_index.json are unchanged from 6534ea1c97.
  • Paths and platforms the change reaches, which I ran and which I could not: the H3 Metal tool path (host compile only). No CUDA or HIP.
  • Exactness: n/a, no token family. The gates are below.
  • Main against this branch, same machine and checkpoint: n/a, as above.
  • Decode speed before and after: n/a. Prompt speed before and after: n/a.
  • Licence of any new weights or drafter: no weights are shipped. MiniMax-H3-Image is under the MiniMax-H3-Image Community License, which excludes the EU, the UK, the Republic of Korea and the USA; the recipe says to read it before use.

Gates, fixed before any run (picture.gates; tf-h3-image exits 1 on a failure and 2 when the case has no reference to gate against):

  • positions, timesteps and Euler steps bit-identical to the reference's;
  • the rotary table within 1 bf16 ULP;
  • each teacher-forced step's target velocity at cosine ≥ 0.999 and relative error ≤ 0.03;
  • the free run's final latent at cosine ≥ 0.99.

Device cells owed:

  1. tf-h3-image built and run on an M5, case A: 2048x2048 text to image, seed 42, the release request's prompt.
  2. Case B: 1280x720, which is drawn on a 2720x1536 canvas.
  3. Case C: a 2048x2048 edit with one reference, which exercises references, anchors and their positions.

The cases come from a reference exporter outside the tree, running SGLang's exact path on one GB10. That needs transformer/, vae/ and the text encoder there (about 136 GB). The M5 needs transformer/ and the pdd files (about 66 GB).

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

The inference checklist does not apply: tf-h3-image is a denoiser tool beside the engine, and no token path changes.

@ashhart

ashhart commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

/atc exchange 20b854dd7a0171c6ba275e0b8acf4153cbadb38f9dd55f2e4085056d055beccd

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto today's main (head 3b73752aa4, the same six commits) so CI runs on a current base. The earlier run was cancelled to free runners before its pytest, client and Windows jobs finished; zig, fmt, the macOS developer tools and release paths had passed.

On the new head, test-h3-geometry, test-h3-modulation-bf16, compile-h3-host and compile-h3-library pass. zig fmt is clean and the lean count is unchanged.

What's left before this lands is the three device cells in the description: cases A, B and C on an M5, gated against reference cases exported on a GB10. They need the model weights, which we haven't downloaded yet.

  • Synthena (Ash's Agent)

@ashhart
ashhart force-pushed the lead/h3-image branch 2 times, most recently from 3b73752 to 0109d9b Compare November 17, 2026 14:38
@ashhart

ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

/atc exchange b8cf2b3af2f02659faba26805a811de44a933a6da1a6f3c9fe617f66157e669b

…mage

A case without audio's input projection is read as a picture's: it may
carry no audio tensor and no audio rows, and the forward dispatches no
audio projection. A clip's case is read and run as before.
MiniMax-H3-Image's distilled checkpoint replaces the output layer with a
head per sampling step. A picture's case may hold them as video_out
[steps, width, hidden] and [steps, width]; step i reads head i, and a run
with another step count is refused. A clip's case keeps its one head.
…3-image)

picture.zig holds the picture's rules on the host: the canvas a size is
drawn on, the distilled schedule from pdd_config.json through float32
timesteps, plain Euler, each row's centred 3D position and the rotary
table from rope.inv_freq, the latent's 2 x 2 packing, the dense tile
map, and the model folder's checks. tf-h3-image builds the transformer's
case from a picture case and runs the six steps, each first on the
reference's own input and gated, then from the noise.
@ashhart
ashhart merged commit 5f53c44 into main Nov 21, 2026
12 of 21 checks passed
@ashhart
ashhart deleted the lead/h3-image branch November 21, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant