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

TerminateIllegalWrapper fix #1206

Merged
merged 6 commits into from
Jun 21, 2024

Conversation

dm-ackerman
Copy link
Contributor

Description

Fix bug in TerminateIllegalWrapper that set values on the wrapper instead of the env.

Fixes #1176

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have run pytest -v and no errors are present.
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I solved any possible warnings that pytest -v has generated that are related to my code to the best of my knowledge.
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

```
if isinstance(self._prev_obs, dict):
    assert self._prev_obs is not None
```

`self._prev_obs` can't be `None` because it is a `dict` instance
Functions need to be set from the actual env, not the wrapper.
Copy link
Contributor

@elliottower elliottower left a comment

Choose a reason for hiding this comment

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

Overall looks good thanks for making the test too, though it should probably be in the file where the other wrapper tests are done just for simplicity. And have we changed all of the other wrappers to do this self.env.unwrapped business yet?

@dm-ackerman
Copy link
Contributor Author

Overall looks good thanks for making the test too, though it should probably be in the file where the other wrapper tests are done just for simplicity. And have we changed all of the other wrappers to do this self.env.unwrapped business yet?

This was the only one I noticed where unwrapped matters.

I moved the wrapper test in with the others

Copy link
Member

@jjshoots jjshoots left a comment

Choose a reason for hiding this comment

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

Looks pretty reasonable to me. The test for terminate illegal is a bit hack with the double call to the env rollout, but otherwise looks sane enough.

@jjshoots jjshoots merged commit 1eef080 into Farama-Foundation:master Jun 21, 2024
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] TerminateIllegalWrapper breaks agent selection
3 participants