Skip to main content

Pytorch version of Stable Baselines, implementations of reinforcement learning algorithms.

Project description

Stable Baselines3

Stable Baselines3 is a set of reliable implementations of reinforcement learning algorithms in PyTorch. It is the next major version of Stable Baselines.

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.

Links

Repository: https://github.com/DLR-RM/stable-baselines3

Blog post: https://araffin.github.io/post/sb3/

Documentation: https://stable-baselines3.readthedocs.io/en/master/

RL Baselines3 Zoo: https://github.com/DLR-RM/rl-baselines3-zoo

SB3 Contrib: https://github.com/Stable-Baselines-Team/stable-baselines3-contrib

Quick example

Most of the library tries to follow a sklearn-like syntax for the Reinforcement Learning algorithms using Gym.

Here is a quick example of how to train and run PPO on a cartpole environment:

import gym

from stable_baselines3 import PPO

env = gym.make("CartPole-v1")

model = PPO("MlpPolicy", env, verbose=1)
model.learn(total_timesteps=10_000)

obs = env.reset()
for i in range(1000):
    action, _states = model.predict(obs, deterministic=True)
    obs, reward, done, info = env.step(action)
    env.render()
    if done:
        obs = env.reset()

Or just train a model with a one liner if the environment is registered in Gym and if the policy is registered:

from stable_baselines3 import PPO

model = PPO("MlpPolicy", "CartPole-v1").learn(10_000)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stable_baselines3-1.5.1a8.tar.gz (133.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stable_baselines3-1.5.1a8-py3-none-any.whl (177.1 kB view details)

Uploaded Python 3

File details

Details for the file stable_baselines3-1.5.1a8.tar.gz.

File metadata

  • Download URL: stable_baselines3-1.5.1a8.tar.gz
  • Upload date:
  • Size: 133.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/22.3.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.12

File hashes

Hashes for stable_baselines3-1.5.1a8.tar.gz
Algorithm Hash digest
SHA256 c8eae14468b33a9cb715d9c4cfa99974cf3ae3e0c48e221b3e312c54f947fb78
MD5 698d6de441ffab122f96b92fd877ed2f
BLAKE2b-256 abcd7a5749037a7795c75c10a35bcda4ad9dc386248fac3d1c5afd1d339b1347

See more details on using hashes here.

File details

Details for the file stable_baselines3-1.5.1a8-py3-none-any.whl.

File metadata

  • Download URL: stable_baselines3-1.5.1a8-py3-none-any.whl
  • Upload date:
  • Size: 177.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/22.3.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.12

File hashes

Hashes for stable_baselines3-1.5.1a8-py3-none-any.whl
Algorithm Hash digest
SHA256 d9c60aa5e821eb29761849b0c94c0f89082a8aa5c0a233b6ad8bd77286751c7f
MD5 7653b2faaf19a5b7539e78beedb4a823
BLAKE2b-256 d8f59dd001c3580a3fd7c6bb55e3deae09a6a665591b172c69f3f4f9bf997cf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page