A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
Remove `from_dict` from `SpeculativeConfig` (#22451)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Harry Mellor committed
Aug 7, 2025 at 18:13 UTC
7e3a8dc90670fd312ce1e0d4eba9bf11c571e3ad
3 files changed
+9
-28
tests/v1/spec_decode/test_ngram.py
+6
-7
@@ -47,13 +47,12 @@ def test_ngram_proposer():
47
model_config = ModelConfig(model="facebook/opt-125m")
48
return NgramProposer(
49
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
+ )))
56
57
# No match.
58
result = ngram_proposer(
vllm/config.py
-5
@@ -2895,11 +2895,6 @@ class SpeculativeConfig:
2895
usedforsecurity=False).hexdigest()
2896
return hash_str
2897
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
-
2898
@staticmethod
2899
def hf_config_override(hf_config: PretrainedConfig) -> PretrainedConfig:
2900
if hf_config.model_type == "deepseek_v3":
vllm/engine/arg_utils.py
+3
-16
@@ -757,18 +757,6 @@ class EngineArgs:
757
lora_group.add_argument("--default-mm-loras",
758
**lora_kwargs["default_mm_loras"])
759
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
-
760
# Observability arguments
761
observability_kwargs = get_kwargs(ObservabilityConfig)
762
observability_group = parser.add_argument_group(
@@ -848,6 +836,8 @@ class EngineArgs:
836
title="VllmConfig",
837
description=VllmConfig.__doc__,
838
)
839
+ vllm_group.add_argument("--speculative-config",
840
+ **vllm_kwargs["speculative_config"])
841
vllm_group.add_argument("--kv-transfer-config",
842
**vllm_kwargs["kv_transfer_config"])
843
vllm_group.add_argument('--kv-events-config',
@@ -1033,10 +1023,7 @@ class EngineArgs:
1023
"enable_chunked_prefill": enable_chunked_prefill,
1024
"disable_log_stats": disable_log_stats,
1025
})
1036
- speculative_config = SpeculativeConfig.from_dict(
1037
- self.speculative_config)
1038
-
1039
- return speculative_config
1026
+ return SpeculativeConfig(**self.speculative_config)
1027
1028
def create_engine_config(
1029
self,