Repository navigation
Add tuned FlashSAC agents and fix G1 symmetry augmentation - #9125
Conversation
G1 symmetry augmentation failed on the velocity tasks: the waist yaw torso_joint and the Dex3 thumb rotation zero_joint have symmetric limits and names without a roll, yaw or pitch token, so the mirror map could not resolve their signs. torso_joint is a yaw and flips; forward kinematics of mirrored poses matches the reflected bodies within a few millimetres everywhere except the hands. The left and right Dex3 hands are not mirror images, so no sign reflects the thumb exactly; zero_joint keeps the existing thumb convention. The vector mirror factors were rebuilt from Python tuples on every call, which is a host-to-device copy and fails inside captured CUDA graphs, as used by SAC's updates. They are now built once per term, device and size. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The PPO vs FlashSAC benchmark tuned SAC per task under the PPO rewards. These settings now ship as rsl_rl_sac_cfg_entry_point agents, so each of the tasks has a PPO and a SAC agent: cartpole, ant, humanoid, Franka drawer, Allegro cube, and the flat and rough ANYmal-D and G1 velocity tasks. Each config matches the benchmarked run field by field, with the iteration count it reached in its time budget. The flat G1 agent moves from the single-setting FlashSAC recipe to the tuned one and reads the policy observation group; the proprio group it named does not exist in the flat G1 environment. Both G1 agents use the symmetry augmentation, now shared with the PPO teacher as G1SymmetryCfg. The G1 mirror unit test is dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
[Medium impact] The PR appears safe to merge; no new actionable issue was found. SummaryAdds tuned FlashSAC agents for the listed control, manipulation, and velocity tasks, and fixes G1 mirror signs and vector-factor caching.
Reviews (2) · Last reviewed commit: "Address review: explicit obs groups, inh..." · Reviewed by Greptile |
| _EXPLICIT_SIGNS = { | ||
| "hand_thumb_0_joint": 1.0, | ||
| # waist yaw of the velocity-task G1; its limits are symmetric, so neither limits nor name resolve it | ||
| "torso_joint": -1.0, | ||
| # Dex3 thumb rotation. The left and right Dex3 hands are not mirror images, so no sign reflects the thumb | ||
| # exactly; finger mirroring is approximate on this hand either way. | ||
| "zero_joint": 1.0, | ||
| } | ||
| # Vector mirror factors per (term, device, size), built once so captured CUDA graphs need no host-to-device copy | ||
| _FACTOR_CACHE: dict[tuple[str, str, int], torch.Tensor] = {} |
There was a problem hiding this comment.
The G1 mirror fixes have no regression tests. Add tests with symmetric joint limits for torso_joint and paired *_zero_joint joints, plus a CUDA test that warms the factor cache before capturing a second call. These cover the exact failures this change fixes; the existing ANYmal tests do not exercise this code.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Left out on purpose to keep the PR to the fix and the configs. The signs were checked with a forward-kinematics comparison (in the description). Both G1 SAC agents run the augmentation with CUDA graphs on, and they train. I can add a small CPU test back if maintainers want one.
There was a problem hiding this comment.
That makes sense — you've validated the signs with forward kinematics and confirmed the CUDA graph path works in practice with the actual SAC agents. Keeping the PR focused on the fix and configs is reasonable, especially when the functionality is already being exercised. If maintainers want test coverage, you can add it then.
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Scope and over-engineering (2), Compatibility and deprecation (1), Implementation (1), Style consistency (3). Other reviewed categories look good.
- PR description: Title matches registrations and symmetry changes; shorten tuning repetition and support PPO/SAC timing claims with reproducible baseline/candidate revisions, command, hardware, backend, environment count, warmup, and learning-time metrics.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: Minimal implementation: Keep all six added task-local rsl_rl_sac_cfg.py modules for their registered configuration contracts; merge symmetry_cfg.py into the existing G1 agent configuration owner, reuse a configured instance, and inherit shared flat settings with rough overrides. Keep reflection signs and factors in g1.py. Suggested PR breakdown: 1. G1 reflection/cache fixes, validated by reflection and capture replay. 2. SAC configurations, compatibility bridge, registrations, and documentation, validated through agent loading and observation/action contracts.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: the existing flat G1 SAC entry point halves action bounds without a deprecation bridge; preserve the old action contract temporarily, warn users, and separately document and test the tuned transition.
- Implementation: The factor-cache lookup converts torch.device to a string for every vector term; key directly by the hashable device to remove repeated representation allocation.
- Style consistency: Repeated tuning sentences, field summaries, and gait rationale duplicate nearby declarations and documentation; remove boilerplate and retain each useful constraint or rationale once.
- Test quality: Test quality looks good.
Significant concerns. Posted 7 inline findings.
Automated review; human maintainers own approval decisions.
| action_range=(-2.0, 2.0), std_range=(math.exp(-10.0), math.exp(2.0)) | ||
| ), | ||
| network_cfg=RslRlResidualMLPCfg(hidden_dim=128, num_blocks=2), | ||
| distribution_cfg=RslRlMLPModelCfg.SquashedGaussianDistributionCfg(action_range=(-1.0, 1.0)), |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve the existing flat SAC contract
The existing class and entry point now halve action bounds and change observation selection and training defaults. Keep the old recipe functional through a warned deprecation transition; expose tuning separately and document and validate both…
There was a problem hiding this comment.
I don't think a deprecation bridge is needed here:
- the old config read a
propriogroup the flat G1 env doesn't have, so it couldn't train as merged - it came in with Add native RSL-RL SAC support #8866 two days ago and hasn't been released
So there's no working contract to keep. Happy to add one if maintainers still want it.
|
run-ci |
The five task SAC agents without obs_groups now set them, so their configs pass validate(); their environments only have a policy group. The rough ANYmal-D and G1 agents inherit their flat siblings and only override the algorithm, the iteration count and the experiment name. The G1 symmetry settings are a shared RslRlSymmetryCfg instance in the PPO config module instead of a preset subclass, and the mirror factor cache keys on torch.device. Docstrings drop the restated settings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
G1 symmetry augmentation (
isaaclab_tasks.core.velocity.mdp.symmetry.g1:compute_symmetric_states) fails onIsaac-Velocity-Flat-G1andIsaac-Velocity-Rough-G1, for PPO and SAC alike. This PR fixes it and gives the tasks from the PPO vs FlashSAC benchmark a tuned SAC agent next to their PPO agent.Two joints of the velocity-task G1 have symmetric limits and names without a roll, yaw or pitch token, so the mirror map cannot resolve their signs and raises: the waist yaw
torso_jointand the Dex3 thumb rotation*_zero_joint.torso_jointis a yaw and flips under a sagittal mirror. I checked the full map with forward kinematics: one robot in a random pose, a second in the mirrored pose, and every body of the second compared with the reflection of its counterpart. Over 20 poses, all bodies outside the hands match within 3.3 mm, and flipping the waist or a hip sign moves bodies by 0.6 to 1.1 m, so the check is sensitive. The thumb links stay several centimetres off for every combination of finger signs, because the left and right Dex3 hands are not mirror images of each other. Finger mirroring is therefore approximate on this robot;zero_jointkeeps the existing thumb convention (hand_thumb_0_joint, +1).The vector mirror factors were also rebuilt from Python tuples on every call. That is a host-to-device copy, which fails inside a captured CUDA graph, as used by rsl_rl SAC's updates. The factors are now built once per term, device and size.
The benchmark tuned FlashSAC per task under the same rewards as PPO. Those settings now ship as
rsl_rl_sac_cfg_entry_pointagents forIsaac-Cartpole,Isaac-Ant,Isaac-Humanoid,Isaac-Open-Drawer-Franka,Isaac-Reorient-Cube-Allegro, and the flat and rough ANYmal-D and G1 velocity tasks. Each config matches the benchmarked run field by field, and itsmax_iterationsis what that run reached in its time budget. Most tasks use the RSL-RL FlashSAC defaults with a higher discount, more updates per iteration, a cosine learning-rate schedule and a short warm-up; the two rough tasks only raise the learning rates and were tuned with 1024 environments.Isaac-Reach-Frankahas no SAC agent: SAC reaches the target but much more slowly than PPO, and none of the settings tried closed that gap.The flat G1 SAC agent from #8866 moves to the tuned settings. It also named a
proprioobservation group, which the flat G1 environment does not have; it now readspolicylike the PPO agent. Without mirrored samples, SAC learns left/right asymmetric gaits on G1, holding one leg in the air or spreading both legs wide, so both G1 SAC agents use the symmetry augmentation. Its settings move intoG1_SYMMETRY_CFG, shared with the G1 PPO teacher.Per-task curves and videos: https://linkify.nvidia.com/s/rsl-rl-ppo-flashsac-supermimic/ (NVIDIA internal).
To try a SAC agent:
🤖 Generated with Claude Code