m-a-p/MERT-v2-FullSong

Model

9

stars

1

commits

2

linked in READMEs

Sep 9, 2026

updated

audio
custom_code
feature-extraction
mert2
music
music-understanding
representation-learning
safetensors
transformers
Browse cluster: Music Audio and Synthesis Tools

README

🤗 MERT-v2-FullSong

Music representations with full-song context

24 kHz mono · 632M parameters · 24 layers · 1,024 dimensions · 25 Hz

🎵 YuE2 project · 🚀 Quick start · 📊 MARBLE · 🎛️ Layer guide · 📚 Citation

MERT-v2-30s   MERT-v2-FullSong   YuE2-3B   🤗 YuE2-Vae   🤗 YuE2-Vae-legacy   🤗 WildSongBench   SheetSage2

MERT-v2-FullSong is a bidirectional music encoder adapted to complete songs lasting 30–360 seconds. Extract general-purpose music representations at the frame or recording level. Load with standard Hugging Face Transformers, using the familiar MERT workflow.

It continues pretraining from MERT-v2-30s and preserves the same feature interface.

MERT2 architecture and training

MERT-v2-30s uses the bidirectional backbone in (B); MERT-v2-FullSong continues through the full-song branch in (C). The causal branch is used for YuE2 tokenization.

🚀 Quick start

Install the matching PyTorch packages:

python -m pip install torch==2.6.0 torchaudio==2.6.0 transformers==4.53.2 huggingface-hub safetensors soundfile
import soundfile as sf
import torch
import torchaudio.functional as AF
from transformers import AutoFeatureExtractor, AutoModel

repo = "m-a-p/MERT-v2-FullSong"
device = "cuda" if torch.cuda.is_available() else "cpu"
processor = AutoFeatureExtractor.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(repo, trust_remote_code=True).eval().to(device)

audio, sr = sf.read("music.wav", dtype="float32", always_2d=True)
audio = audio[:30 * sr].mean(axis=1)  # First 30 seconds, mixed to mono.
waveform = AF.resample(torch.from_numpy(audio), sr, processor.sampling_rate)
inputs = processor(
    waveform.numpy(), sampling_rate=processor.sampling_rate, return_tensors="pt",
).to(device)

with torch.inference_mode():
    output = model(**inputs, output_hidden_states=True)

frames = output.last_hidden_state         # [batch, frames, 1024], 25 Hz
layers = output.hidden_states             # 24 tensors, one per block
mask = output.feature_attention_mask[..., None]
embedding = (frames * mask).sum(1) / mask.sum(1).clamp_min(1)  # [batch, 1024]

hidden_states[0] is block 1; hidden_states[23] is block 24. Remove the audio slice to process a complete song.

📊 MARBLE

Reported frozen-encoder results on MARBLE. All scores are multiplied by 100; higher is better. Bold marks the best displayed value in each column, including ties.

Baseline scores and parameter counts are reproduced from Tables III and V of PupuJEPA; the baselines were not rerun for this release. Evaluation protocols may differ across sources.

General music understanding. MTT = MagnaTagATune; key = GiantSteps refined key accuracy; genre and beat = GTZAN; valence and arousal = EmoMusic. ROC = ROC-AUC; AP = average precision.

ModelParamsMTT ROCMTT APKey acc.Genre acc.Beat F1Valence R²Arousal R²
MERT-Large330M90.637.964.177.686.856.776.1
Dasheng-1.2B1.2B91.540.458.081.487.757.475.0
MuQ310M90.538.563.283.890.158.376.4
MusicFM330M90.938.363.084.190.257.274.4
AudioMAE++307M91.239.561.780.390.059.075.7
MATPAC++307M90.638.263.781.490.157.874.7
A-JEPA307M91.039.265.083.890.057.474.8
PupuJEPA-Large307M91.740.866.186.991.062.576.8
PupuJEPA-Huge632M91.339.764.885.990.562.078.5
MERT-v2-30s632M91.9141.2966.9791.7290.5963.2380.01
MERT-v2-FullSong632M91.7441.2067.0590.6990.5763.5278.14

MTG-Jamendo tagging. Mood denotes mood/theme tags.

