diff --git a/docs/_static/img/colab-badge.svg b/docs/_static/img/colab-badge.svg new file mode 100644 index 0000000..c08066e --- /dev/null +++ b/docs/_static/img/colab-badge.svg @@ -0,0 +1 @@ + Open in ColabOpen in Colab diff --git a/docs/guide/examples.rst b/docs/guide/examples.rst index 980bb5a..2760c14 100644 --- a/docs/guide/examples.rst +++ b/docs/guide/examples.rst @@ -12,6 +12,7 @@ notebooks: - `Full Tutorial `_ - `All Notebooks `_ - `Getting Started`_ +- `RL Baselines zoo`_ .. - `Training, Saving, Loading`_ @@ -20,16 +21,15 @@ notebooks: .. - `Atari Games`_ .. - `Breakout`_ (trained agent included) .. - `Hindsight Experience Replay`_ -.. - `RL Baselines zoo`_ .. _Getting Started: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/stable_baselines_getting_started.ipynb -.. _Training, Saving, Loading: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/saving_loading_dqn.ipynb -.. _Multiprocessing: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/multiprocessing_rl.ipynb -.. _Monitor Training and Plotting: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/monitor_training.ipynb -.. _Atari Games: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/atari_games.ipynb -.. _Breakout: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/breakout.ipynb -.. _Hindsight Experience Replay: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/stable_baselines_her.ipynb -.. _RL Baselines zoo: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/rl-baselines-zoo.ipynb +.. _Training, Saving, Loading: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/saving_loading_dqn.ipynb +.. _Multiprocessing: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/multiprocessing_rl.ipynb +.. _Monitor Training and Plotting: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/monitor_training.ipynb +.. _Atari Games: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/atari_games.ipynb +.. _Breakout: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/breakout.ipynb +.. _Hindsight Experience Replay: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/stable_baselines_her.ipynb +.. _RL Baselines zoo: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/rl-baselines-zoo.ipynb .. |colab| image:: ../_static/img/colab.svg @@ -38,9 +38,8 @@ Basic Usage: Training, Saving, Loading In the following example, we will train, save and load a DQN model on the Lunar Lander environment. -.. .. image:: ../_static/img/try_it.png -.. :scale: 30 % -.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/saving_loading_dqn.ipynb +.. .. image:: ../_static/img/colab-badge.svg +.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/saving_loading_dqn.ipynb .. figure:: https://cdn-images-1.medium.com/max/960/1*f4VZPKOI0PYNWiwt0la0Rg.gif @@ -93,9 +92,8 @@ In the following example, we will train, save and load a DQN model on the Lunar Multiprocessing: Unleashing the Power of Vectorized Environments ---------------------------------------------------------------- .. -.. .. image:: ../_static/img/try_it.png -.. :scale: 30 % -.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/multiprocessing_rl.ipynb +.. .. image:: ../_static/img/colab-badge.svg +.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/multiprocessing_rl.ipynb .. figure:: https://cdn-images-1.medium.com/max/960/1*h4WTQNVIsvMXJTCpXm_TAw.gif @@ -162,9 +160,8 @@ This could be useful when you want to monitor training, for instance display liv learning curves in Tensorboard (or in Visdom) or save the best agent. If your callback returns False, training is aborted early. -.. .. image:: ../_static/img/try_it.png -.. :scale: 30 % -.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/monitor_training.ipynb +.. .. image:: ../_static/img/colab-badge.svg +.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/monitor_training.ipynb .. .. .. figure:: ../_static/img/learning_curve.png .. @@ -270,9 +267,8 @@ Training a RL agent on Atari games is straightforward thanks to ``make_atari_env It will do `all the preprocessing `_ and multiprocessing for you. -.. .. image:: ../_static/img/try_it.png -.. :scale: 30 % -.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/master/atari_games.ipynb +.. .. image:: ../_static/img/colab-badge.svg +.. :target: https://colab.research.google.com/github/Stable-Baselines-Team/rl-colab-notebooks/blob/sb3/atari_games.ipynb .. .. code-block:: python diff --git a/docs/guide/rl_zoo.rst b/docs/guide/rl_zoo.rst new file mode 100644 index 0000000..43d7038 --- /dev/null +++ b/docs/guide/rl_zoo.rst @@ -0,0 +1,108 @@ +.. _rl_zoo: + +================== +RL Baselines3 Zoo +================== + +`RL Baselines3 Zoo `_. is a collection of pre-trained Reinforcement Learning agents using +Stable-Baselines3. +It also provides basic scripts for training, evaluating agents, tuning hyperparameters and recording videos. + +Goals of this repository: + +1. Provide a simple interface to train and enjoy RL agents +2. Benchmark the different Reinforcement Learning algorithms +3. Provide tuned hyperparameters for each environment and RL algorithm +4. Have fun with the trained agents! + +Installation +------------ + +1. Clone the repository: + +:: + + git clone --recursive https://github.com/DLR-RM/rl-baselines3-zoo + cd rl-baselines3-zoo/ + + +.. note:: + + You can remove the ``--recursive`` option if you don't want to download the trained agents + + +2. Install dependencies +:: + + apt-get install swig cmake ffmpeg + pip install -r requirements.txt + + +Train an Agent +-------------- + +The hyperparameters for each environment are defined in +``hyperparameters/algo_name.yml``. + +If the environment exists in this file, then you can train an agent +using: + +:: + + python train.py --algo algo_name --env env_id + +For example (with evaluation and checkpoints): + +:: + + python train.py --algo ppo2 --env CartPole-v1 --eval-freq 10000 --save-freq 50000 + + +Continue training (here, load pretrained agent for Breakout and continue +training for 5000 steps): + +:: + + python train.py --algo a2c --env BreakoutNoFrameskip-v4 -i trained_agents/a2c/BreakoutNoFrameskip-v4_1/BreakoutNoFrameskip-v4.zip -n 5000 + + +Enjoy a Trained Agent +--------------------- + +If the trained agent exists, then you can see it in action using: + +:: + + python enjoy.py --algo algo_name --env env_id + +For example, enjoy A2C on Breakout during 5000 timesteps: + +:: + + python enjoy.py --algo a2c --env BreakoutNoFrameskip-v4 --folder rl-trained_agents/ -n 5000 + + +Hyperparameter Optimization +--------------------------- + +We use `Optuna `_ for optimizing the hyperparameters. + + +Tune the hyperparameters for PPO, using a random sampler and median pruner, 2 parallels jobs, +with a budget of 1000 trials and a maximum of 50000 steps: + +:: + + python train.py --algo ppo --env MountainCar-v0 -n 50000 -optimize --n-trials 1000 --n-jobs 2 \ + --sampler random --pruner median + + +Colab Notebook: Try it Online! +------------------------------ + +You can train agents online using Google `colab notebook `_. + + +.. note:: + + You can find more information about the rl baselines3 zoo in the repo `README `_. For instance, how to record a video of a trained agent. diff --git a/docs/index.rst b/docs/index.rst index b1040cc..278a707 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -42,6 +42,7 @@ Main Features guide/custom_env guide/custom_policy guide/callbacks + guide/rl_zoo guide/migration guide/checking_nan