Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 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
2 changes: 0 additions & 2 deletions vllm/config/vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2926,8 +2926,6 @@ def _get_v2_model_runner_unsupported_features(self) -> list[str]:
# https://github.com/vllm-project/vllm/pull/40704
"ngram",
"ngram_gpu",
# https://github.com/vllm-project/vllm/pull/43091
"draft_model",
"suffix",
"medusa",
"mlp_speculator",
Expand Down
17 changes: 16 additions & 1 deletion vllm/v1/worker/gpu/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
maybe_create_adaptive_verification_manager,
resolve_adaptive_cudagraph_mode,
)
from vllm.v1.worker.gpu.spec_decode.draft_model.speculator import (
PlainDraftModelSpeculator,
)
from vllm.v1.worker.gpu.spec_decode.eagle.eagle3_utils import (
set_eagle3_aux_hidden_state_layers,
verify_supports_aux_hidden_states_over_pp,
Expand Down Expand Up @@ -780,7 +783,11 @@ def _dummy_run(
"skip_attn must only be True for initial memory profiling."
)

# Create a dummy scheduler output.
# Create a dummy scheduler output. Plain draft-model speculation adds
# one correction slot per request during prefill. The scheduler
# accounts for these slots, while dummy runs bypass the scheduler.
# Adjust the dummy token count only when the expanded draft batch
# would exceed the token budget.
num_reqs = min(num_tokens, self.max_num_reqs)
if uniform_decode:
# HACK(lucas): for now since the worker is shared between MRV1 and MRV2,
Expand All @@ -797,6 +804,14 @@ def _dummy_run(
)
# Distribute the remainder evenly so no dummy request exceeds
# ceil(num_tokens / num_reqs) <= max_model_len tokens.
if (
isinstance(self.speculator, PlainDraftModelSpeculator)
and not uniform_decode
):
reserved_draft_tokens = num_reqs
if num_tokens + reserved_draft_tokens > self.max_num_tokens:
num_tokens = self.max_num_tokens - reserved_draft_tokens
Comment thread
wxsIcey marked this conversation as resolved.
Resolved

num_tokens_per_request = [
num_tokens // num_reqs + (i >= num_reqs - num_tokens % num_reqs)
for i in range(num_reqs)
Expand Down
6 changes: 6 additions & 0 deletions vllm/v1/worker/gpu/spec_decode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,11 @@ def init_speculator(vllm_config: VllmConfig, device: torch.device):
)

return EagleSpeculator(vllm_config, device)
elif speculative_config.uses_draft_model():
from vllm.v1.worker.gpu.spec_decode.draft_model.speculator import (
PlainDraftModelSpeculator,
)

return PlainDraftModelSpeculator(vllm_config, device)
else:
raise NotImplementedError(f"{speculative_config.method} is not supported yet.")
2 changes: 2 additions & 0 deletions vllm/v1/worker/gpu/spec_decode/draft_model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
Loading
Loading