[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>
Michael Goin committed
Jun 29, 2026 at 10:00 UTC
0ca39c4f1fc450339f57ceca6bddc2af1abe84a5
1 file changed
+3
vllm/model_executor/models/deepseek_v2.py
+3
@@ -1470,6 +1470,9 @@ class DeepseekV2Model(nn.Module):
1470
[self.hidden_size, self.hidden_size], dim=-1
1471
)
1472
1473
+ if self.end_layer in self.aux_hidden_state_layers:
1474
+ aux_hidden_states.append(hidden_states + residual)
1475
+
1476
hidden_states, _ = self.norm(hidden_states, residual)
1477
if len(aux_hidden_states) > 0:
1478
return hidden_states, aux_hidden_states