|
--- |
|
library_name: stable-baselines3 |
|
tags: |
|
- Pendulum-v1 |
|
- deep-reinforcement-learning |
|
- reinforcement-learning |
|
- stable-baselines3 |
|
model-index: |
|
- name: PPO |
|
results: |
|
- metrics: |
|
- type: mean_reward |
|
value: -272.21 +/- 159.73 |
|
name: mean_reward |
|
task: |
|
type: reinforcement-learning |
|
name: reinforcement-learning |
|
dataset: |
|
name: Pendulum-v1 |
|
type: Pendulum-v1 |
|
--- |
|
|
|
# **PPO** Agent playing **Pendulum-v1** |
|
This is a trained model of a **PPO** agent playing **Pendulum-v1** using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3). |
|
|
|
## Usage (with Stable-baselines3) |
|
```python |
|
from stable_baselines3 import PPO |
|
from stable_baselines3.common.env_util import make_vec_env |
|
|
|
# Create the environment |
|
env_id = "Pendulum-v1" |
|
env = make_vec_env(env_id, n_envs=1) |
|
|
|
# Instantiate the agent |
|
model = PPO( |
|
"MlpPolicy", |
|
env, |
|
gamma=0.98, |
|
use_sde=True, |
|
sde_sample_freq=4, |
|
learning_rate=1e-3, |
|
verbose=1, |
|
) |
|
|
|
# Train the agent |
|
model.learn(total_timesteps=int(1e5)) |
|
|
|
``` |
|
|