executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
evaluationEvaluate pretrained PPO checkpoints, resolve checkpoint/environment configuration, and diagnose load or render issues.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when the user asks to test a pretrained network, evaluate a checkpoint, render a trained policy, average episode rewards, or understand why a PPO checkpoint load fails.
Do not use this sub-skill for training-loop changes, PPO update debugging, reward-log plotting, or GIF composition. Route log plots and frame/GIF workflows to the sibling visualization sub-skill. Route low-level PPO.load, PPO.save, select_action, and architecture questions to the root shared API reference.
PPO_preTrained/<env_name>/PPO_<env_name>_<random_seed>_<run_num>.pth.action_std alignment; the repo's checkpoint files do not store action_std.test.py evaluation pattern: load policy, run episodes, print per-episode rewards, and report the average reward.Resolve the intended checkpoint before running an environment. Use the bundled helper from this sub-skill directory:
python scripts/evaluation_config_helper.py --list-presets
python scripts/evaluation_config_helper.py \
--env-name RoboschoolWalker2d-v1 \
--checkpoint-root PPO_preTrained \
--check-file
The helper is path/configuration-only by default. It does not import gym, roboschool, or the PPO module and does not run rollouts.
Match the live environment to the checkpoint. The environment used for gym.make(env_name) must expose the same observation dimension, action dimension, and action-space type that were used to save the state dict. A checkpoint named for CartPole-v1 is not load-compatible with LunarLander-v2, and a discrete checkpoint is not compatible with a continuous Box policy.
Construct the PPO agent with evaluation-compatible arguments. The original testing script uses lr_actor=0.0003, lr_critic=0.001, gamma=0.99, eps_clip=0.2, and K_epochs=80. These update hyperparameters are mostly inert during pure select_action evaluation, but the constructor still requires them. Continuous policies also require an action_std float at construction time.
Load the checkpoint once the dimensions are known. The shared PPO implementation saves policy_old.state_dict() and load(checkpoint_path) loads the same state dict into both policy_old and policy using torch.load(..., map_location=...). Use the root API reference for exact load/save behavior.
Run episodes and average rewards. The native evaluation loop resets the env, calls ppo_agent.select_action(state), steps the env until done or max_ep_len, clears the rollout buffer after each episode, prints episode reward, and reports average test reward over total_test_episodes.
Render only when the display path is ready. Numeric evaluation does not require rendering. For on-screen display, use a compatible Gym render path and a real display. For rgb_array frame capture and GIF assembly, switch to visualization.
select_action, save, and load details shared across sub-skills.Safe checks for this sub-skill should avoid long rollouts unless the user explicitly has the environment packages, display, and checkpoint ready:
python scripts/evaluation_config_helper.py --help
python scripts/evaluation_config_helper.py --env-name CartPole-v1 --checkpoint-root PPO_preTrained --check-file
python -m py_compile scripts/evaluation_config_helper.py
A real episode rollout is optional and dependency-bound because the native test.py imports legacy gym and roboschool; do not treat a missing optional environment package as a failure of the helper or documentation.