[Bugfix] Capture final-layer aux hidden state in deepseek_v2 backbone (#46973)

Signed-off-by: mgoin <mgoin64@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael Goin
2026-06-29 10:00:31 -04:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 6185d73882
commit 0ca39c4f1f
@@ -1470,6 +1470,9 @@ class DeepseekV2Model(nn.Module):
[self.hidden_size, self.hidden_size], dim=-1
)
if self.end_layer in self.aux_hidden_state_layers:
aux_hidden_states.append(hidden_states + residual)
hidden_states, _ = self.norm(hidden_states, residual)
if len(aux_hidden_states) > 0:
return hidden_states, aux_hidden_states