2 Commits

Author SHA1 Message Date
ZacharyZcR 7291fd19ac tests: skip the fmt=5 codec tests where numpy is absent
CI keeps the runtime path dependency-free, so the Python test job runs
without numpy and the new codec tests errored on import. Guard the import
and skip the class instead — verified both ways: 6/6 run where numpy is
present, 6/6 skip cleanly where it is not.
2026-07-21 01:34:26 +08:00
ZacharyZcR e48346162a tools: fmt=5 index codec — deployable bytes for the E8/IQ3 container (#452 step 2)
#453 settled the scheme; this produces the actual bytes. iq3_pack.encode/decode
implement the container layout so the converter, the engine and the decode
kernels can all be written against one spec:

  98 bytes per 256 weights = 3.0625 bpw
    [ 0..63]  uint8  grid index per 4-dim magnitude block
    [64..95]  uint32 x8 — four 7-bit sign words + 4-bit sub-scale per 32
    [96..97]  fp16   super-scale

Signs use the published odd-parity trick: 7 of every 8 are stored and the 8th
is derived, so the encoder flips the smallest-magnitude weight of any block
whose true signs would violate parity — the cost the #453 ablation priced in,
now actually paid. Sub-scale is searched over all 16 codes against the stored
(fp16-rounded) super-scale, so encode-time and decode-time arithmetic agree.

GLM-5.2 routed experts under this container: 372.7 -> 281.2 GB (-24.6%), and a
176 GB VRAM tier holds ~12,180 experts instead of ~9,190 (+33%).

tests/test_iq3_pack.py: byte budget, deterministic encode, decode checked
value-by-value against an independent loop-based reader written straight from
the layout, sign-parity closure, and reconstruction quality in the band the
chosen scheme measured (rel-RMSE 0.195 vs the torch model's 0.195).
2026-07-20 22:22:46 +08:00