This repository is the official implementation of Controllable Lyrics-to-Melody Generation.
To install requirements:
pip install -r requirements.txt
To run the codes, first go to the code directory:
cd code/tbc_lstm_gan_memofu
To train the proposed model in the paper, run this command:
python train_memofu_style_seq.py
Additionally, to train other ablation models mentioned in the papers, run the following commands:
python train_memofu_style_seq.py
python train_memofu_style.py
python train_memofu_seq.py
python train_memofu.py
To evaluate the aforementioned trained models with objective evaluation, run:
evaluate_memofu.py
To evaluate the controllability of the proposed model, run:
controllability_experiment.py
To generate melodies from the lyrics with designated Reference Style Embeddings (RSE), run generate_memofu.py
with necessary parameters.
For example:
python generate.py --SYLL_LYRICS "When I am king you will be first a gainst the wall" --WORD_LYRICS "When I am king you will be first against against the wall"
--STYLE_PITCH [0.2, 0.2, 0.2] --STYLE_Duration [0.2, 0.2, 0.2] --STYLE_REST [0.2, 0.2, 0.2]
By default, the pre-trained checkpoint is located at checkpoints/adv_train_tbc_lstm_gan_memofu_style_seq
, which is contained in this repository.
To use a different directory, pass the parameter --CKPT_PATH
.