Repository navigation
Add wandb play and resume option - #3426
renezurbruegg wants to merge 6 commits into
Conversation
| "--log_project_name", type=str, default=None, help="Name of the logging project when using wandb or neptune." | ||
| ) | ||
|
|
||
| arg_group.add_argument( |
There was a problem hiding this comment.
Could we make a separate group for wandb instead of adding it to rsl-rl group?
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
|
|
||
| import contextlib |
There was a problem hiding this comment.
This should be moved to isaaclab_rl directory. Core has nothing to do with logging :)
| ``{time-stamp}_{run_name}``. | ||
| """ | ||
|
|
||
| run_id: str | None = None |
There was a problem hiding this comment.
Hmm why does this need to be part of rl config? It isn't used by rsl-rl wrapper.
| help="Select which wandb checkpoint iteration to load. If not provided, the latest checkpoint will be used.", | ||
| ) | ||
| arg_group.add_argument( | ||
| "--wandb_username", |
There was a problem hiding this comment.
Should this be wandb entity? Or that's the same concept?
| Example: | ||
| model_path = get_model_checkpoint(run_id="my_run_id", project="my_project", checkpoint=100, wandb_username="my_username") | ||
| This will download the model checkpoint from https://wandb.ai/my_username/my_project/runs/my_run_id and save it | ||
| to models_tmp/my_project/my_run_id/model_100.pt |
There was a problem hiding this comment.
Would put this in python code-block
|
|
||
|
|
||
| def get_model_checkpoint( | ||
| run_id: str, project="isaaclab", checkpoint: int = -1, wandb_username=None, tmp_folder_dir: str = "models_tmp" |
There was a problem hiding this comment.
| run_id: str, project="isaaclab", checkpoint: int = -1, wandb_username=None, tmp_folder_dir: str = "models_tmp" | |
| run_id: str, project: str = "isaaclab", checkpoint: int = -1, wandb_username=None, tmp_folder_dir: str = "models_tmp" |
| models = [] | ||
| # List all available files in the run | ||
| for file in wdb_run.files(): | ||
| if "model" in file.name and file.name.endswith(".pt"): |
There was a problem hiding this comment.
This is very specific to rsl-rl naming of checkpoints. If plan is to only keep support for rsl-rl, then I suggest moving this to rsl-rl sub-package in isaaclab_rl.
There was a problem hiding this comment.
Would suggest putting this print after the model is found so you also get to know which model iteration you downloaded.
| if wandb_username is None: | ||
| wandb_username = os.environ.get("WANDB_USERNAME") | ||
|
|
||
| print("Downloading model from wandb...", f"{wandb_username}/{project}/{run_id}") |
There was a problem hiding this comment.
| print("Downloading model from wandb...", f"{wandb_username}/{project}/{run_id}") | |
| print(f"Downloading model from wandb: {wandb_username}/{project}/{run_id}") |
| arg_group.add_argument( | ||
| "--wandb_username", | ||
| type=str, | ||
| default=None, |
There was a problem hiding this comment.
Would this make sense?
| default=None, | |
| default=os.environ["WANDB_USERNAME"], |
Mayankm96
left a comment
There was a problem hiding this comment.
Thanks for this feature. Added a few comments.
Also is this using the latest wandb version? Or this works with the default wandb version in IsaacLab (which is 0.12). I think the minimum version I needed was 0.19.
|
This seems a nice feature!! Thanks for the PR, I agree with Mayank: Unless we can make it general to all rl-library, it makes more sense to put in rsl-rl sub package in isaaclab_rl/rsl_rl, or directly pr to rsl_rl if eth folks like it. |
Mayankm96
left a comment
There was a problem hiding this comment.
This is a nice feature, but the checkpoint retrieval is something specific to RSL-RL. Would not put utils for that in the core.
2ef7fc8 to
f3061a4
Compare
|
Hi @renezurbruegg , would you be able to take a look at the review comments? |
|
Hi @renezurbruegg — thank you so much for opening this PR, and for taking the time to contribute to Isaac Lab! 🙏 We're currently doing a big spring-clean of our pull request backlog, which had grown past 400 open PRs. Being honest: at that volume we stopped being able to give every contribution the attention it deserved, and this one is a case where we dropped the ball on getting back to you. That's on us, not on you. Why this PR is being closed: Here is exactly what we found on this PR when we reviewed the backlog:
It was picked up by the sweep because it targets We deliberately did not close pull requests that were approved and ready to land, or that were small and clearly still fixing a live bug — there were 27 of those, and we are merging them rather than closing them. To be completely clear — this is not a judgement on the quality or the value of your work. It's purely about getting the queue down to a size where we can actually review things properly and give contributors real, timely feedback. One thing worth knowing first: Isaac Lab 3.0 has since shipped. It is also the honest reason a lot of these older pull requests stopped applying: the code If this change is still relevant, please reopen this PR or open a fresh one against Thanks again for contributing to Isaac Lab, and sorry for the long silence! 💚 🤖 This comment was drafted with AI assistance as part of a maintainer-led sweep of the Isaac Lab pull request backlog. A maintainer is behind this cleanup — but if this closure looks wrong, it may well be, so please push back and we'll take another look. |
#7925) # Description Ports the intent of #3426 (closed) forward to the current Isaac Lab 3.0 entrypoint architecture, with a cleaner UX: passing a wandb run URL or shorthand as `--checkpoint` now automatically downloads and loads that run's checkpoint — no extra flags required. ```bash # Play (or resume training from) a specific run, latest checkpoint: isaaclab play --rl_library rsl_rl --task <task> \ --checkpoint https://wandb.ai/<entity>/<project>/runs/<run_id> # Or the shorthand, optionally pinning a specific iteration: isaaclab play --rl_library rsl_rl --task <task> \ --checkpoint wandb:<entity>/<project>/<run_id>?checkpoint=100 ``` Starting a **new** `--logger wandb` training run also prints the exact shorthand to copy into a later `--checkpoint`: ``` [INFO] Logging to wandb run: wandb:my_entity/my_project/a1b2c3d4 [INFO] Resume or play it later with: --checkpoint wandb:my_entity/my_project/a1b2c3d4 ``` This works by pinning `WANDB_RUN_ID` before RSL-RL's writer lazily calls `wandb.init()`, so the run id is known and printable immediately instead of only after training completes. No new CLI flags were added — entity resolution reuses the existing `WANDB_ENTITY`/`WANDB_USERNAME` environment variables that `wandb` and RSL-RL's own writer already honor. ## Type of change - New feature (non-breaking change which adds functionality) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## 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 `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
#7925) # Description Ports the intent of #3426 (closed) forward to the current Isaac Lab 3.0 entrypoint architecture, with a cleaner UX: passing a wandb run URL or shorthand as `--checkpoint` now automatically downloads and loads that run's checkpoint — no extra flags required. ```bash # Play (or resume training from) a specific run, latest checkpoint: isaaclab play --rl_library rsl_rl --task <task> \ --checkpoint https://wandb.ai/<entity>/<project>/runs/<run_id> # Or the shorthand, optionally pinning a specific iteration: isaaclab play --rl_library rsl_rl --task <task> \ --checkpoint wandb:<entity>/<project>/<run_id>?checkpoint=100 ``` Starting a **new** `--logger wandb` training run also prints the exact shorthand to copy into a later `--checkpoint`: ``` [INFO] Logging to wandb run: wandb:my_entity/my_project/a1b2c3d4 [INFO] Resume or play it later with: --checkpoint wandb:my_entity/my_project/a1b2c3d4 ``` This works by pinning `WANDB_RUN_ID` before RSL-RL's writer lazily calls `wandb.init()`, so the run id is known and printable immediately instead of only after training completes. No new CLI flags were added — entity resolution reuses the existing `WANDB_ENTITY`/`WANDB_USERNAME` environment variables that `wandb` and RSL-RL's own writer already honor. ## Type of change - New feature (non-breaking change which adds functionality) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## 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 `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: Claude Sonnet 5 <[email protected]> (cherry picked from commit 847354d)
Description
Porting over my old orbit PR for wandb loading and resuming of checkpoints. This allows the user to directly play a specified run from wandb.
Usage:
To e.g. resume (or play) the training from a run located at
https://wandb.ai/<user_name>/<project_name>/runs/<run_id>This will immediately download the newest checkpoint (or the one with iteration --wandb_checkpoint_iteration XX) and use it for play or resuming.
If you are using an extension template, make sure to carry over the changes to your cli_args.py
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there