From c293ccc58ef6e1a0976a62f79f57bc045108073d Mon Sep 17 00:00:00 2001 From: Rita Brugarolas Date: Fri, 1 May 2026 21:13:15 -0700 Subject: [PATCH] [ROCm][Bugfix] Fix init-time bias dtype cast when gate.out_dtype is None (#41405) Signed-off-by: Rita Brugarolas Brufau --- vllm/model_executor/models/deepseek_v2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/models/deepseek_v2.py b/vllm/model_executor/models/deepseek_v2.py index 15913c418b..26a1903fa7 100644 --- a/vllm/model_executor/models/deepseek_v2.py +++ b/vllm/model_executor/models/deepseek_v2.py @@ -351,8 +351,9 @@ class DeepseekV2MoE(nn.Module): self.is_rocm_aiter_moe_enabled and self.gate.e_score_correction_bias is not None ): + gate_out_dtype = self.gate.out_dtype or self.gate.weight.dtype self.gate.e_score_correction_bias.data = ( - self.gate.e_score_correction_bias.data.to(self.gate.out_dtype) + self.gate.e_score_correction_bias.data.to(gate_out_dtype) ) def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: