-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add DefaultDict typehint for optimizer state in accelerator #7318
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7318 +/- ##
======================================
Coverage 87% 87%
======================================
Files 200 200
Lines 12865 12865
======================================
Hits 11210 11210
Misses 1655 1655 |
@@ -114,7 +114,7 @@ def pre_dispatch(self, trainer: 'pl.Trainer') -> None: | |||
def _move_optimizer_state(self) -> None: | |||
""" Moves the state of the optimizers to the GPU if needed. """ | |||
for opt in self.optimizers: | |||
state = defaultdict(dict) | |||
state: DefaultDict = defaultdict(dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@awaelchli @Borda @carmocca do you know why this could be merged in #7277 even though the mypy check was failing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because mypy check is not enforced and auto merge just merged it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be enforced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should now that it's green.
cc: @Borda
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 😃
What does this PR do?
Follow up to #7277
Seeing mypy failures in #7306 because of this missing annotation
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