Downloads · 30 days
32
14% of all-time downloads
anime-song/tsumugi-mrl
tsumugi-mrl is a machine learning model from anime-song. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as cc-by-nc-4.0.
Pretrained music audio encoder from Tsumugi-MRL. It reads stereo audio at 22,050 Hz and returns 512-dimensional frame features at 25 Hz for downstream music tasks.
Downloads · 30 days
32
14% of all-time downloads
All-time downloads
231
Public
Parameters
26M
104 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors104 MB · 100%
From the Hugging Face model README
Pretrained music audio encoder from Tsumugi-MRL. It reads stereo audio at 22,050 Hz and returns 512-dimensional frame features at 25 Hz for downstream music tasks.
import torch
from tsumugi_mrl import TsumugiMRLModel
model = TsumugiMRLModel.from_pretrained("anime-song/tsumugi-mrl").eval()
audio = torch.randn(1, 2, 22_050 * 4) # [batch, 2, samples], stereo 22,050 Hz
with torch.no_grad():
hidden = model(audio) # [batch, frames, 512], 25 frames per second
clip = model.mean_pool(hidden) # [batch, 512]
TsumugiMRLModel lives in the Tsumugi-MRL repository; check it out before
loading the weights. Convert mono audio by repeating the channel. The
checkpoint carries the Mel normalization statistics used in pretraining, so no
separate preprocessing is needed.
Use the frame features or their mean. The model also has an audio_projection
head and encode_embedding(), but no pretraining objective trained that head,
so its embeddings are not meaningful without fine-tuning.
A 128-bin Mel spectrogram (FFT 2,048, hop 441) is computed for each channel, and two adjacent frames are folded together into one 512-dimensional token at 25 Hz. A linear projection feeds an eight-layer Transformer with RoPE, eight heads, a feed-forward width of 2,048, and a final RMSNorm. The encoder has 25.5 M parameters.
The encoder was trained for 625 epochs on 17,037 songs, with 30-second crops and a batch size of 16, by predicting two kinds of targets at masked frames:
Both tokenizers emit eight codes per 25 Hz frame. Training used AdamW with a peak learning rate of 5e-4, 8% warmup, and bfloat16 autocast.
Linear probes on frozen features, seed 0, with early stopping on the validation split. Clip tasks use mean-pooled features; GuitarSet and Ballroom are frame-level.
| Task | Metric | Result |
|---|---|---|
| NSynth pitch | accuracy / macro-F1 | 88.09% / 74.95% |
| NSynth instrument family | accuracy / macro-F1 | 65.33% / 58.42% |
| GuitarSet chord (comping takes) | accuracy / macro-F1 | 70.20% / 60.17% |
| FMA-small genre | accuracy / macro-F1 | 51.88% / 25.68% |
| OpenMIC instrument | micro-F1 / macro-F1 | 42.24% / 41.39% |
| Ballroom beat | F1 / accuracy | 76.56% / 87.29% |
| GiantSteps key | accuracy / macro-F1 | 53.45% / 28.16% |
Against the same encoder pretrained on Mel-RVQ codes alone, GuitarSet chord macro-F1 rises from 44.80% to 60.17% and NSynth pitch accuracy from 85.94% to 88.09%. Beat F1 is about two points lower (78.87% for Mel-RVQ alone).
The weights are released under CC BY-NC 4.0 for non-commercial use.