Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions python/sglang/srt/speculative/eagle_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,10 @@ def forward_batch_generation(self, batch: ScheduleBatch) -> GenerationBatchResul
batch.spec_info = next_draft_input
else:
# All reqs finished and dp_attention isn't forcing extend.
# Stash an empty EagleDraftInput so next iter's merge_batch
# short-circuits on None hidden_states (EagleVerifyInput
# has no merge_batch).
batch.spec_info = EagleDraftInput(
capture_hidden_mode=CaptureHiddenMode.LAST,
)
# Install an idle EagleDraftInput so next iter's scheduler
# ops (merge_batch / filter_batch) see well-typed empty
# tensors instead of None.
self._draft_preprocess_idle(batch)

set_time_batch(
batch.reqs, "set_spec_draft_extend_end_time", trace_only=True
Expand Down
10 changes: 4 additions & 6 deletions python/sglang/srt/speculative/multi_layer_eagle_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,10 @@ def forward_batch_generation(self, batch: ScheduleBatch) -> GenerationBatchResul
batch.spec_info = next_draft_input
else:
# All reqs finished and dp_attention isn't forcing extend.
# Stash an empty EagleDraftInput so next iter's merge_batch
# short-circuits on None hidden_states (EagleVerifyInput
# has no merge_batch).
batch.spec_info = EagleDraftInput(
capture_hidden_mode=CaptureHiddenMode.LAST,
)
# Install an idle EagleDraftInput so next iter's scheduler
# ops (merge_batch / filter_batch) see well-typed empty
# tensors instead of None.
self._draft_preprocess_idle(batch)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The _draft_preprocess_idle method in MultiLayerEagleWorker (defined at line 363) delegates to EAGLEWorker._draft_preprocess_idle, which uses self.model_config.spec_hidden_size. However, MultiLayerEagleWorker appears to use self.model_config.hidden_size for its hidden states (as seen in line 683). This could lead to an AttributeError if spec_hidden_size is missing from the MTP model config, or a shape mismatch crash during merge_batch in the next iteration if the sizes differ. It would be safer to implement a local version of _draft_preprocess_idle that uses the correct hidden size logic for MTP models.


return GenerationBatchResult(
logits_output=logits_output,
Expand Down
Loading