This repository is an implementation of automated music composition with Reinforcement Learning(RL) in PyTorch. We design a novel deep reinforcement learning-based framework with the self-attention-based neural networks for long-sequence music generation, which differs from the conventional Generative Adversarial Network (GAN). Additionally, we utilize Deep Q Network (DQN)-based and Proximal Policy Optimization (PPO)-based techniquein Reinforcement Learning (RL) with the transformer model to generate pop-style piano music sequentially.
pip install -r requirements.txt
We use the "AIlabs-Pop1K7" as training dataset, which can be download here.
Linear Transformer is our pre-trained weights of agent model, which can be downloaded here.
Our expertiment is based on the unconditional generation with Reinforcement Learning using PyTorch framework in Python.
- Pretrain:
python agent_pretrain.py
- Training
python IRL_dqn_train.py
- Evaluation
## Generate midis songs in './gen_midis ##
python testing-no-type-cp.py
Our generated midi files can be downloaded here.