This repository is an implementation of automated music composition with Reinforcement Learning(RL) in PyTorch. The Deep Q Network (DQN) is our primary policy for automated music composition. Within the RL framework, a well-designed reward module is essential for success. Therefore, we developed the Inverse Reinforcement Learning (IRL) framework for the purpose of reward learning within an adversarial framework. The advantage of our IRL algorithm is that it not only enhances policy optimization but also requires no music theory-based rules. The overall system leads to more diverse melodies and maintains the harmony of the generated music sequences.
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.