Skip to content

Load RSL-RL checkpoints from W&B runs - #8406

Closed
jnskkmhr wants to merge 1 commit into
isaac-sim:mainfrom
jnskkmhr:jnskkmhr/PR_wandb_integ
Closed

jnskkmhr wants to merge 1 commit into
isaac-sim:mainfrom
jnskkmhr:jnskkmhr/PR_wandb_integ

Conversation

@jnskkmhr

@jnskkmhr jnskkmhr commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Load RSL-RL checkpoints directly from W&B runs for local inference or continued training. This is useful when a policy was trained on a cluster or remote server: download its saved checkpoint from W&B and run it on your local computer without manually copying checkpoint files between machines.

Example

Run these commands from an Isaac Lab checkout with the RSL-RL dependencies installed. Authenticate on each machine with uv run --with wandb wandb login. Replace YOUR_ENTITY and YOUR_RUN_ID with the entity and run ID shown in the source run's W&B URL.

Train on a cluster or remote server

uv run --with wandb isaaclab train \
    --rl_library rsl_rl \
    --task Isaac-Velocity-Flat-G1 \
    --num_envs 4096 \
    --max_iterations 10000 \
    --logger wandb \
    --log_project_name g1_remote_training

Once the run has uploaded a checkpoint, use its run ID for local playback or continued training. Use the same task and compatible policy configuration when loading the checkpoint.

Download and play on your local computer

uv run --with wandb isaaclab play \
    --rl_library rsl_rl \
    --task Isaac-Velocity-Flat-G1 \
    --num_envs 1 \
    --viz newton_rtx \
    --wandb_entity YOUR_ENTITY \
    --wandb_project g1_remote_training \
    --wandb_run YOUR_RUN_ID

Continue training from the W&B checkpoint

uv run --with wandb isaaclab train \
    --rl_library rsl_rl \
    --task Isaac-Velocity-Flat-G1 \
    --num_envs 4096 \
    --wandb_entity YOUR_ENTITY \
    --wandb_project g1_remote_training \
    --wandb_run YOUR_RUN_ID \
    --logger wandb \
    --log_project_name g1_continued_training

--wandb_project selects the source checkpoint project; --log_project_name selects the destination training project. The loader selects the highest-iteration checkpoint matching agent.load_checkpoint. If omitted, the source project defaults to the agent configuration's wandb_project, and the source entity uses WANDB_ENTITY/WANDB_USERNAME, then the authenticated W&B login. --wandb_run cannot be combined with --checkpoint.

Depends on / setup

Repo PR / branch Relationship
IsaacLab This PR: jnskkmhr/PR_wandb_integ → main Base: main; no prerequisite PRs.
wandb Installed and authenticated client Needed only when downloading a checkpoint from a W&B run.
git fetch https://github.com/jnskkmhr/IsaacLab.git jnskkmhr/PR_wandb_integ
git switch --detach FETCH_HEAD
uv sync --extra dev --extra skrl

Changes

  • Define the source-run options and mutually exclusive checkpoint selection once in the shared RSL-RL parser.
  • Extend utils/wandb.py:get_model_checkpoint with checkpoint-pattern selection; use the same downloader for run IDs and existing URL/URI references.
  • Match and naturally sort checkpoint basenames, independently of remote directory names.
  • Preserve the configured source project before applying destination logging overrides.
  • Let an unavailable W&B client raise its original ModuleNotFoundError.

Test plan

At ee72a7e01, 99/99 passed:

uv run --extra dev --extra skrl python -m pytest -q \
    source/isaaclab_rl/test/test_wandb.py \
    source/isaaclab_rl/test/test_entrypoints.py \
    source/isaaclab_rl/test/test_entrypoints_common.py

The nested-path regression fails before the sorting fix: z_archive/model_3.pt wins over checkpoints/model_100.pt. After the fix, the basename determines the highest iteration while the original remote path is retained for downloading.

Coverage also checks source/destination-project separation, custom patterns, URL/URI compatibility, entity defaults, missing checkpoints, and the original missing-dependency error. Remote W&B calls are replaced at the client boundary; no live checkpoint download or training run was performed.

Full repository formatting/lint and changelog checks passed against upstream/main. Tests emitted 35 existing PyTorch deprecation warnings.

Type of change

  • New feature (non-breaking change which adds functionality)

Release backport

  • Backport this pull request to the active release branch after it merges into main

Checklist

  • Read the contribution guidelines and applied the test-audit criteria.
  • Ran the repository formatting/lint checks and focused validation.
  • Included package changelog fragments.
  • No new warnings (existing warnings are disclosed above where observed).

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Adds W&B checkpoint download to training and playback entrypoints.

Fix the source-project fallback before merging so changing the destination project does not break continued training.

Findings

  1. P1 Logging project changes checkpoint source ▶

Summary

Adds W&B source-run options to RSL-RL training and playback.

  • RSL-RL training and playback can load checkpoints from W&B runs.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Parse W&B source options"] --> B["Apply agent and logging overrides"]
    B --> C{"Explicit source project?"}
    C -->|Yes| D["Use --wandb_project"]
    C -->|No| E["Use agent_cfg.wandb_project"]
    E --> F["May now contain destination project"]
    D --> G["Find matching W&B checkpoint"]
    F --> G
    G --> H["Download checkpoint"]
    H --> I["Load through existing RSL-RL runner"]
Loading

Reviews (1) · Last reviewed commit: "Merge current develop into W&B checkpoin..." · Reviewed by Greptile

if args_cli.wandb_run is not None:
return download_wandb_checkpoint(
log_root_path,
args_cli.wandb_project if args_cli.wandb_project is not None else agent_cfg.wandb_project,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Logging project changes checkpoint source

Using --wandb_run --logger wandb --log_project_name new-project without --wandb_project makes the loader search new-project for the source run. update_rsl_rl_cfg overwrites agent_cfg.wandb_project before this fallback reads it. Continued training therefore fails when the source run exists only in the original project.

Preserve the configured source project before applying logging overrides. The same fallback in play_rsl_rl.py needs the same fix.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Design and architecture (1), Scope and over-engineering (1), Style consistency (2). Other reviewed categories look good.

  • PR description: The title, CLI examples, behavior, and focused validation match the diff; remove the unrelated MPM consumer table and stale prerequisite and branch-refresh notes.
  • Design and architecture: W&B checkpoint resolution duplicates the existing utils/wandb.py owner, creating parallel selection and download behavior; extend get_model_checkpoint and route both backends through it.
  • Scope and over-engineering: Minimal implementation: extend utils/wandb.py and cli_args_rsl_rl.py; delete the duplicate common.py helper, collapse the train/play parser blocks, and keep only backend calls into shared owners; no source modules were added. Replace with one smaller PR: update those four owner/backend files, the changelog, and focused parser and W&B utility tests.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Implementation looks good.
  • Style consistency: The downloader wraps a missing optional dependency instead of preserving ModuleNotFoundError; import wandb directly and retain Python’s original failure.
  • Test quality: Test quality looks good.

Minor fixes needed. Posted 4 inline findings.

Automated review; human maintainers own approval decisions.

@@ -67,6 +68,27 @@ def _parse_args(argv: list[str]) -> argparse.Namespace:
parser.add_argument(
"--external_callback", default=None, help="Fully qualified path to an externally defined callback."
)
parser.add_argument(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Scope Complexity — Duplicated W&B options in both backends

These three options and the --checkpoint conflict check are copied verbatim into play_rsl_rl.py, letting the two CLI contracts drift. Define and validate them once in cli_args_rsl_rl.add_rsl_rl_args, which both backends already call.

@@ -710,6 +710,56 @@ def resolve_checkpoint_selector(
)


def download_wandb_checkpoint(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Design Architecture — Duplicates existing W&B checkpoint helper

isaaclab_rl/utils/wandb.py already owns run-file listing, highest-iteration selection, and download via get_model_checkpoint, and both backends import from it. Extend that module instead of adding a second W&B owner here.

"""Download a checkpoint uploaded by a Weights & Biases run and return its local path.

The checkpoint is picked among the run's uploaded files by matching
:attr:`checkpoint_pattern` against the file name. When several files match, the naturally

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — :attr: role used for parameters

checkpoint_pattern is a function parameter, so :attr: produces an unresolvable cross-reference. The adjacent resolve_checkpoint_selector docstring names parameters in plain text; use checkpoint_pattern here and in Raises.

try:
import wandb
except ImportError as exc: # wandb is an optional logging backend, not a base dependency
raise ImportError("Resolving a checkpoint from W&B requires the 'wandb' package to be installed.") from exc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Wrapped optional dependency import error

The contribution guide requires missing optional dependencies to raise Python's original ModuleNotFoundError rather than being wrapped to add an install hint. Import wandb directly and drop the Raises: ImportError docstring entry.

@maxkra15

Copy link
Copy Markdown
Contributor

thanks for the contribution, can you think of a place in the docs where we can add this and also add it to agent skills, this is very useful for them

@jnskkmhr
jnskkmhr force-pushed the jnskkmhr/PR_wandb_integ branch from 002ac87 to 78757f5 Compare October 15, 2026 19:16
@maxkra15 maxkra15 self-assigned this Oct 28, 2026
@maxkra15
maxkra15 self-requested a review October 28, 2026 12:43

@maxkra15 maxkra15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matching uses basename, sorting uses the full path. checkpoints/model_100.pt + model_20.pt selects iteration 20. Sort basename or captured iteration. Add this regression. Rebase and run CI.

@jnskkmhr
jnskkmhr force-pushed the jnskkmhr/PR_wandb_integ branch from 2c684b1 to ee72a7e Compare November 7, 2026 00:51
@jnskkmhr
jnskkmhr dismissed maxkra15’s stale review November 7, 2026 01:01

solved in new commit

@jnskkmhr

jnskkmhr commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Nov 7, 2026
@jnskkmhr

jnskkmhr commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

@maxkra15 lmk if it's good to merge

@maxkra15 maxkra15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkpoint basenames now sort correctly across nested paths. The13 selector tests and mixed-directory repro pass. Current-head CI is green.

@StafaH StafaH left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently use --checkpoint <WANDB_PATH> for loading wandb checkpoints. Is this not working? Let's fix the usage and documentation of that instead of adding the additional CLI arguments?

@jnskkmhr

Copy link
Copy Markdown
Contributor Author

@StafaH
That, I did not know. Let me check that.

@StafaH

StafaH commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks @jnskkmhr for putting this together. Since --checkpoint already accepts W&B runs for RSL-RL train and play (wandb:<entity>/<project>/<run_id> or the run URL, with an optional ?checkpoint=<iteration>), we'd rather not add a second set of flags. The real gap was that this wasn't documented anywhere outside --help, so I've added it to the quickstart and the RL docs in #9042. Closing this in favor of that. If the W&B path doesn't cover something you need, let us know and we can fix it there.

@StafaH StafaH closed this Nov 16, 2026
StafaH added a commit that referenced this pull request Nov 16, 2026
# Description

RSL-RL `train` and `play` already load checkpoints from W&B runs through
`--checkpoint` (#7925), but this was only mentioned in the `--help`
text. This adds it to the quickstart checkpoint table and to the RL page
(checkpoint selectors and resuming training).

Supersedes #8406.

## Type of change

- Documentation update

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have validated the changed behavior with focused coverage and
applied the [test-audit
criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md)
to any test changes
- [ ] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump package versions — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants