Music-tagger-ast
music classifier and embedding model
1 min readupdated
Built for a university music queue project, this model analyzes entire audio files. It outputs genre tags, mood labels, an energy score, a music classification, and vector embeddings for similarity search. Based on the AST (Audio Spectrogram Transformer) architecture, it was fine-tuned on a dataset of around 16,000 tracks. It is a great fit for developers of music services or bots that need automated track tagging.
Key features
- Detects whether audio contains music, speech, or noise
- Multi-label classification across 21 musical genres
- Evaluates 11 different track moods
- Calculates a numerical energy score from 0 to 1
- Generates vector embeddings for similarity search using cosine distance
What you can do
- Integrate the model into a Telegram bot to automatically detect genres and moods of uploaded tracks
- Build a similar-track search system using music embeddings
- Automatically tag and filter large music collections by energy level
Example
from huggingface_hub import snapshot_download
from ml.inference import load_model, load_windows, score_windows
path = snapshot_download("tesohh/music-tagger-ast")
model = load_model(f"{path}/model.safetensors")
scores = score_windows(model, load_windows("song.mp3"))
print(scores["genre"], scores["mood"], scores["energy"], scores["p_music"])Read more
DetailsThe model has 86.2 million parameters.
On validation: genre mAP 0.683, mood mAP 0.523, music classification accuracy 99.8%.
Training took about 40 minutes on a single RTX 3080 GPU.
Weights license: CC BY-NC-SA 4.0 (non-commercial use only).










Comments