From 4fbd8bb597cf392b94def04a6955f22580356d76 Mon Sep 17 00:00:00 2001 From: Harry Mellor <19981378+hmellor@users.noreply.github.com> Date: Tue, 12 Aug 2025 06:13:32 +0100 Subject: [PATCH] Fix passing `SpeculativeConfig` from the CLI (#22652) Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --- vllm/engine/arg_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vllm/engine/arg_utils.py b/vllm/engine/arg_utils.py index 41a6da709bec7..d74db67bda0dc 100644 --- a/vllm/engine/arg_utils.py +++ b/vllm/engine/arg_utils.py @@ -826,6 +826,10 @@ class EngineArgs: title="VllmConfig", description=VllmConfig.__doc__, ) + # We construct SpeculativeConfig using fields from other configs in + # create_engine_config. So we set the type to a JSON string here to + # delay the Pydantic validation that comes with SpeculativeConfig. + vllm_kwargs["speculative_config"]["type"] = optional_type(json.loads) vllm_group.add_argument("--speculative-config", **vllm_kwargs["speculative_config"]) vllm_group.add_argument("--kv-transfer-config",