Practical overview
When it fits
Use Midi Gpt when a workflow starts from a symbolic score or requires a generated symbolic track that can be saved as MIDI. It supports both arrangement infilling and autoregressive generation from scratch.
Who it is for
- Composers who want to generate tracks or fill gaps in a MIDI arrangement.
- Music-software developers integrating controllable symbolic-music generation into Python workflows.
- Researchers experimenting with transformer-based music composition.
Documented uses
- Regenerate selected missing bars while retaining other arrangement material.
- Generate a new track from scratch using musical attributes.
- Adjust output with documented controls for note density, polyphony and note duration.
- Load a pretrained model or a local checkpoint and export the resulting score to MIDI.
Requirements & limits
The repository is public and MIT-licensed. The README documents prebuilt wheels for CPython 3.10–3.12 on Linux x86_64, macOS x86_64 and arm64, and Windows AMD64.
- Model variants support different context lengths and control attributes; for example,
yellow_mediumsupports four- and eight-bar contexts, whileprism_mediumlists contexts from four to 16 bars and attributes includi - Inference can load named pretrained models from Hugging Face Hub or load a local
.safetensorsor.ptcheckpoint. - The inference extra includes PyTorch,
huggingface_hubandsafetensors; training, real-time and HTTP dependencies are offered as separate extras. - A source build requires Python 3.10+, CMake 3.21+ and a C++20 compiler; the README says prebuilt wheels avoid the compiler requirement.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install the inference package and generate a MIDI file
Set up the documented inference package, load a pretrained model and save a generated score as MIDI.
Before you start
- Python environment with CPython 3.10–3.12 on Linux x86_64, macOS x86_64 or arm64, or Windows AMD64.
- Install the
midigpt[inference]package; the README lists PyTorch 2.0 or later among the inference dependencies. - A pretrained model name such as
yellow_medium.
Steps
Install with the command below.
pip install "midigpt[inference]"Load a pretrained model using
InferenceEngine.from_pretrained("yellow_medium").Create a score and
GenerationRequestwith track prompts and anInferenceConfig, then run the engine session.Save the result with
result.to_midi("output.mid").
Expected outcome
A generated symbolic score saved as a MIDI file; the README’s quick-start example uses a four-bar score with one empty melodic track.
Guide limitations
- The README says the model is downloaded once and cached by
huggingface_hub. model_dimrepresents the context window in bars and must match a value in the selected model’snum_bars_map.- Available controls and context lengths vary by model.
Regenerate selected bars in an existing MIDI arrangement
Use an existing MIDI score as input and request generation for chosen bars while leaving another track unchanged.
Before you start
- An existing MIDI file.
- The
midigpt[inference]package and a loaded pretrained model. - Bar indices for the track to regenerate and the model’s supported context length.
Steps
Load the score with
Score.from_midi("my_song.mid").Create a
GenerationRequestwith aTrackPromptlisting the bars to regenerate; set another track’s prompt toignore=Trueif it should remain out of the token stream.Run the request through
engine.session(score, request).run().Export the result with
result.to_midi("output.mid").
Expected outcome
A MIDI output containing the requested regenerated bars and the score’s other arrangement content.
Guide limitations
- The README’s example regenerates bars 4–7 and ignores track 1; other requests must use valid track and bar indices.
- The selected model’s context window must be configured using a supported value from its
num_bars_map.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- Metacreation-Lab/MIDI-GPT · Official homepage title · retained in its source language

