Repository navigation
Unify RSL-RL training checkpoints and fix G1 distillation - #9063
kellyguo11 merged 8 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
[Medium impact] The effects stay within RSL-RL benchmark runs and the G1 depth-student workflow. Fix run-directory checkpoint selection before merging. Findings
SummaryThe PR makes RSL-RL benchmarks use the training checkpoint resolver and updates the G1 student’s return values for the pinned RSL-RL API.
Reviews (1) · Last reviewed commit: "Follow the pinned RSL-RL API in the G1 s..." · Reviewed by Greptile |
|
|
||
| if agent_cfg.resume and not args_cli.checkpoint: | ||
| return get_checkpoint_path(log_root_path, agent_cfg.load_run, agent_cfg.load_checkpoint) | ||
| return _resolve_checkpoint(args_cli, agent_cfg, log_root_path) |
There was a problem hiding this comment.
Run-directory checkpoints still fail. With
--checkpoint /path/to/teacher_run, update_rsl_rl_cfg sets agent_cfg.load_checkpoint to that directory. The delegated resolver then passes this value to get_checkpoint_path as the pattern for checkpoint filenames. No model_*.pt filename matches the directory path, so the benchmark raises No checkpoints in the directory even when the teacher exists. Preserve a filename pattern when resolving a directory, and add a directory case to the tests.
There was a problem hiding this comment.
Fixed in 3947f8e. A --checkpoint run directory now resolves with the model_.*\.pt pattern in the shared resolver (this also fixes the training entrypoint), and a new test covers it. @greptileai could you re-review?
There was a problem hiding this comment.
The reported failure is fixed: the shared resolver now searches a run directory for model_*.pt, and the new test covers choosing the newest checkpoint.
One edge case remains: get_checkpoint_path treats its run_dir argument as an unanchored regex (re.match), but the resolver passes the directory basename directly. If a sibling directory shares that prefix (for example, run and run-retry), it can select the sibling instead of the explicitly requested run. Escaping and anchoring the basename—or resolving directly inside the provided directory—would avoid that ambiguity. I confirmed the regression test is present, but did not execute it.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.
There was a problem hiding this comment.
Good catch on the sibling case. Fixed in 1b9a0b1: the run name is now escaped and anchored, trailing slashes are normalized, and the test adds a <run>-retry sibling with a higher iteration that must not be selected.
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Scope and over-engineering (1), Compatibility and deprecation (2), Test quality (2). Other reviewed categories look good.
- PR description: Mention the G1 runner-API fix in the title, qualify no-checkpoint rejection for configured resume, and consolidate repeated validation while preserving template sections; supplied runs support functionality, with no measurable performance claim.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: Minimal implementation: Extend benchmark_train_rsl_rl.run with direct checkpoint selection and retain G1 distillation.py for runner integration; delete the single-use resolver and keep both changelog fragments. No source modules were added; the essential flow resolves, loads, and trains. Scope is cohesive; no split recommended.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: implicit distillation resume and MirrorDistillation’s documented returns lose their old contracts; preserve functional legacy paths with targeted warnings, migration and removal guidance, and transition coverage.
- Implementation: Implementation looks good.
- Style consistency: Style consistency looks good.
- Test quality: Private-resolver tests miss regressions in run() selection and loading; exercise the benchmark caller and add a competing run or narrow the latest-run claim.
Significant concerns. Posted 5 inline findings.
Automated review; human maintainers own approval decisions.
| return args_cli, remaining_args, cli_args | ||
|
|
||
|
|
||
| def _resolve_resume_path(args_cli, agent_cfg, log_root_path: str) -> str | None: |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Inline the single-use resolver
This helper adds a handoff and lengthy duplicate contract prose for one branch at one production call site. Put the resume selection in run() and delete the helper.
There was a problem hiding this comment.
Keeping the helper: it is the seam that the checkpoint-resolution tests exercise directly, which a simulation-level run() test cannot do cheaply.
|
|
||
| if agent_cfg.resume and not args_cli.checkpoint: | ||
| return get_checkpoint_path(log_root_path, agent_cfg.load_run, agent_cfg.load_checkpoint) | ||
| return _resolve_checkpoint(args_cli, agent_cfg, log_root_path) |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Deprecate implicit distillation resume
Distillation previously loaded an existing student checkpoint with resume=False and no --checkpoint; it now raises ValueError. Keep that path functional during a warned, documented transition and validate both paths.
There was a problem hiding this comment.
Intentional. Distillation without --checkpoint loading the student's own latest run was the bug; the training entrypoint already rejects it and --checkpoint supplies the teacher. A configured resume still searches the experiment's runs. The PR description now says so.
|
|
||
|
|
||
| def _rsl_rl_resume_path(tmp_path: Path, *, distillation: bool, checkpoint: str | None = None, resume: bool = False): | ||
| from isaaclab.benchmark.entrypoints.backends.rsl_rl.benchmark_train_rsl_rl import _resolve_resume_path |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Exercise the benchmark caller
All new cases call only _resolve_resume_path; they pass if run() restores its faulty selection or omits runner.load. Exercise run() with lightweight substitutes and assert the selected load path and failures.
There was a problem hiding this comment.
Not adding a run()-level test: it needs a full simulation and runner. The end-to-end student benchmark was run on an L40 (newton_mjwarp and newton_kamino) and covers the load path. The checkpoint-selection logic is covered by the helper tests, now including a run-directory case.
|
|
||
|
|
||
| def test_rsl_rl_benchmark_resume_searches_experiment_runs(tmp_path: Path) -> None: | ||
| """A configured resume without ``--checkpoint`` continues this experiment's latest run.""" |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Prove or remove latest-run claim
The fixture has one run, so it cannot distinguish latest-run selection from first-run selection. Add an older competing run or describe only the configured-resume behavior tested.
There was a problem hiding this comment.
Fixed in 3947f8e. The fixture now has an older run with a higher iteration (model_99.pt), so the test only passes if the newest run is selected.
| stats = {"Optimizer/learning_rate": self.learning_rate} | ||
| if self.student.distribution is not None: | ||
| stats["Model/mean_policy_std"] = self.student.output_std.mean().item() | ||
| return {"behavior": mean_loss / count}, stats |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve documented algorithm returns
MirrorDistillation.update() changes its documented loss mapping to a tuple, and process_env_step() changes None to a mapping. Direct callers lose those returns; provide a warned legacy path alongside the runner-facing contract, with migration guidance and validation.
There was a problem hiding this comment.
Not keeping a legacy path: MirrorDistillation subclasses the RSL-RL algorithm and is only called by the runner, and the old return values crash against the pinned RSL-RL (#8866). The docstrings now document the new returns.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
run-ci |
|
run-ci |
Description
Isaac-Velocity-Rough-G1-Depth-Studentcould not run through the RSL-RL training benchmark:The benchmark resolved a checkpoint for every
DistillationRunnerby searching the student experiment's runs,even with
resume=False, and ignored--checkpoint. The training entrypoint already defines the contract:--checkpoint(file, run directory,latest/best, or W&B run) supplies a PPO teacher, and distillation withoutit is rejected unless
resumeis configured.Training and benchmarking now call one checkpoint-selection policy in the existing RSL-RL argument module.
Neither entrypoint owns a separate resolver. Explicit checkpoint references take precedence over configured
resume and remain separate from the configured filename pattern. Both entrypoints honor configured resume.
Selection happens before creating the new run directory, so resume cannot select its own empty output directory.
Checkpoints are loaded with
map_location; RSL-RL decides whether to initialize the teacher or continue the student.An explicit run directory is searched directly for its newest
model_*.ptfile, including bare relative paths,trailing slashes, and names containing regex characters. Sibling directories and checkpoint-named subdirectories
cannot be selected.
The G1 student algorithm (
core/velocity/config/g1/agents/distillation.py) is also updated for the RSL-RL pinintroduced by #8866:
process_env_stepreturns the per-step logging values andupdatereturns(loss_dict, stats_dict). Without it the student crashes in the runner right after the teacher checkpoint loads oncurrent
main, so the benchmark could not complete even with the checkpoint fix.Validation
Benchmark runner (
scripts/benchmarks/training.py) on an L40,main=3e7e61370:main--checkpoint(newton_kamino,isaacsim_rtx)No runs present in ... g1_rough_depth_studentDistillation training requires --checkpoint.--checkpointfileFileNotFoundError: Unable to find the file: ...--checkpoint= 2-iterationIsaac-Velocity-Rough-G1-29DoFteacher (newton_mjwarp,isaacsim_rtx)The 2-iteration teacher is a functional fixture only, not a qualified teacher. Checkpoint-policy tests in
source/isaaclab_rl/test/test_checkpoint_manifest.pycover missing teachers,explicit files/directories, explicit checkpoint precedence, and configured resume. Caller tests in
test_train_checkpoint_path.pyexecute both entrypoints throughrunner.load()with simulation and the runnerreplaced; a structural gate forbids the removed entrypoint-owned resolvers.
Checkpoint ownership revision validation
and 13 existing namespace and native RSL-RL checkpoint-state tests.
resume, checkpoint-pattern overwrite, the original benchmark lookup, duplicate resolver ownership, and creating
the new run directory before resume selection. Each temporary mutation was restored.
git diff --checkpassed.Notes for reviewers
mainisIsaac-Velocity-Rough-G1-29DoF(43 actions). AnIsaac-Velocity-Rough-G1checkpoint (37 actions) is correctly rejected by RSL-RL with a size mismatch.mainthe student's G1 model (with hands) cannot be built withphysics=newton_kamino(SolverKamino cannot simulate this model ... left_hand_palm_link: zero inverse mass and singular inverse inertia). The historical failure never reached scene creation, so this was hidden.Type of change
Checklist
pre-commitchecks withuv run isaaclab --format(ruff 0.14.10 format/check pass on changed files)source/<pkg>/changelog.d/for every touched packageCONTRIBUTORS.mdor my name already exists thereRe-validation after merging
main(rsl-rl-lib at the #8866 pin, L40,newton_mjwarp,newton_renderer)--checkpoint:Distillation training requires --checkpoint.Isaac-Velocity-Rough-G1-29DoFfixture teacher: teacher loads, 2 iterations run, benchmarkbundle and checkpoint written. Before the
distillation.pychange the same run failed withAttributeError: 'NoneType' object has no attribute 'items', thennot enough values to unpack.test_train_checkpoint_path.pypasses; ruff format and check pass on the changed files.