This program will train a machine learning model to generate Lofi music
This is just an experiment, don't use that music to study. It's shit
Based on the work from Skuldur and this article
- Install and setup Anaconda on your system
CPU version
- Run
conda create -n tensorflow_env tensorflow
- Run
conda activate tensorflow_env
GPU version
conda create -n tensorflow_gpuenv tensorflow-gpu
conda activate tensorflow_gpuenv
Prepare a dataset of MIDI files you want to use for training.
Create a new folder called trainingmidis
and copy the MIDIs into it.
You can find a set of Lofi MIDIs here
python3 main.py train
Available parameters:
--epochs=
: Set the amount of epochs the model will run through (Default: 200)--batchsize=
: Set the batch size for each epoch (Default: 64)
After the training, the program will find the best model and copy its weight file into the bestmodels
directory.
During the training, the model will take checkpoints and save them to modelcheckpoints/{ISO 8601 datetime}/
, so you can stop training whenever you like. This means the program won't find the best model, you have to do that manually.
python3 main.py gen --weightfile={path}
Replace {path} with the path to your model weightfile
Available parameters:
notes=
: Set the amount of notes to be generated (Default: 100)
TensorFlow can't allocate enough resources (GPU only)
Run export TF_FORCE_GPU_ALLOW_GROWTH='true'
The model only generates one repeating note
Experiment with the amount of epochs and batch size for training. Loss values < 0.1 seem to work