Repository navigation
h3: MiniMax-H3-Image's edit encoder on Metal in fp32 (tf-h3-image-encoder) - #2778
Conversation
|
Rebased onto today's main, on #2775's new head, so CI runs again (head On the new head these pass: On the fp16 sample gate that changed after the first run ( What's left:
|
dd4ec5e to
c555f28
Compare
035cdc1 to
448710e
Compare
… that draw several tensors
…, grids, encoder layers, clean and anchor rows
…oder and its selftest
…rs and pictures through core, as main does On main, H3's geometry.zig reads safetensors as core.safetensors. The encoder's module pulls geometry.zig in through picture_reference.zig, so it now imports core instead of a safetensors module of its own, and image_encoder.zig, picture_reference.zig and its test read st from core.safetensors. The tool reads PNGs through core.picture, since core already holds picture.zig and a file may sit in one module of a build only.
448710e to
fed9ec9
Compare
What this changes
MiniMax-H3-Image's edit encoder runs on Metal. Before, an edit's reference rows had to come from the reference pipeline's case. After,
tf-h3-image-encoderturns a reference picture into the clean latent rows (and anchor rows) the transformer conditions on. It is the VAE's CNN encoder in fp32, on any Apple GPU.Host rules (
picture_reference.zig), each with tests:image_encoder.zigand four Metal kernels:It runs 256-pixel tiles and blends the 48 moment channels in latent units with
picture_vae's rule. The posterior sample is kept as fp16.moss_image/noise.zig:randnnow calls a newdrawon a generator, so a pipeline can chain draws on one stream (target, anchors, posterior). MOSS-Image's draws are unchanged; its torch digests still match.Issue: n/a. The maintainer asked for MiniMax-H3-Image directly. This is adapted clean-room from a written spec of vLLM-Omni's and SGLang's support.
copy_scanagainst hashes of every upstream file read finds no run of 12 or more tokens.Stacked on: h3: MiniMax-H3-Image's VAE rules on the host, and Pillow's Lanczos-3 in core/picture #2775, which is stacked on h3: MiniMax-H3-Image's transformer on Metal from a picture case (tf-h3-image) #2766. This adds
fc73371a6d,0e39576870,2c28443709anddd4ec5e3c0.atc overlap --json: no open pull request toucheszig/src/families/h3/ormoss_image/noise.zig. The shared build files gain one line each.Checks on this head
Head commit:
dd4ec5e3c0.Lean checker: 386 on the base and 386 on this head, 0 new.
tools/pr_check.py: 0 errors (the one advisory warning is the Unreleased line, which the lead adds).Tests run, with the command and pass, fail and skip counts:
zig build test-h3-geometry compile-h3-host test-picture-host compile-h3-image-encoder --summary all: 11 of 11 steps.test-h3-geometryhas 70 tests, 9 of them new.zig test zig/src/families/moss_image/noise.zig: 3 passed, including the torch digests.zig fmt --checkandgit diff --check: clean.tf-h3-image-encoder selfteston an M3 Ultra, synthetic weights against a float64 host reference, bounds fixed before the first run:The fp16 sample gate was first one step per element. Values near zero moved by three of their own (much finer) steps, so it is now one step at the largest sample's magnitude. This was changed after the first run; please review it.
All-zero weights at the released widths, built from the published header: every name and shape passes the header check. A 1024x1024 reference encodes in 0.6 s (25 tiles).
CI: will run on this head.
Not run, and why: a comparison with the release's own moments. That needs the weights, and their download is on hold.
Receipt
tf-h3-image-encoder.dd4ec5e3c0, Zig 0.17.0, an M3 Ultra under macOS. Shapes fromMiniMaxAI/MiniMax-H3-Imageat492fd8c4ec.Kernel contract
tf-h3-image-encoder selftestagainst a float64 reference, not yet registered withtf-kernel-contract.Checklist
The inference checklist does not apply: this is an encoder for a denoiser beside the engine.