Fix weight mapper: compressor → attn.compressor (not mla_attn), quant weights_proj

- The compressor is on attn.compressor (not attn.mla_attn.compressor)
- weights_proj in indexer is NVFP4-quantized in our checkpoint
This commit is contained in:
2026-05-19 03:20:41 +00:00
parent 396a83ea56
commit b0b5113467
2 changed files with 4 additions and 2 deletions

View File

@@ -1707,7 +1707,7 @@ def _make_deepseek_v4_nvfp4_weights_mapper() -> WeightsMapper:
"compressor.kv_norm.": "compressor.norm.",
"compressor.position_bias": "compressor.ape",
# Attention compressor (after indexer renames)
".self_attn.compressor.": ".attn.mla_attn.compressor.",
".self_attn.compressor.": ".attn.compressor.",
# Attention projections (specific before .self_attn. → .attn.)
".self_attn.q_a_proj.": ".attn.wq_a.",
".self_attn.kv_proj.": ".attn.wkv.",

View File

@@ -1143,11 +1143,13 @@ class DeepseekV4Indexer(nn.Module):
quant_config=quant_config,
prefix=f"{prefix}.wq_b",
)
# weights_proj is NVFP4-quantized in the modelopt checkpoint.
# Upstream uses quant_config=None for the MXFP4 checkpoint.
self.weights_proj = ReplicatedLinear(
hidden_size,
self.n_head,
bias=False,
quant_config=None,
quant_config=quant_config,
prefix=f"{prefix}.weights_proj",
)
self.softmax_scale = self.head_dim**-0.5