Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions docs/cli/list-info.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,51 @@ genelab list envs
genelab list tasks
```

If an extension is not installed, import it explicitly:
If an extension is not installed as an entry point, import it explicitly:

```bash
PYTHONPATH=examples/inverted_pendulum/src \
genelab --import genelab_inverted_pendulum.tasks list tasks
```

## Inspect a task
To see only the bundled asset zoo (skip user-installed entry-point extensions):

```bash
genelab info GeneLab-Inverted-Pendulum-v0
genelab --no-entry-points list robots
```

The task view includes:
## Inspect any registered name

```bash
genelab info GeneLab-Inverted-Pendulum-v0 # task
genelab info CartPole-Env-v0 # env
genelab info anymal_c # robot
```

`info` does not require you to know which registry the name belongs to. Task views additionally
include:

| Section | Meaning |
|---|---|
| Metadata | Registered name, description, cfg type, examples. |
| Task config | `TaskCfg` summary: env, robot, trainable flag, agent. |
| Overridable paths | Dotted paths accepted by `play` and `train`. |

If the inspected task needs an asset that isn't cached yet, `info` fetches it inline behind the
same progress bar used by `play` / `train` / `asset download`.

## Use copied override paths

```bash
genelab play GeneLab-Inverted-Pendulum-v0 \
--env.rewards_cfg.pole_upright.weight 4.0
```

When `play_env` exists, play-mode shortcut flags target `play_env`; explicit paths remain explicit.
When `play_env` exists, play-mode shortcut flags (`--vis` / `--gpu` / `--dt` / `--steps`) target
`play_env`; explicit dotted paths still write the exact subtree you spelled.

## See also

- [Configuration Reference](../reference/configuration.md)
- [CLI Reference](../reference/cli.md)
- [Asset zoo](../concepts/asset_zoo.md)
23 changes: 18 additions & 5 deletions docs/cli/list-info.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,50 @@ genelab list envs
genelab list tasks
```

如果扩展尚未安装,显式导入:
如果扩展尚未通过 entry point 安装,显式导入:

```bash
PYTHONPATH=examples/inverted_pendulum/src \
genelab --import genelab_inverted_pendulum.tasks list tasks
```

## 查看任务
要只看随包 asset zoo(不加载用户已安装的扩展),加 `--no-entry-points`:

```bash
genelab info GeneLab-Inverted-Pendulum-v0
genelab --no-entry-points list robots
```

任务视图包括:
## 查看任意已注册名字

```bash
genelab info GeneLab-Inverted-Pendulum-v0 # task
genelab info CartPole-Env-v0 # env
genelab info anymal_c # robot
```

`info` 不要求事先知道是哪一类。Task 视图额外包含:

| 区域 | 含义 |
|---|---|
| 元信息 | 注册名、描述、cfg 类型、示例命令。 |
| 任务配置 | `TaskCfg` 摘要:env、robot、trainable、agent。 |
| 可覆盖路径 | `play` 和 `train` 接受的 dotted path。 |

若该 task 需要的 asset 尚未缓存,`info` 会即时下载并显示进度条
(和 `play` / `train` / `asset download` 走的是同一条 progress UI)。

## 使用复制出的 override 路径

```bash
genelab play GeneLab-Inverted-Pendulum-v0 \
--env.rewards_cfg.pole_upright.weight 4.0
```

当 task 有 `play_env` 时,play 模式短标志会作用到 `play_env`;显式路径仍保持显式语义。
当 task 提供 `play_env` 时,play 模式下的简写 flag(`--vis` / `--gpu` / `--dt` /
`--steps`)会作用到 `play_env`;显式的 dotted 路径仍按字面写的子树生效。

## 另见

- [配置参考](../reference/configuration.md)
- [CLI 参考](../reference/cli.md)
- [Asset zoo](../concepts/asset_zoo.md)
20 changes: 16 additions & 4 deletions docs/cli/overview.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@ genelab [global options] <command> [arguments]

| Area | Commands |
|---|---|
| Registry discovery | `list robots`, `list envs`, `list tasks`, `info NAME` |
| Runtime | `play TASK`, `train TASK` |
| Registry | `list robots\|envs\|tasks`, `info NAME`, `asset list\|info\|download\|purge` |
| Runtime | `play TASK`, `train TASK`, `eval TASK CHECKPOINT`, `export TASK CHECKPOINT`, `benchmark --suite ...` |
| Project | `project new NAME` |
| Utilities | `cache`, `prof open` |
| Project scaffolding | `project new NAME` |

Running `genelab` with no subcommand prints a landing page with quickstart commands and a count of
registered robots / envs / tasks.

## Global options

| Option | Meaning |
|---|---|
| `--version` | Print the version and exit. |
| `--import MODULE` | Import an extension module before dispatch; repeatable. |
| `--no-entry-points` | Skip extensions from the `genelab.extensions` entry-point group. |

