[Diffusion] Add Minimax-H3 modular pipeline support (#5720)
Signed-off-by: Isotr0py <Isotr0py@outlook.com> Signed-off-by: lishunyang12 <lishunyang12@163.com> Signed-off-by: David Chen <530634352@qq.com> Co-authored-by: lishunyang12 <lishunyang12@163.com> Co-authored-by: SYLAR <125541396+lishunyang12@users.noreply.github.com> Co-authored-by: David Chen <530634352@qq.com>
This commit is contained in:
25 files changed
+843
-177
No files matched your search
@@ -213,9 +213,10 @@ class OmniServeCommand(CLISubcommand):
|
||||
"--task-type",
|
||||
type=str,
|
||||
default=None,
|
||||
choices=["CustomVoice", "VoiceDesign", "Base"],
|
||||
help="Default task type for TTS models (CustomVoice, VoiceDesign, or Base). "
|
||||
"If not specified, will be inferred from model path.",
|
||||
help="Model-defined startup task type. The selected model validates "
|
||||
"supported values; for example, TTS models accept CustomVoice, "
|
||||
"VoiceDesign, or Base, while diffusion models may use it to select "
|
||||
"task-specific weights. If omitted, the model default is used.",
|
||||
)
|
||||
# Forced aligner / word timestamps. --forced-aligner is the opt-in
|
||||
# toggle; heavier knobs (gpu_memory_utilization, dtype, max_model_len)
|
||||
|
||||
@@ -9,6 +9,7 @@ from typing import Any, Literal
|
||||
import huggingface_hub
|
||||
import vllm.envs as envs
|
||||
from vllm.logger import init_logger
|
||||
from vllm.transformers_utils.repo_utils import file_or_path_exists
|
||||
from vllm.v1.engine.exceptions import EngineDeadError, EngineGenerateError
|
||||
|
||||
from vllm_omni.engine.async_omni_engine import AsyncOmniEngine
|
||||
@@ -73,6 +74,16 @@ def omni_snapshot_download(model_id: str) -> str:
|
||||
|
||||
return snapshot_download(model_id)
|
||||
|
||||
# Modular Diffusers repositories describe independently loadable
|
||||
# components. Let the selected pipeline download only its component
|
||||
# sources instead of eagerly materializing the entire repository.
|
||||
try:
|
||||
if file_or_path_exists(model_id, "modular_model_index.json", revision=None):
|
||||
return model_id
|
||||
except (huggingface_hub.errors.GatedRepoError, huggingface_hub.errors.RepositoryNotFoundError):
|
||||
# Preserve the more helpful errors raised by the full-download path.
|
||||
pass
|
||||
|
||||
try:
|
||||
download_weights_from_hf_specific(
|
||||
model_name_or_path=model_id,
|
||||
|
||||
@@ -16,7 +16,10 @@ from vllm_omni.config.config_factory import StageConfigFactory, with_trust_remot
|
||||
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
|
||||
from vllm_omni.diffusion.utils.hf_utils import _looks_like_dreamzero
|
||||
from vllm_omni.diffusion.utils.hf_utils import (
|
||||
_looks_like_dreamzero,
|
||||
get_diffusion_model_index,
|
||||
)
|
||||
from vllm_omni.entrypoints.stage_utils import _to_dict
|
||||
from vllm_omni.inputs.data import OmniSamplingParams
|
||||
from vllm_omni.platforms import current_omni_platform
|
||||
@@ -74,9 +77,9 @@ def _try_get_class_name_from_diffusers_config(model: str) -> str | None:
|
||||
Returns:
|
||||
Model type string if found, None otherwise
|
||||
"""
|
||||
model_index = get_hf_file_to_dict("model_index.json", model, revision=None)
|
||||
model_index = get_diffusion_model_index(model)
|
||||
if model_index and isinstance(model_index, dict) and "_class_name" in model_index:
|
||||
logger.debug(f"Found model_type '{model_index['_class_name']}' in model_index.json")
|
||||
logger.debug(f"Found Diffusers model type '{model_index['_class_name']}'")
|
||||
return model_index["_class_name"]
|
||||
|
||||
return None
|
||||
@@ -278,12 +281,12 @@ def resolve_model_config_path(model: str) -> str | None:
|
||||
model_type = hf_config.model_type
|
||||
except (ValueError, Exception):
|
||||
# If standard transformers format fails, try diffusers format
|
||||
if file_or_path_exists(model, "model_index.json", revision=None):
|
||||
if get_diffusion_model_index(model) is not None:
|
||||
model_type = _try_get_class_name_from_diffusers_config(model)
|
||||
if model_type is None:
|
||||
raise ValueError(
|
||||
f"Could not determine model_type for diffusers model: {model}. "
|
||||
f"Please ensure the model has 'model_type' in transformer/config.json or model_index.json"
|
||||
"Please ensure its Diffusers pipeline index contains '_class_name'"
|
||||
)
|
||||
elif file_or_path_exists(model, "config.json", revision=None):
|
||||
# Try to read config.json manually for custom models like Bagel that fail get_config
|
||||
@@ -308,7 +311,7 @@ def resolve_model_config_path(model: str) -> str | None:
|
||||
if model_type is None:
|
||||
raise ValueError(
|
||||
f"Could not determine model_type for model: {model}. "
|
||||
f"Model is not in standard transformers format and does not have model_index.json. "
|
||||
"Model is not in standard transformers or Diffusers format. "
|
||||
f"Please ensure the model has proper configuration files with 'model_type' field"
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user