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

[Refactoring] Replace direct gym version checks with decorated functions (#) #691

Merged
merged 8 commits into from
Nov 21, 2022

Conversation

ordinskiy
Copy link
Contributor

Description

Replaces direct gym version checks with @implement_for decorated functions (primarily gym.py and tests), except some places in tests where direct check still looks better (less complicated). Extracted gym environments version definition logic in tests.

Motivation and Context

This simplifies the logic of functions that check for gym versions, improves readability and makes it easier to adapt for bc-braking changes in gym. Proposed by @vmoens.

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of examples)
  • Refactoring

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.

@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 Nov 21, 2022
@vmoens vmoens added the enhancement New feature or request label Nov 21, 2022
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.

Wonderful! Thanks a mil!

@vmoens vmoens merged commit b583ac1 into pytorch:main Nov 21, 2022
vmoens added a commit that referenced this pull request Nov 23, 2022
* amend

* [BugFix] ConvNet forward method with tensors of more than 4 dimensions (#686)

* cnn forward fix

* more general code

* cnn testing

* precommit run check

* convnet tests

* [Feature] add `standard_normal` for RewardScaling (#682)

* Add standard_normal

* give attribute access

* Update standard_normal

* Update tests

* Fix tests

* Address in-place scaling of reward

* Improvise tests

* [Feature] Jumanji envs (#674)

* amend

* [Feature] Default collate_fn (#688)

* init

* amend

* amend

* [BugFix] Fix Examples (#687)

* amend

* [Refactoring] Replace direct gym version checks with decorated functions (#691)

* [Refactoring] Replace gym version checking with decorated functions (#)

Initial commit. Only tests.

* Refactoring in gym.py

* More refactoring in gym.py

* Completed refactoring

* amend

* amend

* Version 0.0.3 (#696)

* [Docs] Host TensorDict docs inside TorchRL docs (#693)

* Pull tensordict docs into TorchRL docs

* Add banner for tensordict docs

* [BugFix] Fix docs build (#698)

* [BugFix] Proper error messages for orphan transform creation (#697)

* amend

* [Feature] Append, init and insert transforms in ReplayBuffer (#695)

* lint

Co-authored-by: albertbou92 <albertbou92@users.noreply.github.com>
Co-authored-by: Aditya Gandhamal <61016383+adityagandhamal@users.noreply.github.com>
Co-authored-by: yingchenlin <yc.jon.lin@gmail.com>
Co-authored-by: Sergey Ordinskiy <113687736+ordinskiy@users.noreply.github.com>
Co-authored-by: Tom Begley <tomcbegley@gmail.com>
Co-authored-by: Alan Schelten <alan@schelten.net>
vmoens added a commit that referenced this pull request Jan 5, 2023
* init

* tests1

* run examples in tests

* [Feature] MPPI Planner (#694)

* amend

* [BugFix] ConvNet forward method with tensors of more than 4 dimensions (#686)

* cnn forward fix

* more general code

* cnn testing

* precommit run check

* convnet tests

* [Feature] add `standard_normal` for RewardScaling (#682)

* Add standard_normal

* give attribute access

* Update standard_normal

* Update tests

* Fix tests

* Address in-place scaling of reward

* Improvise tests

* [Feature] Jumanji envs (#674)

* amend

* [Feature] Default collate_fn (#688)

* init

* amend

* amend

* [BugFix] Fix Examples (#687)

* amend

* [Refactoring] Replace direct gym version checks with decorated functions (#691)

* [Refactoring] Replace gym version checking with decorated functions (#)

Initial commit. Only tests.

* Refactoring in gym.py

* More refactoring in gym.py

* Completed refactoring

* amend

* amend

* Version 0.0.3 (#696)

* [Docs] Host TensorDict docs inside TorchRL docs (#693)

* Pull tensordict docs into TorchRL docs

* Add banner for tensordict docs

* [BugFix] Fix docs build (#698)

* [BugFix] Proper error messages for orphan transform creation (#697)

* amend

* [Feature] Append, init and insert transforms in ReplayBuffer (#695)

* lint

Co-authored-by: albertbou92 <albertbou92@users.noreply.github.com>
Co-authored-by: Aditya Gandhamal <61016383+adityagandhamal@users.noreply.github.com>
Co-authored-by: yingchenlin <yc.jon.lin@gmail.com>
Co-authored-by: Sergey Ordinskiy <113687736+ordinskiy@users.noreply.github.com>
Co-authored-by: Tom Begley <tomcbegley@gmail.com>
Co-authored-by: Alan Schelten <alan@schelten.net>

* lint

Co-authored-by: albertbou92 <albertbou92@users.noreply.github.com>
Co-authored-by: Aditya Gandhamal <61016383+adityagandhamal@users.noreply.github.com>
Co-authored-by: yingchenlin <yc.jon.lin@gmail.com>
Co-authored-by: Sergey Ordinskiy <113687736+ordinskiy@users.noreply.github.com>
Co-authored-by: Tom Begley <tomcbegley@gmail.com>
Co-authored-by: Alan Schelten <alan@schelten.net>
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. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants