evaluation
Evaluate pretrained PPO checkpoints, resolve checkpoint/environment configuration, and diagnose load or render issues.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- evaluation
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Evaluate pretrained PPO checkpoints, resolve checkpoint/environment configuration, and diagnose load or render issues.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/checkpoints-and-envs.md4.7 KB
- 参考文档references/evaluation-workflow.md5.8 KB
- 参考文档references/troubleshooting.md5.7 KB
- 脚本scripts/evaluation_config_helper.py12.4 KB
03 SKILL.md 正文
Evaluation
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.
What this sub-skill owns
- Resolving the pretrained checkpoint path convention:
PPO_preTrained/<env_name>/PPO_<env_name>_<random_seed>_<run_num>.pth. - Matching checkpoint names to environment names, action-space class, and PPO constructor dimensions.
- Preserving continuous-policy
action_stdalignment; the repo's checkpoint files do not storeaction_std. - Running or adapting the
test.pyevaluation pattern: load policy, run episodes, print per-episode rewards, and report the average reward. - Deciding whether rendering is safe in local, notebook, remote, or headless sessions.
- Diagnosing missing Gym/Roboschool dependencies, checkpoint path mistakes, Gym/Gymnasium API drift, and state-dict shape mismatches.
Quick workflow
-
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-fileThe 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 forCartPole-v1is not load-compatible withLunarLander-v2, and a discrete checkpoint is not compatible with a continuousBoxpolicy. -
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, andK_epochs=80. These update hyperparameters are mostly inert during pureselect_actionevaluation, but the constructor still requires them. Continuous policies also require anaction_stdfloat at construction time. -
Load the checkpoint once the dimensions are known. The shared PPO implementation saves
policy_old.state_dict()andload(checkpoint_path)loads the same state dict into bothpolicy_oldandpolicyusingtorch.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 untildoneormax_ep_len, clears the rollout buffer after each episode, prints episode reward, and reportsaverage test rewardovertotal_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_arrayframe capture and GIF assembly, switch to visualization.
Core references
- Evaluation workflow - evaluation loop adaptation, old/new Gym API handling, and render choices.
- Checkpoints and environments - file naming, built-in pretrained environment presets, and action-space matching rules.
- Troubleshooting - missing dependencies, checkpoint mismatch, headless rendering, and Gym/Gymnasium compatibility failures.
- Root PPO API reference - constructor,
select_action,save, andloaddetails shared across sub-skills.
Validation commands
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.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).