training-policy
Teaches safe Rex-Gym legacy PPO training setup and packaged policy playback, including CLI flags, controller-policy mapping, configs, checkpoints, agent counts, and bounded preflight diagnosis.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training-policy
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Teaches safe Rex-Gym legacy PPO training setup and packaged policy playback, including CLI flags, controller-policy mapping, configs, checkpoints, agent counts, and bounded preflight diagnosis.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/cli-reference.md3.5 KB
- 参考文档references/policy-playback.md3.1 KB
- 参考文档references/training-workflows.md5.0 KB
- 参考文档references/troubleshooting.md4.8 KB
- 脚本scripts/inspect_policy_catalog.py8.6 KB
03 SKILL.md 正文
Rex-Gym training and policy operation
Use this route for Rex-Gym PPO training, rex-gym train, pretrained policy
playback, checkpoint or policy-catalog questions, agent counts, log directories,
open-loop/IK selection, or TensorFlow graph setup. It covers the legacy
Python 3.7/TensorFlow 1.x-style runtime and safe preparation; it does not claim
that a policy is good, that it transfers to hardware, or that a GUI is
available.
Scope and routing
- Read CLI reference for the exact Click commands, choices, defaults, and argument mapping.
- Read training workflows before preparing a log directory or considering a PPO launch.
- Read policy playback for policy ids, package-data mapping, and the finite playback loop.
- Read troubleshooting for dependency, checkpoint, controller, and runtime failures.
- Run the safe policy catalog inspector from any working directory before using packaged policies. It only reads distribution metadata and small config text; it never trains, opens a GUI, restores a graph, or copies checkpoint data.
- Route task spaces, terrain semantics, robot/low-level models, and controller behavior to simulation environments and locomotion modeling. This route only explains how those choices enter the training/playback CLI.
Do not put a large checkpoint into a skill or a new log tree merely to inspect it. Treat a missing package asset, missing display, incompatible dependency, or uncertain controller/task pairing as a preflight stop rather than improvising.
Install and bounded entry checks
The package README targets Python 3.7 and the legacy dependency set. The published package command is:
python3.7 -m pip install rex_gym
rex-gym --help
rex-gym train --help
rex-gym policy --help
rex_gym and rex-gym are the underscore/hyphen spellings of the package
distribution; use the spelling accepted by the package index in the chosen
Python 3.7 environment. TensorFlow 1.15.5 and TensorFlow Probability 0.8 are
legacy dependencies. In the verified setup, TensorFlow/TFP imports require
protobuf 3.20.3. Do not upgrade this stack casually to modern TensorFlow.
First perform bounded checks only:
From the generated skill directory, run the bundled helper with a path inside this tree:
python sub-skills/training-policy/scripts/inspect_policy_catalog.py
python sub-skills/training-policy/scripts/inspect_policy_catalog.py --policy walk_ik --config-summary
The second form is an asset/config check, not a playback test. Confirm the package, the requested policy id, all three TensorFlow checkpoint sidecars, and a readable config before considering a launch. Also check that the parent of the proposed log directory exists and is writable, and choose a positive agent count appropriate to the selected config.
Select the workflow
Train with PPO
Training is an explicit, potentially long-running side effect. Ask for a bounded run plan and authorization before launching; the ordinary command is:
rex-gym train --env walk --log-dir ./rex-logs
For a rendered one-agent playground session, the README form is:
rex-gym train --playground True --env walk --log-dir ./rex-logs
Add controller, terrain, robot mark, environment arguments, and flags only after validating them against the sibling environment/model routes. A complete shape is:
rex-gym train --env walk --log-dir ./rex-logs --agents-number 25 \
--inverse-kinematics --terrain plane --mark base \
--arg target_position 1.0 --flag on_rack True
--log-dir is required. --playground True sets one rendered/debug
environment; ordinary training uses the selected agent count or the config
default. The trainer appends a timestamp and <env>_<signal> to the log path,
saves config.yaml, builds the PPO graph, and writes summaries/checkpoints.
There is no safe dry-run flag in the CLI: use the inspector and --help, not a
training command, for bounded verification.
Play a packaged policy
The command has no log-dir or agent-count flag:
rex-gym policy --env walk --inverse-kinematics --terrain plane --mark base
The player resolves the signal, loads package config.yaml, creates the
rendered environment, restores the mapped TensorFlow checkpoint, and steps
until the environment returns done. This is a GUI/runtime operation, so do
not call it as a smoke test. A display, time, and enough storage for logs or
runtime caches may be required; a terminal policy check is not a quality
claim.
Mapping facts to preserve
- Environment choices are
gallop,walk,turn,standup,go, andposes. With neither controller flag, defaults are respectivelyik,ik,ol,ol,ik, andik. - Supported packaged policy ids are
gallop_ol,gallop_ik,walk_ik,walk_ol,standup_ol,turn_ik,turn_ol, andposes_ik. The exact folder/checkpoint mapping is in policy playback. gois present in the environment/default mapping, butgo_ikis not a supported policy-catalog entry. Do not infer a pretrained Go policy from the environment choice; stop when the catalog/config/checkpoint is absent.- If both controller flags are supplied, the parser chooses open loop first; it does not enforce mutual exclusion. Use exactly one or neither.
Graph and agent safety notes
Trainer creates LimitDuration, RangeNormalize, ClipAction, and
ConvertTo32Bit wrappers. Training graph construction is placed under
/cpu:0; the source sets use_gpu=False, permits soft placement, and enables
GPU memory growth in the TensorFlow 1.x session. Non-Windows training can use
external-process environment wrappers; playground mode stays one agent.
The current code default is num_agents = 25 and update_every = 25 (an older
README snippet says 20). --agents-number overrides the number used to build
the batch, but the source warning checks the config's own divisibility and does
not robustly validate every override. Prefer a positive count dividing the
config update interval, and stop on batch-shape or resource errors instead of
blindly increasing it.
For failures, use troubleshooting, then repeat the catalog check. Do not promise a full training result, policy quality, hardware transfer, or GUI playback when the relevant runtime is not available.
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).