Skip to content

[Minor][Spec Decode] Add use_eagle to SpeculativeConfig #17213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions vllm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2566,6 +2566,9 @@ def num_lookahead_slots(self) -> int:
"""
return self.num_speculative_tokens

def use_eagle(self) -> bool:
return self.method in ("eagle", "eagle3")

def __repr__(self) -> str:
method = self.method
model = None if method == "ngram" else self.draft_model_config.model
Expand Down
2 changes: 1 addition & 1 deletion vllm/v1/core/sched/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(
self.num_spec_tokens = self.num_lookahead_tokens = 0
if speculative_config:
self.num_spec_tokens = speculative_config.num_speculative_tokens
if speculative_config.method in ("eagle", "eagle3"):
if speculative_config.use_eagle():
self.num_lookahead_tokens = self.num_spec_tokens

def schedule(self) -> SchedulerOutput:
Expand Down
6 changes: 2 additions & 4 deletions vllm/v1/worker/gpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ def __init__(
if get_pp_group().is_last_rank:
if self.speculative_config.method == "ngram":
self.drafter = NgramProposer(self.vllm_config)
elif self.speculative_config.method == "eagle" or \
self.speculative_config.method == "eagle3":
elif self.speculative_config.use_eagle():
self.drafter = EagleProposer(self.vllm_config,
self.device) # type: ignore
if self.speculative_config.method == "eagle3":
Expand Down Expand Up @@ -1192,8 +1191,7 @@ def execute_model(
assert isinstance(self.drafter, NgramProposer)
spec_token_ids = self.generate_draft_token_ids(
valid_sampled_token_ids, sampling_metadata)
elif self.speculative_config.method == "eagle" or \
self.speculative_config.method == "eagle3":
elif self.speculative_config.use_eagle():
assert isinstance(self.drafter, EagleProposer)
# TODO(woosuk): Refactor the loop.
next_token_ids: list[int] = []
Expand Down