OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

Midi Gpt

Midi Gpt is a GPT-2 transformer and Python package for computer-assisted multitrack symbolic music composition, with inference tools to generate or fill musical bars and export results as MIDI.

Independent OpenViST project profile, based on linked sources.

Midi Gpt — OpenViST project profile in AI Models.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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_medium supports four- and eight-bar contexts, while prism_medium lists contexts from four to 16 bars and attributes includi
  • Inference can load named pretrained models from Hugging Face Hub or load a local .safetensors or .pt checkpoint.
  • The inference extra includes PyTorch, huggingface_hub and safetensors; 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.

Source-based practical guide

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

  1. Install with the command below.

    Documented command
    pip install "midigpt[inference]"
  2. Load a pretrained model using InferenceEngine.from_pretrained("yellow_medium").

  3. Create a score and GenerationRequest with track prompts and an InferenceConfig, then run the engine session.

  4. 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_dim represents the context window in bars and must match a value in the selected model’s num_bars_map.
  • Available controls and context lengths vary by model.
Source-based practical guide

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

  1. Load the score with Score.from_midi("my_song.mid").

  2. Create a GenerationRequest with a TrackPrompt listing the bars to regenerate; set another track’s prompt to ignore=True if it should remain out of the token stream.

  3. Run the request through engine.session(score, request).run().

  4. 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.
Evidence and transparency

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