MiniMax-Music3
MiniMax-Music3
MiniMax发布Music 3音乐生成模型,支持生成最长五分钟的完整歌曲,输出32 kHz、16位立体声WAV音频。模型采用8B Global LLM与0.6B Local LLM的Hybrid-LM分层架构,结合Flow Matching与Flow-VAE连续隐状态合成系统,支持歌词与结构化音乐描述(含全局元数据、人声细节、编曲)的细粒度控制。模型已开源,支持SGLang、diffusers及ComfyUI推理框架。
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]。 - 音乐描述定义音乐风格、情感走向、人声表现、乐器配置、编曲和制作风格。
为实现精确控制,我们建议使用包含三个部分的 Structured Caption:
- 全局元数据:流派、子流派、BPM、调性、音阶、情感走向、聆听场景和制作风格。
- 人声细节:人声性别、音色、表演风格、和声、伴唱和人声效果。
- 编曲:主要和次要乐器、段落级乐器演变、律动、贝斯、打击乐、织体和空间效果。
这种表示方式使模型不仅能遵循全局风格,还能跟随歌曲随时间的音乐发展。
Hybrid-LM
MiniMax Music 3 采用分层自回归架构,将全局音乐建模与局部声学建模分离。
- **Global LLM(8B)**逐帧预测第一个 RVQ codebook,并建模歌曲的长程语义和结构推进。
- **Local LLM(0.6B)**预测每帧内的其余声学 codebook,恢复细粒度声学信息。
Global LLM 从 Qwen3-8B 初始化。训练期间,其 embedding 和输出层首先适配语义音乐 token。随后,Global 和 Local LLM 联合训练,以建模所有 RVQ codebook。
连续隐状态合成
合成模块并非仅从离散 RVQ token 解码,而是融合 Global 和 Local LLM 的最终隐状态。这些连续表示保留了更丰富的声学信息,用于人声发音、乐器质感和时间连续性。
合成路径如下:
Global 和 Local LLM 隐状态
↓
隐状态融合
↓
Flow Matching (2.4B)
↓
Flow-VAE latent
↓
Flow-VAE Decoder (123M)
↓
32 kHz 立体声音频
Flow-VAE 架构改编自 MiniMax Speech,并针对音乐的动态范围和频谱特性进行了重新训练。
音乐 Tokenizer
训练 tokenizer 使用八层残差向量量化(RVQ):
- 第一个语义 codebook 包含 16,384 个条目,捕获核心音乐语义和结构。
- 其余七个声学 codebook 各包含 1,024 个条目,表示残差声学细节。
训练首先优化语义 codebook,然后联合训练全部八个 codebook。推理时,波形合成使用融合后的 LLM 隐状态,无需离散 tokenizer 解码器。
使用方法
MiniMax Music 3 由 SGLang-Omni 支持。请按照官方安装指南准备运行环境。
下载模型
hf download MiniMaxAI/MiniMax-Music3 --local-dir /path/to/minimax_ttm
我们推荐以下推理框架来服务该模型:
diffusers — 参见 diffusers 文档
ComfyUI — 参见 ComfyUI 教程
使用 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 模块化 pipeline 使用。在 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 offloading 后,生成约占用 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)
# 仅需在约 22 GB 以下显存时使用 — 较慢,但可适配 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 个声学帧。
- 段落标签和音乐描述提供生成控制,而非严格的符号保证。生成的节奏、调性、乐器配置、歌词和歌曲结构可能无法始终精确匹配每个请求的细节。
联系我们
请通过 model@minimax.io 联系我们。