This project is an implementation of Music Transformer(https://arxiv.org/abs/1809.04281) using GPT-2.
The GPT-2 source code was used from the link below.
https://github.com/openai/gpt-2
The difference with the GPT-2 source is that this used only decoder and relative position embedding.
- tensorflow 1.14
- numpy
- librosa
- tensorboardX
- tqdm
- python-midi https://github.com/louisabraham/python3-midi
-
Download and extract Maestro dataset V.2.0.0 from the following link https://magenta.tensorflow.org/datasets/maestro
-
Run preprocessing.ipynb
Modify daestro_dir into your own maestro dataset path in the file.
-
Modify the data_dirs and load_dir, save_dir.
data_dirs: the directories to load preprocessed data files
load_dir: the directory to load a model
save_dir: the directory to save a model -
Run Music-GPT-2.ipynb you can increase the batch size by changing batch_size variable.
Run 'Output MIDI file' cell in Music-GPT-2.ipynb to make a new MIDI file. You should input load_dir, and variable N means the sequence length of what you want to make. It should be greater than the hyper-parameter n_time.
Three samples created by Music-GPT-2
https://soundcloud.com/hutenheum/sets/three-musical-moments-by-gpt-2