tools: qwen4_strata_to_gguf writes output.weight as Q8_0 in every tier (the engine's native head wants it; Ultra KL +3.4 % with BF16 dense)

This commit is contained in:
Niko1221 committed 2026-12-04 09:30:48 +01:00
1 parent c623598440
commit af8aaadb9e
1 file changed
+3 -3
+3 -3
View File
@@ -63,10 +63,10 @@ if DENSE == "auto":
DENSE = "bf16" if S.manifest.get("tier", "") == "ultra" else "q8_0"
def put_mat(name, a):
def put_mat(name, a, q8=False): # q8: this tensor as Q8_0 whatever the dense format (the engine's native head wants a Q8_0 / K-quant output.weight)
global n_t
a = np.ascontiguousarray(a, dtype=np.float32)
if DENSE == "q8_0" and a.shape[-1] % 32 == 0:
if (DENSE == "q8_0" or q8) and a.shape[-1] % 32 == 0:
q = np.ascontiguousarray(quantize(a, gguf.GGMLQuantizationType.Q8_0))
keep.append(q)
w.add_tensor(name, q, raw_dtype=gguf.GGMLQuantizationType.Q8_0)
@@ -153,7 +153,7 @@ put_mat("output_hc_down.weight", unrot(S.get(m + "input_mix_weight_down.weight")
put_mat("output_hc_up.weight", unrot(S.get(m + "input_mix_weight_up.weight")))
put_bf16("token_embd.weight", unrot(S.get(LM + "embed_tokens.weight")))
print("embed done %.0f s" % (time.time() - t0), flush=True)
put_mat("output.weight", unrot(S.get("lm_head.weight")))
put_mat("output.weight", unrot(S.get("lm_head.weight")), q8=True)
print("head done %.0f s" % (time.time() - t0), flush=True)
w.write_header_to_file()
w.write_kv_data_to_file()