[Bugfix] Preserve object storage URIs during model resolution (#5036)

Signed-off-by: Ziyang Zhang <hafuhafu@qq.com>
This commit is contained in:
Ma1oneZhang authored and GitHub committed 2026-08-15 14:11:48 +08:00
1 parent 35cacf020c
commit 6f36fd3b78
6 files changed
+267 -18

No files matched your search

+23 -12
View File
@@ -11,7 +11,12 @@ from vllm.sampling_params import RequestOutputKind, SamplingParams
from vllm.transformers_utils.config import get_config, get_hf_file_to_dict
from vllm.transformers_utils.repo_utils import file_or_path_exists
from vllm_omni.config.config_factory import StageConfigFactory, with_trust_remote_code_override
from vllm_omni.config.config_factory import (
StageConfigFactory,
_materialize_object_storage_configs,
_name_match_candidate,
with_trust_remote_code_override,
)
from vllm_omni.config.pipeline_registry import OMNI_PIPELINES
from vllm_omni.config.stage_config import _DEPLOY_DIR
from vllm_omni.config.yaml_util import create_config, load_yaml_config, merge_configs
@@ -210,12 +215,13 @@ def _try_resolve_omni_model_type(model: str) -> str | None:
Searches both the legacy ``stage_configs/*.yaml`` directory and the
migrated ``deploy/*.yaml`` directory for a stem that substring-matches
the model path (e.g. ``cosyvoice3`` in
``FunAudioLLM/Fun-CosyVoice3-0.5B-2512``). The longest match wins so
``cosyvoice3`` beats ``cosyvoice`` and ``bagel_single_stage`` beats
``bagel``.
the model path basename (e.g. ``cosyvoice3`` in
``FunAudioLLM/Fun-CosyVoice3-0.5B-2512``). Only the basename is scanned
so URI segments such as the bucket name cannot select an unrelated
pipeline. The longest match wins so ``cosyvoice3`` beats ``cosyvoice``
and ``bagel_single_stage`` beats ``bagel``.
"""
model_lower = model.lower().replace("-", "").replace("_", "")
model_lower = _name_match_candidate(model).lower().replace("-", "").replace("_", "")
best_match: str | None = None
best_len = 0
for subdir in ("model_executor/stage_configs", "deploy"):
@@ -274,24 +280,29 @@ def resolve_model_config_path(model: str) -> str | None:
Raises:
ValueError: If model_type cannot be determined
"""
# Object-storage URIs are streamed by vLLM's Run:AI streamer only after
# each stage builds its ModelConfig, so config resolution here reads the
# local copy that vLLM-Omni materializes for such URIs. Name-based
# fallbacks keep the original string (the materialized path is a hash).
config_source = _materialize_object_storage_configs(model)
# Try to get config from standard transformers format first
try:
hf_config = get_config(model, trust_remote_code=True)
hf_config = get_config(config_source, trust_remote_code=True)
model_type = hf_config.model_type
except (ValueError, Exception):
# If standard transformers format fails, try diffusers format
if get_diffusion_model_index(model) is not None:
model_type = _try_get_class_name_from_diffusers_config(model)
if get_diffusion_model_index(config_source) is not None:
model_type = _try_get_class_name_from_diffusers_config(config_source)
if model_type is None:
raise ValueError(
f"Could not determine model_type for diffusers model: {model}. "
"Please ensure its Diffusers pipeline index contains '_class_name'"
)
elif file_or_path_exists(model, "config.json", revision=None):
elif file_or_path_exists(config_source, "config.json", revision=None):
# Try to read config.json manually for custom models like Bagel that fail get_config
# but have a valid config.json with model_type
try:
config_dict = get_hf_file_to_dict("config.json", model, revision=None)
config_dict = get_hf_file_to_dict("config.json", config_source, revision=None)
if config_dict and "model_type" in config_dict:
model_type = config_dict["model_type"]
else:
@@ -315,7 +326,7 @@ def resolve_model_config_path(model: str) -> str | None:
)
default_config_path = current_omni_platform.get_default_stage_config_path()
if model_type == "vla" and _looks_like_dreamzero(model):
if model_type == "vla" and _looks_like_dreamzero(config_source):
model_type = "dreamzero"
if model_type in _DIFFUSERS_CLASS_TO_CONFIG: