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

[BugFix] SafeModule not safely handling specs #1352

Merged
merged 12 commits into from
Jul 5, 2023

Conversation

matteobettini
Copy link
Contributor

@matteobettini matteobettini commented Jul 3, 2023

The safe module is very unsafe ;)
Fixes #1278

Signed-off-by: Matteo Bettini <matbet@meta.com>
@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 Jul 3, 2023
Signed-off-by: Matteo Bettini <matbet@meta.com>
Signed-off-by: Matteo Bettini <matbet@meta.com>
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 thanks!

Signed-off-by: Matteo Bettini <matbet@meta.com>
Signed-off-by: Matteo Bettini <matbet@meta.com>
try:
self._device = item.device
except RuntimeError:
self._device = item._device
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this because otherwise it would throw an error when trying to clone a CompositeSpec with no device

@matteobettini matteobettini marked this pull request as draft July 4, 2023 09:53
Signed-off-by: Matteo Bettini <matbet@meta.com>
Signed-off-by: Matteo Bettini <matbet@meta.com>
@matteobettini matteobettini marked this pull request as ready for review July 4, 2023 10:06
# Conflicts:
#	torchrl/modules/tensordict_module/common.py
#	torchrl/modules/tensordict_module/probabilistic.py
@matteobettini matteobettini marked this pull request as draft July 4, 2023 15:50
Signed-off-by: Matteo Bettini <matbet@meta.com>
Signed-off-by: Matteo Bettini <matbet@meta.com>
@matteobettini matteobettini marked this pull request as ready for review July 4, 2023 16:19
@vmoens vmoens added the bug Something isn't working label Jul 5, 2023
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 minor comment

torchrl/data/tensor_specs.py Outdated Show resolved Hide resolved
Signed-off-by: Matteo Bettini <matbet@meta.com>
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.

Final

@vmoens vmoens merged commit e4fef6b into pytorch:main Jul 5, 2023
@matteobettini matteobettini deleted the fix_safe_modules branch July 6, 2023 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] ActorCriticWrapper overriding module specs
3 participants