-
-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic documentation embeddign the tutorials and requirements, bas…
…ed on RLlib tutorials structure
- Loading branch information
1 parent
9655ead
commit 82f854e
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: "Stable-Baselines3" | ||
--- | ||
|
||
# SB3 Tutorial | ||
|
||
These tutorials show you how to use [SB3](https://stable-baselines3.readthedocs.io/en/master/) to train agents in PettingZoo environments. | ||
|
||
* [PPO for Pistonball](/tutorials/sb3/pistonball/): _Train a PPO model in a parallel environment_ | ||
|
||
* [PPO for Rock-Paper-Scissors](/tutorials/sb3/rps/) _Train a PPO model in an AEC environment_ | ||
|
||
|
||
```{figure} https://docs.ray.io/en/latest/_images/rllib-stack.svg | ||
:alt: RLlib stack | ||
:width: 80% | ||
``` | ||
|
||
```{toctree} | ||
:hidden: | ||
:caption: RLlib | ||
pistonball | ||
holdem | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: "SB3: PPO for Pistonball (Parallel)" | ||
--- | ||
|
||
# RLlib: PPO for Pistonball | ||
|
||
This tutorial shows how to train a [Proximal Policy Optimization](https://stable-baselines3.readthedocs.io/en/master/modules/ppo.html) (PPO) model on the [Pistonball](https://pettingzoo.farama.org/environments/butterfly/pistonball/) environment ([parallel](https://pettingzoo.farama.org/api/parallel/)). | ||
|
||
After training, run the provided code to watch your trained agent play vs itself. See the [documentation](https://stable-baselines3.readthedocs.io/en/master/guide/save_format.html) for more information about saving and loading models. | ||
|
||
|
||
## Environment Setup | ||
To follow this tutorial, you will need to install the dependencies shown below. It is recommended to use a newly-created virtual environment to avoid dependency conflicts. | ||
```{eval-rst} | ||
.. literalinclude:: ../../../tutorials/SB3/requirements.txt | ||
:language: text | ||
``` | ||
|
||
## Code | ||
The following code should run without any issues. The comments are designed to help you understand how to use PettingZoo with RLLib. If you have any questions, please feel free to ask in the [Discord server](https://discord.gg/nhvKkYa6qX). | ||
|
||
### Training the RL agent | ||
|
||
```{eval-rst} | ||
.. literalinclude:: ../../../tutorials/SB3/sb3_pistonball.py | ||
:language: python | ||
``` | ||
|
||
### Watching the trained RL agent play | ||
|
||
```{eval-rst} | ||
.. literalinclude:: ../../../tutorials/SB3/render_sb3_pistonball.py | ||
:language: python | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: "SB3: PPO for Rock-Paper-Scissors (AEC)" | ||
--- | ||
|
||
# RLlib: PPO for Rock-Paper-Scissors | ||
|
||
This tutorial shows how to train a [Proximal Policy Optimization](https://stable-baselines3.readthedocs.io/en/master/modules/ppo.html) (PPO) model on the [Pistonball](https://pettingzoo.farama.org/environments/classic/rps/) environment ([AEC](https://pettingzoo.farama.org/api/aec/)). | ||
|
||
After training, run the provided code to watch your trained agent play vs itself. See the [documentation](https://stable-baselines3.readthedocs.io/en/master/guide/save_format.html) for more information about saving and loading models. | ||
|
||
|
||
## Environment Setup | ||
To follow this tutorial, you will need to install the dependencies shown below. It is recommended to use a newly-created virtual environment to avoid dependency conflicts. | ||
```{eval-rst} | ||
.. literalinclude:: ../../../tutorials/SB3/requirements.txt | ||
:language: text | ||
``` | ||
|
||
## Code | ||
The following code should run without any issues. The comments are designed to help you understand how to use PettingZoo with RLLib. If you have any questions, please feel free to ask in the [Discord server](https://discord.gg/nhvKkYa6qX). | ||
|
||
### Training the RL agent | ||
|
||
```{eval-rst} | ||
.. literalinclude:: ../../../tutorials/SB3/sb3_rps.py | ||
:language: python | ||
``` | ||
|
||
### Watching the trained RL agent play | ||
|
||
```{eval-rst} | ||
.. literalinclude:: ../../../tutorials/SB3/render_sb3_rps.py | ||
:language: python | ||
``` |