Repository navigation
tools/gguf_to_q4nx.py: repack a GGUF into a Q4NX model directory - #128
Conversation
|
Docs7 for 1bit-monster/engine
Commit |
PR Reviewer Guide 🔍(Review updated until commit aa04259)Here are some key observations to aid the review process:
|
Every projection and lm_head becomes q4_1 tiles: Q4_0, Q4_1 and Q4_K map code for code (exact apart from bf16 scale and zero), other types are dequantized and requantized. verify checks every tensor against the GGUF; tests/gguf_to_q4nx_test.py pins the tile layout to the verified golden tile and repacks a synthetic GGUF (run in CI). Qwen3-0.6B-Q4_K_M: 311/311 tensors pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f43b083 to
aa04259
Compare
|
Persistent review updated to latest commit aa04259 |
Adds
tools/gguf_to_q4nx.py. It repacks a qwen3 GGUF into a Q4NX model directory (model.q4nx,config.json, and a tokenizer copied from--tokenizer), so a GGUF can run on the NPU.lm_headis written as q4_1 tiles, the kind the lane and dx read.verifycompares every tensor with the GGUF, dequantized. The exact types must stay within the bf16 rounding bound; for the requantized ones it reports the error.tests/gguf_to_q4nx_test.py(runs in CI) checks the tile layout in both directions against the committed golden q4_1 tile, which has a verified SHA-256. It also packs and verifies a synthetic GGUF with Q4_0, Q4_1, Q4_K, Q8_0 and F32 tensors.Measured on strixhalo with
Qwen3-0.6B-Q4_K_M.gguf:verify. The Q4_K tensors have 0 weights over the bound. The Q6_K tensors requantize to cosine 0.9969.dx_decode_test --refagainstdx_model.py refon the repacked directory gives 24/24 tokens, logits cosine at least 0.99995, 21.0 ms/step, and 0 TDRs.1bit serve --device npu: loads in 1.1 s and answers "The capital of France is Paris." at 59.6 tok/s.Limits: qwen3 only. The GGUF vocabulary is not converted into
tokenizer.json.🤖 Generated with Claude Code