Audio-Text-to-Text
PEFT
Safetensors
audio
audio-reasoning
reinforcement-learning
grpo
self-supervised-learning
lora
Instructions to use NearAndDear98/Audio-R1-AF-Next-Think with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use NearAndDear98/Audio-R1-AF-Next-Think with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("nvidia/audio-flamingo-next-think-hf") model = PeftModel.from_pretrained(base_model, "NearAndDear98/Audio-R1-AF-Next-Think") - Notebooks
- Google Colab
- Kaggle
File size: 3,260 Bytes
b2426c0 e453b50 b2426c0 | 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 | ---
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](https://huggingface.co/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.
- **Paper:** [Audio-R1: Audio Reasoning through Reinforcement Learning on Self-Supervised Tasks](https://arxiv.org/abs/2610.34609)
- **Project page:** https://ijihoon98.github.io/Audio-R1/
## 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
```python
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
```bibtex
@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}
}
```
|