CultureMERT-TA-95M is a 95M-parameter music foundation model adapted to diverse musical cultures through
task arithmetic. Instead of direct continual pre-training on a multi-cultural mixture, as in
CultureMERT-95M, this model merges multiple
single-culture adapted variants of
MERT-v1-95M—each continually pre-trained via our two-stage strategy on a distinct musical tradition:
🔀 This model serves as an alternative to
CultureMERT-95M. It merges culturally specialized models in weight space via task arithmetic to form a unified multi-cultural model. Each single-culture adapted model is obtained using the same two-stage continual pre-training strategy as CultureMERT-95M, applied separately to each musical tradition prior to merging.
We follow the same evaluation protocol as
CultureMERT-95M and report results in comparison to both it and
MERT-v1-95M:
1from transformers import Wav2Vec2FeatureExtractor, AutoModel
2import torch
3from torch import nn
4import torchaudio.transforms as T
5from datasets import load_dataset
6
7# Load model weights and preprocessor config
8model = AutoModel.from_pretrained("ntua-slp/CultureMERT-TA-95M", trust_remote_code=True)
9processor = Wav2Vec2FeatureExtractor.from_pretrained("ntua-slp/CultureMERT-TA-95M", trust_remote_code=True)
10
11# Load example audio
12dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation", trust_remote_code=True).sort("id")
13audio_array = dataset[0]["audio"]["array"]
14sampling_rate = dataset.features["audio"].sampling_rate
15
16# Resample if needed
17resample_rate = processor.sampling_rate
18if resample_rate != sampling_rate:
19 print(f'Setting sample rate from {sampling_rate} to {resample_rate}')
20 resampler = T.Resample(sampling_rate, resample_rate)
21else:
22 resampler = None
23
24# Audio file is decoded on the fly
25if resampler is None:
26 input_audio = dataset[0]["audio"]["array"]
27else:
28 input_audio = resampler(torch.from_numpy(dataset[0]["audio"]["array"]).to(dtype=resampler.kernel.dtype))
29
30# Extract hidden states
31inputs = processor(input_audio, sampling_rate=resample_rate, return_tensors="pt")
32with torch.no_grad():
33 outputs = model(**inputs, output_hidden_states=True)
34
35# Representations: 13 layers (CNN feature extractor + 12 Transformer)
36# NOTE: each layer performs differently in different downstream tasks - you should choose empirically
37all_layer_hidden_states = torch.stack(outputs.hidden_states).squeeze()
38print(all_layer_hidden_states.shape) # [13 layers, Time steps, 768 feature_dim]
39
40# For utterance-level classification tasks, you can simply reduce the representation in time
41time_reduced_hidden_states = all_layer_hidden_states.mean(-2)
42print(time_reduced_hidden_states.shape) # [13, 768]
43
44# You can even use a learnable weighted average representation over all layers
45aggregator = nn.Conv1d(in_channels=13, out_channels=1, kernel_size=1)
46weighted_avg_hidden_states = aggregator(time_reduced_hidden_states.unsqueeze(0)).squeeze()
47print(weighted_avg_hidden_states.shape) # [768]
This model is released under a non-commercial CC BY-NC 4.0 license and is intended for research purposes. While it is designed to address cultural bias in MIR, its training data and pretraining paradigm may still reflect cultural and dataset-specific biases. The model should not be used in commercial or generative applications without explicit consideration of cultural representation, proper attribution, and consent from relevant communities or dataset curators.
1@inproceedings{kanatas2025culturemert,
2 title = {{CultureMERT}: Continual Pre-Training for Cross-Cultural Music Representation Learning},
3 author = {Kanatas, Angelos-Nikolaos and Papaioannou, Charilaos and Potamianos, Alexandros},
4 booktitle = {Proceedings of the 26th International Society for Music Information Retrieval Conference (ISMIR)},
5 address = {Daejeon, South Korea},
6 pages = {569--578},
7 year = {2025},
8 doi = {10.5281/zenodo.17706517},
9 url = {https://arxiv.org/abs/2506.17818}
10}