[Bugfix] Fix DeepSeek V4 mHC broadcast buffer for dummy load (#51368)

Signed-off-by: Hollow Man <hollowman@opensuse.org>
This commit is contained in:
ℍ𝕠𝕝𝕝𝕠𝕨 𝕄𝕒𝕟
2026-08-18 17:02:18 -07:00
committed by GitHub
parent ef47a897e2
commit a9f4afb66f
4 changed files with 46 additions and 7 deletions
+4 -5
View File
@@ -504,10 +504,6 @@ class DeepseekV4MegaMoEExperts(nn.Module):
is_padding=is_padding,
)
# This method must have been already called during the weight loading phase.
# We call it again here to cover the dummy weight loading case.
self.finalize_weights()
assert self._transformed_l1_weights is not None
assert self._transformed_l2_weights is not None
deep_gemm.fp8_fp4_mega_moe(
@@ -1543,9 +1539,12 @@ class DeepseekV4ForCausalLM(
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
loader = AutoWeightsLoader(self, skip_substrs=["mtp."])
loaded_params = loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
self.process_weights_after_loading()
return loaded_params
def process_weights_after_loading(self) -> None:
self.model.finalize_mega_moe_weights()
self.model.finalize_mhc_broadcast_weights()
return loaded_params
def get_expert_mapping(self) -> list[tuple[str, str, int, str]]:
return self.model.get_expert_mapping()