Skip to content

Commit 7e3a8dc

Browse files
authored
Remove from_dict from SpeculativeConfig (#22451)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
1 parent 139d155 commit 7e3a8dc

File tree

3 files changed

+9
-28
lines changed

3 files changed

+9
-28
lines changed

tests/v1/spec_decode/test_ngram.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ def ngram_proposer(min_n: int, max_n: int, k: int) -> NgramProposer:
4747
model_config = ModelConfig(model="facebook/opt-125m")
4848
return NgramProposer(
4949
vllm_config=VllmConfig(model_config=model_config,
50-
speculative_config=SpeculativeConfig.
51-
from_dict({
52-
"prompt_lookup_min": min_n,
53-
"prompt_lookup_max": max_n,
54-
"num_speculative_tokens": k,
55-
"method": "ngram",
56-
})))
50+
speculative_config=SpeculativeConfig(
51+
prompt_lookup_min=min_n,
52+
prompt_lookup_max=max_n,
53+
num_speculative_tokens=k,
54+
method="ngram",
55+
)))
5756

5857
# No match.
5958
result = ngram_proposer(

vllm/config.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2895,11 +2895,6 @@ def compute_hash(self) -> str:
28952895
usedforsecurity=False).hexdigest()
28962896
return hash_str
28972897

2898-
@classmethod
2899-
def from_dict(cls, dict_value: dict) -> "SpeculativeConfig":
2900-
"""Parse the CLI value for the speculative config."""
2901-
return cls(**dict_value)
2902-
29032898
@staticmethod
29042899
def hf_config_override(hf_config: PretrainedConfig) -> PretrainedConfig:
29052900
if hf_config.model_type == "deepseek_v3":

vllm/engine/arg_utils.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -757,18 +757,6 @@ def add_cli_args(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
757757
lora_group.add_argument("--default-mm-loras",
758758
**lora_kwargs["default_mm_loras"])
759759

760-
# Speculative arguments
761-
speculative_group = parser.add_argument_group(
762-
title="SpeculativeConfig",
763-
description=SpeculativeConfig.__doc__,
764-
)
765-
speculative_group.add_argument(
766-
"--speculative-config",
767-
type=json.loads,
768-
default=None,
769-
help="The configurations for speculative decoding. Should be a "
770-
"JSON string.")
771-
772760
# Observability arguments
773761
observability_kwargs = get_kwargs(ObservabilityConfig)
774762
observability_group = parser.add_argument_group(
@@ -848,6 +836,8 @@ def add_cli_args(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
848836
title="VllmConfig",
849837
description=VllmConfig.__doc__,
850838
)
839+
vllm_group.add_argument("--speculative-config",
840+
**vllm_kwargs["speculative_config"])
851841
vllm_group.add_argument("--kv-transfer-config",
852842
**vllm_kwargs["kv_transfer_config"])
853843
vllm_group.add_argument('--kv-events-config',
@@ -1033,10 +1023,7 @@ def create_speculative_config(
10331023
"enable_chunked_prefill": enable_chunked_prefill,
10341024
"disable_log_stats": disable_log_stats,
10351025
})
1036-
speculative_config = SpeculativeConfig.from_dict(
1037-
self.speculative_config)
1038-
1039-
return speculative_config
1026+
return SpeculativeConfig(**self.speculative_config)
10401027

10411028
def create_engine_config(
10421029
self,

0 commit comments

Comments
 (0)