ModelParamsInstrument ROCInstrument APMood ROCMood APGenre ROCGenre APTop-50 ROCTop-50 AP
MERT-Large330M75.518.875.313.586.118.082.629.1
Dasheng-1.2B1.2B75.019.076.115.585.518.882.429.6
MuQ310M74.819.173.713.285.419.183.030.2
MusicFM330M74.618.574.914.185.319.481.929.7
AudioMAE++307M77.119.975.614.086.318.983.131.1
MATPAC++307M77.219.775.114.185.719.682.530.2
A-JEPA307M76.619.374.614.385.519.282.529.6
PupuJEPA-Large307M78.421.276.215.386.120.182.830.5
PupuJEPA-Huge632M77.620.575.914.785.920.183.130.7
MERT-v2-30s632M80.2722.8979.4416.6888.0121.2284.1832.17
MERT-v2-FullSong632M80.2723.5178.7415.7487.9820.6684.1331.62

Supplemental: Chords1217 frame accuracy is 78.48 for MERT-v2-30s and 77.79 for MERT-v2-FullSong.

HF reproduction verified: Both models reproduce all ten MARBLE tasks with the fixed evaluation settings. Scores and best settings.

🎛️ Layer guide

Recommended probe settings with the encoder frozen. L1 = hidden_states[0]; All-layer MLP uses all 24 layers.

Task / datasetMERT-v2-30s layerProbe LRMERT-v2-FullSong layerProbe LR
Genre · GTZANL235e-3L245e-4
Beat · GTZANL211e-3L231e-3
Key · GiantStepsL41e-3L231e-3
Emotion · EmoMusicAll-layer MLP5e-5L245e-4
Chords · Chords1217All-layer MLP1e-4All-layer MLP5e-4
Tagging · MagnaTagATuneL221e-3L231e-3
Instrument · MTG-JamendoL141e-3L121e-3
Mood/theme · MTG-JamendoL161e-3L131e-3
Genre · MTG-JamendoL191e-3L161e-3
Top-50 · MTG-JamendoL131e-3L221e-3

📚 Citation

Technical report coming soon. For now, please cite MERT (ICLR 2024) and MARBLE (NeurIPS 2023) when using MERT-v2 or its benchmark results in your research.

@inproceedings{li2024mert,
  title = {MERT: Acoustic Music Understanding Model with Large-Scale Self-supervised Training},
  author = {Li, Yizhi and Yuan, Ruibin and Zhang, Ge and Ma, Yinghao and Chen, Xingran and Yin, Hanzhi and Xiao, Chenghao and Lin, Chenghua and Ragni, Anton and Benetos, Emmanouil and Gyenge, Norbert and Dannenberg, Roger and Liu, Ruibo and Chen, Wenhu and Xia, Gus and Shi, Yemin and Huang, Wenhao and Wang, Zili and Guo, Yike and Fu, Jie},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://proceedings.iclr.cc/paper_files/paper/2024/hash/33dffa2e3d2ab74a783d1a8c292f66d9-Abstract-Conference.html}
}

@inproceedings{yuan2023marble,
  title = {MARBLE: Music Audio Representation Benchmark for Universal Evaluation},
  author = {Yuan, Ruibin and Ma, Yinghao and Li, Yizhi and Zhang, Ge and Chen, Xingran and Yin, Hanzhi and Zhuo, Le and Liu, Yiqi and Huang, Jiawen and Tian, Zeyue and Deng, Binyue and Wang, Ningzhi and Lin, Chenghua and Benetos, Emmanouil and Ragni, Anton and Gyenge, Norbert and Dannenberg, Roger and Chen, Wenhu and Xia, Gus and Xue, Wei and Liu, Si and Wang, Shi and Liu, Ruibo and Guo, Yike and Fu, Jie},
  booktitle = {Advances in Neural Information Processing Systems},
  volume = {36},
  pages = {39626--39647},
  year = {2023},
  doi = {10.52202/075280-1722},
  url = {https://proceedings.neurips.cc/paper_files/paper/2023/hash/7cbeec46f979618beafb4f46d8f39f36-Abstract-Datasets_and_Benchmarks.html}
}

Weights: CC BY-NC 4.0. Dependency notices.

YuE2 family: Song generation · Audio decoder · Benchmark decoder.

Contributors

a43992899

1 commits

m-a-p/MERT-v2-FullSong

Model

9

stars

1

commits

2

linked in READMEs

Sep 9, 2026

updated

audio
custom_code
feature-extraction
mert2
music
music-understanding
representation-learning
safetensors
transformers
Browse cluster: Music Audio and Synthesis Tools

README

🤗 MERT-v2-FullSong

Music representations with full-song context

24 kHz mono · 632M parameters · 24 layers · 1,024 dimensions · 25 Hz

🎵 YuE2 project · 🚀 Quick start · 📊 MARBLE · 🎛️ Layer guide · 📚 Citation

MERT-v2-30s   MERT-v2-FullSong   YuE2-3B   🤗 YuE2-Vae   🤗 YuE2-Vae-legacy   🤗 WildSongBench   SheetSage2

MERT-v2-FullSong is a bidirectional music encoder adapted to complete songs lasting 30–360 seconds. Extract general-purpose music representations at the frame or recording level. Load with standard Hugging Face Transformers, using the familiar MERT workflow.

It continues pretraining from MERT-v2-30s and preserves the same feature interface.

MERT2 architecture and training

MERT-v2-30s uses the bidirectional backbone in (B); MERT-v2-FullSong continues through the full-song branch in (C). The causal branch is used for YuE2 tokenization.

🚀 Quick start

Install the matching PyTorch packages:

python -m pip install torch==2.6.0 torchaudio==2.6.0 transformers==4.53.2 huggingface-hub safetensors soundfile
import soundfile as sf
import torch
import torchaudio.functional as AF
from transformers import AutoFeatureExtractor, AutoModel

repo = "m-a-p/MERT-v2-FullSong"
device = "cuda" if torch.cuda.is_available() else "cpu"
processor = AutoFeatureExtractor.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(repo, trust_remote_code=True).eval().to(device)

audio, sr = sf.read("music.wav", dtype="float32", always_2d=True)
audio = audio[:30 * sr].mean(axis=1)  # First 30 seconds, mixed to mono.
waveform = AF.resample(torch.from_numpy(audio), sr, processor.sampling_rate)
inputs = processor(
    waveform.numpy(), sampling_rate=processor.sampling_rate, return_tensors="pt",
).to(device)

with torch.inference_mode():
    output = model(**inputs, output_hidden_states=True)

frames = output.last_hidden_state         # [batch, frames, 1024], 25 Hz
layers = output.hidden_states             # 24 tensors, one per block
mask = output.feature_attention_mask[..., None]
embedding = (frames * mask).sum(1) / mask.sum(1).clamp_min(1)  # [batch, 1024]

hidden_states[0] is block 1; hidden_states[23] is block 24. Remove the audio slice to process a complete song.

📊 MARBLE

Reported frozen-encoder results on MARBLE. All scores are multiplied by 100; higher is better. Bold marks the best displayed value in each column, including ties.

Baseline scores and parameter counts are reproduced from Tables III and V of PupuJEPA; the baselines were not rerun for this release. Evaluation protocols may differ across sources.

General music understanding. MTT = MagnaTagATune; key = GiantSteps refined key accuracy; genre and beat = GTZAN; valence and arousal = EmoMusic. ROC = ROC-AUC; AP = average precision.

ModelParamsMTT ROCMTT APKey acc.Genre acc.Beat F1Valence R²Arousal R²
MERT-Large330M90.637.964.177.686.856.776.1
Dasheng-1.2B1.2B91.540.458.081.487.757.475.0
MuQ310M90.538.563.283.890.158.376.4
MusicFM330M90.938.363.084.190.257.274.4
AudioMAE++307M91.239.561.780.390.059.075.7
MATPAC++307M90.638.263.781.490.157.874.7
A-JEPA307M91.039.265.083.890.057.474.8
PupuJEPA-Large307M91.740.866.186.991.062.576.8
PupuJEPA-Huge632M91.339.764.885.990.562.078.5
MERT-v2-30s632M91.9141.2966.9791.7290.5963.2380.01
MERT-v2-FullSong632M91.7441.2067.0590.6990.5763.5278.14

MTG-Jamendo tagging. Mood denotes mood/theme tags.

ModelParamsInstrument ROCInstrument APMood ROCMood APGenre ROCGenre APTop-50 ROCTop-50 AP
MERT-Large330M75.518.875.313.586.118.082.629.1
Dasheng-1.2B1.2B75.019.076.115.585.518.882.429.6
MuQ310M74.819.173.713.285.419.183.030.2
MusicFM330M74.618.574.914.185.319.481.929.7
AudioMAE++307M77.119.975.614.086.318.983.131.1
MATPAC++307M77.219.775.114.185.719.682.530.2
A-JEPA307M76.619.374.614.385.519.282.529.6
PupuJEPA-Large307M78.421.276.215.386.120.182.830.5
PupuJEPA-Huge632M77.620.575.914.785.920.183.130.7
MERT-v2-30s632M80.2722.8979.4416.6888.0121.2284.1832.17
MERT-v2-FullSong632M80.2723.5178.7415.7487.9820.6684.1331.62

Supplemental: Chords1217 frame accuracy is 78.48 for MERT-v2-30s and 77.79 for MERT-v2-FullSong.

HF reproduction verified: Both models reproduce all ten MARBLE tasks with the fixed evaluation settings. Scores and best settings.

🎛️ Layer guide

Recommended probe settings with the encoder frozen. L1 = hidden_states[0]; All-layer MLP uses all 24 layers.

Task / datasetMERT-v2-30s layerProbe LRMERT-v2-FullSong layerProbe LR
Genre · GTZANL235e-3L245e-4
Beat · GTZANL211e-3L231e-3
Key · GiantStepsL41e-3L231e-3
Emotion · EmoMusicAll-layer MLP5e-5L245e-4
Chords · Chords1217All-layer MLP1e-4All-layer MLP5e-4
Tagging · MagnaTagATuneL221e-3L231e-3
Instrument · MTG-JamendoL141e-3L121e-3
Mood/theme · MTG-JamendoL161e-3L131e-3
Genre · MTG-JamendoL191e-3L161e-3
Top-50 · MTG-JamendoL131e-3L221e-3

📚 Citation

Technical report coming soon. For now, please cite MERT (ICLR 2024) and MARBLE (NeurIPS 2023) when using MERT-v2 or its benchmark results in your research.

@inproceedings{li2024mert,
  title = {MERT: Acoustic Music Understanding Model with Large-Scale Self-supervised Training},
  author = {Li, Yizhi and Yuan, Ruibin and Zhang, Ge and Ma, Yinghao and Chen, Xingran and Yin, Hanzhi and Xiao, Chenghao and Lin, Chenghua and Ragni, Anton and Benetos, Emmanouil and Gyenge, Norbert and Dannenberg, Roger and Liu, Ruibo and Chen, Wenhu and Xia, Gus and Shi, Yemin and Huang, Wenhao and Wang, Zili and Guo, Yike and Fu, Jie},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://proceedings.iclr.cc/paper_files/paper/2024/hash/33dffa2e3d2ab74a783d1a8c292f66d9-Abstract-Conference.html}
}

@inproceedings{yuan2023marble,
  title = {MARBLE: Music Audio Representation Benchmark for Universal Evaluation},
  author = {Yuan, Ruibin and Ma, Yinghao and Li, Yizhi and Zhang, Ge and Chen, Xingran and Yin, Hanzhi and Zhuo, Le and Liu, Yiqi and Huang, Jiawen and Tian, Zeyue and Deng, Binyue and Wang, Ningzhi and Lin, Chenghua and Benetos, Emmanouil and Ragni, Anton and Gyenge, Norbert and Dannenberg, Roger and Chen, Wenhu and Xia, Gus and Xue, Wei and Liu, Si and Wang, Shi and Liu, Ruibo and Guo, Yike and Fu, Jie},
  booktitle = {Advances in Neural Information Processing Systems},
  volume = {36},
  pages = {39626--39647},
  year = {2023},
  doi = {10.52202/075280-1722},
  url = {https://proceedings.neurips.cc/paper_files/paper/2023/hash/7cbeec46f979618beafb4f46d8f39f36-Abstract-Datasets_and_Benchmarks.html}
}

Weights: CC BY-NC 4.0. Dependency notices.

YuE2 family: Song generation · Audio decoder · Benchmark decoder.

Contributors

a43992899

1 commits