[Config Refactor][2/N] Pipeline + Deploy Config Schema (#2383)
Signed-off-by: lishunyang <lishunyang12@163.com> Signed-off-by: reidliu41 <reid201711@gmail.com> Signed-off-by: Alex Brooks <albrooks@redhat.com> Co-authored-by: reidliu41 <reid201711@gmail.com> Co-authored-by: xiaohajiayou <75477391+xiaohajiayou@users.noreply.github.com> Co-authored-by: Alex Brooks <albrooks@redhat.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
104 files changed
+3959
-3814
No files matched your search
@@ -1,6 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import types
|
||||
import weakref
|
||||
@@ -15,7 +17,7 @@ from vllm.v1.engine.exceptions import EngineDeadError
|
||||
from vllm_omni.engine.async_omni_engine import AsyncOmniEngine
|
||||
from vllm_omni.entrypoints.client_request_state import ClientRequestState
|
||||
from vllm_omni.entrypoints.pd_utils import PDDisaggregationMixin
|
||||
from vllm_omni.entrypoints.utils import get_final_stage_id_for_e2e
|
||||
from vllm_omni.entrypoints.utils import detect_explicit_cli_keys, get_final_stage_id_for_e2e
|
||||
from vllm_omni.metrics.stats import OrchestratorAggregator as OrchestratorMetrics
|
||||
from vllm_omni.model_executor.model_loader.weight_utils import download_weights_from_hf_specific
|
||||
from vllm_omni.outputs import OmniRequestOutput
|
||||
@@ -69,6 +71,48 @@ OutputMessageHandleResult = tuple[Literal[True], None, None, None] | tuple[Liter
|
||||
class OmniBase(PDDisaggregationMixin):
|
||||
"""Shared runtime foundation for AsyncOmni and Omni."""
|
||||
|
||||
@classmethod
|
||||
def from_cli_args(
|
||||
cls,
|
||||
args: argparse.Namespace,
|
||||
*,
|
||||
parser: argparse.ArgumentParser | None = None,
|
||||
**overrides: Any,
|
||||
) -> OmniBase:
|
||||
"""Construct an ``Omni`` / ``AsyncOmni`` from an ``argparse.Namespace``.
|
||||
|
||||
Mirrors the ``EngineArgs.from_cli_args`` pattern used upstream and in
|
||||
``OmniEngineArgs.from_cli_args``. This is the recommended entry point
|
||||
for any argparse-based caller (offline scripts, tests, CI): it
|
||||
expands ``vars(args)`` into kwargs and automatically captures which
|
||||
flags the user typed on the command line so that argparse defaults
|
||||
do not silently override deploy YAML values.
|
||||
|
||||
Passing ``parser`` is strongly recommended: without it, flag-to-dest
|
||||
resolution falls back to a name-based heuristic that misidentifies
|
||||
flags with ``dest=`` overrides, alias flags, and ``--disable-X`` /
|
||||
``store_false`` pairs. See :func:`detect_explicit_cli_keys`.
|
||||
|
||||
Args:
|
||||
args: Parsed argparse namespace from ``parser.parse_args()``.
|
||||
parser: The argparse parser used to produce ``args``. When
|
||||
provided, each user-typed flag is resolved to its real
|
||||
``dest`` via the parser's action table.
|
||||
**overrides: Extra keyword arguments that take precedence over
|
||||
attributes on ``args``.
|
||||
|
||||
Example::
|
||||
|
||||
parser = FlexibleArgumentParser()
|
||||
parser.add_argument("--model", required=True)
|
||||
args = parser.parse_args()
|
||||
omni = Omni.from_cli_args(args, parser=parser) # preferred
|
||||
omni = Omni.from_cli_args(args, parser=parser, model="other")
|
||||
"""
|
||||
kwargs: dict[str, Any] = {**vars(args), **overrides}
|
||||
kwargs["_cli_explicit_keys"] = detect_explicit_cli_keys(sys.argv[1:], parser)
|
||||
return cls(**kwargs)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
model: str,
|
||||
|
||||
Reference in new issue
Block a user