Views
No views yet
1import gymnasium as gym
2from stable_baselines3 import PPO
3from huggingface_sb3 import load_from_hub
4
5model = PPO.load(
6 load_from_hub("zozo-dejante/ppo-LunarLander-v3", "ppo_LunarLander.zip")
7)
8
9test_env = gym.make("LunarLander-v3", render_mode="human", max_episode_steps=400)
10observation, _info = test_env.reset()
11while True:
12 action, _states = model.predict(observation)
13 observation, reward, terminated, truncated, info = test_env.step(action)
14
15 test_env.render()
16
17 if terminated or truncated:
18 observation, _info = test_env.reset()