Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

Linear: MXFP4 weight_packed name (AutoRound / compressed-tensors) in the E8M0 block route

YanissAmz4770e089f6c7
diff --git a/exllamav3/modules/linear.py b/exllamav3/modules/linear.py
index e243761..1144a9a 100644
--- a/exllamav3/modules/linear.py
+++ b/exllamav3/modules/linear.py
@@ -285,7 +285,8 @@ class Linear(Module):
elif scale_q is not None and scale_q.dim() == 2:
# DeepSeek-V4 style: fp8/fp4 blocks + E8M0 scale grid, checkpoint
# orientation (out, in); dequant first, then orient/pad like a plain load
- w_raw = self.config.stc.get_tensor(key + ".weight", dev, no_defer = True)
+ wname = ".weight_packed" if self.config.stc.has_tensor(key + ".weight_packed") else ".weight" # compressed-tensors / AutoRound MXFP4
+ w_raw = self.config.stc.get_tensor(key + wname, dev, no_defer = True)
weight = self.dequant_e8m0_blocks_(w_raw, scale_q)
if self.transposed_load:
weight = weight.T
diff --git a/tests/test_linear_vendor_load_cpu.py b/tests/test_linear_vendor_load_cpu.py
index 890238b..3576d5d 100644
--- a/tests/test_linear_vendor_load_cpu.py
+++ b/tests/test_linear_vendor_load_cpu.py
@@ -69,6 +69,14 @@ def test_fp8_per_tensor_and_channel(tmp_path):
check(w, vi.dequant_fp8(wb, "F8_E4M3", s))
+def test_mxfp4_weight_packed_name(tmp_path):
+ """AutoRound / compressed-tensors MXFP4: `weight_packed` + U8 `weight_scale` (found on a real Qwen3-0.6B MXFP4 checkpoint)."""
+ nib = H.rng.integers(0, 16, size=(64, 128)).astype(np.uint8)
+ sb = H.rng.integers(120, 132, size=(64, 4)).astype(np.uint8)
+ w = make_linear(tmp_path, {"l.weight_packed": H.t("U8", H.pack_nibbles(nib)), "l.weight_scale": H.t("U8", sb)}, {}, "l", 64, 128)
+ check(w, vi.dequant_mxfp4_linear(H.pack_nibbles(nib), vi.e8m0_to_f32(sb)))
+
+
def test_mxfp4_linear_u8_and_e8m0(tmp_path):
nib = H.rng.integers(0, 16, size=(64, 128)).astype(np.uint8)
sb = H.rng.integers(120, 132, size=(64, 4)).astype(np.uint8)