Views
No views yet
1pip install stable-baselines3 gymnasium box2d-py huggingface_sb3
2
3```python
4import gymnasium as gym
5from stable_baselines3 import PPO
6from huggingface_sb3 import load_from_hub
7
8repo_id = "AAAchalie/ppo-LunarLander-v3-ppo"
9filename = "ppo-LunarLander-v3-ppo.zip"
10
11model = load_from_hub(repo_id, filename)
12env = gym.make("LunarLander-v3", render_mode="human")
13
14obs, _ = env.reset()
15done = False
16
17while not done:
18 action, _ = model.predict(obs)
19 obs, reward, terminated, truncated, _ = env.step(action)
20 done = terminated or truncated
21...