[Model] Add GLM-TTS text-to-speech model support (#3141)
Signed-off-by: BeatSeat <wendavid552@gmail.com> Signed-off-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com> Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com>
This commit is contained in:
1 parent
748470c1fb
commit
28ce618f0e
38 files changed
+7568
-7
No files matched your search
@@ -17,6 +17,7 @@ _CLASS_TO_MODULE: dict[str, str] = {
|
||||
"FishSpeechConfig": "vllm_omni.transformers_utils.configs.fish_speech",
|
||||
"FishSpeechSlowARConfig": "vllm_omni.transformers_utils.configs.fish_speech",
|
||||
"FishSpeechFastARConfig": "vllm_omni.transformers_utils.configs.fish_speech",
|
||||
"GLMTTSConfig": "vllm_omni.transformers_utils.configs.glm_tts",
|
||||
"VoxCPM2Config": "vllm_omni.transformers_utils.configs.voxcpm2",
|
||||
"VoxtralTTSConfig": "vllm_omni.transformers_utils.configs.voxtral_tts",
|
||||
"CosyVoice3Config": "vllm_omni.transformers_utils.configs.cosyvoice3",
|
||||
@@ -36,6 +37,7 @@ __all__ = [
|
||||
"FishSpeechConfig",
|
||||
"FishSpeechSlowARConfig",
|
||||
"FishSpeechFastARConfig",
|
||||
"GLMTTSConfig",
|
||||
"VoxCPM2Config",
|
||||
"VoxtralTTSConfig",
|
||||
"CosyVoice3Config",
|
||||
@@ -65,6 +67,7 @@ def __dir__():
|
||||
# run as soon as `vllm_omni.transformers_utils.configs` is imported.
|
||||
from vllm_omni.transformers_utils.configs import cosyvoice3 as _cosyvoice3 # noqa: F401, E402
|
||||
from vllm_omni.transformers_utils.configs import fish_speech as _fish_speech # noqa: F401, E402
|
||||
from vllm_omni.transformers_utils.configs import glm_tts as _glm_tts # noqa: F401, E402
|
||||
from vllm_omni.transformers_utils.configs import mammoth_moda2 as _mammoth_moda2 # noqa: F401, E402
|
||||
from vllm_omni.transformers_utils.configs import ming_flash_omni as _ming_flash_omni # noqa: F401, E402
|
||||
from vllm_omni.transformers_utils.configs import omnivoice as _omnivoice # noqa: F401, E402
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""GLM-TTS config registration with transformers AutoConfig.
|
||||
|
||||
Registers GLMTTSConfig (model_type="glm_tts") so that
|
||||
``AutoConfig.from_pretrained("path/to/glm-tts")`` returns the correct config class.
|
||||
|
||||
Note: GLM-TTS uses a Llama backbone, but we register a custom config
|
||||
to handle the special token IDs and flow model parameters.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from transformers import AutoConfig, PretrainedConfig
|
||||
|
||||
|
||||
class GLMTTSConfig(PretrainedConfig):
|
||||
"""Llama-based AR model for text-to-speech token generation.
|
||||
|
||||
Special token IDs are loaded dynamically from the tokenizer at init time.
|
||||
"""
|
||||
|
||||
model_type: str = "glm_tts"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
vocab_size: int = 98304,
|
||||
hidden_size: int = 2048,
|
||||
intermediate_size: int = 6144,
|
||||
num_hidden_layers: int = 28,
|
||||
num_attention_heads: int = 16,
|
||||
num_key_value_heads: int = 4,
|
||||
hidden_act: str = "silu",
|
||||
max_position_embeddings: int = 8192,
|
||||
rms_norm_eps: float = 1e-5,
|
||||
rope_theta: float = 10000.0,
|
||||
audio_token_start: int = -1,
|
||||
audio_token_end: int = -1,
|
||||
boa_token_id: int = -1,
|
||||
eoa_token_id: int = -1,
|
||||
pad_token_id: int = -1,
|
||||
bos_token_id: int = -1,
|
||||
speech_token_vocab_size: int = 32768,
|
||||
speech_token_dim: int = 512,
|
||||
spk_embed_dim: int = 192,
|
||||
mel_dim: int = 80,
|
||||
input_frame_rate: float = 25.0,
|
||||
mel_framerate: int = 50,
|
||||
max_token_text_ratio: float = 20.0,
|
||||
min_token_text_ratio: float = 2.0,
|
||||
sample_method: str = "ras",
|
||||
ras_top_p: float = 0.8,
|
||||
ras_top_k: int = 25,
|
||||
ras_win_size: int = 10,
|
||||
ras_tau_r: float = 0.1,
|
||||
**kwargs: Any,
|
||||
):
|
||||
self.vocab_size = vocab_size
|
||||
self.hidden_size = hidden_size
|
||||
self.intermediate_size = intermediate_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.hidden_act = hidden_act
|
||||
self.max_position_embeddings = max_position_embeddings
|
||||
self.rms_norm_eps = rms_norm_eps
|
||||
self.rope_theta = rope_theta
|
||||
self.audio_token_start = audio_token_start
|
||||
self.audio_token_end = audio_token_end
|
||||
self.boa_token_id = boa_token_id
|
||||
self.eoa_token_id = eoa_token_id
|
||||
self.speech_token_vocab_size = speech_token_vocab_size
|
||||
self.speech_token_dim = speech_token_dim
|
||||
self.spk_embed_dim = spk_embed_dim
|
||||
self.mel_dim = mel_dim
|
||||
self.input_frame_rate = input_frame_rate
|
||||
self.mel_framerate = mel_framerate
|
||||
self.max_token_text_ratio = max_token_text_ratio
|
||||
self.min_token_text_ratio = min_token_text_ratio
|
||||
self.sample_method = sample_method
|
||||
self.ras_top_p = ras_top_p
|
||||
self.ras_top_k = ras_top_k
|
||||
self.ras_win_size = ras_win_size
|
||||
self.ras_tau_r = ras_tau_r
|
||||
super().__init__(pad_token_id=pad_token_id, bos_token_id=bos_token_id, **kwargs)
|
||||
|
||||
|
||||
AutoConfig.register("glm_tts", GLMTTSConfig)
|
||||
|
||||
__all__ = [
|
||||
"GLMTTSConfig",
|
||||
]
|
||||
Reference in new issue
Block a user