Skip to content

Commit 0613caa

Browse files
Toni-SMjtigue-bdai
authored andcommitted
Implements deterministic evaluation for skrl's multi-agent algorithms (#1972)
## Description Implement deterministic evaluation for skrl's multi-agent algorithms in `play.py` script (fix #1935). The current application only takes into account single-agent algorithms. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [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 0b3add8 commit 0613caa

File tree

1 file changed

+6
-1
lines changed
  • scripts/reinforcement_learning/skrl

1 file changed

+6
-1
lines changed

scripts/reinforcement_learning/skrl/play.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ def main():
179179
with torch.inference_mode():
180180
# agent stepping
181181
outputs = runner.agent.act(obs, timestep=0, timesteps=0)
182-
actions = outputs[-1].get("mean_actions", outputs[0])
182+
# - multi-agent (deterministic) actions
183+
if hasattr(env, "possible_agents"):
184+
actions = {a: outputs[-1][a].get("mean_actions", outputs[0][a]) for a in env.possible_agents}
185+
# - single-agent (deterministic) actions
186+
else:
187+
actions = outputs[-1].get("mean_actions", outputs[0])
183188
# env stepping
184189
obs, _, _, _, _ = env.step(actions)
185190
if args_cli.video:

0 commit comments

Comments
 (0)