[ROCm][Bugfix] Fix init-time bias dtype cast when gate.out_dtype is None (#41405)
Signed-off-by: Rita Brugarolas Brufau <rita.brugarolasbrufau@amd.com>
This commit is contained in:
@@ -351,8 +351,9 @@ class DeepseekV2MoE(nn.Module):
|
|||||||
self.is_rocm_aiter_moe_enabled
|
self.is_rocm_aiter_moe_enabled
|
||||||
and self.gate.e_score_correction_bias is not None
|
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 = (
|
||||||
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:
|
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
||||||
|
|||||||
Reference in New Issue
Block a user