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

Update hooks pseudocode #7713

Merged
merged 3 commits into from
May 27, 2021
Merged

Update hooks pseudocode #7713

merged 3 commits into from
May 27, 2021

Conversation

carmocca
Copy link
Contributor

What does this PR do?

See title.
I removed the inputs/outputs because IMO they decrease the readability if we want to do them correctly. Also because the value in this snippet is the hook order, not the inputs/arguments - we have the API reference for those.

Also included:

  • Changelog update requested by @awaelchli
  • Test improvement

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 update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

  • 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

@carmocca carmocca added the docs Documentation related label May 25, 2021
@carmocca carmocca added this to the v1.4 milestone May 25, 2021
@carmocca carmocca self-assigned this May 25, 2021
@codecov
Copy link

codecov bot commented May 25, 2021

Codecov Report

Merging #7713 (95e2c5c) into master (d26953c) will decrease coverage by 0%.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #7713   +/-   ##
======================================
- Coverage      93%     92%   -0%     
======================================
  Files         199     199           
  Lines       12971   12960   -11     
======================================
- Hits        12001   11952   -49     
- Misses        970    1008   +38     

@@ -1064,7 +1064,9 @@ override :meth:`pytorch_lightning.core.LightningModule.tbptt_split_batch`:

Hooks
^^^^^
This is the pseudocode to describe how all the hooks are called during a call to ``.fit()``.
This is the pseudocode to describe the structure of :meth:`~pytorch_lightning.trainer.Trainer.fit`.
The inputs and outputs of each function are not represented for simplicity. Please check each function's API reference
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer keeping outputs here since its very helpful to distinguish some hooks (on_train_epoch_end vs training_epoch_end) and since inputs/outputs across hooks are closely related to the order of execution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it because I find it weird having the argument for training_step but not all the other functions that take a batch argument or an outputs argument.

So either I would add the batch argument for all functions or for none of them.

But adding it for all decreases the simplicity

Copy link
Contributor

Choose a reason for hiding this comment

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

that's fair. should we have a separate section to discuss how data is passed across hooks (not for this PR)?
it can clarify #7723

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. If you have any ideas on how to clear it do not hesitate to send a patch or open an issue

@Borda Borda enabled auto-merge (squash) May 26, 2021 09:20
@Borda Borda added the ready PRs ready to be merged label May 26, 2021
@carmocca carmocca disabled auto-merge May 26, 2021 15:22
@@ -1064,7 +1064,9 @@ override :meth:`pytorch_lightning.core.LightningModule.tbptt_split_batch`:

Hooks
^^^^^
This is the pseudocode to describe how all the hooks are called during a call to ``.fit()``.
This is the pseudocode to describe the structure of :meth:`~pytorch_lightning.trainer.Trainer.fit`.
The inputs and outputs of each function are not represented for simplicity. Please check each function's API reference
Copy link
Contributor

Choose a reason for hiding this comment

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

that's fair. should we have a separate section to discuss how data is passed across hooks (not for this PR)?
it can clarify #7723

@carmocca carmocca merged commit 906c067 into master May 27, 2021
@carmocca carmocca deleted the docs/hooks-pseudocode branch May 27, 2021 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants