AGENT SKILL

envs-and-transforms

Build, validate, transform, vectorize, and debug TorchRL environments and TensorDict transition layouts.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
envs-and-transforms
license
MIT
metadata
{ "disco-role": "operating" }
description
Build, validate, transform, vectorize, and debug TorchRL environments and TensorDict transition layouts.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

TorchRL envs-and-transforms

Load this sub-skill when the task involves TorchRL environments, transformed environments, vectorized environments, environment specs, optional simulator wrappers, or the TensorDict transition layout produced by EnvBase.step and consumed by step_mdp.

Use this skill for

  • Building CPU-safe native environments such as PendulumEnv and custom EnvBase subclasses.
  • Wrapping Gym/Gymnasium and other simulator backends with TorchRL environment wrappers.
  • Adding TransformedEnv, Compose, ObservationNorm, StepCounter, ActionScaling, image transforms, reward transforms, action transforms, and key transforms.
  • Checking and debugging observation_spec, action_spec, reward_spec, done_spec, input_spec, and output_spec with check_env_specs.
  • Moving a transition from root + "next" layout to the next-step root layout with step_mdp.
  • Choosing SerialEnv versus ParallelEnv, debugging vectorized worker issues, and validating specs before multiprocessing.
  • Reasoning about multi-agent environment grouping and nested per-agent specs.
  • Routing optional simulator, rendering, and pixel dependencies without claiming they are verified in a base CPU environment.

Route away

  • Policy, actor, critic, distribution, recurrent module, or network construction: use modules-and-policies.
  • Collectors, replay buffers, samplers, writers, or data-collection topology: use collectors-and-replay.
  • PPO/SAC/DQN/objective wiring, value estimators, target updates, trainers, Hydra configs, or SOTA recipes: use objectives-and-training.
  • VLA-specific action chunk training targets and service-backed robot/LLM workflows: use llm-vla-and-services. Generic ActionChunkTransform key semantics are summarized here only to route safely.

Fast operating path

  1. Pick the smallest environment surface: native PendulumEnv or a custom EnvBase for core TorchRL behavior; wrapper classes only when the simulator dependency is installed.
  2. Inspect specs before writing policy or collector code. Validate with check_env_specs(env, ...) offline because it runs a short rollout and may reset seeding state.
  3. Add transforms with explicit in_keys, out_keys, in_keys_inv, and out_keys_inv; verify transformed specs and use clone() before reusing a transform already attached to another env.
  4. Run a tiny rollout, inspect root keys and ("next", ...) keys, then use step_mdp with the env's reward_keys, done_keys, and action_keys when keys are nested or multi-agent.
  5. Debug in one process with SerialEnv; move to ParallelEnv only after the same factory passes check_env_specs.
  6. For optional Gym/Gymnasium, MuJoCo, DM Control, IsaacLab, VMAS, PettingZoo, OpenSpiel, Brax, Jumanji, rendering, or pixel stacks, follow the optional-backend checklist before treating failures as TorchRL bugs.

References

Safe smoke helper

Run scripts/smoke_env_rollout.py in an environment where torchrl, torch, and tensordict import. From this sub-skill directory:

python scripts/smoke_env_rollout.py --steps 3 --check-specs

From another working directory, pass the actual local path of this sub-skill's scripts/smoke_env_rollout.py copy to Python.

Expected signal: concise success text showing the TorchRL version, rollout batch size, and step_mdp keys. The helper uses only native PendulumEnv, TransformedEnv, StepCounter, check_env_specs, and step_mdp; it does not require Gym, rendering, multiprocessing, or GPUs.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351