Skip to content

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

Merged
merged 41 commits into from
Sep 5, 2022
Merged

fixes typing errors in auto_restart.py #13904

merged 41 commits into from
Sep 5, 2022

Conversation

donlapark
Copy link
Contributor

@donlapark donlapark commented Jul 28, 2022

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 is Dict[str, Any], the other times, it is Dict[int, Any].

Also, the state attribute in MergedIteratorState can have two types: Dict[int, IteratorState] or Dict[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 of state to Dict and then conditionally sets it to a more specific type in update method later.

Does your PR introduce any breaking changes? If yes, please list them.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

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:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jul 28, 2022
@otaj otaj mentioned this pull request Jul 29, 2022
52 tasks
@otaj otaj added this to the pl:1.7.x milestone Aug 2, 2022
@mergify mergify bot added the has conflicts label Aug 3, 2022
@mergify mergify bot removed the has conflicts label Aug 6, 2022
@codecov
Copy link

codecov bot commented Aug 6, 2022

Codecov Report

Merging #13904 (e5844dd) into master (66ca093) will increase coverage by 14%.
The diff coverage is 95%.

❗ Current head e5844dd differs from pull request most recent head e81d961. Consider uploading reports for the commit e81d961 to get more accurate results

@@            Coverage Diff            @@
##           master   #13904     +/-   ##
=========================================
+ Coverage      61%      76%    +14%     
=========================================
  Files         331      331             
  Lines       26621    26709     +88     
=========================================
+ Hits        16343    20253   +3910     
+ Misses      10278     6456   -3822     

@carmocca carmocca modified the milestones: pl:1.7.x, pl:1.8 Aug 9, 2022
@mergify mergify bot added the ready PRs ready to be merged label Aug 29, 2022
@rohitgr7
Copy link
Contributor

rohitgr7 commented Sep 1, 2022

@carmocca mind review as code-owner?

@rohitgr7 rohitgr7 requested a review from awaelchli September 5, 2022 08:35
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

@rohitgr7 rohitgr7 merged commit 381600d into Lightning-AI:master Sep 5, 2022
@donlapark donlapark deleted the fixes_mypy_auto_restart_py branch September 7, 2022 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality pl Generic label for PyTorch Lightning package ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants