Repository navigation
hy4_flash: host vision config, patchify, bilinear taps, and 3D M-RoPE layout (slice 4a of #4795) - #5022
Conversation
|
I trial-merged One case needs a resize regression before this goes into serving. When one side is clamped to the minimum 32 pixels, the resized area can exceed the requested ceiling. The retry then derives its next ceiling from that larger area and can repeat the same grid indefinitely. A scratch portrait and landscape fixture with a four-token budget hit a 14-second test timeout on the current implementation. The result should fit four tokens, including the row newline. A local prototype makes the ceiling decrease on every retry and handles a single merged row or column directly. One column can fit at most Igor Lessio - AIFLOW LABS |
|
Great catch, @AIFlowML — thank you for testing Fixed in
Added regression coverage in
|
|
Thanks for the fix. I trial-merged zig build test-hy4-flash-host -Dfixed-cpu -j2 --summary allThe author's revised suite passed 38/38. Adding the original independent 320×32 and 32×320 portraits and landscapes, each with a four-token budget, plus the pinned official config check, brought it to 40/40. Both orientations returned within budget, including each row's newline token. That closes my host resize finding. A served vision path and CUDA device qualification are outside this slice. Igor Lessio - AIFLOW LABS |
|
Thanks @GrgaPalcic. The narrow-image fix now bounds the remaining axis and makes the general area budget decrease. The raster patch order, position taps and image-newline M-RoPE layout are consistent in the host-only helper, and the earlier termination issue is addressed in source. This looks safe to land as the host-only slice through the normal checks. Full image preprocessing and engine token equivalence remain qualification work for the later integration.
|
9777ec1 to
9777084
Compare
|
Thank you @GrgaPalcic. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
Adds host-side SigLIP2 vision configuration, image preprocessing, bilinear
128x128position-embedding taps, and 3D M-RoPE layout fortencent/Hy4-flash-FP8insidezig/src/families/hy4_flash/(vision_config.zigandvision_config_test.zig):Config.read/Config.parse: parsesvision_configfromconfig.jsonand optional normalization/pixel bounds fromprocessor_config.json/preprocessor_config.json(returningnullfor text-only checkpoints), validating Hy4-flash SigLIP2 geometry (hidden=1152,heads=16,depth<=32,intermediate=4304,out_hidden=3072,patch=16,merge=2,channels=3,max_image_size=2048,hidden_act="gelu") and rejecting non-finite or non-positiveeps,rescale,std_, or inverted pixel bounds.tokensForGrid,prepare,prepareRgb,patchifyRaster: smart-resizes images onto32-pixel multiples (patch * merge) withinmin_pixels..max_pixelsandmax_tokens(accounting for oneimage_newlineper merged row), resizes viacore.picture.resample.resize(.pillow, ...), and patchifies in raster(gh, gw, C=3, ph=16, pw=16)order with(scaled - mean) / std.positions: computes bilinear 4-tap indices and weights into the128x128position grid (scale_factor = (size + 0.1) / 128, with exact identity at128x128).layout: computessrc_idx [n](-1on text,0..total_img_tokenson image pads), 3D M-RoPEpos3 [3, n](T, H, W), andrope_deltafor single-image, multi-image, and text-only prompts, rejecting odd grids, overlapping/unsorted runs, and out-of-bounds spans.vision_config_test.ziginzig/src/families/hy4_flash/host_tests.zig(48/48pass intest-hy4-flash-host).No served path, model load, default, or GPU kernel is changed in this slice. Remaining work for #4795: CUDA kernels + kernel contract gates/controls/limits, served W8A16
TP=2/TP=4+DFly2CUDA Graphs with serial token-equality receipts, and CUDA SigLIP2--vision+ 3D M-RoPE integration.main(ef4d6429f, after hy4_flash: host W8A16 FP8 weight map, TP=1/2/4 partition, and Engram FP8 row format (slice 1 of #4795) #4827 and hy4_flash: W8A16 CUDA weight packing for qmmf projections and TP=1/2/4 FP8 experts (slice 2a of #4795) #4895 merged); adds 2 commits (19a0adca3,9777ec144)atc overlap --json: run on9777ec144againstorigin/main(ef4d6429f) —changedFiles: 3,overlaps: [],worktreeOverlaps: [](complete: false,limitations: ["otherPullRequestsLimit", "pullFilesUnavailable", "pullRequestsLimit", "timeLimit"]).Checks on this head
9777ec144f8278d8a4d13367f02c35992dbec2ee(baseef4d6429fc873fe34cf37379f69921a791b04ab3)python3 tools/zig/lean_check.py, on the base and on this head:165on base (ef4d6429f, inherited),165on head (9777ec144),0new (python3 tools/pr_check.py --base origin/main:0 error(s))zig build -Dfixed-cpu test-hy4-flash-host --summary allon9777ec144(Zig0.17.0, Linux x86_64):48pass,0fail,0skip (42baseline +6new; exit0)zig fmt --check build.zig zig && git diff --check: exit0Receipt
n/a — host-only vision preprocessing and 3D M-RoPE layout module and unit tests; does not reach inference, model load, serving, or any GPU kernel.
ef4d6429f, head9777ec144, Zig0.17.0(-Dfixed-cpu), Linux x86_64 host (no GPU); targets officialtencent/Hy4-flash-FP8@003107fa248f5892064ab1c43af0a7003dd68c9btools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: n/a (does not reach inference; exactness of config parsing, raster patchify normalization,128x128identity and closed-form bilinear 4-tap interpolation, single/multi-image 3D M-RoPE coordinates andrope_delta, plus refusal controls is verified invision_config_test.zig)tools/bench_openai.py: n/a (host-only slice)Checklist