MiniMax 发布音乐生成模型 MiniMax Music 3
MiniMaxAI/MiniMax-Music3
MiniMax 发布音乐生成模型 MiniMax Music 3,可根据歌词和音乐描述生成最长五分钟的完整歌曲,输出 32 kHz、16-bit 立体声 WAV。
原文给出了分层 LLM 与 Flow Matching 的完整架构和显存占用,读者可据此判断本地部署音乐生成的门槛。
MiniMax Music 3
MiniMax Music 3 是一款高性能音乐生成模型,可创作最长五分钟的完整歌曲。它以歌词和详细的音乐描述为条件,生成结构连贯、人声富有表现力、编曲不断演进且长音频质量稳定的歌曲。
MiniMax Music 3 结合了用于长程音乐结构的 8B Global LLM、用于帧级声学细节的 0.6B Local LLM,以及基于 Flow Matching 和 Flow-VAE 的连续隐藏状态合成系统。该模型可生成 32 kHz、16 位立体声 WAV 音频。
演示
在 MiniMax Music 3 Demo 上探索音乐生成示例。
具备长程连贯性的完整歌曲
MiniMax Music 3 原生支持生成最长五分钟的完整歌曲。该模型在长序列中保持音乐主题、节奏、人声特征和编曲推进,从而支持前奏、主歌、预副歌、副歌、桥段、器乐间奏和尾奏等完整结构。
细粒度音乐控制
该模型接受两种互补的输入:
- 歌词定义要演唱的歌词内容,并可包含显式段落标签,例如
[Intro]、[Verse]、[Pre-Chorus]、[Chorus]、[Post-Chorus]、[Bridge]、[Instrumental]、[Solo]和[Outro]。 - 音乐描述定义音乐风格、情感推进、人声表现、乐器编制、编曲和制作特征。
为实现精确控制,我们建议使用包含三个部分的结构化描述:
- 全局元数据:流派、子流派、BPM、调性、音阶、情感推进、聆听场景和制作特征。
- 人声细节:人声性别、音色、演唱风格、和声、伴唱和人声效果。
- 编曲:主要和次要乐器、段落级乐器演变、律动、贝斯、打击乐、织体和空间效果。
这种表示方式使模型不仅能够遵循全局风格,还能遵循歌曲随时间的音乐发展。
Hybrid-LM
MiniMax Music 3 采用分层自回归架构,将全局音乐建模与局部声学建模分离。
- Global LLM(8B)逐帧预测第一个 RVQ 码本,并对歌曲的长程语义和结构推进进行建模。
- Local LLM(0.6B)预测每一帧内剩余的声学码本,并恢复细粒度声学信息。
Global LLM 由 Qwen3-8B 初始化。在训练过程中,其嵌入层和输出层首先适配语义音乐 token。随后,Global 和 Local LLM 联合训练,以对所有 RVQ 码本进行建模。
连续隐藏状态合成
合成模块并非仅从离散 RVQ token 解码,而是融合 Global 和 Local LLM 的最终隐藏状态。这些连续表示保留了更丰富的声学信息,用于人声咬字、乐器织体和时间连续性。
合成路径为:
Global and Local LLM hidden states
↓
Hidden-state fusion
↓
Flow Matching (2.4B)
↓
Flow-VAE latent
↓
Flow-VAE Decoder (123M)
↓
32 kHz stereo audio
Flow-VAE 架构改编自 MiniMax Speech,并针对音乐的动态范围和频谱特性重新训练。
音乐分词器
训练分词器使用八层残差向量量化(RVQ):
- 第一个语义码本包含 16,384 个条目,用于捕捉核心的音乐语义与结构。
- 其余七个声学码本各包含 1,024 个条目,用于表示残余的声学细节。
训练时先优化语义码本,再联合训练全部八个码本。推理时,波形合成使用融合后的 LLM 隐藏状态,无需离散分词器解码器。
使用方法
MiniMax Music 3 由 SGLang-Omni 提供支持。请按照官方 安装指南 准备运行环境。
下载模型
hf download MiniMaxAI/MiniMax-Music3 --local-dir /path/to/minimax_ttm
我们推荐使用以下推理框架来部署该模型:
diffusers - 参见 diffusers 文档
使用 SGLang-Omni 部署
sgl-omni serve --model-path MiniMaxAI/MiniMax-Music3 --port 8000
生成音乐
该服务使用共享的语音 API。将歌词放入 input,将音乐描述放入 instructions。将 [Verse] 和 [Chorus] 等歌词结构标签单独放在各自的行上。
curl http://127.0.0.1:8000/v1/audio/speech \
-H 'Content-Type: application/json' \
-d '{
"model": "MiniMaxAI/MiniMax-Music3",
"input": "[Verse]\nMorning light filtering through the pine\n[Chorus]\nSoftly the world begins to breathe",
"instructions": "A warm acoustic pop song with intimate female vocals, fingerpicked guitar, soft piano, and a gradual emotional build into a wide final chorus.",
"response_format": "wav",
"seed": 7,
"max_new_tokens": 750,
"stream": false
}' \
--output minimax_music3.wav
max_new_tokens 将音频帧数上限设为每秒 25 帧。当模型输出音频结束 token 时,生成可能在该上限之前完成。响应为 32 kHz、16 位立体声 WAV 文件。
可复现示例
以下端到端示例包含用于生成参考音频的完整歌词、音乐描述和生成参数。
| 用例 | 请求 | 结果 |
|---|---|---|
| 文本生成音乐 | 查看脚本 | minimax_ttm.wav |
🧨 Diffusers
MiniMax Music 3 以 diffusers 模块化流水线的形式提供。在 huggingface/diffusers#14456 合并之前,请从该 PR 的提交安装 diffusers:
以下代码片段适用于 24GB 以上显存的 GPU
pip install git+https://github.com/huggingface/diffusers@dafe3733fcfdbf3c48915fe77be3aef65b5d6a2d transformers accelerate soundfile
import soundfile as sf
import torch
from diffusers import ModularPipeline
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-Music3")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda")
lyrics = """[verse]
Morning light filtering through the pine
Every quiet street is yours and mine
[chorus]
Softly the world begins to breathe"""
prompt = (
"Genre: acoustic pop. BPM: 96. Key: C major. Warm and intimate, building gently into the chorus. "
"Vocals: soft female lead, close and breathy, light stacked harmonies in the chorus. "
"Arrangement: fingerpicked guitar and soft piano; brushed drums and upright bass enter in the chorus."
)
audio = pipe(
prompt=prompt,
lyrics=lyrics,
audio_duration=60.0,
generator=torch.Generator("cuda").manual_seed(7),
output="audios",
)[0]
sf.write("song.wav", audio.T.float().cpu().numpy(), pipe.sampling_rate)
低显存
完整精度可在 24GB 显存以内运行。使用自动 CPU 卸载时,生成约占用 22 GB;此外,逐层流式加载语言模型后,甚至可在 8 GB 显卡上运行:
import torch
from diffusers import ComponentsManager, ModularPipeline
from diffusers.hooks import apply_group_offloading
manager = ComponentsManager()
manager.enable_auto_cpu_offload(device="cuda")
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-Music3", components_manager=manager)
pipe.load_components(dtype=torch.bfloat16)
# Only needed below ~22 GB of VRAM — slower, but fits in 8 GB.
apply_group_offloading(
pipe.language_model, onload_device=torch.device("cuda"), offload_type="leaf_level", use_stream=True
)
提示词增强
简洁的自然语言描述可直接使用。如需更丰富的提示词和更精确的控制,请使用提供的 music-caption-rewriter 技能,将其扩展为包含 Global Metadata、Vocal Details 和 Arrangement 的结构化描述(Structured Caption)。该技能会在编曲描述中保留附加于歌词段落标签的音乐指令,同时将歌词文本保留在歌词输入中。
npx skills add MiniMax-AI/MiniMax-Music3 --skill music-caption-rewriter
局限性
- 推理需要 CUDA。
- 目前仅支持非流式生成。
- 分词后的文本提示词上限为 5,000 个 token。
- 音频生成上限为 9,000 个声学帧。
- 段落标签和音乐描述提供的是生成式控制,而非严格的符号化保证。生成的节奏、调性、配器、歌词和歌曲结构可能并不总能与每一项请求细节完全一致。
联系我们
请通过 [email protected] 联系我们。
来源:MiniMax 模型发布 · hf-mirror.com