[Fast Start] Cache the MTP draft model in a separate daemon group (#57312)
Signed-off-by: liusy58 <mg21330037@smail.nju.edu.cn> Signed-off-by: Isotr0py <Isotr0py@outlook.com> Co-authored-by: Isotr0py <Isotr0py@outlook.com>
This commit is contained in:
@@ -14,7 +14,7 @@ from vllm.config.cache import CacheDType
|
||||
from vllm.config.kernel import MoEBackend
|
||||
from vllm.config.model import HfOverrides, ModelConfig
|
||||
from vllm.config.parallel import ParallelConfig
|
||||
from vllm.config.utils import config
|
||||
from vllm.config.utils import config, replace
|
||||
from vllm.logger import init_logger
|
||||
from vllm.transformers_utils.config import get_hf_text_config
|
||||
from vllm.utils.hashing import safe_hash
|
||||
@@ -25,8 +25,10 @@ if TYPE_CHECKING:
|
||||
from transformers import PretrainedConfig
|
||||
|
||||
import vllm.model_executor.layers.quantization as me_quant
|
||||
from vllm.config.vllm import VllmConfig
|
||||
else:
|
||||
PretrainedConfig = Any
|
||||
VllmConfig = Any
|
||||
|
||||
me_quant = LazyLoader(
|
||||
"model_executor", globals(), "vllm.model_executor.layers.quantization"
|
||||
@@ -371,6 +373,17 @@ def _validate_qwen3_omni_dspark(
|
||||
)
|
||||
|
||||
|
||||
# (SpeculativeConfig field, VllmConfig sub-config, overridden field)
|
||||
_DRAFT_VLLM_CONFIG_OVERRIDES = (
|
||||
# Otherwise the draft inherits the target's --moe-backend, which fails
|
||||
# when the draft is unquantized and that backend is not.
|
||||
("moe_backend", "kernel_config", "moe_backend"),
|
||||
# Only when set, so the draft keeps a KV cache layout the target shares.
|
||||
("attention_backend", "attention_config", "backend"),
|
||||
("kv_cache_dtype", "cache_config", "cache_dtype"),
|
||||
)
|
||||
|
||||
|
||||
@config
|
||||
class SpeculativeConfig:
|
||||
"""Configuration for speculative decoding."""
|
||||
@@ -1771,6 +1784,18 @@ class SpeculativeConfig:
|
||||
|
||||
return draft_parallel_config
|
||||
|
||||
def apply_draft_overrides(self, vllm_config: VllmConfig) -> VllmConfig:
|
||||
"""Overlay this config's kernel overrides onto a target VllmConfig.
|
||||
|
||||
Only non-None fields override, so an unset field keeps whatever the
|
||||
target resolved.
|
||||
"""
|
||||
for src, config_name, dst in _DRAFT_VLLM_CONFIG_OVERRIDES:
|
||||
if (value := getattr(self, src)) is not None:
|
||||
sub_config = replace(getattr(vllm_config, config_name), **{dst: value})
|
||||
vllm_config = replace(vllm_config, **{config_name: sub_config})
|
||||
return vllm_config
|
||||
|
||||
@field_validator("attention_backend", mode="before")
|
||||
@classmethod
|
||||
def _parse_attention_backend(cls, value: Any) -> Any:
|
||||
|
||||
Reference in New Issue
Block a user