Skip to content

Commit d6a4ae3

Browse files
pascal-rothmohanksriram
authored andcommitted
Adds empirical normalizer export when using rsl-rl workflow (isaac-sim#624)
Adds the empirical normalizer in the ONNX model export for RSL-RL `play.py` script. Earlier, this was not being done, which would cause empirical normalization to not work in the ONNX model. - Bug fix (non-breaking change which fixes an issue) - [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 - [ ] 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 - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
1 parent 8f014bf commit d6a4ae3

File tree

1 file changed

+4
-2
lines changed
  • source/standalone/workflows/rsl_rl

1 file changed

+4
-2
lines changed

source/standalone/workflows/rsl_rl/play.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ def main():
7979
# obtain the trained policy for inference
8080
policy = ppo_runner.get_inference_policy(device=env.unwrapped.device)
8181

82-
# export policy to onnx
82+
# export policy to onnx/jit
8383
export_model_dir = os.path.join(os.path.dirname(resume_path), "exported")
8484
export_policy_as_jit(
8585
ppo_runner.alg.actor_critic, ppo_runner.obs_normalizer, path=export_model_dir, filename="policy.pt"
8686
)
87-
export_policy_as_onnx(ppo_runner.alg.actor_critic, path=export_model_dir, filename="policy.onnx")
87+
export_policy_as_onnx(
88+
ppo_runner.alg.actor_critic, normalizer=ppo_runner.obs_normalizer, path=export_model_dir, filename="policy.onnx"
89+
)
8890

8991
# reset environment
9092
obs, _ = env.get_observations()

0 commit comments

Comments
 (0)