## Extension loading order

Expand All @@ -30,7 +41,7 @@ Use entry points for daily work and `--import` for local experiments.
## Overrides

Runtime commands accept unknown `--a.b.c VALUE` options after the task id. The CLI forwards them to
`apply_overrides`.
`apply_overrides`:

```bash
genelab play TASK_ID --env.simulation.dt 0.005
Expand All @@ -48,3 +59,4 @@ When stdin is a TTY, the CLI can prompt for a missing task id, unknown registry
- [CLI Reference](../reference/cli.md)
- [Discovery: list and info](list-info.md)
- [Play and Train](play-train.md)
- [Eval and export](../concepts/eval-and-export.md)
44 changes: 29 additions & 15 deletions docs/cli/overview.zh.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,61 @@
# CLI 总览

`genelab` CLI 是注册表和任务配置上的薄调度层。它不拥有任务逻辑;它负责发现扩展、解析已注册对象、应用 override,然后调用 task 或 runner。
`genelab` CLI 是注册表(registry)与任务配置之上的薄分发层。它不持有 task 逻辑——
发现扩展、解析已注册对象、应用 override,然后调用 task 或 runner。

## 命令模型

```bash
genelab [全局选项] <命令> [参数]
```

| 区域 | 命令 |
| 分组 | 命令 |
|---|---|
| 注册表发现 | `list robots`、`list envs`、`list tasks`、`info NAME` |
| 运行时 | `play TASK`、`train TASK` |
| 工具 | `cache`、`prof open` |
| 项目骨架 | `project new NAME` |
| Registry | `list robots\|envs\|tasks`、`info NAME`、`asset list\|info\|download\|purge` |
| Runtime | `play TASK`、`train TASK`、`eval TASK CHECKPOINT`、`export TASK CHECKPOINT`、`benchmark --suite ...` |
| Project | `project new NAME` |
| Utilities | `cache`、`prof open` |

不带子命令运行 `genelab` 会打印 landing 页:包含 quickstart 命令以及已注册的
robots / envs / tasks 数量。

## 全局选项

| 选项 | 含义 |
|---|---|
| `--version` | 打印版本并退出。 |
| `--import MODULE` | 分发前导入扩展模块;可重复。 |
| `--no-entry-points` | 跳过 `genelab.extensions` entry point 组的扩展。 |

## 扩展加载顺序

任何需要注册表数据的命令都会按顺序加载:
每个需要 registry 数据的命令按以下顺序加载扩展:

1. 通过 `load_bundled_asset_zoo()` 加载随包 asset zoo robot。
2. 已安装的 `genelab.extensions` entry point,除非设置 `--no-entry-points`。
3. 重复传入的显式 `--import MODULE`。
1. 通过 `load_bundled_asset_zoo()` 装入随包的 asset zoo 机器人。
2. 已安装的 `genelab.extensions` entry points(除非传 `--no-entry-points`)。
3. 多次显式的 `--import MODULE`。

日常工作用 entry point,本地实验用 `--import`。
日常工作用 entry points,临时实验用 `--import`。

## Overrides

运行时命令在 task id 后接受未知的 `--a.b.c VALUE` 选项。CLI 会把它们转发给
`apply_overrides`。
Runtime 命令在 task id 后接受未知的 `--a.b.c VALUE` 选项,由 CLI 转发到
`apply_overrides`:

```bash
genelab play TASK_ID --env.simulation.dt 0.005
```

用 `genelab info TASK_ID` 查看有效路径。
可用路径见 `genelab info TASK_ID`。

## 交互模式

stdin 是 TTY 时,CLI 可以为缺失 task id、未知注册表名字、非法 `--agent`、未知 override 路径弹出选择器。CI 和脚本中会直接抛出相同错误。
当 stdin 是 TTY 时,CLI 可以为缺失的 task id、未知的注册名、非法 `--agent` 或
未知 override 路径弹出交互选择器;CI 与脚本中则直接抛出同样的错误。

## 另见

- [CLI 参考](../reference/cli.md)
- [发现:list 与 info](list-info.md)
- [play 与 train](play-train.md)
- [Eval 与 export](../concepts/eval-and-export.md)
97 changes: 92 additions & 5 deletions docs/cli/play-train.en.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Play and Train
# Runtime: play and train

`play` runs a registered task. `train` runs a registered task through a supported runner when the
task provides an agent config.
task provides an agent config. This page also covers the post-training runtime subcommands —
`eval`, `export`, and `benchmark` — which take the same checkpoint produced by `train`.

## Play

Expand All @@ -23,8 +24,8 @@ The policy options (`--agent`, `--checkpoint`, `--num-envs`, `--prof*`) apply on
tasks — those whose play env config is a `ManagerBasedRlEnvCfg`. Non-RL **scene-playback
demos** (e.g. `GeneLab-Rubiks-Play-v0`, `GeneLab-Wuji-Hand-Playback-v0`), whose config
subclasses the base `ManagerBasedEnvCfg`, run their own built-in playback; passing those
options prints a warning and they are ignored. `--steps` / `--vis` / `--gpu` and dotted
config overrides still apply to both.
options prints a warning and they are ignored. `--steps` / `--vis` / `--headless` / `--gpu` /
`--dt` and dotted config overrides still apply to both.

Checkpoint replay:

Expand All @@ -44,6 +45,19 @@ genelab play TASK_ID \
--checkpoint <ckpt> --headless
```

## Shortcut flags

Both `play` and `train` rewrite the following shortcuts into `env.simulation.*` overrides:

| Shortcut | Override |
|---|---|
| `-v`, `--vis` | `env.simulation.vis=true` |
| `--headless` | `env.simulation.vis=false` (mutually exclusive with `--vis`) |
| `--gpu` | `env.simulation.gpu=true` |
| `--steps N` | play: `env.simulation.steps=N`; train: alias for `--max_iterations N` |
| `--dt SECONDS` | `env.simulation.dt=SECONDS` |
| `--a.b.c VALUE` | Any dotted cfg path |

## Train

```bash
Expand All @@ -57,7 +71,38 @@ genelab train TASK_ID --gpus 4 --num_envs 4096
```

`--num_envs` is total across ranks and must divide evenly by `--gpus`. Use
`--num_envs_per_gpu` for per-rank semantics.
`--num_envs_per_gpu` for per-rank semantics (mutually exclusive with `--num_envs`).
Multi-GPU is RSL-RL only; the first entry automatically relaunches under `torchrun`.

### In-training eval

Pass `--eval_every K` to run a deterministic rollout every K iterations. On improvement, the
runner writes `best_model.<ext>` into `--log_dir`:

```bash
genelab train TASK_ID --eval_every 50 --eval_episodes 20
```

| Option | Meaning (default) |
|---|---|
| `--eval_every K` | Evaluate every K iterations. |
| `--eval_episodes N` | Episodes per evaluation (10). |
| `--eval_num_envs N` | Parallel envs during eval (matches training). |
| `--eval_seed N` | RNG seed for the eval rollout (0). |

### Multi-seed train

`--seeds 1,2,3` fans out the current `train` invocation into one independent subprocess per seed:

```bash
genelab train TASK_ID --seeds 1,2,3,4 --parallel 2 --num_envs 4096
```

- `--parallel N` caps concurrency (default 1 — sequential).
- Each child is invoked with `--seed S` and `--log_dir <parent>/seed_<S>`.
- Without an explicit `--log_dir`, the parent is
`logs/multi-seed/<task_id>/<YYYY-MM-DD_HH-MM-SS>/`.
- If any seed fails, the command exits non-zero.

## RL backends

Expand Down Expand Up @@ -95,6 +140,47 @@ GENELAB_SB3_DEMO_PATH=/tmp/franka_pp_demos.npz \
--gpu --num-envs 32 --max-iterations 2000000
```

## Post-training subcommands

`eval`, `export`, and `benchmark` all take a registered task plus a checkpoint and reuse the
task's play env config — see [Eval and export](../concepts/eval-and-export.md) for the
conceptual picture and script-level details.

### Eval

Deterministic rollout that writes `eval.json` (`return_mean`, `length_mean`, and
`success_rate` if the task publishes `extras['is_success']`):

```bash
genelab eval TASK_ID logs/.../model_300.pt \
--num-envs 64 --episodes 100 --out eval.json
```

`--deterministic` / `--stochastic` toggles the policy mode; `--max-steps` caps the rollout.

### Export

Export the policy as TorchScript or ONNX (per-term scale/clip baked into the model):

```bash
genelab export TASK_ID logs/.../model_300.pt --format onnx --out policy.onnx
```

A sibling `<OUTPUT>.metadata.json` records the observation schema.

### Benchmark

Batch eval driven by a JSON suite, aggregated into one report:

```bash
genelab benchmark --suite suite.json --out report.json
genelab benchmark --suite suite.json --reference baseline.json --tolerance 0.1
```

`suite.json` is `[{"task": ..., "checkpoint": ..., "episodes": ..., "seed": ..., "num_envs": ...}, ...]`.
With `--reference`, the command compares `return_mean` against the baseline and exits non-zero
when any task drops more than `--tolerance` — usable directly as a CI regression gate.

## Config overrides

Any unknown option after the task id is treated as a dotted config override:
Expand All @@ -110,3 +196,4 @@ genelab play TASK_ID \
- [Run RL Experiments](../best-practices/rl-experiments.md)
- [CLI Reference](../reference/cli.md)
- [RL runner](../concepts/rl-runner.md)
- [Eval and export](../concepts/eval-and-export.md)
Loading