environment-utils
Use PARL environment wrappers, replay buffers, schedulers, CSV logging, and summary helpers safely across Gym, continuous-control, Atari, MuJoCo, multi-agent, and vector-env workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- environment-utils
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use PARL environment wrappers, replay buffers, schedulers, CSV logging, and summary helpers safely across Gym, continuous-control, Atari, MuJoCo, multi-agent, and vector-env workflows.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/logging-and-schedulers.md6.7 KB
- 参考文档references/troubleshooting.md8.1 KB
- 参考文档references/wrappers-and-data.md10.3 KB
- 脚本scripts/check_env_utils.py4.9 KB
03 SKILL.md 正文
PARL environment utilities
Use this sub-skill when a task involves PARL's environment wrappers or small utilities around an RL loop: Gym API compatibility, continuous action remapping, Atari/MuJoCo/multi-agent/vector environment wrappers, ReplayMemory, schedulers, CSVLogger, logger, summary, tensorboard, or visualdl helpers.
Do not use this sub-skill to choose a full algorithm, implement a parl.Model/parl.Agent, or manage xparl workers. Route adjacent tasks to sibling operating skills:
../core-framework/SKILL.mdfor backend selection,Model/Algorithm/Agent, save/restore, inference export, and weight synchronization.../algorithm-recipes/SKILL.mdfor DQN/DDPG/TD3/SAC/PPO/QMIX/MADDPG/A2C/IMPALA/CQL/OAC recipes and training-loop structure.../xparl-distributed/SKILL.mdfor@parl.remote_class,parl.connect,xparl start, remote environments, ports, and cluster security.
Operating workflow
-
Normalize the environment API first. For ordinary Gym environments, wrap with
CompatWrapperbefore calling code that expects the old four-returnstepAPI. Then add workflow-specific wrappers such asActionMappingWrapper,wrap_deepmind,wrap_rms,MAenv, orVectorEnv. -
Choose wrappers by action/observation surface. Use
ActionMappingWrapperonly when the environment action space is a continuousBox; use Atari wrappers only for Atari-like image/action-meaning environments; use MuJoCo RMS wrappers for continuous-control normalization; use multi-agent wrappers only when the PettingZoo or legacy multiagent dependency stack is intentionally installed. -
Check data utility shapes before training. Configure
ReplayMemory(max_size, obs_dim, act_dim)from the actual observation and action dimensions. For discrete actions passact_dim=0; for continuous actions pass a positive integer action dimension. -
Keep logging output explicit. Set a deliberate
logger.set_dir(...)before writing summaries, or createCSVLoggerwith an explicit file path in a scratch/output directory. Avoid accidental deletion from logger helpers when a directory already exists. -
Smoke-test utilities safely. Run the bundled checker before adapting examples:
python scripts/check_env_utils.py --jsonAdd
--optional-wrappersto classify optional Atari, MuJoCo, and multi-agent imports without creating real environments. -
Escalate by symptom. For wrapper/data-flow behavior, read
references/wrappers-and-data.md; for logging and schedulers, readreferences/logging-and-schedulers.md; for failures, readreferences/troubleshooting.md.
Verification status
The utility signatures for CompatWrapper, ActionMappingWrapper, VectorEnv, ReplayMemory, PiecewiseScheduler, LinearDecayScheduler, and CSVLogger were checked against an installed PARL 2.2.1 package. Small scheduler, replay-memory, CSV, vector-env, and action-mapping behaviors are covered by the bundled checker. Atari, MuJoCo, PettingZoo multi-agent, TensorBoard, and VisualDL flows are optional dependency surfaces and should be rechecked in the user's target environment before use.
Reference map
references/wrappers-and-data.md— Gym compatibility, action mapping, vector envs, Atari/MuJoCo/multi-agent wrappers, replay-memory contracts, and small NumPy RL helpers.references/logging-and-schedulers.md— schedulers, CSV output, PARL logger directories, summary/TensorBoard/VisualDL behavior, and file-write safety.references/troubleshooting.md— common fixes for Gym API mismatches, optional dependencies, action/replay shapes, logger deletion, CSV key mismatches, and summary backends.scripts/check_env_utils.py— deterministic local checker for safe imports, signatures, and tiny pure-Python utility exercises.
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).