Views
No views yet
1from stable_baselines3 import PPO
2import gymnasium as gym
3
4# Load the model
5model = PPO.load("drap/cartpole-ppo")
6
7# Create environment
8env = gym.make("CartPole-v1")
9
10# Test the model
11obs, _ = env.reset()
12while True:
13 action, _ = model.predict(obs, deterministic=True)
14 obs, reward, terminated, truncated, _ = env.step(action)
15 if terminated or truncated:
16 break