Unverified Commit 1de1b432 authored by Toni-SM's avatar Toni-SM Committed by GitHub

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
https://github.com/isaac-sim/IsaacLab/issues/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
parent 7b9b4502
......@@ -179,6 +179,11 @@ def main():
with torch.inference_mode():
# agent stepping
outputs = runner.agent.act(obs, timestep=0, timesteps=0)
# - multi-agent (deterministic) actions
if hasattr(env, "possible_agents"):
actions = {a: outputs[-1][a].get("mean_actions", outputs[0][a]) for a in env.possible_agents}
# - single-agent (deterministic) actions
else:
actions = outputs[-1].get("mean_actions", outputs[0])
# env stepping
obs, _, _, _, _ = env.step(actions)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment