I've added seed number randomisation selection for the stable-baselines repository, to investigate the effects of undifferentiating randomisation on overfitting and memorization in deep reinforcement learning.
Documentation is available online: https://stable-baselines.readthedocs.io/
RL Baselines Zoo. is a collection of pre-trained Reinforcement Learning agents using Stable-Baselines.
It also provides basic scripts for training, evaluating agents, tuning hyperparameters and recording videos.
Goals of this repository:
- Provide a simple interface to train and enjoy RL agents
- Benchmark the different Reinforcement Learning algorithms
- Provide tuned hyperparameters for each environment and RL algorithm
- Have fun with the trained agents!
Github repo: https://github.com/araffin/rl-baselines-zoo
Documentation: https://stable-baselines.readthedocs.io/en/master/guide/rl_zoo.html
Note: Stabe-Baselines supports Tensorflow versions from 1.8.0 to 1.14.0. Support for Tensorflow 2 API is planned.
Baselines requires python3 (>=3.5) with the development headers. You'll also need system packages CMake, OpenMPI and zlib. Those can be installed as follows
sudo apt-get update && sudo apt-get install cmake libopenmpi-dev python3-dev zlib1g-devInstallation of system packages on Mac requires Homebrew. With Homebrew installed, run the following:
brew install cmake openmpiTo install stable-baselines on Windows, please look at the documentation.
Install the Stable Baselines package:
pip install stable-baselines[mpi]
This includes an optional dependency on MPI, enabling algorithms DDPG, GAIL, PPO1 and TRPO. If you do not need these algorithms, you can install without MPI:
pip install stable-baselines
Please read the documentation for more details and alternatives (from source, using docker).
Most of the library tries to follow a sklearn-like syntax for the Reinforcement Learning algorithms.
Here is a quick example of how to train and run PPO2 on a cartpole environment:
import gym
from stable_baselines.common.policies import MlpPolicy
from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines import PPO2
env = gym.make('CartPole-v1')
env = DummyVecEnv([lambda: env]) # The algorithms require a vectorized environment to run
model = PPO2(MlpPolicy, env, verbose=1)
model.learn(total_timesteps=10000)
obs = env.reset()
for i in range(1000):
action, _states = model.predict(obs)
obs, rewards, dones, info = env.step(action)
env.render()
env.close()Or just train a model with a one liner if the environment is registered in Gym and if the policy is registered:
from stable_baselines import PPO2
model = PPO2('MlpPolicy', 'CartPole-v1').learn(10000)Please read the documentation for more examples.
All the following examples can be executed online using Google colab notebooks:
| Name | Refactored(1) | Recurrent | Box |
Discrete |
MultiDiscrete |
MultiBinary |
Multi Processing |
|---|---|---|---|---|---|---|---|
| A2C | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| ACER | ✔️ | ✔️ | ❌ (5) | ✔️ | ❌ | ❌ | ✔️ |
| ACKTR | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ✔️ |
| DDPG | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ (4) |
| DQN | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ |
| GAIL (2) | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ❌ | ✔️ (4) |
| HER (3) | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ✔️ | ❌ |
| PPO1 | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ (4) |
| PPO2 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| SAC | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ |
| TD3 | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ |
| TRPO | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ (4) |
(1): Whether or not the algorithm has be refactored to fit the BaseRLModel class.
(2): Only implemented for TRPO.
(3): Re-implemented from scratch, now supports DQN, DDPG, SAC and TD3
(4): Multi Processing with MPI.
(5): TODO, in project scope.
NOTE: Soft Actor-Critic (SAC) and Twin Delayed DDPG (TD3) were not part of the original baselines and HER was reimplemented from scratch.
Actions gym.spaces:
Box: A N-dimensional box that containes every point in the action space.Discrete: A list of possible actions, where each timestep only one of the actions can be used.MultiDiscrete: A list of possible actions, where each timestep only one action of each discrete set can be used.MultiBinary: A list of possible actions, where each timestep any of the actions can be used in any combination.
Some of the baselines examples use MuJoCo (multi-joint dynamics in contact) physics simulator, which is proprietary and requires binaries and a license (temporary 30-day license can be obtained from www.mujoco.org). Instructions on setting up MuJoCo can be found here
All unit tests in baselines can be run using pytest runner:
pip install pytest pytest-cov
pytest --cov-config .coveragerc --cov-report html --cov-report term --cov=.
We try to maintain a list of project using stable-baselines in the documentation, please tell us when if you want your project to appear on this page ;)
To cite this repository in publications:
@misc{stable-baselines,
author = {Hill, Ashley and Raffin, Antonin and Ernestus, Maximilian and Gleave, Adam and Kanervisto, Anssi and Traore, Rene and Dhariwal, Prafulla and Hesse, Christopher and Klimov, Oleg and Nichol, Alex and Plappert, Matthias and Radford, Alec and Schulman, John and Sidor, Szymon and Wu, Yuhuai},
title = {Stable Baselines},
year = {2018},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/hill-a/stable-baselines}},
}
Stable-Baselines is currently maintained by Ashley Hill (aka @hill-a), Antonin Raffin (aka @araffin), Maximilian Ernestus (aka @erniejunior), Adam Gleave (@AdamGleave) and Anssi Kanervisto (@Miffyli).
Important Note: We do not do technical support, nor consulting and don't answer personal questions per email.
To any interested in making the baselines better, there is still some documentation that needs to be done. If you want to contribute, please read CONTRIBUTING.md guide first.
Stable Baselines was created in the robotics lab U2IS (INRIA Flowers team) at ENSTA ParisTech.
Logo credits: L.M. Tenkes