-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fixes typing errors in auto_restart.py #13904
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
fixes typing errors in auto_restart.py #13904
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #13904 +/- ##
=========================================
+ Coverage 61% 76% +14%
=========================================
Files 331 331
Lines 26621 26709 +88
=========================================
+ Hits 16343 20253 +3910
+ Misses 10278 6456 -3822 |
@carmocca mind review as code-owner? |
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 !
Co-authored-by: Carlos Mocholí <[email protected]>
Co-authored-by: Carlos Mocholí <[email protected]>
for more information, see https://pre-commit.ci
What does this PR do?
Fixes typing errors in
pytorch_lightning/utilities/auto_restart.py
as a part of #13445.Well, this was quite a tough one, as the type of
state_dict
is not consistent throughout the file. Sometimes its type isDict[str, Any]
, the other times, it isDict[int, Any]
.Also, the
state
attribute inMergedIteratorState
can have two types:Dict[int, IteratorState]
orDict[str, Dict[int, IteratorState]]
, depending on whether the dataset is map-based or iterable. I have applied a band-aid fix which initially sets the type ofstate
toDict
and then conditionally sets it to a more specific type inupdate
method later.Does your PR introduce any breaking changes? If yes, please list them.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