Last active
January 23, 2021 20:07
-
-
Save davidADSP/1368346492393421122f47c965bdd9ed to your computer and use it in GitHub Desktop.
Training a PPO model on Pendulum
This file contains hidden or 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
import gym | |
from stable_baselines import PPO1 | |
from stable_baselines.common.policies import MlpPolicy | |
from stable_baselines.common.callbacks import EvalCallback | |
env = gym.make('Pendulum-v0') | |
model = PPO1(MlpPolicy, env) | |
# Separate evaluation env | |
eval_env = gym.make('Pendulum-v0') | |
eval_callback = EvalCallback(eval_env, best_model_save_path='./logs/', | |
log_path='./logs/', eval_freq=500, | |
deterministic=True, render=False) | |
model.learn(5000, callback=eval_callback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment