Rebase multi-API serving on latest main
Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
1 parent
78934753ff
commit
dc3c7dbe16
25 files changed
+1832
-202
No files matched your search
@@ -4,12 +4,14 @@
|
||||
import json
|
||||
import os
|
||||
import types
|
||||
from dataclasses import fields, is_dataclass
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass, fields, is_dataclass
|
||||
from typing import Any, get_args, get_origin
|
||||
|
||||
from vllm.logger import init_logger
|
||||
from vllm.sampling_params import RequestOutputKind, SamplingParams
|
||||
|
||||
from vllm_omni.config.config_factory import with_trust_remote_code_override
|
||||
from vllm_omni.entrypoints.stage_utils import _to_dict
|
||||
from vllm_omni.inputs.data import OmniSamplingParams
|
||||
|
||||
@@ -79,6 +81,64 @@ def parse_stage_overrides(value: Any) -> dict[str, dict[str, Any]] | None:
|
||||
return parsed
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class StageConfigInputs:
|
||||
"""Normalized inputs shared by all stage-config loading paths."""
|
||||
|
||||
model: str
|
||||
kwargs: dict[str, Any]
|
||||
trust_remote_code: bool | None
|
||||
deploy_config_path: str | None
|
||||
stage_overrides: dict[str, dict[str, Any]] | None
|
||||
strategy_config_path: str | None
|
||||
|
||||
|
||||
def prepare_stage_config_inputs(
|
||||
model: str,
|
||||
kwargs: Mapping[str, Any],
|
||||
*,
|
||||
trust_remote_code: bool | None,
|
||||
snapshot_model: bool = False,
|
||||
) -> StageConfigInputs:
|
||||
"""Normalize model/config arguments before resolving stage configs.
|
||||
|
||||
The standard API worker, multi-API parent, and headless entrypoint must
|
||||
apply the same legacy-key filtering, trust-remote-code precedence, and
|
||||
config-file extraction before calling :func:`resolve_omni_config`.
|
||||
"""
|
||||
resolved_model = model
|
||||
if snapshot_model:
|
||||
# Keep model materialization at the CLI boundary for the parent-owned
|
||||
# launch path. The API worker's OmniBase has already done this work.
|
||||
from vllm_omni.entrypoints.omni_base import omni_snapshot_download
|
||||
|
||||
resolved_model = omni_snapshot_download(model)
|
||||
|
||||
resolved_kwargs = dict(kwargs)
|
||||
for legacy_arg in ("stage_configs_path", "stage_configs"):
|
||||
if legacy_arg in resolved_kwargs:
|
||||
raise ValueError(f"`{legacy_arg}` is no longer supported; use `deploy_config` instead.")
|
||||
# Frontend process count is not a stage engine override.
|
||||
resolved_kwargs.pop("api_server_count", None)
|
||||
resolved_kwargs.pop("disable_log_stats", None)
|
||||
if resolved_kwargs.get("diffusion_streaming_output") and resolved_kwargs.get("streaming_output") is None:
|
||||
resolved_kwargs["streaming_output"] = True
|
||||
resolved_kwargs.pop("model_tag", None)
|
||||
|
||||
resolved_kwargs = with_trust_remote_code_override(resolved_kwargs, trust_remote_code)
|
||||
deploy_config_path = resolved_kwargs.pop("deploy_config", None)
|
||||
strategy_config_path = resolved_kwargs.pop("strategy_config", None)
|
||||
stage_overrides = parse_stage_overrides(resolved_kwargs.pop("stage_overrides", None))
|
||||
return StageConfigInputs(
|
||||
model=resolved_model,
|
||||
kwargs=resolved_kwargs,
|
||||
trust_remote_code=trust_remote_code,
|
||||
deploy_config_path=deploy_config_path,
|
||||
stage_overrides=stage_overrides,
|
||||
strategy_config_path=strategy_config_path,
|
||||
)
|
||||
|
||||
|
||||
def get_final_stage_id_for_e2e(
|
||||
output_modalities: list[str] | None, default_modalities: list[str], stage_list: list
|
||||
) -> int:
|
||||
|
||||
Reference in new issue
Block a user