Skip to content

Clean and simple implementations of deep reinforcement learning algorithms using PyTorch.

Notifications You must be signed in to change notification settings

danielnbarbosa/simple_rl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

PyTorch 1.0 implementation of deep reinforcement learning algorithms. Striving for readability and clarity.

As an overarching goal I am trying to keep things as simple as possible and adhere to the original research papers. Working through this has been very helpful for me to really understand the algorithms. Feel free to use it as a working baseline and extend it to suit your needs. If you find issues please let me know!

Environments

To keep things simple, only OpenAI gym environments are integrated. CartPole-v0 is the default because it converges quickly. Other environments with low dimensional state spaces like Acrobot-v1 and LunarLander-v2 as well as all the atari environments like PongDeterministic-v4 can passed in as an option on the command line.

Algorithms

The following algorithms have been implemented:

  • dqn
  • reinforce
  • ppo

Dependencies

  • python 3.6
  • pytorch 1.0
  • gym

Quick Start

First create a virtual environment with all the dependencies installed:

conda create -y -n simple_rl python=3.6 anaconda
conda activate simple_rl
conda install -y -c pytorch pytorch torchvision opencv
pip install gym box2d-py
pip install gym[atari]

Then just select the algorithm you want to use and start training: ./run.py ppo

When training finishes you can see the agent by evaluating the model: ./run.py ppo --eval

You can also run on other environments: ./run.py ppo --env Acrobot-v1

Some algorithms support multiple parallel environments: ./run.py ppo --multi --env Acrobot-v1

Acknowledgements

Thank you to the following code examples that helped me build this.

About

Clean and simple implementations of deep reinforcement learning algorithms using PyTorch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages