Natooz/MidiTok

MIDI / symbolic music tokenizers for Deep Learning models 🎶

What it solves

MidiTok provides a standardized way to convert music files (MIDI and abc) into sequences of tokens that machine learning models, such as Transformers, can understand. This removes the need for manually implementing complex music tokenization schemes for tasks like music generation, transcription, or Music Information Retrieval (MIR).

How it works

The library implements a wide variety of established music tokenization methods (such as REMI, MIDI-Like, and CPWord). It allows users to set specific parameters for how music is represented as tokens. Additionally, it supports advanced vocabulary training using techniques like Byte Pair Encoding (BPE), Unigram, and WordPiece, and provides tools for data augmentation and integration with the Hugging Face Hub for sharing models.

Who it’s for

Researchers and developers working on AI music generation, music transcription, and Music Information Retrieval (MIR) who need to prepare their music datasets for training deep learning models.

Highlights

  • Multiple Tokenization Schemes: Supports a vast array of industry-standard tokenizations including REMI, REMI+, TSD, and MuMIDI.
  • Hugging Face Integration: Seamlessly integrates with the Hugging Face Hub for allowing users to push and download pretrained tokenizers.
  • Trainable Vocabularies: Ability to train tokenizers using BPE, Unigram, and WordPiece for optimized music representation.
  • PyTorch Ready: Includes built-in utilities for creating PyTorch datasets and data loaders for streamlined model training.