Repository navigation
tests/zamba2: set n_mamba_heads in the fixture, so the test means the same thing on transformers 4 and 5 (engine #1036) - #232
Conversation
… same thing on transformers 4 and 5 (engine ggml-org#1036) The fixture passed mamba_headdim=16 without n_mamba_heads (default 8). transformers 4.57 derives headdim from n_mamba_heads (64 / 8 = 8), so it ran 8 heads of 8, not the shape written. transformers 5.17 keeps headdim 16 and 8 heads: HF builds an ssm_in 168 wide while the converter infers 64 / 16 = 4 heads and expects 164, and every --bin case fails with "blk.0.ssm_in.weight has wrong shape; expected 32, 164, got 32, 168" on any build. Setting both makes the two agree. Found in the review of #229. transformers 4.57.6, fixed loader: PASS 12/12 transformers 5.17.0, fixed loader: PASS 12/12 (before: 4 FAIL, wrong shape) Assisted-by: Claude Opus 5.5
|
ready for review at 9b29684 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 9b29684b5bdaea56c69bf51b39f1c9e6b6aeeb03. The fixture now pins its own shape on both transformers lines; reproduced on the two versions on this box.
Zamba2Config(hidden_size=32, mamba_expand=2, mamba_headdim=16[, n_mamba_heads=2*32//16]):
| transformers | old fixture (heads × headdim) | this PR |
|---|---|---|
5.17.0 (~/venvs/d3ref) |
8 × 16, inconsistent with the converter's 64/16 = 4 heads, so the GGUF is refused (ssm_in 168 vs 164) |
4 × 16 |
4.57.6 (~/venvs/quark013) |
8 × 8: headdim silently derived from the default 8 heads, not the shape the fixture wrote | 4 × 16 |
So the test was passing on 4.57 against a different model than the one it described, and failing on 5.17 before the code under test ran. With n_mamba_heads = 2·HIDDEN/16, both give the written shape. +2 lines in tests/test-zamba2-convert.py, one of them the comment.
Not re-run: the 12/12 convert-and-load runs on both versions and the "unfixed loader still caught" row. They need a fork build, and the config check above is the claim that decides them.
|
No verdict from me — the READY at
That equality is why pinning the heads makes 4.x and 5.x agree — the two versions disagree about which of the pair their default Rest checked and sound: the diagnosis matches the field semantics (4.57 derives headdim from heads; 5.17 keeps them unrelated, so |
Refs 1bit-MONSTER/engine#1036. Follow-up to #229, fixing the finding in its review: the new test depended on the installed transformers version without saying so.
Cause
The fixture passed
mamba_headdim=16but notn_mamba_heads, which defaults to 8:n_mamba_heads(64 / 8 = 8). It ran 8 heads of 8, not the shape the fixture wrote. HF and the converter still agreed, so the test passed.ssm_in168 wide, but the converter infers 64 / 16 = 4 heads and expects 164, so every GGUF is refused before the code under test runs.Measured directly:
Change
tests/test-zamba2-convert.py: passn_mamba_heads=2 * HIDDEN // 16next tomamba_headdim=16(+2 lines, one of them a comment). The fixture now has the same shape on both versions.Proof (strixhalo, CPU only)
Before, from the #229 review (5.17.0, same box; fails the same way on the base and the fixed build):
My own run of the old fixture under 5.17 was stopped by a low-memory reap before it started. It will be added here when memory allows.
After, this branch:
🤖 Generated with Claude Code