Skip to content

Add Music Flamingo support to Audio Flamingo 3#43458

Closed
lashahub wants to merge 16 commits intohuggingface:mainfrom
lashahub:mf
Closed

Add Music Flamingo support to Audio Flamingo 3#43458
lashahub wants to merge 16 commits intohuggingface:mainfrom
lashahub:mf

Conversation

@lashahub
Copy link
Copy Markdown
Contributor

This PR adds support for Music Flamingo to Audio Flamingo 3, NVIDIA's open large audio-language model designed for deep music understanding and reasoning.

Built on Audio Flamingo 3, Music Flamingo specializes in music analysis and long-form audio reasoning, extending maximum audio support to 20 minutes (vs. 10 minutes in AF3) via Rotary Time Embeddings (RoTE). It also adds a more comprehensive music-focused system prompt, introduces audio boundary tokens (<|sound_bos|>, <|sound_eos|>) for better audio sequence modeling.

Music Flamingo can be loaded directly from the Hugging Face Hub:

from transformers import AutoModel, AutoProcessor

model_id = "nvidia/music-flamingo-2601-hf"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id, device_map="auto", dtype="bfloat16")

conversation = [{
    "role": "user",
    "content": [
        {"type": "text", "text": "Describe this track in detail - genre, tempo, key, instruments, and mood."},
        {"type": "audio", "path": "song.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=500)
print(processor.batch_decode(outputs[:, inputs.input_ids.shape[1]:], skip_special_tokens=True))
# Example: "This energetic Eurodance track at 150 BPM in E major features bright synth arpeggios..."

@github-actions
Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: audioflamingo3

@ebezzam ebezzam mentioned this pull request Jan 28, 2026
@ebezzam ebezzam self-assigned this Jan 28, 2026
@ebezzam ebezzam closed this Feb 10, 2026
@lashahub lashahub deleted the mf branch April 4, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants