REINFORCE on CartPole-v1
PyTorch Monte Carlo policy gradient for Unit 4 of the Hugging Face Deep RL Course. The policy samples actions from a categorical distribution. Training uses discounted reward-to-go, standardized within each episode, with Adam.
| Evaluation | Result |
|---|---|
| Held-out episodes | 30 |
| Mean reward | 500.00 |
| Standard deviation | 0.00 |
| Course score (mean โ standard deviation) | 500.00 |
| Unit 4 threshold | 350 |
Run the published policy
Download agent.py and install the runtime dependencies:
pip install torch "gymnasium[classic-control]==1.2.3" scipy safetensors imageio imageio-ffmpeg
from agent import evaluate, load_pretrained, make_env
policy = load_pretrained()
environments = [make_env(False) for _ in range(30)]
mean, std, score, episode_rewards = evaluate(policy, environments, 500, 60291)
print(mean, std, score)
agent.py includes the trained safetensors payload, the policy architecture, and the training code. The independent per-episode scores and evaluation seed are in results.json.
Evaluation results
- Mean reward on CartPole-v1self-reported500.00 +/- 0.00