pip install -r requirements.txt
Clone the VGMIDI dataset repository, go to the unabelled pieces directory and
extract the midi.zip
file:
git clone
cd vgmidi/unlabelled
unzip midi.zip
Go to the src
directory of unabelled pieces and run the midi_split
script:
cd unlabelled/src
python3 midi_split.py --csv ../../vgmidi_unlabelled.csv --midi ../midi
Augment the VGMIDI dataset with tranposition and time strech as defined by Oore et al. 2017:
python3 augment.py --midi <path_to_midi_data>
Encode the VGMIDI dataset with the encoding scheme as defined by Oore et al. 2017:
python3 encoder.py --midi <path_to_midi_data>
Train a fast-tranformer on the VGMIDI dataset:
python3 train.py --train vgmidi_augmented/train/ --test vgmidi_augmented/test --seq_len 2048 --lr 1e-04 --epochs 50 --d_query 32 --n_heads 8 --n_layers 8 --batch_size 16 --save_to trained/model_{}.pth
This repository includes a pre-trained model (trained/model40.pth
). To generate music with that model:
python3 generate.py --seq_len 2048 --n_layers 8 --model trained/model40.pth --vocab_size 390 --k 45 --p 0.9
To generate music with a model you trained yourself, simply change the --model argument to point to the model saved during training.