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

Fix truncated_bptt_steps hiddens detach() and improve docs #8145

Merged
merged 23 commits into from
Jul 1, 2021

Conversation

gtauzin
Copy link
Contributor

@gtauzin gtauzin commented Jun 26, 2021

What does this PR do?

This PR was discussed on Slack with @awaelchli.
It fixes the detach() on hiddens in the case it is a tuple of Tensors (typically, for nn.LSTM).
It reverts the documentation change that I pushed on #7846 as it turned out to be incorrect.
It also proposes a documentation improvement explaining a bit more what (I understood) happens behind the scenes and stresses the importance of using it along with batch_first=True. Please let me know if this is correct!

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs) [Slack]
  • 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 update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

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:

  • 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 🙃

@gtauzin
Copy link
Contributor Author

gtauzin commented Jun 26, 2021

Could I get any suggestions wrt where I should add my test?

@codecov
Copy link

codecov bot commented Jun 26, 2021

Codecov Report

Merging #8145 (bc858af) into master (3e6f884) will decrease coverage by 5%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #8145    +/-   ##
=======================================
- Coverage      93%     88%    -5%     
=======================================
  Files         212     212            
  Lines       13679   13693    +14     
=======================================
- Hits        12720   12050   -670     
- Misses        959    1643   +684     

Signed-off-by: Guillaume Tauzin <[email protected]>
@awaelchli awaelchli added docs Documentation related bug Something isn't working labels Jun 28, 2021
@awaelchli awaelchli added this to the v1.3.x milestone Jun 28, 2021
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.

great improvement!

docs/source/common/lightning_module.rst Outdated Show resolved Hide resolved
docs/source/common/lightning_module.rst Outdated Show resolved Hide resolved
pytorch_lightning/loops/batch/training_batch_loop.py Outdated Show resolved Hide resolved
@awaelchli awaelchli self-assigned this Jun 28, 2021
gtauzin added 4 commits July 1, 2021 10:34
Signed-off-by: Guillaume Tauzin <[email protected]>
Signed-off-by: Guillaume Tauzin <[email protected]>
Signed-off-by: Guillaume Tauzin <[email protected]>
@pep8speaks
Copy link

pep8speaks commented Jul 1, 2021

Hello @gtauzin! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-07-01 16:28:20 UTC

@gtauzin gtauzin marked this pull request as ready for review July 1, 2021 13:38
@gtauzin gtauzin requested a review from awaelchli July 1, 2021 13:39
@gtauzin gtauzin changed the title [WIP] Fix truncated_bptt_steps hiddens detach() and improve docs Fix truncated_bptt_steps hiddens detach() and improve docs Jul 1, 2021
@gtauzin
Copy link
Contributor Author

gtauzin commented Jul 1, 2021

I believe it is ready. Not that I could not run the test locally on my laptop. The make test fails for a rather high number of tests unrelated to my change and hangs without finishing.

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.

Thanks @gtauzin <3

@awaelchli awaelchli added the ready PRs ready to be merged label Jul 1, 2021
@gtauzin
Copy link
Contributor Author

gtauzin commented Jul 1, 2021

You're welcome @awaelchli. Any idea when the release including this change will be out?

@awaelchli
Copy link
Contributor

@gtauzin since this is a bugfix, it will go into next week's patch release and/or RC release, given that it is merged until then :)

docs/source/common/lightning_module.rst Outdated Show resolved Hide resolved
docs/source/common/lightning_module.rst Outdated Show resolved Hide resolved
docs/source/common/lightning_module.rst Outdated Show resolved Hide resolved
pytorch_lightning/loops/batch/training_batch_loop.py Outdated Show resolved Hide resolved
gtauzin and others added 2 commits July 1, 2021 18:07
Signed-off-by: Guillaume Tauzin <[email protected]>
@gtauzin gtauzin requested a review from carmocca July 1, 2021 16:25
gtauzin added 2 commits July 1, 2021 18:27
Signed-off-by: Guillaume Tauzin <[email protected]>
Signed-off-by: Guillaume Tauzin <[email protected]>
@Borda Borda enabled auto-merge (squash) July 1, 2021 21:07
@Borda Borda merged commit baa7de2 into Lightning-AI:master Jul 1, 2021
@carmocca carmocca mentioned this pull request Jul 1, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs Documentation related ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants