[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
@@ -9,6 +9,7 @@ import argparse
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
from types import FrameType
|
||||
from typing import Any
|
||||
|
||||
@@ -21,6 +22,7 @@ from vllm.utils.argparse_utils import FlexibleArgumentParser
|
||||
|
||||
from vllm_omni.entrypoints.cli.logo import log_logo
|
||||
from vllm_omni.entrypoints.openai.api_server import omni_run_server
|
||||
from vllm_omni.entrypoints.utils import detect_explicit_cli_keys
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
@@ -79,6 +81,9 @@ class OmniServeCommand(CLISubcommand):
|
||||
"""The `serve` subcommand for the vLLM CLI."""
|
||||
|
||||
name = "serve"
|
||||
# Parser stashed at subparser_init so ``cmd`` can resolve each user-typed
|
||||
# flag to its real ``dest`` via the parser's action table.
|
||||
_parser: FlexibleArgumentParser | None = None
|
||||
|
||||
@staticmethod
|
||||
def cmd(args: argparse.Namespace) -> None:
|
||||
@@ -90,6 +95,10 @@ class OmniServeCommand(CLISubcommand):
|
||||
if hasattr(args, "model_tag") and args.model_tag is not None:
|
||||
args.model = args.model_tag
|
||||
|
||||
# Stash the set of long-option keys the user actually typed so the
|
||||
# stage-config factory can give YAML precedence over argparse defaults.
|
||||
args._cli_explicit_keys = detect_explicit_cli_keys(sys.argv[1:], OmniServeCommand._parser)
|
||||
|
||||
if args.headless:
|
||||
run_headless(args)
|
||||
else:
|
||||
@@ -138,11 +147,33 @@ class OmniServeCommand(CLISubcommand):
|
||||
help="Default task type for TTS models (CustomVoice, VoiceDesign, or Base). "
|
||||
"If not specified, will be inferred from model path.",
|
||||
)
|
||||
# TODO(@lishunyang12): deprecate once all models migrate to --deploy-config
|
||||
omni_config_group.add_argument(
|
||||
"--stage-configs-path",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Path to the stage configs file. If not specified, the stage configs will be loaded from the model.",
|
||||
help="[Deprecated — will be removed in a future release] Path to a legacy "
|
||||
"stage configs YAML (stage_args format). Prefer --deploy-config for new-format deploy YAMLs.",
|
||||
)
|
||||
omni_config_group.add_argument(
|
||||
"--deploy-config",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Path to a deploy config YAML (new format with stages/engine_args). "
|
||||
"Mutually exclusive with --stage-configs-path.",
|
||||
)
|
||||
omni_config_group.add_argument(
|
||||
"--stage-overrides",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Per-stage JSON overrides. Example: "
|
||||
'\'{"0": {"gpu_memory_utilization": 0.8}, "2": {"enforce_eager": true}}\'',
|
||||
)
|
||||
omni_config_group.add_argument(
|
||||
"--async-chunk",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=None,
|
||||
help="Override the deploy YAML's ``async_chunk:`` bool. Unset leaves the YAML value in force.",
|
||||
)
|
||||
omni_config_group.add_argument(
|
||||
"--stage-id",
|
||||
@@ -406,6 +437,9 @@ class OmniServeCommand(CLISubcommand):
|
||||
action="store_true",
|
||||
help="Enable diffusion pipeline profiler to display stage durations.",
|
||||
)
|
||||
# Stash via type(self) so the docs hook (which execs this function in a
|
||||
# sandboxed globals dict via ``DummySelf``) doesn't fail on a NameError.
|
||||
type(self)._parser = serve_parser
|
||||
return serve_parser
|
||||
|
||||
|
||||
@@ -461,10 +495,15 @@ def run_headless(args: argparse.Namespace) -> None:
|
||||
raise ValueError("headless mode requires worker_backend=multi_process")
|
||||
|
||||
args_dict = vars(args).copy()
|
||||
# Preserve the explicit-keys set captured at parse time so per-stage yaml
|
||||
# values (e.g. stage 1's ``gpu_memory_utilization: 0.5``) are not
|
||||
# overwritten by argparse defaults for flags the user didn't type.
|
||||
cli_explicit_keys = args_dict.pop("_cli_explicit_keys", None)
|
||||
config_path, stage_configs = load_and_resolve_stage_configs(
|
||||
model,
|
||||
args_dict.get("stage_configs_path"),
|
||||
args_dict,
|
||||
cli_explicit_keys=cli_explicit_keys,
|
||||
)
|
||||
|
||||
# Locate the stage config that matches stage_id.
|
||||
|
||||
Reference in new issue
Block a user