Downloads · 30 days
9
31% of all-time downloads
Bashaarat1/fine-tuned-musicgen-small
fine-tuned-musicgen-small is a machine learning model from Bashaarat1. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
python from transformers import AutoProcessor, MusicgenForConditionalGeneration import soundfile as sf
Downloads · 30 days
9
31% of all-time downloads
All-time downloads
29
Public
Parameters
589M
1.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.2 GB · 100%
From the Hugging Face model README
# 🎵 Fine-Tuned MusicGen-Small (CLAP-Aligned)
### Smarter, more accurate text-to-music generation — fast, lightweight, and production-ready.
This model is a **CLAP-guided fine-tuned version of `facebook/musicgen-small`**, designed to generate music that more closely matches your text prompts.
It is **compact**, **fast**, and ideal for **web apps, mobile apps, and real-time audio generation systems**.
---
## Why This Model?
Compared to the original MusicGen-Small, this version delivers:
- **Better alignment** between text prompts and generated music
- **More stable pitch** and cleaner melodic structure
- **Faster inference** and smaller size than MusicGen-Large
- **Easy integration** into any backend (FastAPI, Node.js, Python servers)
---
## Quick Metrics (30-example evaluation)
| Model | FAD_CLAP ↓ | CLAP Score ↑ | Pitch Stability ↑ |
|---------------------------|-----------:|--------------:|-------------------:|
| Base MusicGen-Small | 0.9726 | 0.2885 | Low |
| **Fine-tuned (this model)** | **0.9093** | 0.3076 | **High** |
| MusicGen-Large (SOTA) | 0.9269 | **0.3266** | Medium |
**Highlights:**
- ⚡ **Lowest FAD_CLAP** — closest to real audio distribution
- 🎧 Strong boost in **semantic match** between caption & audio
- 🎼 **Most stable pitch** among all compared models
---
## Generate Music in 5 Lines
```python
from transformers import AutoProcessor, MusicgenForConditionalGeneration
import soundfile as sf
model_id = "Bashaarat1/fine-tuned-musicgen-small"
processor = AutoProcessor.from_pretrained(model_id)
model = MusicgenForConditionalGeneration.from_pretrained(model_id)
inputs = processor(text=["Lo-fi beat with soft piano"], return_tensors="pt")
audio = model.generate(**inputs)[0, 0].cpu().numpy()
sf.write("music.wav", audio, 16000)
pip install fastapi uvicorn transformers torch soundfile
Example:
@app.post("/generate")
def generate_music(prompt: str):
inputs = processor(text=[prompt], return_tensors="pt")
audio = model.generate(**inputs)[0, 0].cpu().numpy()
...
This makes deployment into web apps, mobile apps, Unity games, or cloud APIs extremely simple.
This work builds on Meta’s MusicGen and LAION’s CLAP models.
@misc{fine_tuned_musicgen_small_2025,
title = {Fine-tuned MusicGen-Small (CLAP-Aligned)},
author = {Bashaarat et al.},
year = {2025},
howpublished = {\url{https://huggingface.co/Bashaarat1/fine-tuned-musicgen-small}}
}