Downloads · 30 days
75
6% of all-time downloads
oriyonay/musicnn-pytorch
musicnn-pytorch is a machine learning model from oriyonay. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This is a PyTorch reimplementation of the MusicNN library for music audio tagging.
Downloads · 30 days
75
6% of all-time downloads
All-time downloads
1.2K
Public
Parameters
792K
79.9 MB on disk
Likes
0
Public
Click a slice to open those files.
.pt38.4 MB · 92%
From the Hugging Face model README
This is a PyTorch reimplementation of the MusicNN library for music audio tagging.
It contains the model architecture and converted weights from the original TensorFlow 1.x checkpoints.
MTT_musicnn: Trained on MagnaTagATune (50 tags) - Default modelMSD_musicnn: Trained on Million Song Dataset (50 tags)MSD_musicnn_big: Larger version trained on MSD (512 filters)from transformers import AutoModel
# Load the model (downloads automatically)
model = AutoModel.from_pretrained("oriyonay/musicnn-pytorch", trust_remote_code=True)
# Use the model
tags = model.predict_tags("your_audio.mp3", top_k=5)
print(f"Top 5 tags: {tags}")
from transformers import AutoModel
model = AutoModel.from_pretrained("oriyonay/musicnn-pytorch", trust_remote_code=True)
# Extract embeddings from any layer
emb = model.extract_embeddings("your_audio.mp3", layer="penultimate", pool="mean")
print(emb.shape)
# Install dependencies
!pip install transformers torch librosa soundfile
# Load with AutoModel
from transformers import AutoModel
model = AutoModel.from_pretrained("oriyonay/musicnn-pytorch", trust_remote_code=True)
# Use the model
tags = model.predict_tags("your_audio.mp3", top_k=5)
print(tags)
If you prefer to download the code manually:
from musicnn_torch import top_tags
# Get top 5 tags for an audio file
tags = top_tags('path/to/audio.mp3', model='MTT_musicnn', topN=5)
print(tags)
pip install transformers torch librosa soundfile
Original implementation by Jordi Pons. PyTorch port by Gemini.