From 9562759861625dafb46d3c49791c562696a9cb36 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Tue, 10 Nov 2026 16:52:37 -0400 Subject: [PATCH] gguf_to_q4nx: an unknown quantisation type refuses by file and number, not from inside an enum engine#2013: packing `Ternary-Bonsai-2-27B-PTQ1_0.gguf` died as ValueError: np.uint32(143) is not a valid GGMLQuantizationType raised inside `GGUFReader._build_tensors` -- a traceback four frames deep that names neither the file nor a way forward, and that reads as a caller bug rather than "this pack uses a quantisation type this tree does not support". The reader is where it fails, so the guard goes there: : np.uint32(143) is not a valid GGMLQuantizationType. A tensor uses a quantisation type this gguf library does not know (it knows F32, F16, Q4_0, ..., TQ1_0, TQ2_0, MXFP4, NVFP4, Q1_0); a newer or vendor-specific type needs a dequantiser before this pack can be packed, and nothing was written `ValueError`s that are not this enum's are re-raised, so the guard cannot swallow an unrelated one, and the message says nothing was written because that is the question a caller interrupted mid-pack actually asks. Verified both bonsai GGUFs against it: the ternary now refuses by file and number (above), and the q4_0 keeps its own existing named refusal (`no Q4NX name for blk.0.attn_gate.weight`) -- different gap, same discipline. Neither writes an output directory. What this does NOT do: make either pack packable. The 143 type needs a dequantiser, and `attn_gate` needs a Q4NX name AND a layout decision (where the gate goes), which is not a rename -- both stated on #2013, where the row that needs them (#1984) is also recorded as blocked rather than merely unrun. Refs #2013, #1984 --- tools/gguf_to_q4nx.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/gguf_to_q4nx.py b/tools/gguf_to_q4nx.py index 6d8ab1a0c..d594c5e47 100755 --- a/tools/gguf_to_q4nx.py +++ b/tools/gguf_to_q4nx.py @@ -373,7 +373,19 @@ def moe_meta(r, items, table): def pack(args): - r = gguf.GGUFReader(args.gguf) + # engine#2013: a quantisation type this gguf cannot read fails INSIDE GGUFReader's _build_tensors, as + # `ValueError: np.uint32(143) is not a valid GGMLQuantizationType` from the enum -- naming neither the file nor a way + # forward, and looking like a caller bug rather than "this pack uses a type this tree does not support". Refuse by + # file and number instead. + try: + r = gguf.GGUFReader(args.gguf) + except ValueError as e: + if "GGMLQuantizationType" not in str(e): + raise + raise SystemExit( + f"{args.gguf}: {e}. A tensor uses a quantisation type this gguf library does not know (it knows " + f"{', '.join(q.name for q in gguf.GGMLQuantizationType)}); a newer or vendor-specific type needs a " + "dequantiser before this pack can be packed, and nothing was written") refuse_unsupported_rope(r) # before the output directory exists: no half-written container os.makedirs(args.out, exist_ok=True) items = planned(r)