Remove from_dict from SpeculativeConfig (#22451)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor 2025-08-07 18:13:04 +01:00 committed by GitHub
parent 139d155781
commit 7e3a8dc906
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 28 deletions

View File

@ -47,13 +47,12 @@ def test_ngram_proposer():
model_config = ModelConfig(model="facebook/opt-125m") model_config = ModelConfig(model="facebook/opt-125m")
return NgramProposer( return NgramProposer(
vllm_config=VllmConfig(model_config=model_config, vllm_config=VllmConfig(model_config=model_config,
speculative_config=SpeculativeConfig. speculative_config=SpeculativeConfig(
from_dict({ prompt_lookup_min=min_n,
"prompt_lookup_min": min_n, prompt_lookup_max=max_n,
"prompt_lookup_max": max_n, num_speculative_tokens=k,
"num_speculative_tokens": k, method="ngram",
"method": "ngram", )))
})))
# No match. # No match.
result = ngram_proposer( result = ngram_proposer(

View File

@ -2895,11 +2895,6 @@ class SpeculativeConfig:
usedforsecurity=False).hexdigest() usedforsecurity=False).hexdigest()
return hash_str return hash_str
@classmethod
def from_dict(cls, dict_value: dict) -> "SpeculativeConfig":
"""Parse the CLI value for the speculative config."""
return cls(**dict_value)
@staticmethod @staticmethod
def hf_config_override(hf_config: PretrainedConfig) -> PretrainedConfig: def hf_config_override(hf_config: PretrainedConfig) -> PretrainedConfig:
if hf_config.model_type == "deepseek_v3": if hf_config.model_type == "deepseek_v3":

View File

@ -757,18 +757,6 @@ class EngineArgs:
lora_group.add_argument("--default-mm-loras", lora_group.add_argument("--default-mm-loras",
**lora_kwargs["default_mm_loras"]) **lora_kwargs["default_mm_loras"])
# Speculative arguments
speculative_group = parser.add_argument_group(
title="SpeculativeConfig",
description=SpeculativeConfig.__doc__,
)
speculative_group.add_argument(
"--speculative-config",
type=json.loads,
default=None,
help="The configurations for speculative decoding. Should be a "
"JSON string.")
# Observability arguments # Observability arguments
observability_kwargs = get_kwargs(ObservabilityConfig) observability_kwargs = get_kwargs(ObservabilityConfig)
observability_group = parser.add_argument_group( observability_group = parser.add_argument_group(
@ -848,6 +836,8 @@ class EngineArgs:
title="VllmConfig", title="VllmConfig",
description=VllmConfig.__doc__, description=VllmConfig.__doc__,
) )
vllm_group.add_argument("--speculative-config",
**vllm_kwargs["speculative_config"])
vllm_group.add_argument("--kv-transfer-config", vllm_group.add_argument("--kv-transfer-config",
**vllm_kwargs["kv_transfer_config"]) **vllm_kwargs["kv_transfer_config"])
vllm_group.add_argument('--kv-events-config', vllm_group.add_argument('--kv-events-config',
@ -1033,10 +1023,7 @@ class EngineArgs:
"enable_chunked_prefill": enable_chunked_prefill, "enable_chunked_prefill": enable_chunked_prefill,
"disable_log_stats": disable_log_stats, "disable_log_stats": disable_log_stats,
}) })
speculative_config = SpeculativeConfig.from_dict( return SpeculativeConfig(**self.speculative_config)
self.speculative_config)
return speculative_config
def create_engine_config( def create_engine_config(
self, self,