[DeepSeekNextN] fix: residual of head norm can be None (#7398)

This commit is contained in:
Cheng Wan
2025-06-20 14:45:16 -07:00
committed by GitHub
parent e879d8b7a8
commit 22bfed7509

View File

@@ -107,7 +107,11 @@ class DeepseekModelNextN(nn.Module):
)
if not forward_batch.forward_mode.is_idle():
hidden_states, _ = self.shared_head.norm(hidden_states, residual)
if residual is not None:
hidden_states, _ = self.shared_head.norm(hidden_states, residual)
else:
hidden_states = self.shared_head.norm(hidden_states)
return hidden_states