PyTorch
English
midigpt
music
midi
symbolic-music
music-generation
gpt2

MIDI-GPT

MIDI-GPT is a GPT-2 transformer for symbolic music generation trained on the GigaMIDI dataset. It supports bar-level infill, autoregressive multi-track generation, and attribute-conditioned generation.

Paper: MIDI-GPT: A Controllable Language Model for Symbolic Music Performance Generation (AAAI 2025) GitHub: Metacreation/MIDI-GPT PyPI: midigpt


Models

File num_bars_map Infill Attributes Status
yellow_medium-final.safetensors 4, 8 yes note density, polyphony (min/max), note duration (min/max) complete (500k steps)
yellow_small-final.safetensors 4, 8 yes note density, polyphony (min/max), note duration (min/max) complete (500k steps)
prism_medium-step376000.safetensors 4, 8, 12, 16 yes key signature, pitch range, silence, note duration, note density (bar), polyphony (bar), pitch class set, genre training in progress (376k / 500k steps)
expressive_medium-step90000.safetensors 4, 8, 12, 16 yes key signature, pitch range, silence, note duration, note density (bar), polyphony (bar), pitch class set, nomml, genre training in progress (90k / 500k steps)

prism_medium and expressive_medium are mid-training checkpoints, not final snapshots — expect loss to keep improving and these files to be superseded as training continues. InferenceEngine.from_pretrained(name) always resolves to the newest checkpoint for that name. ghost (an extended architecture with a MaskBar vocabulary token and up to 16-bar context) is currently training for the first time and has no checkpoint uploaded here yet.

model_dim in InferenceConfig is the context window in bars, not a vocabulary dimension — pass a value from the model's num_bars_map. expressive additionally encodes sub-grid timing via delta tokens and supports switchable velocity/microtiming controls. See docs/models.md in the GitHub repository for the full breakdown.


Installation

pip install "midigpt[inference]"

Usage

from midigpt import Score
from midigpt.inference.engine import InferenceEngine
from midigpt.inference.config import GenerationRequest, InferenceConfig, TrackPrompt

# Download and cache the model automatically
engine = InferenceEngine.from_pretrained("yellow")   # or "prism_medium", "expressive"

# Load a MIDI file
score = Score.from_midi("my_song.mid")

# Infill bars 4–7 on track 0 given surrounding context
request = GenerationRequest(
    tracks=[
        TrackPrompt(id=0, bars=list(range(4, 8))),
    ],
    config=InferenceConfig(model_dim=8),
)

session = engine.session(score, request)
result  = session.run()
result.to_midi("output.mid")

The model is downloaded once and cached by huggingface_hub in ~/.cache/huggingface/hub/.


Training

Models are trained on GigaMIDI v2.0.0 using the midigpt training pipeline with PyTorch Lightning. Training configs and the preprocessing pipeline are available in the GitHub repository.


Citation

@misc{pasquier2025midigptcontrollablegenerativemodel,
      title={MIDI-GPT: A Controllable Generative Model for Computer-Assisted Multitrack Music Composition}, 
      author={Philippe Pasquier and Jeff Ens and Nathan Fradet and Paul Triana and Davide Rizzotti and Jean-Baptiste Rolland and Maryam Safi},
      year={2025},
      eprint={2501.17011},
      archivePrefix={arXiv},
      primaryClass={cs.SD},
      url={https://arxiv.org/abs/2501.17011}, 
}

License

Creative Commons Attribution-NonCommercial 4.0 International (CC-BY-NC-4.0). Copyright (c) 2026 Metacreation Lab.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train Metacreation/MIDI-GPT

Space using Metacreation/MIDI-GPT 1

Paper for Metacreation/MIDI-GPT