From b532742530206d3442352bda814cf0ca03fd7898 Mon Sep 17 00:00:00 2001 From: biondizzle Date: Mon, 11 May 2026 07:13:44 +0000 Subject: [PATCH] debug: add shape/dtype logging to finalize_weights --- patches/deepseek_v4.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/patches/deepseek_v4.py b/patches/deepseek_v4.py index 8141058..2a601c6 100644 --- a/patches/deepseek_v4.py +++ b/patches/deepseek_v4.py @@ -625,6 +625,14 @@ class DeepseekV4MegaMoEExperts(nn.Module): self._check_runtime_supported() from deep_gemm.mega import transform_nvfp4_weights_for_mega_moe + # Debug: log shapes/dtypes before transform + print(f"[NVFP4-MoE] w13_weight: shape={self.w13_weight.shape} dtype={self.w13_weight.dtype}") + print(f"[NVFP4-MoE] w13_weight_scale: shape={self.w13_weight_scale.shape} dtype={self.w13_weight_scale.dtype}") + print(f"[NVFP4-MoE] w13_weight_scale_2: shape={self.w13_weight_scale_2.shape} dtype={self.w13_weight_scale_2.dtype}") + print(f"[NVFP4-MoE] w2_weight: shape={self.w2_weight.shape} dtype={self.w2_weight.dtype}") + print(f"[NVFP4-MoE] w2_weight_scale: shape={self.w2_weight_scale.shape} dtype={self.w2_weight_scale.dtype}") + print(f"[NVFP4-MoE] w2_weight_scale_2: shape={self.w2_weight_scale_2.shape} dtype={self.w2_weight_scale_2.dtype}") + # === Native NVFP4 path === # The DeepGEMM nvfp4 mega_moe kernel consumes NVFP4 directly: # - E2M1 packed uint8 (same as checkpoint)