Repository navigation
Conversation
a879310 to
0fa460a
Compare
|
Rebased onto today's main, on #2778's new head, so the stack's CI runs on one base (head On the new head these pass: On the whole-run gate that changed after a run: the new form is sound. The selftest keeps a floor of cosine 0.999, and a run must sit no further from float64 than twice a float32-sum host run. That bound follows the reduction order's own noise, which a fixed 0.99999 did not. MOSS-Image's gates use the same form. One fix for this PR's kernel sits higher in the stack. In What's left:
|
0fa460a to
28067fa
Compare
28067fa to
b538cc1
Compare
does The macOS dev-tools job failed to compile tf-h3-image-encoder: "file exists in modules 'picture_codec' and 'core'". The tool's encoder imports core, whose root has imported picture/picture.zig since eb43e2b, and the tool also built a picture_codec module rooted at that file. The tool now imports that same core and reads core.picture: the picture half of ashhart#2779's "the edit encoder, its reference rules and its tool read safetensors and pictures through core", which this stack's older copy of the encoder commit lacks.
does The macOS dev-tools job failed to compile tf-h3-image-encoder: "file exists in modules 'picture_codec' and 'core'". The tool's encoder imports core, whose root has imported picture/picture.zig since eb43e2b, and the tool also built a picture_codec module rooted at that file. The tool now imports that same core and reads core.picture: the picture half of ashhart#2779's "the edit encoder, its reference rules and its tool read safetensors and pictures through core", which this stack's older copy of the encoder commit lacks.
b538cc1 to
a105e8f
Compare
Each text segment is tokenised on its own and cut to 4,096 tokens; references enter as a label and a vision block whose rows are tagged 0. Positions follow Qwen-VL's M-RoPE, and the rotary table rounds to bf16. The Qwen copy of a reference keeps or scales its short edge to 1,024 with Pillow's LANCZOS. The text encoder's and the refiner's configs are checked at the released geometry.
tf-h3-image-prompt turns a prompt into the text rows tf-h3-image reads: Qwen3-VL's text model to the hidden state leaving layer index 49, then condition_proj, the two token-refiner blocks over every row and the final norm. Weights are bf16 read in place; products run in simdgroup matrices with fp32 sums, so chips without tensor units run it too. The encoder also takes a reference's vision rows and DeepStack features at their image pads, ready for the edit's tower. Its selftest writes a tiny synthetic checkpoint, loads it as a real run does, and gates each kernel alone and each whole run against a float64 host reference with the same bf16 rounding points.
… its fixture through core, as main does prompt.zig pulls in tensors.zig, which on main reads core.safetensors, so the tool's prompt module imports core. A file may sit in one module of a build only, and core already holds picture.zig, qwen_vl/rope.zig and checkpoint_fixture.zig, so picture_prompt.zig, its test and the tool read them through core, and the build's own picture, rope and fixture modules go. test-h3-image-prompt's root imports core in their place.
a105e8f to
6428a08
Compare
|
Closing this one: all of its work is on main, some of it moved or renamed since this branch was cut, so nothing is left to merge.
|
What this changes
MiniMax-H3-Image's prompt path runs on Metal. Before,
tf-h3-imagecould take its prompt rows only from a reference pipeline's case. After,tf-h3-image-promptmakes them from the prompt itself:condition_proj, its two token-refiner blocks andfinal_normfollow.The tool writes
textandtext_tagsin the picture case's format. Everything runs on any Apple GPU, with no tensor units needed.Host rules (
picture_prompt.zig), with tests:Picture i:labels and vision blocks for edits;The runner (
prompt.zig,prompt_kernels.zig,prompt_weights.zig) and its kernels (h3_prompt.metal): simdgroup products with fp32 sums, fp32 norm statistics, rotary, causal and full attention with fp32 softmax and sums, and both SiLU forms. It maps only the shards holding the embedding and layers 0-49.A float64 host reference (
prompt_reference.zig) with the same bf16 rounding points, fortf-h3-image-prompt selftest.For edits, the encoder already places vision rows at the image pads and adds DeepStack after layers 0-2; the selftest covers that. Qwen3-VL's vision tower itself is not here: core
qwen_vlis Qwen3.5's tower, and an edit's prompt rows still come from the case.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 edit encoder on Metal in fp32 (tf-h3-image-encoder) #2778, then h3: MiniMax-H3-Image's VAE rules on the host, and Pillow's Lanczos-3 in core/picture #2775 and h3: MiniMax-H3-Image's transformer on Metal from a picture case (tf-h3-image) #2766. Land it after h3: MiniMax-H3-Image's edit encoder on Metal in fp32 (tf-h3-image-encoder) #2778. This adds
364f13aa57,d54a228c0fand0fa460a1c6, rebased onto h3: MiniMax-H3-Image's edit encoder on Metal in fp32 (tf-h3-image-encoder) #2778 with its one build line kept beside this one.atc overlap --json: no open pull request touches the new files.build.zigandmetal_targets.ziggain one line each.Checks on this head
Head commit:
0fa460a1c6. The checks below were rerun after the rebase onto h3: MiniMax-H3-Image's edit encoder on Metal in fp32 (tf-h3-image-encoder) #2778: 13 of 13 steps and 70 tests.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 test-h3-image-prompt compile-h3-host compile-h3-image-prompt test-picture-host --summary all: 14 of 14 steps.test-h3-image-prompthas 13 tests, and is part ofzig build test.zig fmt --checkandgit diff --check: clean.tf-h3-image-prompt selfteston an M3 Ultra: a synthetic checkpoint loaded as a real run loads one, checked against a float64 host reference.condition_proj, refiner, final normThe whole-run gate changed after a run. It was first cosine ≥ 0.99999 and relative error ≤ 0.005, and the refiner missed it on a second seed while every kernel alone was bit-exact. It is now "no further from float64 than twice a float32-sum host run", the form MOSS-Image's gates use. Please review that change.
CI: will run on this head.
Not run, and why: real weights. Their download is on hold.
Receipt
tf-h3-image-prompt.a87931041b, Zig 0.17.0, an M3 Ultra under macOS. Configs fromMiniMaxAI/MiniMax-H3-Imageat492fd8c4ecand MiniMax-H3'stext_encoder/config.json.Kernel contract
tf-h3-image-prompt selftestagainst a float64 reference, not yet registered withtf-kernel-contract.Checklist
The inference checklist does not apply: this makes a denoiser's prompt rows, beside the engine.