NearAndDear98's picture
Add training details
dd6a0d1 verified
|
Raw History Blame Contribute Delete
3.26 kB
metadata
license: other
license_name: nvidia-oneway-noncommercial
license_link: https://huggingface.co/nvidia/audio-flamingo-next-think-hf
base_model: nvidia/audio-flamingo-next-think-hf
library_name: peft
pipeline_tag: audio-text-to-text
tags:
  - audio
  - audio-reasoning
  - reinforcement-learning
  - grpo
  - self-supervised-learning
  - lora

Audio-R1 — Audio Flamingo Next Think (LoRA)

LoRA adapter for nvidia/audio-flamingo-next-think-hf trained with Audio-R1, an RL post-training framework that uses audio self-supervised tasks as a source of verifiable rewards.

Training Details

Hyperparameter Value
Method GRPO, 1 epoch, LoRA
Reward accuracy (1.0 if the chosen letter is correct) + format (0.2)
Format reward non-empty <think> (the model answers without an <answer> tag)
Optimizer / LR schedule AdamW, cosine
Learning rate / warmup ratio 5e-6 / 0.03
Rollouts per prompt 8
Sampling temperature / top-p 0.8 / 0.9
KL coefficient β 0.04
Clip ε 0.2
Per-device batch × grad. accumulation 8 × 4
GPUs 4
LoRA rank / α / dropout 8 / 32 / 0.05
LoRA targets all linear layers; audio encoder frozen
Precision / seed bf16 / 42

Usage

import librosa, torch
from peft import PeftModel
from transformers import AutoProcessor, MusicFlamingoForConditionalGeneration

base = "nvidia/audio-flamingo-next-think-hf"
processor = AutoProcessor.from_pretrained(base)
model = MusicFlamingoForConditionalGeneration.from_pretrained(base, dtype=torch.float32, device_map="auto")
model = PeftModel.from_pretrained(model, "NearAndDear98/Audio-R1-AF-Next-Think").eval()

SYSTEM = (
    "Your response MUST contain two parts in this exact order: "
    "1. Your reasoning enclosed within <think> </think> tags. "
    "2. The final answer — a single letter for the correct option — enclosed "
    "within <answer> </answer> tags."
)
question = "<sound>\nQuestion ...\n(A) ...\n(B) ...\n(C) ...\n(D) ..."   # one <sound> per audio
prompt = processor.apply_chat_template(
    [{"role": "system", "content": SYSTEM}, {"role": "user", "content": question}],
    tokenize=False, add_generation_prompt=True,
)
audios = [librosa.load("example.wav", sr=16000, mono=True)[0]]
inputs = processor(text=[prompt], audio=audios, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(processor.batch_decode(out[:, inputs["input_ids"].shape[-1]:], skip_special_tokens=True)[0])

License

The base model is released under the NVIDIA OneWay Noncommercial License; this adapter inherits those terms and is for non-commercial research use only.

Citation

@article{jeong2026audior1,
  title   = {Audio-R1: Audio Reasoning through Reinforcement Learning on Self-Supervised Tasks},
  author  = {Jeong, Jihoon and Ravanelli, Mirco and Wang, Zhepei and Subakan, Cem},
  journal = {arXiv preprint arXiv:2610.34609},
  year    = {2026}
}