Skip to content

Add model: BEATs pretrained audio models#4352

Closed
isaac-chung wants to merge 4 commits into
mainfrom
beats
Closed

Add model: BEATs pretrained audio models#4352
isaac-chung wants to merge 4 commits into
mainfrom
beats

Conversation

@isaac-chung

@isaac-chung isaac-chung commented Apr 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds BEATs (Audio Pre-Training with Acoustic Tokenizers) pretrained model implementations
  • Three pretrained checkpoints: BEATs_iter1, BEATs_iter2, BEATs_iter3
  • Auto-downloads BEATs source files from the unilm repo since there is no pip package
  • Tested BEATs_iter2: 75% accuracy on ESC50, also ran on AudioSetMini 0.38 mAP (matches the paper)

Model checklist

  • I have filled out the ModelMeta object to the extent possible
  • I have ensured that my model can be loaded using:
    • mteb.get_model(model_name, revision)
    • mteb.get_model_meta(model_name, revision)
  • I have tested the implementation works on a representative set of tasks
  • The model is public, i.e., is available either as an API or the weights are publicly available to download

Notes

  • Checkpoints are hosted on OneDrive (not HuggingFace), so model_name must point to a local .pt file
  • BEATs source code (MIT license) is fetched at runtime to ~/.cache/torch/hub/beats_src/

isaac-chung and others added 2 commits April 5, 2026 23:10
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@KennethEnevoldsen KennethEnevoldsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really love to get this on HF, even if it is not supported that way everything we have is on HF.

"""


def _load_beats_modules():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm don't we want to put it on huggingface instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something like this could work:

from huggingface_hub import hf_hub_download
import torch

with open(hf_hub_download("username/repo", "model.pt"), "rb") as f:
    obj = torch.load(f, map_location="cpu", weights_only=True)

Comment thread mteb/models/model_implementations/beats_models.py Outdated
logger = logging.getLogger(__name__)

_BEATS_SRC_URL = "https://raw.githubusercontent.com/microsoft/unilm/master/beats"
_BEATS_SRC_FILES = ["BEATs.py", "backbone.py", "modules.py"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably rather copy this in - (this could break very easily with change on their end)

Either than or put it together with the weight on hf

@isaac-chung

Copy link
Copy Markdown
Collaborator Author

So we didn't upload models like EvaCLIP to HF for the same reason - we don't maintain them. Could that be a caveat? That we can upload models but don't maintain them? Or we want to maintain them as well?

Comment thread mteb/models/model_implementations/beats_models.py Outdated

beats_iter1 = ModelMeta(
loader=BEATsWrapper,
name="microsoft/beats-iter1",

@Samoed Samoed Apr 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this pretrained or finetuned model? They have a lot of models and this is not clear which it is

Image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the "Pre-trained Model" column

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they then fine-utned on audioset?

Should we make sure they are eq. to the ones in the paper?

Should we rename to:
microsoft/beats-iter1-pretrained

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they then fine-utned on audioset?

Yeah, I've added it as a training dataset in ModelMeta.

Should we make sure they are eq. to the ones in the paper?

we get the same scores as in the paper for AudioSetMini, but different for ESC50, maybe because we set it up differently? (cross validation)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed models.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm out classification tasks are different due sampling - do we have some of the other models in their table we can compare with to see if the ordering is approx. the same?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's SpeechCommandsv2 too - we have the mini version.

@KennethEnevoldsen KennethEnevoldsen Apr 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm looked to compare a few of the implementation I'm not sure exactly what to draw from these, but beats seems to be doing surprisingly poorly.

mdl ours theirs
beats 0.75 0.951
microsoft/msclap-2023 0.974
microsoft/msclap-2022 0.9095
CLAP (not sure which one) 0.967
MIT/ast-finetuned-audioset-10-10-0.4593 / AST 0.962 0.887
lyrebird/wav2clip / Wav2CLIP 0.721 0.860

We do seem to be maintaining relative ordering if CLAP == microsoft/msclap-2023.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which dataset/task are these for?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESC50

@Samoed Samoed added the new model Questions related to adding a new model to the benchmark label Apr 7, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to inactivity.

@github-actions github-actions Bot added the stale label Apr 22, 2026
@KennethEnevoldsen

Copy link
Copy Markdown
Contributor

@isaac-chung do we need to figure out what to do here?

@isaac-chung

Copy link
Copy Markdown
Collaborator Author

Re: model hosting, I guess we could a) copy the needed files, or b) host it in the mteb org on HF.

Re: correctness/repro scores from the paper, we have the mini/sampled versions of the datasets they used in the paper. We can see if their repo has more scores. Otherwise I'm not sure what else we can try.

@KennethEnevoldsen

Copy link
Copy Markdown
Contributor

If we could move it all to a versioned repo, then I think that would be fine (e.g. hf)

@KennethEnevoldsen

Copy link
Copy Markdown
Contributor

@isaac-chung this seems to have been getting stale - do we want to finish it up?

@isaac-chung

Copy link
Copy Markdown
Collaborator Author

Sure. But we might want to focus on the mveb effort first?

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to inactivity.

@github-actions github-actions Bot added the stale label May 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed due to inactivity.

@github-actions github-actions Bot closed this May 31, 2026
@Samoed Samoed deleted the beats branch June 9, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new model Questions related to adding a new model to the benchmark stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants