https://github.com/daniel05155/reinforcement-learning-in-music-generation
An implementation of automated music composition using Deep Reinforcement Learning with PyTorch.
https://github.com/daniel05155/reinforcement-learning-in-music-generation
inverse-reinforcement-learning music-generation python pytorch reinforcement-learning
Last synced: 3 months ago
JSON representation
An implementation of automated music composition using Deep Reinforcement Learning with PyTorch.
- Host: GitHub
- URL: https://github.com/daniel05155/reinforcement-learning-in-music-generation
- Owner: daniel05155
- Created: 2024-06-07T12:17:38.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-05-04T15:18:51.000Z (about 1 year ago)
- Last Synced: 2025-10-11T12:44:49.540Z (10 months ago)
- Topics: inverse-reinforcement-learning, music-generation, python, pytorch, reinforcement-learning
- Language: Python
- Homepage:
- Size: 359 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Automated Music Composition Using Deep Reinforcement Learning
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.
## Model architecture
### DQN-Based Architecture

### PPO-Based Architecture

# Getting started
## Install Dependencies
```
pip install -r requirements.txt
```
## Dataset
We use the "AIlabs-Pop1K7" as training dataset, which can be download [here](https://github.com/YatingMusic/compound-word-transformer/tree/main).
## Pre-trained Weights
Linear Transformer is our pre-trained weights of agent model, which can be downloaded [here](https://drive.google.com/file/d/1qRALPNx--GCzLJqrkEfP0bcm91jpkvcI/view?usp=sharing).
## Run the Codes
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
```
## Demo
Our generated midi files can be downloaded [here](https://drive.google.com/drive/folders/13HKoJLNTd_gKfzMb2OlZP4nKBRlLHfQ3?usp=sharing).