TopGit tracks hill-a/stable-baselines on GitHub as part of the AI Tools family. The project has 4.3k stars. A fork of OpenAI Baselines, implementations of reinforcement learning algorithms
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
WARNING: This package is in maintenance mode, please use Stable-Baselines3 (SB3) for an up-to-date version. You can find a migration guide in SB3 documentation.
Stable Baselines
Stable Baselines is a set of improved implementations of reinforcement learning algorithms based on OpenAI Baselines.
You can read a detailed presentation of Stable Baselines in the Medium article.
These algorithms will make it easier for the research community and industry to replicate, refine, and identify new ideas, and will create good baselines to build projects on top of. We expect these tools will be used as a base around which new ideas can be added, and as a tool for comparing a new approach against existing ones. We also hope that the simplicity of these tools will allow beginners to experiment with a more advanced toolset, without being buried in implementation details.
Note: despite its simplicity of use, Stable Baselines (SB) assumes you have some knowledge about Reinforcement Learning (RL). You should not utilize this library without some practice. To that extent, we provide good resources in the documentation to get started with RL.
Main differences with OpenAI Baselines
This toolset is a fork of OpenAI Baselines, with a major structural refactoring, and code cleanups:
Unified structure for all algorithms
PEP8 compliant (unified code style)
Documented functions and classes
More tests & more code coverage
Additional algorithms: SAC and TD3 (+ HER support for DQN, DDPG, SAC and TD3)
Features
Stable-Baselines
OpenAI Baselines
State of the art RL methods
:heavy_check_mark: (1)
:heavy_check_mark:
Documentation
:heavy_check_mark:
:x:
Custom environments
:heavy_check_mark:
:heavy_check_mark:
Custom policies
:heavy_check_mark:
:heavy_minus_sign: (2)
Common interface
:heavy_check_mark:
:heavy_minus_sign: (3)
Tensorboard support
:heavy_check_mark:
:heavy_minus_sign: (4)
Ipython / Notebook friendly
:heavy_check_mark:
:x:
PEP8 code style
:heavy_check_mark:
:heavy_check_mark: (5)
Custom callback
:heavy_check_mark:
:heavy_minus_sign: (6)
(1): Forked from previous version of OpenAI baselines, with now SAC and TD3 in addition (2): Currently not available for DDPG, and only from the run script. (3): Only via the run script. (4): Rudimentary logging of training information (no loss nor graph). (5): EDIT: you did it OpenAI! :cat: (6): Passing a callback function is only available for DQN
Documentation
Documentation is available online: https://stable-baselines.readthedocs.io/
RL Baselines Zoo: A Collection of 100+ Trained RL Agents
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
Note: Stable-Baselines supports Tensorflow versions from 1.8.0 to 1.14.0. Support for Tensorflow 2 API is planned.
Prerequisites
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
Installation of system packages on Mac requires Homebrew. With Homebrew installed, run the following:
brew install cmake openmpi
Windows 10
To install stable-baselines on Windows, please look at the documentation.
Install using pip
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).
Example
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')
# Optional: PPO2 requires a vectorized environment to run
# the env is now wrapped automatically when passing it to the constructor
# env = DummyVecEnv([lambda: env])
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.
Try it online with Colab Notebooks !
All the following examples can be executed online using Google colab notebooks:
Full Tutorial
All Notebooks
Getting Started
Training, Saving, Loading
Multiprocessing
Monitor Training and Plotting
Atari Games
RL Baselines Zoo
Implemented Algorithms
Name
Refactored(1)
Recurrent
Box
Discrete
MultiDiscrete
MultiBinary
Multi Processing
A2C
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
ACER
:heavy_check_mark:
:heavy_check_mark:
:x: (5)
:heavy_check_mark:
:x:
:x:
:heavy_check_mark:
ACKTR
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:x:
:x:
:heavy_check_mark:
DDPG
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:
:x:
:x:
:heavy_check_mark: (4)
DQN
:heavy_check_mark:
:x:
:x:
:heavy_check_mark:
:x:
:x:
:x:
GAIL (2)
:heavy_check_mark:
:x:
:heavy_check_mark:
:heavy_check_mark:
:x:
:x:
:heavy_check_mark: (4)
HER (3)
:heavy_check_mark:
:x:
:heavy_check_mark:
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:
PPO1
:heavy_check_mark:
:x:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark: (4)
PPO2
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
SAC
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:
:x:
:x:
:x:
TD3
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:
:x:
:x:
:x:
TRPO
:heavy_check_mark:
:x:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark: (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.
MuJoCo
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
Testing the installation
All unit tests in baselines can be run using pytest runner:
pip install pytest pytest-cov
make pytest
Projects Using Stable-Baselines
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 ;)
Citing the Project
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}},
}
Maintainers
Stable-Baselines is currently maintained by Ashley Hill (aka @hill-a), Antonin Raffin (aka @araffin), Maximilian Ernestus (aka @ernestum), 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.
How To Contribute
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.
Acknowledgments
Stable Baselines was created in the robotics lab U2IS (INRIA Flowers team) at ENSTA ParisTech.
How active is development on hill-a/stable-baselines?
The most recent commit recorded on hill-a/stable-baselines was 4.2 years ago, based on the GitHub push timestamp. The repository has 720 forks — one of the better signals of community interest.
How does hill-a/stable-baselines compare to other AI Tools projects?
hill-a/stable-baselines is tracked by TopGit in the AI Tools category, with 4.3k GitHub stars and written in Python. Browse the AI Tools topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does hill-a/stable-baselines have?
hill-a/stable-baselines has 4.3k GitHub stars — refresh the page for the live number, or check github.com/hill-a/stable-baselines. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is hill-a/stable-baselines?
hill-a/stable-baselines (hill-a/stable-baselines) is a Python project on GitHub. From the project's own README: A fork of OpenAI Baselines, implementations of reinforcement learning algorithms
What language is hill-a/stable-baselines written in?
hill-a/stable-baselines is written primarily in Python. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is hill-a/stable-baselines associated with?
GitHub's repository topics for hill-a/stable-baselines: "baselines", "data-science", "gym", "machine-learning", "openai", "python", "reinforcement-learning", "reinforcement-learning-algorithms", "toolbox". TopGit's editorial category is AI Tools.
Why is hill-a/stable-baselines categorized under AI Tools?
TopGit places hill-a/stable-baselines in the AI Tools category based on its GitHub topics and description (tagged: "baselines", "data-science", "gym"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Curious whether stable-baselines is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about stable-baselines.