Repository navigation
Conversation
This was referenced Nov 10, 2026
Owner
Author
|
/atc exchange 549959234cd65d08f3b00c1bee240540cfa752c8ca1b169defc4e411a26951eb |
Owner
Author
5 of 8 tasks
ashhart
force-pushed
the
lead/h3-image-edit
branch
5 times, most recently
from
November 22, 2026 02:56
94db89a to
d35f5d2
Compare
…er (suites to come)
…trations and nine planted controls
…trations and ten planted controls; four kernels reserve their group sizes
…istrations and fourteen planted controls; hp_attention's padded last key is a known finding
…infinite last value stays infinite; its contract entries lose their known finding and gain a control
… float64 reference of the tower Config.parseDeepStack reads Qwen3-VL's deepstack_visual_indexes (rising, below the depth, at most four); Config.parse still refuses them. With taps, the weights add each deepstack_merger_list merger and the tower runs each one after its block: LayerNorm over the merged width, fc1, exact GELU and fc2. Tower.loadAt and shards.headersAt take the tensors' prefix, and shards.findPrefix finds an HF checkpoint's. A tower without taps loads the same tensors under vision_tower. and runs the same kernels in the same order. reference.zig runs the whole tower on the host in float64 or float32 sums at the Metal tower's bf16 rounding points. qwen_vl_tools.zig roots the tower, its settings, shards, reference and core's pictures in one module for tools beside the engine.
…tack rows on Metal, and its selftest tf-h3-image-vision TEXT_ENCODER_DIR MODEL_DIR reference out.safetensors reads the picture upright in RGB, makes its Qwen copy (qwen_copy.zig, picture_prompt's rule moved to a file of its own), cuts the processor's patches and runs core's tower with DeepStack under the checkpoint's own prefix. It writes grid, rows [tokens, 5120] and deepstack [3, tokens, 5120] in bf16, aligned. `selftest` writes a tiny Qwen3-VL tower in HF's names and layouts and loads it as a run does. Each output (the merged rows and each tap's) must sit within twice a float32-sum host run's distance from a float64 reference of the whole tower, with cosine at least 0.999; a second run, an untapped run and the same tower in MLX's Qwen3.5 layout through Tower.load must give the same bytes. The tool's modules: one core root for the tower and pictures, which qwen_copy.zig also reads as its picture module, so no file is in two modules. zig/build/h3_image_vision.zig adds the tool, a host compile and the tower's host tests in test-h3-image-prompt.
--reference vision.safetensors (repeatable, in upload order) reads tf-h3-image-vision's rows: the prompt gains each reference's label and vision block, the pads take M-RoPE positions from its grid, and the encoder places its rows and adds its DeepStack rows after layers 0 to 2. With a size, --anchors OUT_PREFIX writes tf-h3-image-encoder's grid and anchor rows as the case's references and anchors, so an edit's case is whole. Text-only runs are unchanged. The selftest's picture run now reads its rows back from a file as --reference does.
… recipe An edit runs in five tools: the edit encoder's anchors, tf-h3-image-vision, tf-h3-image-prompt with --reference and --anchors, the transformer and the decoder. The vision tower's section gives what runs, the checkpoint's inferred names, its precision, why Qwen3.5 is unchanged, and the selftest's gates and results on an M3 Ultra.
…ugh core The macOS dev-tools job failed to compile tf-h3-image-prompt: h3_image_files.zig and h3_image_prompt_edit.zig import `checkpoint_fixture`, a module only tf-h3-image-vision's build registers. The prompt tool reads the fixture through `core`, whose root imports checkpoint_fixture.zig, so a second module rooted at that file would own it twice. The tool now registers `checkpoint_fixture` as h3_image_prompt_fixture.zig, which re-exports core's Entry and image.
…s H3 Metal tools The stack's h3_metal.zig registered tf-h3-dit and tf-h3-image itself; main's h3_host.zig metalTools now registers those two, so the restack kept main's call and h3_metal.zig was left unused. Its three image tools join metalTools and the file goes.
Main's cf37b2a (glm metal: prompt.zig and the Metal contract main back to 600 lines after main's #3920) already has the supplied one-line limits gate. Keep that gate, put the three H3 suites and their defers on one source line, and join the limits accumulator to the gate so the suite registrations preserve main's 600-line ceiling.
ashhart
force-pushed
the
lead/h3-image-edit
branch
from
November 23, 2026 19:27
d35f5d2 to
cc43e2e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
MiniMax-H3-Image's edits now run end to end with TensorFold's own tools. Before, an edit's prompt rows had to come from a reference pipeline's case, because Qwen3-VL's vision tower and its DeepStack features were not here. After:
The vision tower takes DeepStack taps, opt-in (
core/qwen_vl).Config.parseDeepStackreadsdeepstack_visual_indexes: rising blocks below the depth, at most four.Config.parsestill refuses them, so the engine's Qwen3.5 checkpoints load exactly as before.deepstack_merger_list.{j}.norm,.linear_fc1,.linear_fc2), and the loader takes a tensor prefix (model.visual.for an HF checkpoint, found fromblocks.0.norm1.weight).Tower.imageDeepruns each tap's merger after its block. Its LayerNorm is taken over the merged width, after the 2x2 shuffle.imageisimageDeepwith no taps.qwen_vl/reference.zigis a float64 host reference of the whole tower.tf-h3-image-vision TEXT_ENCODER_DIR MODEL_DIR reference.(png|jpg|webp) out.safetensorsreads a reference upright in RGB and makes its Qwen copy by the prompt rules' size and LANCZOS. It then cuts its patches as Qwen2VLImageProcessorFast does, runs the tower with DeepStack on any Apple GPU, and writesgrid,rows[tokens, 5120] anddeepstack[3, tokens, 5120].tf-h3-image-prompt --reference vision.safetensors(repeatable, in upload order) presents the edit:--anchors PREFIXalso writes the edit encoder's grid and anchor rows into the case, so one run of the tools makes a whole edit case.The Qwen copy's rule moves into
families/h3/qwen_copy.zig, withpicture_prompt.zigre-exporting it. The vision tool reads it without putting a core file in two modules.core/qwen_vl_tools.zigis the tools' one core module.The recipe runs an edit end to end in five tools (encoder for anchors, vision, prompt, transformer on an M5, decoder) and documents the vision tower and its gates.
Issue: n/a. The maintainer asked for MiniMax-H3-Image directly. This is adapted clean-room from the written spec's encoder sections (DeepStack's three post-shuffle-norm mergers added after decoder layers 0 to 2) and our own Qwen-VL tower.
copy_scanagainst hashes of every upstream file the spec's reader read finds no run of 12 or more tokens.Stacked on: kernel contract: MiniMax-H3-Image's 19 Metal kernels, 31 registrations and 34 planted controls; the prompt path's attention keeps an infinite last value #2808, then h3: MiniMax-H3-Image's text to image end to end: the prompt tool writes the canvas and the seed's starting rows #2781, h3: MiniMax-H3-Image's image decoder on Metal in bf16 (tf-h3-image-decoder) #2780, h3: MiniMax-H3-Image's prompt path on Metal: Qwen3-VL to layer 50 and the token refiner (tf-h3-image-prompt) #2779, h3: MiniMax-H3-Image's edit encoder on Metal in fp32 (tf-h3-image-encoder) #2778, 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 last. This adds
56441fba90,417792720f,7fd9d9d19dand32e520d08f.atc overlap --json: incomplete under its API limits. Shared files arebuild.zig(one line) andcore/qwen_vl's files, which no open pull request in its first pages touches.Checks on this head
32e520d08f.tools/pr_check.py --base lead/h3-image-contract: 0 errors. Its one advisory warning is the Unreleased line, which the lead adds.zig build test-h3-image-prompt test-h3-geometry compile-h3-image-vision compile-h3-image-prompt compile-h3-host: exit 0. This includes the tower's new host tests:parse, with bad lists refused;tf-h3-image-vision selfteston an M3 Ultra passes every gate. Its gates were fixed before its first run. It runs a synthetic HF-named tower undermodel.visual.(4 blocks of 144, taps after 0, 2 and 3, 54 tokens) through the real loader and patch path:vision_tower.*in MLX's Qwen3.5 layout gives the same rows throughTower.loadandimage().Qwen3.5's tower unchanged:
image(), the newimage()andimageDeep(&.{})were byte-identical;test-flashnext-vision-memory-hostpasses.tf-h3-image-prompt selftest: every gate passes. Its picture run now reads its vision rows back from a file, as--referencedoes.zig fmt --check: clean.Owed device cells
tf-h3-image-visionon a real reference against the reference pipeline's vision and DeepStack rows. Then an edit end to end on an M5.Receipt
tf-h3-image-prompt --reference FILE(repeatable) and--anchors PREFIX; the new tooltf-h3-image-vision; build stepstf-h3-image-visionandcompile-h3-image-vision.32e520d08f, Zig 0.17.0, macOS on an M3 Ultra. Synthetic checkpoints only.Checklist
The inference checklist does not apply to the image tools. The one engine-side change, the tower's opt-in, keeps Qwen3.5's bytes.