Skip to content

[ROCm] [CI] Keep original layer count for Eagle3DeepseekV2 init test - #48260

Closed
stefankoncarevic wants to merge 5 commits into
vllm-project:mainfrom
stefankoncarevic:fix-eagle3-deepseekv2-use-original-num-layers
Closed

stefankoncarevic wants to merge 5 commits into
vllm-project:mainfrom
stefankoncarevic:fix-eagle3-deepseekv2-use-original-num-layers

Conversation

@stefankoncarevic

@stefankoncarevic stefankoncarevic commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

test_can_initialize_large_subset[Eagle3DeepseekV2ForCausalLM] fails in the AMD
ROCm CI (basic models init tests) with:

File "vllm/v1/worker/gpu_model_runner.py", line 6056, in _dummy_run
    hidden_states, _ = outputs
ValueError: too many values to unpack (expected 2)

The Eagle3 draft (AQ-MedAI/Kimi-K25-eagle3) requests auxiliary hidden states
from target layers (2, 30, 58) (log: Using auxiliary layers from speculative config: (2, 30, 58)). The initialization test's default dummy_hf_overrides
collapses the target model (moonshotai/Kimi-K2.5) to a single hidden layer, so
layers 2/30/58 don't exist. In DeepseekV2Model.forward no layer index then
matches, aux_hidden_states stays empty, and the model returns a bare
hidden_states tensor instead of the (hidden_states, aux_hidden_states) tuple:

# vllm/model_executor/models/deepseek_v2.py
if len(aux_hidden_states) > 0:
    return hidden_states, aux_hidden_states
return hidden_states

Because Eagle3 sets use_aux_hidden_state_outputs=True, _dummy_run
unconditionally unpacks two values (hidden_states, _ = outputs). Unpacking a
bare tensor iterates its first dim (num tokens > 2), raising
too many values to unpack (expected 2).

This is the same class of issue as Eagle3Qwen3vlForCausalLM: with reduced
layers the configured aux layers are absent.

Changes

  • Set use_original_num_layers=True for Eagle3DeepseekV2ForCausalLM in
    tests/models/registry.py, so the target keeps its full layer count during
    initialization. Layers 2/30/58 then exist, aux hidden states are collected,
    the model returns the (hidden_states, aux_hidden_states) tuple, and the
    unpack succeeds. This matches the existing pattern used by the other Eagle3 /
    speculative entries.
  • Also set max_model_len=8192. With the full layer count the target
    (Kimi-K2.5) is large (~169 GiB of dummy weights), and the default
    max_model_len (262144) sizes a KV cache too big to fit alongside the weights,
    causing a torch.OutOfMemoryError during KV cache allocation. Reducing
    max_model_len shrinks the KV cache so the test fits in CI VRAM (same approach
    already used by other heavy entries in this registry).

Test Plan

Environment: AMD MI300 (gfx942), ROCm, VLLM_ROCM_USE_AITER unset (default
FalseROCM_ATTN backend), matching the AMD CI configuration.

pytest -x -s "tests/models/test_initialization.py::test_can_initialize_large_subset[Eagle3DeepseekV2ForCausalLM]"

Test Result

  • test_can_initialize_large_subset[Eagle3DeepseekV2ForCausalLM]: 1 passed
    (~288 s), previously failed with
    ValueError: too many values to unpack (expected 2).

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Eagle3 draft `AQ-MedAI/Kimi-K25-eagle3` requests auxiliary hidden states
from target layers (2, 30, 58). The initialization test's default
`dummy_hf_overrides` collapses the target `Kimi-K2.5` to a single hidden
layer, so those layers don't exist and `DeepseekV2Model.forward` returns a
bare `hidden_states` tensor instead of `(hidden_states, aux_hidden_states)`.
With Eagle3's `use_aux_hidden_state_outputs=True`, `_dummy_run` unpacks two
values and iterating the bare tensor fails:
  ValueError: too many values to unpack (expected 2)
Set `use_original_num_layers=True` so the target keeps all layers, the
configured aux layers exist, and the tuple is returned (same pattern as the
other Eagle3 entries). Also set `max_model_len=8192`: with the full layer
count Kimi-K2.5 is large, and the default max len sizes a KV cache too big
to fit alongside the weights (OOM); reducing it keeps the test within CI VRAM.
Test-only change; no vLLM runtime code is modified.

Signed-off-by: Stefan Koncarevic <stefan.koncarevic@amd.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added deepseek Related to DeepSeek models rocm Related to AMD ROCm labels Jul 10, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Jul 10, 2026
@stefankoncarevic

Copy link
Copy Markdown
Contributor Author

Putting this on hold pending #47077.

Eagle3DeepseekV2ForCausalLM and Eagle3DeepseekV3ForCausalLM are the same checkpoint (moonshotai/Kimi-K2.5 with the AQ-MedAI/Kimi-K25-eagle3 draft) registered under two arch names, and they share the same root cause: the reduced-layer dummy init returns a bare hidden-states tensor, which the runner unpacks as hidden_states, _ = outputs.

#47077 fixes that for Eagle3DeepseekV3 in shared runtime code (robust unpack + the MLA decode-only assertion), which should also cover Eagle3DeepseekV2 here. To avoid two divergent fixes for the same model, I'll wait for #47077 to merge and then re-check whether Eagle3DeepseekV2 passes on main without this test-only change. If it does, I'll close this PR as no longer needed.

@stefankoncarevic

Copy link
Copy Markdown
Contributor Author

Resolved by #48527. Verified locally on MI300 that test_can_initialize_large_subset[Eagle3DeepseekV2ForCausalLM] passes on current main with the default config. Closing.

@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek Related to DeepSeek models rocm Related to AMD ROCm

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant