Skip to content

Conversation

@CyprienRicque
Copy link
Contributor

@CyprienRicque CyprienRicque commented Jul 4, 2022

What does this PR do?

Fixes mypy typing errors in pytorch_lightning/strategies/single_tpu.py in #13445.

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

This could be a breaking change in case I missed something/relative to older lightning versions.

in SingleTPUStrategy class, in function setup(self, trainer: "pl.Trainer"), the call to self.model.on_post_move_to_device() has been removed because the condition to trigger it cannot be True.
The condition is is_overridden("on_post_move_to_device", self.lightning_module). To be True, among other things, this condition requires the parent class to contain the on_post_move_to_device method. This on_post_move_to_device method is not present in any of the parent classes listed in is_overridden, therefore the condition cannot be True. (parents classes being LightningModule, LightningDataModule and Callback).

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 🙃

@mergify mergify bot added the ready PRs ready to be merged label Jul 4, 2022
@mergify mergify bot added has conflicts and removed ready PRs ready to be merged labels Jul 4, 2022
@mergify mergify bot added ready PRs ready to be merged and removed has conflicts ready PRs ready to be merged labels Jul 4, 2022
@Borda Borda enabled auto-merge (squash) July 4, 2022 16:30
@awaelchli awaelchli disabled auto-merge July 5, 2022 06:20
@awaelchli awaelchli enabled auto-merge (squash) July 5, 2022 06:20
@awaelchli awaelchli changed the title fix mypy typing errors in pytorch_lightning/strategies/single_tpu.py Fix mypy typing errors in pytorch_lightning/strategies/single_tpu.py Jul 5, 2022
@awaelchli awaelchli merged commit 61473c2 into Lightning-AI:master Jul 5, 2022
jerome-habana pushed a commit to jerome-habana/lightning that referenced this pull request Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants