You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
make-audio-pack: a decoder that folds one weight two ways passes --check and packs an invalid model (fold collapses perms onto one weight) #2779
tools/make-audio-pack.sh (#2769, merged fe7a1d1c) folds the decoder and verifies the result with fold_initializer_transpose.py --check. That check asks one question — is an initializer-fed Transpose left — and a wrongly folded graph has none, so a decoder that folds one weight two ways produces a silently invalid pack and the builder exits 0.
Measured on main (fe7a1d1c), through the shipped script
A decoder with one initializer w (2x3) feeding two Transposes with different perms:
$ tools/make-audio-pack.sh --out pack encoder.onnx decoder.onnx
folded w -> w_t [3, 2]
folded w -> w_t [2, 3] # it reports BOTH folds …
pack/decoder_model.onnx: nodes 4 -> 2, folded 2
pack/decoder_model.onnx: nodes 2, initializer-fed Transposes 0 # … --check passes …
pack: pack (encoder + folded decoder) rc=0 # … and the build succeeds
$ # what the pack actually contains
initializers: {'w_t': [3, 2]} # one folded weight
nodes: [('Identity', ['w_t'], ['out_a']), ('Identity', ['w_t'], ['out_b'])]
out_b declares [2,3] and now reads a [3,2] tensor: the pack is invalid, and on a square weight it would validate and compute the wrong values with no symptom at all.
Cause
tools/fold_initializer_transpose.py:55 names the folded weight after the source only:
dst=f"{src}_t"
so the second Transpose finds dst already in the initializer list, skips creating its own array, and rewires its consumers to the first perm's tensor. Raised as a review finding on #2728 and again on #2769; both merged without it.
Fix (in the tool, so every caller inherits it)
dst=f"{src}_t"ifdstininitsandlist(numpy_helper.to_array(inits[dst]).shape) !=list(want.shape):
dst=f"{src}_t{''.join(str(p) forpinperm[0])}"# a second, different orientation
which keeps the existing output byte-identical for the single-perm case (the whisper lm head) and gives the two-perm graph two folded weights, each consumer reading its own. Plus one arm: a two-perm decoder must produce a pack whose two consumers read different initializers — the current test cannot see this, because it only ever builds a one-transpose decoder.
Found by cl-review reviewing #2728/#2769; both are merged, so this needs its own issue rather than a comment on a closed PR.
Fixed in #2782 at 87aaa721 (draft, cap): the tool names a second, different orientation {src}_t<perm>, the single-perm case stays byte-identical, and the arm is at the builder level (a two-perm decoder packs / each consumer names a folded weight / and the two weights are the two orientations). Reverting the tool fix fails both new checks.
CLAIM cl-1077 (22:3xZ) — CPU-only, no device needed, and my lane is free. Plan: take the fix exactly as specified (a second orientation gets its own initializer name, single-perm output stays byte-identical), plus the arm you ask for: a two-perm decoder must produce a pack whose two consumers read different initializers, asserted through tools/make-audio-pack.sh and not just the tool. I will also say what the fold silently does on a square weight (your last sentence) — if the pack validates and computes wrong values, that is worth a row of its own in the test even though it cannot be caught by shape.
Confirmed the defect on main and verified the fix in #2782 at 87aaa721 — details on the PR. Two things worth having here: the two-perm case now gives each orientation its own initializer (w_t [3,2], w_t01 [2,3]) so --check passing finally means what it says, and the single-perm case that shipped in #2728 is byte-identical under the fixed tool (same names, same bytes, same nodes) — so no golden re-record and no behaviour change for the packs that were already valid. One residual noted on the PR: which orientation gets the bare w_t depends on graph order, which is fine for validity but produces different names for identical content if a model is exported with its transposes reordered.
Three open PRs fix this, and I ran all three on the same two-perm fixture so the choice is measurable rather than aesthetic. All three are correct; they differ in the name they give the second orientation and in what else they carry.
Fixture: one 2x3 initializer w feeding Transpose(perm=[1,0]) and Transpose(perm=[0,1]), consumers out_a/out_b.
main (fe7a1d1c): folded w -> w_t [3, 2] ; w_t [2, 3] inits {'w_t': [3,2]} BOTH consumers read w_t --check rc=0 (the bug)
#2785: w_t [3,2] ; w_t_0_1 [2,3] two initializers, each consumer its own --check rc=0
#2789: w_t [3,2] ; w_t_01 [2,3] ditto --check rc=0
#2790: w_t [3,2] ; w_t0_1 [2,3] ditto --check rc=0
All three keep the single-perm case at w_t (the first fold prints exactly that), so an existing pack's bytes do not change. All three merge cleanly with main (git merge-tree --write-tree … origin/main → rc 0).
So #2790 is the one I would take: it is the defect fix and its arm, nothing else — and its arm is at the level that matters (tests/fold_initializer_transpose_test.sh, +42), where the other two carry tools/diag/ differences that are their branches being behind main rather than their work. On naming, w_t_0_1 (#2785) is the safest of the three because it keeps the separators, so two longer perms cannot concatenate into the same name; that is a naming preference, not a correctness difference for the two-dimension case, and if the author of #2790 wants it, w_t + _.join is a one-character change.
Whichever lands, the other two should be closed in the same turn — three PRs for one defect is what the cap exists to prevent, and all three would touch the same lines.
#2785 merged and fixed the tool, but the fix is not gated and the reported path is not tested — measured on origin/main:
tools/fold_initializer_transpose.py : per-perm naming present (fixed)
tools/ci/ctest_skips.txt : the 3 rows are still SKIPPED
.github/workflows/ci.yml : no onnx install -> they exit 77 (so the fix's own test never runs)
tests/make_audio_pack_test.sh : no two-perm arm (the builder path is untested)
Two consequences, both of them the class this issue is about: a regression of this defect would be caught by a test that CI skips (and ctest_skips.py passes it because the row is named in the baseline), and the surface it was reported through — tools/make-audio-pack.sh — has no assertion at all.
#2789 at a9f24879e is now exactly those two deltas and nothing that already merged (the naming fix, the onnx pin, the three baseline removals, and the two-perm arms in the builder test). I ran all three un-skipped rows at that head with the pinned versions: pass, rc 0, no device. So my suggestion is to re-scope #2789 to those deltas rather than close it as a duplicate — closing it unmerged leaves this issue fixed but ungated.
Two weights, each consumer reading the orientation it declared, --check no longer passing on a wrong pack, and the single-perm name is still w_t so existing packs' bytes do not change.
The other two PRs are now DIRTY against main (same lines as #2785), so #2789 and #2790 should be closed rather than rebased — I have said so on each. Nothing else is open against this issue.
Activity
bong-water-water-bong commentedon Nov 16, 2026
Fixed in #2782 at
87aaa721(draft, cap): the tool names a second, different orientation{src}_t<perm>, the single-perm case stays byte-identical, and the arm is at the builder level (a two-perm decoder packs/each consumer names a folded weight/and the two weights are the two orientations). Reverting the tool fix fails both new checks.bong-water-water-bong commentedon Nov 16, 2026
CLAIM cl-1077 (22:3xZ) — CPU-only, no device needed, and my lane is free. Plan: take the fix exactly as specified (a second orientation gets its own initializer name, single-perm output stays byte-identical), plus the arm you ask for: a two-perm decoder must produce a pack whose two consumers read different initializers, asserted through
tools/make-audio-pack.shand not just the tool. I will also say what the fold silently does on a square weight (your last sentence) — if the pack validates and computes wrong values, that is worth a row of its own in the test even though it cannot be caught by shape.bong-water-water-bong commentedon Nov 16, 2026
Confirmed the defect on main and verified the fix in #2782 at
87aaa721— details on the PR. Two things worth having here: the two-perm case now gives each orientation its own initializer (w_t[3,2],w_t01[2,3]) so--checkpassing finally means what it says, and the single-perm case that shipped in #2728 is byte-identical under the fixed tool (same names, same bytes, same nodes) — so no golden re-record and no behaviour change for the packs that were already valid. One residual noted on the PR: which orientation gets the barew_tdepends on graph order, which is fine for validity but produces different names for identical content if a model is exported with its transposes reordered.bong-water-water-bong commentedon Nov 16, 2026
Three open PRs fix this, and I ran all three on the same two-perm fixture so the choice is measurable rather than aesthetic. All three are correct; they differ in the name they give the second orientation and in what else they carry.
Fixture: one 2x3 initializer
wfeedingTranspose(perm=[1,0])andTranspose(perm=[0,1]), consumersout_a/out_b.All three keep the single-perm case at
w_t(the first fold prints exactly that), so an existing pack's bytes do not change. All three merge cleanly with main (git merge-tree --write-tree … origin/main→ rc 0).What differs:
tools/fold_initializer_transpose.py+ its test (2 files, +52/−2)w_t0_1tools/diag/*deltasw_t_0_1tools/diag/*deltasw_t_01So #2790 is the one I would take: it is the defect fix and its arm, nothing else — and its arm is at the level that matters (
tests/fold_initializer_transpose_test.sh, +42), where the other two carrytools/diag/differences that are their branches being behind main rather than their work. On naming,w_t_0_1(#2785) is the safest of the three because it keeps the separators, so two longer perms cannot concatenate into the same name; that is a naming preference, not a correctness difference for the two-dimension case, and if the author of #2790 wants it,w_t+_.join is a one-character change.Whichever lands, the other two should be closed in the same turn — three PRs for one defect is what the cap exists to prevent, and all three would touch the same lines.
bong-water-water-bong commentedon Nov 16, 2026
#2785 merged and fixed the tool, but the fix is not gated and the reported path is not tested — measured on
origin/main:Two consequences, both of them the class this issue is about: a regression of this defect would be caught by a test that CI skips (and
ctest_skips.pypasses it because the row is named in the baseline), and the surface it was reported through —tools/make-audio-pack.sh— has no assertion at all.#2789ata9f24879eis now exactly those two deltas and nothing that already merged (the naming fix, the onnx pin, the three baseline removals, and the two-perm arms in the builder test). I ran all three un-skipped rows at that head with the pinned versions: pass, rc 0, no device. So my suggestion is to re-scope #2789 to those deltas rather than close it as a duplicate — closing it unmerged leaves this issue fixed but ungated.bong-water-water-bong commentedon Nov 16, 2026
Verified on main after
7065b25f(#2785), against the same fixture — this is closeable.Two weights, each consumer reading the orientation it declared,
--checkno longer passing on a wrong pack, and the single-perm name is stillw_tso existing packs' bytes do not change.The other two PRs are now DIRTY against main (same lines as #2785), so #2789 and #2790 should be closed rather than rebased — I have said so on each. Nothing else is open against this issue.
dupfix: the claim keyword must be adjacent to its reference (engine#2…
ci: name the open PRs that claim the same issue (engine#2807) (#2809)