-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Your current environment
vllm serve [model] ----speculative-config '{"method": "ngram", "num_speculative_tokens": 10, "ngram_prompt_lookup_max": 10}'
does not work. Pass in any model you would like.
🐛 Describe the bug
Bug: --speculative-config
argument parsing fails with AttributeError
Problem
When running vllm serve (model) --speculative-config
, the command fails because the argument gets parsed differently than expected, causing it to be converted into a SpeculativeConfig
object instead of remaining as a dictionary.
Root Cause
The issue occurs in vllm/engine/arg_utils.py
where --speculative-config
is added through the VllmConfig argument group:
vllm_kwargs = get_kwargs(VllmConfig)
vllm_group = parser.add_argument_group(
title="VllmConfig",
description=VllmConfig.__doc__,
)
vllm_group.add_argument("--speculative-config",
**vllm_kwargs["speculative_config"])
This causes the argument to be automatically parsed into a SpeculativeConfig
object. However, downstream code expects it to be a dictionary and calls .get()
on it, resulting in:
AttributeError: 'SpeculativeConfig' object has no attribute 'get'
This error occurs in vllm/engine/arg_utils.py
, line 1458, in is_v1_supported_oracle
:
self.speculative_config.get("method") == "draft_model"
Solution
Remove --speculative-config
from the VllmConfig argument group and add it as a separate argument with proper JSON parsing:
vllm_kwargs = get_kwargs(VllmConfig)
vllm_group = parser.add_argument_group(
title="VllmConfig",
description=VllmConfig.__doc__,
)
# vllm_group.add_argument("--speculative-config",
# **vllm_kwargs["speculative_config"])
vllm_group.add_argument("--kv-transfer-config",
**vllm_kwargs["kv_transfer_config"])
vllm_group.add_argument('--kv-events-config',
**vllm_kwargs["kv_events_config"])
vllm_group.add_argument("--compilation-config", "-O",
**vllm_kwargs["compilation_config"])
vllm_group.add_argument("--additional-config",
**vllm_kwargs["additional_config"])
# Other arguments
parser.add_argument("--speculative-config", type=json.loads)
This fix ensures --speculative-config
remains as a dictionary, which is what the downstream code expects.
Before submitting a new issue...
- Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.