Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Features] PettingZoo possibility to choose reset strategy #2048

Merged
merged 16 commits into from
Apr 8, 2024

Conversation

matteobettini
Copy link
Contributor

@matteobettini matteobettini commented Mar 29, 2024

Here I have a small set of modifications to PettingZoo wrapper that have been requested by users.

The modifications are:

  • possibility to override if an environment is done whaen any or all agents are done
  • setting the done flags for dead agents properly

cc @renos

Copy link

pytorch-bot bot commented Mar 29, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/2048

Note: Links to docs will display an error until the docs builds have been completed.

❌ 6 New Failures, 2 Unrelated Failures

As of commit 9d7d515 with merge base c98754f (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 29, 2024
@vmoens vmoens added the Environments Adds or modifies an environment wrapper label Mar 30, 2024
@matteobettini matteobettini changed the title [Features] PettingZoo [Features] PettingZoo possibility to choose reset strategy Apr 1, 2024
Copy link
Contributor

@vmoens vmoens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I would just add a test for this

@matteobettini
Copy link
Contributor Author

LGTM, I would just add a test for this

Added!

Copy link
Contributor

@vmoens vmoens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor edits

torchrl/envs/libs/pettingzoo.py Outdated Show resolved Hide resolved
torchrl/envs/libs/pettingzoo.py Outdated Show resolved Hide resolved
torchrl/envs/libs/pettingzoo.py Outdated Show resolved Hide resolved
torchrl/envs/libs/pettingzoo.py Outdated Show resolved Hide resolved
matteobettini and others added 4 commits April 3, 2024 07:39
Co-authored-by: Vincent Moens <vincentmoens@gmail.com>
Co-authored-by: Vincent Moens <vincentmoens@gmail.com>
Co-authored-by: Vincent Moens <vincentmoens@gmail.com>
Co-authored-by: Vincent Moens <vincentmoens@gmail.com>
@vmoens
Copy link
Contributor

vmoens commented Apr 8, 2024

Tests are failing with

  File "/pytorch/rl/torchrl/envs/libs/pettingzoo.py", line 273, in _build_env
    if importlib.metadata.version("pettingzoo") != "1.24.3":
AttributeError: module 'importlib' has no attribute 'metadata'

@matteobettini
Copy link
Contributor Author

matteobettini commented Apr 8, 2024

this is weird, it seems to throw that error only when using vec_env

I believe that ParallelEnv is causing some kind of bug on importlib_metadata

@vmoens
Copy link
Contributor

vmoens commented Apr 8, 2024

Can't we just use pettingzoo.__version__ along with packaging.version.parse?

@vmoens vmoens merged commit 79e2b07 into pytorch:main Apr 8, 2024
59 of 67 checks passed
@matteobettini matteobettini deleted the petting_zoo_fix branch April 9, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Environments Adds or modifies an environment wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants