Update skrl integration for version 2.0.0#5311
Conversation
Greptile SummaryThis PR updates the skrl integration to support version 2.0.0, bumping the minimum version requirement and adapting all API call sites, agent configs, and wrapper logic to the new interface (renamed preprocessor fields, new
Confidence Score: 4/5Safe to merge after fixing the missing raise on ValueError in skrl.py. One P1 bug (missing raise) causes a misleading runtime crash on any unsupported ml_framework value passed to SkrlVecEnvWrapper. All other changes are straightforward API-rename updates with no logic errors. source/isaaclab_rl/isaaclab_rl/skrl.py (missing raise on ValueError, line 83) Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI as play.py / train.py
participant Wrapper as SkrlVecEnvWrapper
participant skrl as skrl library
participant Runner as skrl Runner
CLI->>Wrapper: SkrlVecEnvWrapper(env, ml_framework)
alt ml_framework == torch
Wrapper->>skrl: from skrl.envs.wrappers.torch import wrap_env
else ml_framework starts with jax
Wrapper->>skrl: from skrl.envs.wrappers.jax import wrap_env
else ml_framework == warp
Wrapper->>skrl: from skrl.envs.wrappers.warp import wrap_env
else invalid
Wrapper-->>CLI: ValueError not raised — P1 bug
end
Wrapper->>skrl: wrap_env(env, wrapper)
skrl-->>CLI: wrapped env
CLI->>Runner: Runner(env, cfg)
Runner-->>CLI: runner
Note over CLI: play.py only
CLI->>CLI: env.reset() → obs
CLI->>CLI: env.state() → states
loop simulation
CLI->>Runner: runner.agent.act(obs, states, ...)
Runner-->>CLI: outputs
CLI->>CLI: env.step(actions) → obs
CLI->>CLI: env.state() → states
end
|
There was a problem hiding this comment.
🤖 Isaac Lab Review Bot
Summary
This PR updates Isaac Lab's skrl integration from 1.4.3 to 2.0.0, covering the breaking API changes. The changes are well-targeted and correct for the files touched: state_preprocessor → observation_preprocessor rename for single-agent configs, set_running_mode → enable_training_mode, new states parameter in agent.act(), and AMP reward parameter renames.
Verdict: Changes are correct. One concern about migration scope.
Findings
1. ⚠️ Incomplete state_preprocessor → observation_preprocessor migration across YAML configs
The PR updates 7 out of ~77 skrl YAML configs that use state_preprocessor. In skrl 2.0.0, state_preprocessor now specifically preprocesses MARL global states — not observations. For single-agent envs where states is None, the preprocessor becomes a no-op, meaning observations go unprocessed (no RunningStandardScaler normalization).
This won't crash, but it silently degrades training quality for every single-agent skrl task in Isaac Lab (ant, anymal_c, cartpole, humanoid, G1, H1, go2, franka reach/cabinet, shadow_hand, etc.).
Is this being handled in a follow-up PR?
2. ✅ Pre-existing raise ValueError bug fixed
Good catch — the raise keyword was missing on the framework validation error.
3. 💡 Missing CHANGELOG and version bump
Since the minimum skrl version jumps from 1.4.3 → 2.0.0 (breaking), this warrants:
source/isaaclab_rl/docs/CHANGELOG.rstentry- Version bump in
source/isaaclab_rl/config/extension.toml
4. 💡 jax-numpy removal from CLI choices
The --ml_framework choices drop jax-numpy. Users with scripts using --ml_framework jax-numpy will get argparse errors. Worth a note in the CHANGELOG.
There was a problem hiding this comment.
🤖 Isaac Lab Review Bot
Summary
This PR correctly updates Isaac Lab's skrl integration from 1.4.3 to 2.0.0, addressing the breaking API changes. The core changes are well-implemented:
- ✅
set_running_mode("eval")→enable_training_mode(False, apply_to_models=True) - ✅ New
statesparameter inagent.act()andenv.state()calls - ✅ AMP config renames:
state_preprocessor→observation_preprocessor,amp_state_preprocessor→amp_observation_preprocessor,task_reward_weight/style_reward_weight→task_reward_scale/style_reward_scale - ✅ MAPPO critic input
OBSERVATIONS→STATES - ✅ Missing
raisekeyword onValueErrorfixed - ✅ Minimum skrl version updated to 2.0.0
Verdict: Approve with minor suggestions
The implementation is correct. No bugs or logic errors. Two process items to consider:
Findings
1. 💡 Partial config migration (by design?)
The PR updates 7 YAML configs (3 AMP, 2 IPPO, 2 MAPPO), but leaves ~67 other skrl PPO configs unchanged. For example, skrl_ppo_cfg.yaml in the same directories (cart_double_pendulum, shadow_hand_over) still have only state_preprocessor: RunningStandardScaler without observation_preprocessor.
Impact: In skrl 2.0.0, state_preprocessor processes MARL global states (privileged observations), not regular observations. For single-agent envs where states=None, this becomes a no-op, meaning observations go un-normalized. This silently degrades training quality.
Question: Is there a follow-up PR planned (hence the branch name toni/skrl_2.0.0_part1)? If so, this is fine as-is. If not, the remaining PPO configs should be migrated.
2. 💡 Missing CHANGELOG.rst and version bump
Since the minimum skrl version changes from 1.4.3 → 2.0.0 (a breaking change for users), this warrants:
- An entry in
source/isaaclab_rl/docs/CHANGELOG.rst - A version bump in
source/isaaclab_rl/config/extension.toml
The PR checklist shows these items are unchecked.
3. 📝 jax-numpy removal
The --ml_framework CLI choices drop jax-numpy. Users with existing scripts using this option will get argparse errors. Consider noting this in the CHANGELOG.
Code Quality
The implementation follows established patterns and is consistent with the codebase. No additional inline comments needed - the changes are straightforward and correct.
Signed-off-by: Kelly Guo <kellyg@nvidia.com>
Doc Build Failure AnalysisThe Root CauseThe PR bumps This syntax requires Python 3.10+, but the doc build environment appears to use an earlier version. The import failure cascades to every module that transitively imports from
Suggested Fixes
@Toni-SM — could you check if skrl 2.0.0 has |
There was a problem hiding this comment.
🤖 Isaac Lab Review Bot
Summary
All previous concerns have been addressed in this update. The PR now includes the CHANGELOG entries and version bumps for both isaaclab_rl (0.5.0 → 0.5.1) and isaaclab_tasks (0.11.14 → 0.11.16).
Implementation Verdict
Ship it ✅
Findings
No new issues. The follow-up commits correctly added:
source/isaaclab_rl/docs/CHANGELOG.rstentry for 0.5.1source/isaaclab_tasks/docs/CHANGELOG.rstentry for 0.11.16- Version bumps in both
extension.tomlfiles
The partial config migration (only multi-agent configs updated) appears intentional given the branch name part1, which is acceptable for incremental rollout.
# Description * #5311 - Update skrl integration for version 2.0.0 ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (existing functionality will not work without user modification) - 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 `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: Antoine RICHARD <antoiner@nvidia.com> Signed-off-by: bxwang <bixiong.wang@x-humanoid.com> Signed-off-by: bixiong wang <wangbx02@126.com> Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: nv-caelan <cgarrett@nvidia.com> Co-authored-by: Clemens Schwarke <96480707+ClemensSchwarke@users.noreply.github.com> Co-authored-by: Kelly Guo <kellyguo11@users.noreply.github.com> Co-authored-by: Antoine RICHARD <antoiner@nvidia.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: bixiong wang <wangbx02@126.com> Co-authored-by: bxwang <bixiong.wang@x-humanoid.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: OpenClaw <openclaw@users.noreply.github.com> Co-authored-by: Toni-SM <aserranomuno@nvidia.com>
DirectMARLEnv envs (cart_double_pendulum, shadow_hand_over) crashed
out of the gate on benchmark_startup:
AttributeError: 'CartDoublePendulumEnv' object has no attribute
'single_action_space'
Multi-agent envs expose ``action_spaces`` (plural, dict keyed by
agent id) instead of ``single_action_space``. The first-step random
action sample needs the matching shape — a per-agent dict of stacked
tensors — and ``env.step`` accepts that shape directly.
Extract the action sampler to ``_action_sampling.py`` so it has unit
tests covering both single-agent and multi-agent shapes (gym wrappers,
heterogeneous per-agent action dims, in-bounds samples, per-env
independence). Discriminator is a duck-type on
``unwrapped.action_spaces`` so the helper doesn't need to import
isaaclab — keeps tests fast.
benchmark_skrl.py also gets a small auto-promotion: if the user
leaves the default ``--algorithm ppo`` AND the task is multi-agent,
silently switch to ``ippo``. Plain PPO can't train a DirectMARLEnv
(its observation preprocessor and policy assume Tensor obs, not
dict), and the per-task yaml entry points already advertise
``skrl_ippo_cfg_entry_point`` for these tasks. Explicit
``--algorithm mappo`` etc. is honoured as-is.
Together with the prior ``state_preprocessor → observation_preprocessor``
yaml rename (cherry-pick from PR isaac-sim#5311), this unblocks
cart_double_pendulum and shadow_hand_over end-to-end on the
benchmark suite.
Description
Updates the integration of skrl for the version 2.0.0.
This also solves #5300.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there