How yatingmusic/remi works
Project type and purpose
• This is a research-oriented machine-learning pipeline for symbolic music generation. It is neither a web app nor a full-stack service; instead it’s an open-source toolkit that:
• Reads raw MIDI files
• Converts them into a custom, text-like token representation (“REMI”)
• Trains or fine-tunes a Transformer-XL model on those tokens
• Generates new (or continuation) MIDI sequences from the trained model
File structure
Top-level files and directories:
• chord_recognition.py – optional script for chord analysis of MIDI
• finetune.py – script to fine-tune the Transformer model on new data
• main.py – generation example (from scratch and continuation)
• midi2remi.ipynb – notebook showing how to convert MIDI to REMI tokens
• model.py – definition of PopMusicTransformer class (load, generate, close)
• modules.py – Transformer-XL core modules borrowed from kimiyoung/transformer-xl
• utils.py – helper functions (e.g., data loading, token mapping)
• result/ – folder to hold generated MIDI outputs
Patterns and indicators:
• A clear data-processing pipeline: MIDI → REMI tokens → model input
• Two main workflows: training/finetuning (finetune.py) vs. inference/generation (main.py)
• Separation of concerns: “modules.py” for architecture, “model.py” for orchestration
Key insights from the README
• REMI provides a metrical context for rhythm and harmony.
• Underlying model: Transformer-XL (tensorflow-gpu 1.14.0).
• External library: miditoolkit for MIDI parsing.
• Two checkpoints provided for inference (“tempo” only and “tempo+chord”).
• Data directories (not in this distribution) house train/evaluation MIDI files.
• Generation parameters: n_target_bar, temperature, top_k sampling.