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

Fixed TypeError on 1.7.6 when torch.distributed unavailable #14809

Merged
merged 3 commits into from
Sep 20, 2022

Conversation

otaj
Copy link
Contributor

@otaj otaj commented Sep 20, 2022

What does this PR do?

#14454 added a subtle bug - when torch.distributed was not available, type of ProcessGroup was set to ..., however it is once used inside Optional (Optional[ProcessGroup]). However, having an Optional of Ellipsis is not allowed by Python type system and results in obscure TypeError.

This was noticed in #14765 (comment)

I do not know how to properly test this. I tried to mock torch.distributed.is_available() and sys.modules and import pytorch_lightning in a test, however this did not yield expected failure on previous version.

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 🙃

cc @Borda @tchaton @rohitgr7 @akihironitta @awaelchli

@otaj otaj added code quality pl Generic label for PyTorch Lightning package labels Sep 20, 2022
@otaj otaj added this to the pl:1.7.x milestone Sep 20, 2022
@otaj otaj self-assigned this Sep 20, 2022
@otaj otaj changed the title Fixed TypeError on 1.7.6 when torch.distributed unavailable Fixed TypeError on 1.7.6 when torch.distributed unavailable Sep 20, 2022
Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

Thank you @otaj
I also have no idea how to test this

@awaelchli awaelchli added bug Something isn't working priority: 0 High priority task labels Sep 20, 2022
@mergify mergify bot added the ready PRs ready to be merged label Sep 20, 2022
@Borda Borda enabled auto-merge (squash) September 20, 2022 17:51
@Borda Borda merged commit ac5e0b3 into master Sep 20, 2022
@Borda Borda deleted the typing/process_group branch September 20, 2022 20:35
@otaj otaj mentioned this pull request Sep 21, 2022
10 tasks
kaushikb11 pushed a commit that referenced this pull request Sep 21, 2022
* Fixed TypeError on 1.7.6 when distributed unavailable
* changelog
carmocca pushed a commit that referenced this pull request Sep 21, 2022
* Fixed TypeError on 1.7.6 when distributed unavailable
* changelog
carmocca pushed a commit that referenced this pull request Sep 21, 2022
* Fixed TypeError on 1.7.6 when distributed unavailable
* changelog
lexierule pushed a commit that referenced this pull request Sep 22, 2022
* Fixed TypeError on 1.7.6 when distributed unavailable
* changelog
rohitgr7 pushed a commit that referenced this pull request Sep 24, 2022
* Fixed TypeError on 1.7.6 when distributed unavailable
* changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code quality pl Generic label for PyTorch Lightning package priority: 0 High priority task ready PRs ready to be merged
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants