AGENT SKILL

policy-training-inference

Select, configure, train, evaluate, and safely plan inference for LeRobot policies, processors, devices, checkpoints, and optional PEFT adapters.

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

01 前言 Front Matter

name
policy-training-inference
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Select, configure, train, evaluate, and safely plan inference for LeRobot policies, processors, devices, checkpoints, and optional PEFT adapters.
disable-model-invocation
true

02 资源文件 10

03 SKILL.md 正文

Policy training and inference

Use this sub-skill when the task names lerobot-train, lerobot-eval, lerobot-rollout, a policy type or checkpoint, policy processors, CUDA/device selection, PEFT, or rollout inference. This sub-skill covers model-side configuration and safe command planning. Route dataset format, episode schema, features, and statistics acquisition to dataset-workflows; route physical robot/teleoperator operation and data collection to robot-control-data-collection; route simulator installation, environment configuration, and RL to simulation-and-rl.

Safety and operating boundary

  • Treat training, Hub access, checkpoint downloads/uploads, W&B logging, and rollout as side effects. First inspect and validate; only execute after the user explicitly requests execution and all gates below pass.
  • This skill can plan a rollout but does not authorize robot motion. Require a dry-run/help check, a bounded duration, a tested robot/camera/teleoperator handoff, an emergency stop, and a human at the controls before any hardware command.
  • Never call a CPU import or CPU model construction proof a CUDA execution proof. A requested cuda device must be checked with torch.cuda.is_available() and the intended policy/dependencies must be importable.
  • Prefer local checkpoints with local_files_only for offline validation. Hub identifiers may trigger downloads when the real command runs; ask before that.
  • Do not invent a policy type. Confirm it is registered, its modeling module can be imported, and its scoped extra is installed.

Inputs and outputs

Collect: LeRobot version, policy type or checkpoint, dataset/environment handoff, feature keys/shapes, normalization statistics source, device/backend and VRAM, training or evaluation budget, output directory, resume source, optional PEFT settings, credentials/Hub consent, and whether real hardware is involved.

Produce one of:

  1. a validated, bounded training command plan and expected checkpoint layout;
  2. an evaluation plan with checkpoint, environment, episode, recording, and device gates; or
  3. a rollout plan that remains explicitly blocked until hardware safety gates pass.

Record unknown feature/stat/processor provenance as an unresolved validation item, not as a successful compatibility claim.

Fast routing workflow

  1. Choose policy. Start with act for a small/single-task baseline. Consider diffusion for action-distribution experiments; smolvla, pi0, pi05, pi0_fast, or other VLA policies only when the language/vision checkpoint, tokenizer, memory, and GPU budget are known. See model-overview.md.
  2. Check the scoped extra. The base package supplies core policy machinery; optional policies use extras such as diffusion, pi, smolvla, groot, wallx, xvla, peft, or training. Missing dependencies must be fixed by the smallest relevant extra, not all by default.
  3. Resolve the config. For a fresh policy, construct a registered config with make_policy_config(type, ...) and obtain input/output features from dataset metadata or an environment. For a checkpoint, load its config.json through PreTrainedConfig.from_pretrained; preserve its type and processor contract unless a deliberate override is validated.
  4. Build the model and processors. make_policy requires exactly one of dataset metadata or environment config. It infers action outputs and missing input features, validates visual consistency, places the model on config.device, and loads safetensors for a normal checkpoint. Build the matching pre/post pipelines with make_pre_post_processors; for a checkpoint load the saved policy_preprocessor.json and policy_postprocessor.json.
  5. Validate one synthetic batch. Confirm observation names, image channel/order and shape, state/action dimensions, task/text fields, batch dimensions, finite normalized values, model output shape, and postprocessed action shape before launching a long run. Use step_through or transform_features to locate a processor mismatch.
  6. Bound the run. Use a short smoke run first (steps small, no Hub push, W&B disabled, fixed output directory). Then choose checkpoint frequency, evaluation split/episodes, workers, accumulation, mixed precision, and output policy. Do not reuse a non-empty output directory unless resume=true.
  7. Handoff. Dataset and simulator owners must confirm their contracts. A real-robot owner must confirm robot, camera, teleop, calibration, and stop controls before lerobot-rollout is considered runnable.

CLI decision points

  • lerobot-train uses dotted draccus fields: --dataset.repo_id, --policy.type, --policy.device, --batch_size, --steps, --output_dir, --save_freq, --eval_steps, --parallelism.*, --accelerator.*, --peft.*, and --resume/--config_path.
  • For a pretrained policy, use --policy.path=<local-dir-or-hub-id> in the current CLI contract. For a resume, use --resume=true --config_path=<checkpoint train_config.json, pretrained_model directory, or permitted Hub run source>. Do not confuse fine-tuning from --policy.path with restoring optimizer/RNG/ sampler state via --resume.
  • lerobot-eval needs --policy.path, --env.type, and bounded --eval.n_episodes; --eval.batch_size=1 is the conservative first check. Recording is off unless explicitly enabled. Hub environments additionally require --trust_remote_code=true consent.
  • lerobot-rollout is the deployment engine. strategy.type=base does not record and must not receive a dataset; sentry/highlight/dagger/episodic need the appropriate recording dataset, and dagger needs a teleoperator. sync works for all policies; rtc is for supported slow chunking policies and requires policy-specific queue/horizon validation.
  • Run the bundled probes/builders before copying a command into a shell: check_policy_environment.py, train_command_builder.py, eval_command_builder.py, and rollout_help.py. They print commands and checks but never start training, inference, downloads, simulators, or hardware.

Training and checkpoint rules

TrainPipelineConfig.validate() requires a policy or reward model, disallows an existing output directory for a fresh run, applies the policy optimizer and scheduler presets by default, and requires a nonzero dataset eval_split when eval_steps > 0. A normal checkpoint contains a policy config and model.safetensors; processor JSON/state files must accompany it for faithful inference. Training checkpoints also contain train_config.json and training state. Safetensors is the compatible default; DCP model artifacts require a sharded run. Sharded training currently rejects PEFT, fp16, in-training env rollouts, reward-model training, multiple optimizers, compile/activation checkpointing placeholders, and context parallelism greater than one.

PreTrainedPolicy.from_pretrained puts the policy in eval mode; call train() only for training. The base contract requires get_optim_params, reset, forward, predict_action_chunk, and select_action. forward returns (loss, logging_dict_or_none); inference calls reset() at episode start and select_action() after preprocessing. Keep logging values native and avoid passing gradient-bearing tensors into logs.

Final validation checklist

  • python -m ... --help/CLI help succeeds in the target environment.
  • check_policy_environment.py reports the registered choice, optional package status, policy class import, requested device, CUDA availability, and any import failure without claiming execution readiness when a gate is missing.
  • The exact checkpoint has config.json, weights, and matching pre/postprocessor files; revision and local-only policy are explicit.
  • Dataset/environment feature names are mapped deliberately; rename_map is used only when the checkpoint contract requires it, and normalization stats are from the intended dataset or an explicitly approved override.
  • One bounded batch passes through preprocessor → policy → postprocessor with finite tensors and the expected action dimension.
  • Training has a new/approved output directory, bounded steps, checkpoint policy, no unintended Hub/W&B side effects, and a resume source if applicable.
  • Evaluation has bounded episodes and recording disabled unless requested.
  • Rollout has hardware/safety approval, finite duration, correct device, tested cameras, and emergency-stop readiness. Otherwise report blocked, not ready.

Bundled reference map

  • model-overview.md: registered policy catalog, scoped extras, and conditional selection guidance.
  • configuration.md: config dataclasses, dotted fields, feature/device construction, and distributed restrictions.
  • api-reference.md: verified factory, policy, processor, serialization, normalization, and device signatures.
  • workflows.md: bounded training, resume, eval, PEFT, and rollout planning recipes.
  • cli-reference.md: safe train/eval/rollout CLI fields and side-effect gates.
  • troubleshooting.md: dependency, checkpoint, device, training, evaluation, and rollout recovery.

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