m-a-p / MERT-v0

huggingface.co
Total runs: 185
24-hour runs: 0
7-day runs: -132
30-day runs: -371
Model's Last Updated: June 02 2023
feature-extraction

Introduction of MERT-v0

Model Details of MERT-v0

Introduction to our series work

The development log of our Music Audio Pre-training (m-a-p) model family:

  • 02/06/2023: arxiv pre-print and training codes released.
  • 17/03/2023: we release two advanced music understanding models, MERT-v1-95M and MERT-v1-330M , trained with new paradigm and dataset. They outperform the previous models and can better generalize to more tasks.
  • 14/03/2023: we retrained the MERT-v0 model with open-source-only music dataset MERT-v0-public
  • 29/12/2022: a music understanding model MERT-v0 trained with MLM paradigm, which performs better at downstream tasks.
  • 29/10/2022: a pre-trained MIR model music2vec trained with BYOL paradigm.

Here is a table for quick model pick-up:

Name Pre-train Paradigm Training Data (hour) Pre-train Context (second) Model Size Transformer Layer-Dimension Feature Rate Sample Rate Release Date
MERT-v1-330M MLM 160K 5 330M 24-1024 75 Hz 24K Hz 17/03/2023
MERT-v1-95M MLM 20K 5 95M 12-768 75 Hz 24K Hz 17/03/2023
MERT-v0-public MLM 900 5 95M 12-768 50 Hz 16K Hz 14/03/2023
MERT-v0 MLM 1000 5 95 M 12-768 50 Hz 16K Hz 29/12/2022
music2vec-v1 BYOL 1000 30 95 M 12-768 50 Hz 16K Hz 30/10/2022
Explanation

The m-a-p models share the similar model architecture and the most distinguished difference is the paradigm in used pre-training. Other than that, there are several nuance technical configuration needs to know before using:

  • Model Size : the number of parameters that would be loaded to memory. Please select the appropriate size fitting your hardware.
  • Transformer Layer-Dimension : The number of transformer layers and the corresponding feature dimensions can be outputted from our model. This is marked out because features extracted by different layers could have various performance depending on tasks .
  • Feature Rate : Given a 1-second audio input, the number of features output by the model.
  • Sample Rate : The frequency of audio that the model is trained with.

Introduction to this model

MERT-v0 is a completely unsupervised model trained on 1000 hour music audios. Its architecture is similar to the HuBERT model , but it has been specifically designed for music through the use of specialized pre-training strategies. It is SOTA-comparable on multiple MIR tasks even under probing settings, while keeping fine-tunable on a single 2080Ti. It outperforms Jukebox representation on GTZAN (genre classification) and GiantSteps (key classification) datasets. Larger models trained with more data are on the way.

Performance Comparison

Model Usage

from transformers import Wav2Vec2FeatureExtractor
from transformers import AutoModel
import torch
from torch import nn
import torchaudio.transforms as T
from datasets import load_dataset


# loading our model weights
model = AutoModel.from_pretrained("m-a-p/MERT-v0", trust_remote_code=True)
# loading the corresponding preprocessor config
processor = Wav2Vec2FeatureExtractor.from_pretrained("m-a-p/MERT-v0",trust_remote_code=True)

# load demo audio and set processor
dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

resample_rate = processor.sampling_rate
# make sure the sample_rate aligned
if resample_rate != sampling_rate:
    print(f'setting rate from {sampling_rate} to {resample_rate}')
    resampler = T.Resample(sampling_rate, resample_rate)
else:
    resampler = None

# audio file is decoded on the fly
if resampler is None:
    input_audio = dataset[0]["audio"]["array"]
else:
  input_audio = resampler(torch.from_numpy(dataset[0]["audio"]["array"]))
  
inputs = processor(input_audio, sampling_rate=resample_rate, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs, output_hidden_states=True)

# take a look at the output shape, there are 13 layers of representation
# each layer performs differently in different downstream tasks, you should choose empirically
all_layer_hidden_states = torch.stack(outputs.hidden_states).squeeze()
print(all_layer_hidden_states.shape) # [13 layer, Time steps, 768 feature_dim]

# for utterance level classification tasks, you can simply reduce the representation in time
time_reduced_hidden_states = all_layer_hidden_states.mean(-2)
print(time_reduced_hidden_states.shape) # [13, 768]

# you can even use a learnable weighted average representation
aggregator = nn.Conv1d(in_channels=13, out_channels=1, kernel_size=1)
weighted_avg_hidden_states = aggregator(time_reduced_hidden_states.unsqueeze(0)).squeeze()
print(weighted_avg_hidden_states.shape) # [768]

Citation

@misc{li2023mert,
      title={MERT: Acoustic Music Understanding Model with Large-Scale Self-supervised Training}, 
      author={Yizhi Li and Ruibin Yuan and Ge Zhang and Yinghao Ma and Xingran Chen and Hanzhi Yin and Chenghua Lin and Anton Ragni and Emmanouil Benetos and Norbert Gyenge and Roger Dannenberg and Ruibo Liu and Wenhu Chen and Gus Xia and Yemin Shi and Wenhao Huang and Yike Guo and Jie Fu},
      year={2023},
      eprint={2306.00107},
      archivePrefix={arXiv},
      primaryClass={cs.SD}
}

Runs of m-a-p MERT-v0 on huggingface.co

185
Total runs
0
24-hour runs
-18
3-day runs
-132
7-day runs
-371
30-day runs

More Information About MERT-v0 huggingface.co Model

MERT-v0 huggingface.co

MERT-v0 huggingface.co is an AI model on huggingface.co that provides MERT-v0's model effect (), which can be used instantly with this m-a-p MERT-v0 model. huggingface.co supports a free trial of the MERT-v0 model, and also provides paid use of the MERT-v0. Support call MERT-v0 model through api, including Node.js, Python, http.

MERT-v0 huggingface.co Url

https://huggingface.co/m-a-p/MERT-v0

m-a-p MERT-v0 online free

MERT-v0 huggingface.co is an online trial and call api platform, which integrates MERT-v0's modeling effects, including api services, and provides a free online trial of MERT-v0, you can try MERT-v0 online for free by clicking the link below.

m-a-p MERT-v0 online free url in huggingface.co:

https://huggingface.co/m-a-p/MERT-v0

MERT-v0 install

MERT-v0 is an open source model from GitHub that offers a free installation service, and any user can find MERT-v0 on GitHub to install. At the same time, huggingface.co provides the effect of MERT-v0 install, users can directly use MERT-v0 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

MERT-v0 install url in huggingface.co:

https://huggingface.co/m-a-p/MERT-v0

Url of MERT-v0

MERT-v0 huggingface.co Url

Provider of MERT-v0 huggingface.co

m-a-p
ORGANIZATIONS

Other API from m-a-p

huggingface.co

Total runs: 95.9K
Run Growth: -74.6K
Growth Rate: -77.71%
Updated:May 25 2025
huggingface.co

Total runs: 35.1K
Run Growth: -8.1K
Growth Rate: -23.20%
Updated:May 25 2025
huggingface.co

Total runs: 20.7K
Run Growth: 18.8K
Growth Rate: 90.71%
Updated:September 30 2026
huggingface.co

Total runs: 666
Run Growth: -425
Growth Rate: -63.81%
Updated:June 02 2023
huggingface.co

Total runs: 591
Run Growth: -117
Growth Rate: -19.80%
Updated:November 19 2024
huggingface.co

Total runs: 455
Run Growth: 79
Growth Rate: 17.36%
Updated:April 09 2024
huggingface.co

Total runs: 408
Run Growth: 277
Growth Rate: 67.89%
Updated:April 08 2024
huggingface.co

Total runs: 214
Run Growth: -110
Growth Rate: -51.40%
Updated:April 08 2024
huggingface.co

Total runs: 171
Run Growth: -35
Growth Rate: -20.47%
Updated:November 22 2024
huggingface.co

Total runs: 114
Run Growth: -182
Growth Rate: -159.65%
Updated:March 18 2025
huggingface.co

Total runs: 102
Run Growth: 27
Growth Rate: 26.47%
Updated:June 03 2024
huggingface.co

Total runs: 76
Run Growth: -117
Growth Rate: -153.95%
Updated:April 08 2024
huggingface.co

Total runs: 37
Run Growth: 5
Growth Rate: 13.51%
Updated:March 12 2025
huggingface.co

Total runs: 21
Run Growth: -6
Growth Rate: -28.57%
Updated:December 20 2023