File size: 15,799 Bytes
61caea1 266c1c8 6a0c0ba 266c1c8 93fb383 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 82fe4cc 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 8dca892 e943a1e 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 f91b34e 27d1014 61caea1 266c1c8 174e10a 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 f91b34e 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 61caea1 266c1c8 93fb383 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
---
license: other
language:
- en
arxiv: 2511.10289
tags:
- music/songs
- music understanding
- music reasoning
datasets:
- nvidia/MF-Skills
pipeline_tag: audio-text-to-text
library_name: transformers
---
# Model Overview
<div align="center" style="display: flex; justify-content: center; align-items: center; text-align: center;">
<a href="https://github.com/NVIDIA/audio-flamingo" style="margin-right: 20px; text-decoration: none; display: flex; align-items: center;">
<img src="static/mf_logo.png" alt="Music Flamingo 🔥🚀🔥" width="120">
</a>
</div>
<div align="center" style="display: flex; justify-content: center; align-items: center; text-align: center;">
<h2>
Music Flamingo: Scaling Music Understaning in Audio Language Models
</h2>
</div>
<div align="center" style="display: flex; justify-content: center; margin-top: 10px;">
<a href="https://arxiv.org/abs/2511.10289"><img src="https://img.shields.io/badge/arXiv-2511.10289-AD1C18" style="margin-right: 5px;"></a>
<a href="https://research.nvidia.com/labs/adlr/MF/"><img src="https://img.shields.io/badge/Demo page-228B22" style="margin-right: 5px;"></a>
<a href="https://github.com/NVIDIA/audio-flamingo"><img src='https://img.shields.io/badge/Github-Audio Flamingo 3-9C276A' style="margin-right: 5px;"></a>
<a href="https://github.com/NVIDIA/audio-flamingo/stargazers"><img src="https://img.shields.io/github/stars/NVIDIA/audio-flamingo.svg?style=social"></a>
</div>
<div align="center" style="display: flex; justify-content: center; margin-top: 10px; flex-wrap: wrap; gap: 5px;">
<a href="https://huggingface.co/nvidia/music-flamingo">
<img src="https://img.shields.io/badge/🤗-Checkpoints-ED5A22.svg">
</a>
<a href="https://huggingface.co/datasets/nvidia/MF-Skills">
<img src="https://img.shields.io/badge/🤗-Dataset: MF--Skills-ED5A22.svg">
</a>
</div>
<div align="center" style="display: flex; justify-content: center; margin-top: 10px;">
<a href="https://huggingface.co/spaces/nvidia/music-flamingo"><img src="https://img.shields.io/badge/🤗-Gradio Demo (7B)-5F9EA0.svg" style="margin-right: 5px;"></a>
</div>
🚨 **Note:** This is a *preview* model. We will release a better base and a thinking version of the model in the next few weeks.
## Description:
Music Flamingo (MF) is a fully open, state-of-the-art Large Audio-Language Model (LALM) designed to advance music (including song) understanding in foundational audio models. MF brings together innovations in:
- Deep music understanding across songs and instrumentals.
- Rich, theory-aware captions and question answering (harmony, structure, timbre, lyrics, cultural context).
- Reasoning-centric training using chain-of-thought + reinforcement learning with custom rewards for step-by-step reasoning.
- Long-form song reasoning over full-length, multicultural audio (extended context).
Extensive evaluations confirm Music Flamingo's effectiveness, setting new benchmarks on over 10+ public music understanding and reasoning tasks.
**This model is for non-commercial research purposes only.**
<center><img src="static/mf_main.png" width="800"></center>
## Usage
Music Flamingo (MF) is supported in 🤗 Transformers. To run the model, first install Transformers:
```bash
pip install --upgrade pip
pip install --upgrade git+https://github.com/huggingface/transformers accelerate
```
> **Note:** MF processes audio in 30-second windows with a **10-minute** total cap per sample. Longer inputs are truncated.
### Single-turn: audio + text instruction
```python
from transformers import AudioFlamingo3ForConditionalGeneration, AutoProcessor
model_id = "nvidia/music-flamingo-hf"
processor = AutoProcessor.from_pretrained(model_id)
model = AudioFlamingo3ForConditionalGeneration.from_pretrained(model_id, device_map="auto")
conversation = [
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this track in full detail - tell me the genre, tempo, and key, then dive into the instruments, production style, and overall mood it creates."},
{"type": "audio", "path": "https://huggingface.co/datasets/nvidia/MF-Skills/resolve/main/assets/song_1.mp3"},
],
}
]
inputs = processor.apply_chat_template(
conversation,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
decoded_outputs = processor.batch_decode(outputs[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(decoded_outputs)
```
### Batch multiple conversations
```python
from transformers import AudioFlamingo3ForConditionalGeneration, AutoProcessor
model_id = "nvidia/music-flamingo-hf"
processor = AutoProcessor.from_pretrained(model_id)
model = AudioFlamingo3ForConditionalGeneration.from_pretrained(model_id, device_map="auto")
conversations = [
[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this track in full detail - tell me the genre, tempo, and key, then dive into the instruments, production style, and overall mood it creates."},
{
"type": "audio",
"path": "https://huggingface.co/datasets/nvidia/MF-Skills/resolve/main/assets/song_1.mp3",
},
],
}
],
[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Write a rich caption that blends the technical details (genre, BPM, key, chords, mix) with how the song feels emotionally and dynamically as it unfolds.",
},
{
"type": "audio",
"path": "https://huggingface.co/datasets/nvidia/MF-Skills/resolve/main/assets/song_2.mp3"
},
],
}
],
]
inputs = processor.apply_chat_template(
conversations,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
decoded_outputs = processor.batch_decode(outputs[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(decoded_outputs)
```
### Text-only and audio-only prompts
```python
# text-only
conv = [{"role": "user", "content": [{"type": "text", "text": "What is the capital of France?"}]}]
batch = processor.apply_chat_template(conv, tokenize=True, add_generation_prompt=True, return_dict=True).to(device)
print(processor.batch_decode(model.generate(**batch)[:, batch["input_ids"].shape[1]:], skip_special_tokens=True)[0])
# audio-only
conv = [{"role": "user", "content": [{"type": "audio", "path": "https://.../sample.wav"}]}]
batch = processor.apply_chat_template(conv, tokenize=True, add_generation_prompt=True, return_dict=True).to(device)
print(processor.batch_decode(model.generate(**batch)[:, batch["input_ids"].shape[1]:], skip_special_tokens=True)[0])
```
### Training / Fine-tuning
```python
from transformers import AudioFlamingo3ForConditionalGeneration, AutoProcessor
model_id = "nvidia/music-flamingo-hf"
processor = AutoProcessor.from_pretrained(model_id)
model = AudioFlamingo3ForConditionalGeneration.from_pretrained(model_id, device_map="auto")
model.train()
conversation = [
[
{
"role": "user",
"content": [
{"type": "text", "text": "What's the key of this song?"},
{"type": "audio", "path": "https://huggingface.co/datasets/nvidia/MF-Skills/resolve/main/assets/song_1.mp3"},
],
},
{
"role": "assistant",
"content": [{"type": "text", "text": "D major"}],
}
],
[
{
"role": "user",
"content": [
{
"type": "text",
"text": "What's the bpm of this song?",
},
{"type": "audio", "path": "https://huggingface.co/datasets/nvidia/MF-Skills/resolve/main/assets/song_2.mp3"},
],
},
{
"role": "assistant",
"content": [{"type": "text", "text": "87"}],
}
]
]
inputs = processor.apply_chat_template(
conversation,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
output_labels=True,
).to(model.device)
loss = model(**inputs).loss
loss.backward()
```
### Generation options
You can tune decoding similar to other text-generation models:
```python
generate_kwargs = {
"max_new_tokens": 256,
"do_sample": True,
"temperature": 0.7,
"top_p": 0.9,
}
out = model.generate(**batch, **generate_kwargs)
```
## Additional Speed & Memory Improvements
### Flash Attention 2
If your GPU supports it and you are **not** using `torch.compile`, install Flash-Attention and enable it at load time:
```bash
pip install flash-attn --no-build-isolation
```
```python
model = AudioFlamingo3ForConditionalGeneration.from_pretrained(
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, attn_implementation="flash_attention_2"
).to(device)
```
### Torch compile
MF’s forward pass is compatible with `torch.compile` for significant speed-ups:
```python
import torch
torch.set_float32_matmul_precision("high")
model.generation_config.cache_implementation = "static"
model.generation_config.max_new_tokens = 256
model.forward = torch.compile(model.forward, mode="reduce-overhead", fullgraph=True)
```
> `torch.compile` is not compatible with Flash Attention 2 at the same time.
### PyTorch SDPA
If Flash-Attention isn’t available, MF will use PyTorch scaled-dot product attention (SDPA) by default on supported PyTorch versions. You can set it explicitly:
```python
model = AudioFlamingo3ForConditionalGeneration.from_pretrained(
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, attn_implementation="sdpa"
).to(device)
```
## License / Terms of Use
The model is released under the [NVIDIA OneWay Noncommercial License](static/NVIDIA_OneWay_Noncommercial_License.docx). Portions of the dataset generation are also subject to the [Qwen Research License](https://huggingface.co/Qwen/Qwen2.5-3B/blob/main/LICENSE) and OpenAI’s [Terms of Use](https://openai.com/policies/terms-of-use).
## Deployment Geography
Global.
## Use Case
Intended for researchers and developers to explore:
- Music question answering and reasoning
- Long-context music comprehension
- Interactive music design assistants
## References:
* [Music Flamingo: Scaling Music
Understanding in Audio Language Models](https://research.nvidia.com/labs/adlr/MF/)
* [Project Page](https://github.com/NVIDIA/audio-flamingo)
* [Demo Website](https://musicflamingo-nv-umd.github.io/)
## Model Architecture:
**Architecture Type:** Transformer
**Network Architecture:** [Audio Flamingo 3](https://github.com/NVIDIA/audio-flamingo/tree/audio_flamingo_3)
**Number of model parameters:** 8B
MF uses:
- AF-Whisper unified audio encoder from Audio Flamingo 3
- MLP-based audio adaptor
- Decoder-only LLM backbone (Qwen2.5-7B)
**This model was developed based on [Audio Flamingo 3](https://github.com/NVIDIA/audio-flamingo/tree/audio_flamingo_3)**
## Input:
Input Type: Music (song or instrumental), Text <br>
Input Format: WAV/MP3/FLAC, UTF-8 text <br>
Input Parameters: Audio is Two-Dimensional (2D) and Text is One-Dimensional (1D)<br>
Other Properties Related to Input: <br>
-Max Audio Length: 20 Minutes <br>
-Max Text Length: 24000 tokens<br>
## Output:
Output Type: Text (and optional speech) <br>
Text Format: UTF-8 string <br>
Output Parameters: One-Dimensional (1D)<br>
Other Properties Related to Output: <br>
-Max Text Length: 2048 tokens <br>
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems (A100/H100). By leveraging NVIDIA’s hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions. <br>
## Software Integration:
**Runtime Engine:** PyTorch / HuggingFace Transformers
**Supported Hardware:**
* NVIDIA Ampere (A100)
* NVIDIA Hopper (H100)
**Supported OS:**
* Linux
The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels are essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment.
## Model Version:
* v1.0
---
## Training and Testing Datasets:
### Training Dataset:
MF is trained entirely on music data collected from various sources. For each dataset, we mention whether the dataset annotations are collected by Human or they are Automated i.e. generated using AI models.
**Data Modality:** Audio
**Audio Training Data Size:** 10,000 to 1 Million Hours
The data collection method noted below applies for all datasets used for training and testing:<br>
Data Collection Method: Human <br>
Labeling Collection Method: Please see below.
* [LP-MusicCaps](https://github.com/seungheondoh/lp-music-caps) (Automated)
* [MusicQA](https://github.com/shansongliu/MU-LLaMA?tab=readme-ov-file) (Automated)
* [MusicAVQA](https://gewu-lab.github.io/MUSIC-AVQA/) (Human)
* [MusicBench](https://huggingface.co/datasets/amaai-lab/MusicBench) (Automated)
* [Mu-LLAMA](https://github.com/shansongliu/MU-LLaMA) (Automated)
* [NSynth](https://magenta.tensorflow.org/datasets/nsynth) (Human)
* [FMA](https://github.com/mdeff/fma) (Human)
* [MusDB-HQ](https://zenodo.org/records/3338373) (Human)
* [Music4All](https://sites.google.com/view/contact4music4all) (Human)
* [Million Song Dataset](http://millionsongdataset.com/) (Human)
* [MF-Skills (ours)](https://huggingface.co/nvidia/music-flamingo) (Automated)
* [MF-Think (ours)](https://huggingface.co/nvidia/music-flamingo) (Automated)
---
### Testing Dataset:
Music Flamingo is evaluated on the test split of the following datasets.
Data Collection Method: Human (for all datasets noted below) <br>
Labeling Method: Please see below.
* [MusicAVQA](https://gewu-lab.github.io/MUSIC-AVQA/) (Human)
* [NSynth](https://magenta.tensorflow.org/datasets/nsynth) (Human)
* [GTZAN](https://www.tensorflow.org/datasets/catalog/gtzan) (Human)
* [MMAU-pro](https://sonalkum.github.io/mmau-pro/) (Human)
* [MMAU](https://github.com/Sakshi113/mmau/tree/main) (Human)
* [MMAR](https://arxiv.org/abs/2505.13032) (Human)
* [MuchoMusic](https://huggingface.co/datasets/yongyizang/RUListening) (Automated)
* [MusicInstruct](https://huggingface.co/datasets/m-a-p/Music-Instruct) (Automated)
* [MusicQA](https://huggingface.co/datasets/mu-llama/MusicQA) (Automated)
* [SongCaps (ours)](https://huggingface.co/nvidia/music-flamingo) (Automated)
---
## Inference:
**Engine:** HuggingFace Transformers
**Test Hardware:** NVIDIA A100 80 GB
---
## Ethical Considerations:
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
Please report model quality, risk, security vulnerabilities or NVIDIA AI Concerns [here](https://app.intigriti.com/programs/nvidia/nvidiavdp/detail).
---
## Acknowledgements
Built with Audio Flamingo 3, Qwen, NVILA and the open audio-ML community. |