Skip to content

Instantly share code, notes, and snippets.

@starhopp3r
Created August 11, 2020 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starhopp3r/db91e5e4974614f7e305362c25713a4b to your computer and use it in GitHub Desktop.
Save starhopp3r/db91e5e4974614f7e305362c25713a4b to your computer and use it in GitHub Desktop.
import gym
import rocket_lander_gym
from stable_baselines import PPO2
env = gym.make('RocketLander-v0')
# Monitor the run
env = gym.wrappers.Monitor(env, "./video", force=True)
# Load the saved model
model = PPO2.load("ppo2-falcon.zip", env=None)
# Run the trained agent
obs = env.reset()
while True:
env.render()
action, _states = model.predict(obs)
obs, rewards, done, info = env.step(action)
if done:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment