Views
No views yet
1import gymnasium as gym
2from stable_baselines3 import PPO
3from huggingface_sb3 import load_from_hub
4
5checkpoint = load_from_hub("thomasarmstrong/ppo-LunarLander-v3", "ppo-LunarLander-v3.zip")
6model = PPO.load(checkpoint)
7
8env = gym.make("LunarLander-v3")
9obs, info = env.reset()
10while True:
11 action, _ = model.predict(obs, deterministic=True)
12 obs, reward, terminated, truncated, info = env.step(action)
13 if terminated or truncated:
14 obs, info = env.reset()