[New Model] support nemotron Audex (#4976)

Signed-off-by: Yuekai Zhang <zhangyuekai@foxmail.com>
Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Yueqian Lin <linyueqian@outlook.com>
Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-07-28 03:58:22 +00:00
1 parent f2c5152df0
commit 5014fea4a0
64 files changed
+7760 -39

No files matched your search

+13 -4
View File
@@ -30,7 +30,7 @@ from vllm.logger import init_logger
from vllm.v1.engine import EngineCoreRequest
from vllm.v1.engine.input_processor import InputProcessor
from vllm_omni.config.config_factory import StageConfigFactory
from vllm_omni.config.config_factory import StageConfigFactory, with_trust_remote_code_override
from vllm_omni.config.stage_config import (
DuplexSessionRuntimeConfig,
load_deploy_config,
@@ -151,7 +151,7 @@ class AsyncOmniEngine:
transfer_emitter: Any = None,
log_stats: bool = False,
tokenizer: str | None = None,
trust_remote_code: bool = False,
trust_remote_code: bool | None = None,
**kwargs: Any,
) -> None:
self.model = model
@@ -230,7 +230,11 @@ class AsyncOmniEngine:
if deploy_config_path is not None:
self.duplex_session_config = load_deploy_config(deploy_config_path).duplex_session
kwargs["trust_remote_code"] = trust_remote_code
# Tri-state: None means "not specified" — the deploy yaml's per-stage
# trust_remote_code stays in effect. An explicit True/False here is a
# global override (precedence: caller > deploy yaml > default False);
# the merge rule lives in with_trust_remote_code_override.
kwargs = with_trust_remote_code_override(kwargs, trust_remote_code)
self.config_path, self.stage_configs = self._resolve_stage_configs(
model,
kwargs,
@@ -786,6 +790,11 @@ class AsyncOmniEngine:
supported_tasks=self.supported_tasks,
)
request.external_req_id = cid
# Companions are stage-0-final: without this worker-visible tag
# the AR runner would still emit downstream connector payloads
# for them (the orchestrator-side final_stage_id=0 registration
# alone does not reach the worker).
request = apply_omni_final_stage_metadata(request, 0)
# Registration of this companion on stage-0's output processor is
# deferred to Orchestrator._handle_add_companion, which routes
@@ -1142,7 +1151,7 @@ class AsyncOmniEngine:
model: str,
kwargs: dict[str, Any],
*,
trust_remote_code: bool,
trust_remote_code: bool | None,
) -> tuple[str, list[Any]]:
"""Resolve stage configs and inject defaults shared by orchestrator/headless."""
+8 -1
View File
@@ -30,7 +30,10 @@ from vllm.v1.engine.utils import (
from vllm_omni.distributed.omni_coordinator import create_stage_coord_client
from vllm_omni.engine import OmniEngineCoreRequest
from vllm_omni.engine.stage_init_utils import set_death_signal
from vllm_omni.engine.stage_init_utils import (
maybe_apply_audex_cfg_patches,
set_death_signal,
)
logger = init_logger(__name__)
@@ -131,6 +134,10 @@ class StageEngineCoreProc(EngineCoreProc):
_vllm_engine_core_module.EngineCoreRequest,
)
# Audex CFG scheduler patches must land before EngineCore builds
# its Scheduler; gated on the stage's logits_processors config.
maybe_apply_audex_cfg_patches(kwargs.get("vllm_config"))
engine_core = StageEngineCoreProc(
*args,
engine_index=dp_rank,
+65
View File
@@ -767,11 +767,53 @@ def build_engine_args_dict(
stage_id = stage_config.stage_id
engine_args_dict = _to_dict(engine_args)
pipeline_model_root = model
model = engine_args_dict.pop("model", None) or model
stage_defines_tokenizer = (
engine_args_dict.get("tokenizer") is not None or engine_args_dict.get("tokenizer_subdir") is not None
)
audex_stage = str(engine_args_dict.get("model_stage") or "")
if audex_stage == "audex_xcodec":
# TTA stage 1 decodes with the external XCodec1 checkpoint, not a
# subfolder of the Audex repo: the source comes from XCODEC1_PATH,
# the stage yaml's own ``model`` entry, or the default HF repo — the
# pipeline-level model (the Audex root) is never a valid source.
from vllm_omni.model_executor.models.audex.checkpoint import (
ensure_audex_snapshot,
ensure_xcodec1_snapshot,
)
stage_model = None if model == pipeline_model_root else model
model = ensure_xcodec1_snapshot(os.environ.get("XCODEC1_PATH") or stage_model)
if not stage_defines_tokenizer:
# XCodec1 ships no tokenizer files; borrow the thinker's (same
# workaround as the TTS decoder stage).
audex_root = ensure_audex_snapshot(pipeline_model_root, profile="tta")
engine_args_dict["tokenizer"] = os.path.join(audex_root, "checkpoint_folder_audiogen")
stage_defines_tokenizer = True
elif audex_stage.startswith("audex"):
# Audex users pass the HF repo ROOT; make sure the required snapshot
# subset exists locally BEFORE subdir resolution, otherwise the
# subdirs get joined onto the raw repo id on a fresh cache. The
# profile keeps TTS-only deployments from pulling the full-checkpoint
# extras.
from vllm_omni.model_executor.models.audex.checkpoint import ensure_audex_snapshot
if audex_stage == "audex_omni":
audex_profile = "full"
elif audex_stage == "audex_tta_thinker":
audex_profile = "tta"
else:
audex_profile = "tts"
model = ensure_audex_snapshot(model, profile=audex_profile)
model = _resolve_model_tokenizer_paths(model, engine_args_dict)
if engine_args_dict.get("model_stage") in ("audex_thinker", "audex_tta_thinker"):
# Audex ships its thinker weights deduplicated into a sibling folder;
# replicate the official prepare-script symlink on first use. The TTA
# thinker loads the same checkpoint_folder_audiogen checkpoint.
from vllm_omni.model_executor.models.audex.checkpoint import ensure_audiogen_weights
ensure_audiogen_weights(model)
apply_cli_tokenizer(
engine_args_dict,
cli_tokenizer=cli_tokenizer,
@@ -1197,3 +1239,26 @@ def initialize_diffusion_stage(
od_config = build_diffusion_config(model, stage_cfg, metadata)
return create_diffusion_client(model, od_config, metadata, stage_init_timeout, batch_size, use_inline)
def maybe_apply_audex_cfg_patches(vllm_config: Any) -> None:
"""Install the Audex CFG scheduler patches for CFG-configured engines.
Must run in the engine-core process BEFORE ``Scheduler`` is constructed:
the patch wraps ``Scheduler.__init__`` to add the pair registry, so a
scheduler built earlier would never become pair-aware. Gated on the
engine's ``logits_processors`` so non-CFG stages stay untouched.
"""
model_config = getattr(vllm_config, "model_config", None)
processors = getattr(model_config, "logits_processors", None) or []
if not any("AudexCFGLogitsProcessor" in getattr(proc, "__name__", str(proc)) for proc in processors):
return
from vllm_omni.model_executor.models.audex.cfg import apply_cfg_patches
apply_cfg_patches()
from vllm.v1.core.sched.scheduler import Scheduler
if not getattr(Scheduler.schedule, "_audex_cfg_patched", False):
raise RuntimeError("Audex CFG scheduler patches failed to install before Scheduler construction")