[Config] Return VllmOmniConfig from create_from_model (#4818)
Signed-off-by: zwhzzz0821 <2831474076@qq.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
907f932b72
commit
793d3e9ab7
56 files changed
+865
-282
No files matched your search
@@ -314,6 +314,8 @@ def resolve_model_config_path(model: str) -> str:
|
||||
|
||||
def load_stage_configs_from_model(
|
||||
model: str,
|
||||
*,
|
||||
trust_remote_code: bool,
|
||||
base_engine_args: dict | None = None,
|
||||
deploy_config_path: str | None = None,
|
||||
stage_overrides: dict[str, dict[str, Any]] | None = None,
|
||||
@@ -322,13 +324,14 @@ def load_stage_configs_from_model(
|
||||
"""Load stage configurations from model's default config file.
|
||||
|
||||
For models registered in the pipeline registry (new path), uses
|
||||
``StageConfigFactory.create_from_model()`` which merges
|
||||
``StageConfigFactory.create_legacy_stage_configs_from_model()`` which merges
|
||||
PipelineConfig + DeployConfig + CLI overrides.
|
||||
|
||||
For other models (legacy path), loads stage configs from YAML.
|
||||
|
||||
Args:
|
||||
model: Model name or path (used to determine model_type)
|
||||
trust_remote_code: Whether to trust remote code while resolving the model config.
|
||||
base_engine_args: Base engine args to merge as CLI overrides.
|
||||
deploy_config_path: Optional explicit deploy config path.
|
||||
stage_overrides: Per-stage overrides from --stage-overrides.
|
||||
@@ -346,20 +349,25 @@ def load_stage_configs_from_model(
|
||||
base_engine_args = {}
|
||||
|
||||
cli_overrides = _convert_dataclasses_to_dict(dict(base_engine_args))
|
||||
cli_overrides["trust_remote_code"] = trust_remote_code
|
||||
if stage_overrides:
|
||||
for stage_id_str, overrides in stage_overrides.items():
|
||||
for key, val in overrides.items():
|
||||
cli_overrides[f"stage_{stage_id_str}_{key}"] = val
|
||||
|
||||
# Current runtime initialization still consumes legacy OmegaConf stage
|
||||
# configs. ``StageConfigFactory.create_from_model`` now produces the
|
||||
# structured ``VllmOmniConfig`` object; future RFC #4021 changes will
|
||||
# migrate the engine/runtime consumers and replace this legacy resolver.
|
||||
strategy_specs = None
|
||||
if strategy_config_path is not None:
|
||||
from vllm_omni.config.composable_parallel.strategy_loader import load_strategy_specs
|
||||
|
||||
strategy_specs = load_strategy_specs(strategy_config_path)
|
||||
|
||||
stages, omni_lb_policy = StageConfigFactory.create_from_model(
|
||||
stages, omni_lb_policy = StageConfigFactory.create_legacy_stage_configs_from_model(
|
||||
model,
|
||||
trust_remote_code=cli_overrides.get("trust_remote_code", False),
|
||||
trust_remote_code=trust_remote_code,
|
||||
cli_overrides=cli_overrides,
|
||||
deploy_config_path=deploy_config_path,
|
||||
strategy_specs=strategy_specs,
|
||||
@@ -550,6 +558,8 @@ def load_and_resolve_stage_configs(
|
||||
model: str,
|
||||
stage_configs_path: str | None,
|
||||
kwargs: dict | None,
|
||||
*,
|
||||
trust_remote_code: bool,
|
||||
default_stage_cfg_factory: Any = None,
|
||||
deploy_config_path: str | None = None,
|
||||
stage_overrides: dict[str, dict[str, Any]] | None = None,
|
||||
@@ -561,6 +571,7 @@ def load_and_resolve_stage_configs(
|
||||
model: Model name or path
|
||||
stage_configs_path: Optional path to legacy YAML (stage_args format)
|
||||
kwargs: Engine arguments to merge with stage configs
|
||||
trust_remote_code: Whether to trust remote code while resolving the model config.
|
||||
default_stage_cfg_factory: Optional callable that takes no args and returns
|
||||
default stage config list when no configs are found
|
||||
deploy_config_path: Optional path to deploy YAML (new format).
|
||||
@@ -606,6 +617,7 @@ def load_and_resolve_stage_configs(
|
||||
config_path = deploy_config_path
|
||||
stage_configs, omni_lb_policy = load_stage_configs_from_model(
|
||||
model,
|
||||
trust_remote_code=trust_remote_code,
|
||||
base_engine_args=kwargs,
|
||||
deploy_config_path=deploy_config_path,
|
||||
stage_overrides=stage_overrides,
|
||||
@@ -621,6 +633,7 @@ def load_and_resolve_stage_configs(
|
||||
config_path = resolve_model_config_path(model)
|
||||
stage_configs, omni_lb_policy = load_stage_configs_from_model(
|
||||
model,
|
||||
trust_remote_code=trust_remote_code,
|
||||
base_engine_args=kwargs,
|
||||
stage_overrides=stage_overrides,
|
||||
strategy_config_path=strategy_config_path,
|
||||
|
||||
Reference in new issue
Block a user