Views
No views yet
| Metric | Value |
|---|---|
| Mean Reward | 500.00 ± 0.00 |
| Eval Episodes | 20 |
| Training Timesteps | 100,000 |
| Training Time | ~2 minutes (CPU) |
| Parameter | Value |
|---|---|
| Algorithm | PPO |
| Policy | MlpPolicy |
| n_steps | 32 |
| batch_size | 256 |
| n_epochs | 20 |
| gamma | 0.98 |
| gae_lambda | 0.8 |
| ent_coef | 0.0 |
| clip_range | 0.2 |
| learning_rate | 0.001 |
| n_envs | 8 |
| total_timesteps | 100,000 |
1from stable_baselines3 import PPO
2from huggingface_sb3 import load_from_hub
3
4# Download and load the model
5checkpoint = load_from_hub(
6 repo_id="shubhamshakya21/ppo-CartPole-v1",
7 filename="ppo-CartPole-v1.zip",
8)
9model = PPO.load(checkpoint)
10
11# Use the model
12import gymnasium as gym
13env = gym.make("CartPole-v1")
14obs, info = env.reset()
15for _ in range(1000):
16 action, _ = model.predict(obs, deterministic=True)
17 obs, reward, terminated, truncated, info = env.step(action)
18 if terminated or truncated:
19 obs, info = env.reset()n_steps=32): fits CartPole's short episodesn_epochs=20): maximizes learning per rolloutgamma=0.98): optimized for ~500-step horizonpip install stable-baselines3 huggingface_sb3 gymnasium