[Model] Add YuE2-3B text-to-music (model + /v1/audio/speech adapter) (#7886)

Signed-off-by: Youyuan Li <105433145+Darcy-Lee@users.noreply.github.com>
Signed-off-by: princepride <wangzhipeng628@gmail.com>
Co-authored-by: princepride <wangzhipeng628@gmail.com>
This commit is contained in:
Youyuan Liandprincepride authored and GitHub committed 2026-10-01 18:04:31 +08:00
1 parent a038b38179
commit 423f34326e
27 files changed
+3294 -6

No files matched your search

@@ -26,6 +26,7 @@ _CLASS_TO_MODULE: dict[str, str] = {
"VoxtralTTSConfig": "vllm_omni.transformers_utils.configs.voxtral_tts",
"CosyVoice3Config": "vllm_omni.transformers_utils.configs.cosyvoice3",
"MiniMaxMusic3Config": "vllm_omni.transformers_utils.configs.minimax_music3",
"Yue2Config": "vllm_omni.transformers_utils.configs.yue2",
"OmniVoiceConfig": "vllm_omni.transformers_utils.configs.omnivoice",
"BailingMoeV2Config": "vllm_omni.transformers_utils.configs.ming_flash_omni",
"BailingMM2Config": "vllm_omni.transformers_utils.configs.ming_flash_omni",
@@ -56,6 +57,7 @@ __all__ = [
"VoxtralTTSConfig",
"CosyVoice3Config",
"MiniMaxMusic3Config",
"Yue2Config",
"OmniVoiceConfig",
"BailingMoeV2Config",
"BailingMM2Config",
@@ -96,3 +98,4 @@ from vllm_omni.transformers_utils.configs import omnivoice as _omnivoice # noqa
from vllm_omni.transformers_utils.configs import sensenova_u1 as _sensenova_u1 # noqa: F401, E402
from vllm_omni.transformers_utils.configs import voxcpm2 as _voxcpm2 # noqa: F401, E402
from vllm_omni.transformers_utils.configs import voxtral_tts as _voxtral_tts # noqa: F401, E402
from vllm_omni.transformers_utils.configs import yue2 as _yue2 # noqa: F401, E402
@@ -0,0 +1,73 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""HuggingFace config for m-a-p/YuE2-3B.
The checkpoint's own ``config.json`` already carries every field the AR
backbone needs (it is Qwen3-1.7B-shaped with q_norm/k_norm and an extended
184,704-entry vocabulary), plus the acoustic-side fields (``latent_dim``,
``max_latent_frames``, ``timestep_shift``). Registering this class lets vLLM
build a ``ModelConfig`` without ``trust_remote_code``: the package's own
``Yue2ForCausalLM`` replaces the repository's auto_map modeling code, and the
deploy YAML pins ``hf_overrides.architectures`` to it.
"""
from __future__ import annotations
from typing import Any
from transformers import AutoConfig
from transformers.configuration_utils import PretrainedConfig
class Yue2Config(PretrainedConfig):
"""Config for the YuE2-3B AR–NAR Mixture-of-Transformers checkpoint."""
model_type = "yue2"
def __init__(
self,
hidden_size: int = 2048,
num_hidden_layers: int = 28,
num_attention_heads: int = 16,
num_key_value_heads: int = 8,
head_dim: int = 128,
intermediate_size: int = 6144,
vocab_size: int = 184704,
rms_norm_eps: float = 1e-6,
rope_theta: float = 1000000.0,
max_position_embeddings: int = 24576,
tie_word_embeddings: bool = False,
latent_dim: int = 64,
max_latent_frames: int = 24576,
timestep_shift: float = 1.0,
**kwargs: Any,
) -> None:
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
self.hidden_size = hidden_size
self.num_hidden_layers = num_hidden_layers
self.num_attention_heads = num_attention_heads
self.num_key_value_heads = num_key_value_heads
self.head_dim = head_dim
self.intermediate_size = intermediate_size
self.vocab_size = vocab_size
self.rms_norm_eps = rms_norm_eps
self.rope_theta = rope_theta
self.max_position_embeddings = max_position_embeddings
self.latent_dim = latent_dim
self.max_latent_frames = max_latent_frames
self.timestep_shift = timestep_shift
# The checkpoint's config.json (like upstream's qwen_config derivative,
# fast.py) omits the standard Qwen3 fields the AR backbone expects;
# synthesize the same defaults upstream does so vLLM's Qwen3Model and
# MLP construct without AttributeError.
self.hidden_act = str(kwargs.pop("hidden_act", "silu"))
self.attention_bias = bool(kwargs.pop("attention_bias", False))
self.attention_dropout = float(kwargs.pop("attention_dropout", 0.0))
self.use_sliding_window = bool(kwargs.pop("use_sliding_window", False))
self.sliding_window = kwargs.pop("sliding_window", None)
self.max_window_layers = int(kwargs.pop("max_window_layers", 0))
AutoConfig.register("yue2", Yue2Config)
__all__ = ["Yue2Config"]