-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Enable logger connector re-design #7891
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fa8121d
Integrate logger connector refactor with loops
carmocca de56277
mypy
carmocca e7a2e6d
Fix test
carmocca f38db7c
Refactor test
carmocca a9c5c4e
Deprecate `self.log(sync_dist_op)` in favor of `self.log(reduce_fx)`
carmocca ce9b089
Update CHANGELOG
carmocca f5ec8d4
Update CHANGELOG
carmocca 67da5fb
word repetition
awaelchli da135b8
Merge branch 'master' into refactor/use-new-logger-connector
carmocca 211e3b3
Access results directly
carmocca 91e8e0e
__to_float_tensor
carmocca 716e91a
Add comment
carmocca 3c2849d
Pass as kwarg for readability
carmocca e53f24a
Add comment
carmocca 4bd4be9
Add comment
carmocca b024729
__to_float_tensor -> __to_tensor
carmocca bab742e
Remove metric_attribute
carmocca ab28850
Mark as protected
carmocca 33ea492
Remove FIXME
carmocca cce4941
Update CHANGELOG.md
carmocca f09e726
mypy
carmocca d53fe03
Merge branch 'master' into refactor/use-new-logger-connector
carmocca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are the docs for batch size, is this what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but what I'm missing is why e.g. what is that parameter used for (inferred or otherwise)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To compute the correct average when we ask
self.log
to average the metric on epoch end.It has to be weighted by the batch size because often the last batch does not have the same size as the others.
The dataset is not guaranteed to be divisible by the batch size and the
drop_last
in the PyTorch DataLoader isFalse
by default.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the ResultMetric in result.py you will find the line:
self.cumulated_batch_size += batch_size
and the cumulated_batch_size is then used in the compute() method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok that's what I thought it was for but I couldn't find in the code where it's actually doing that.
So does this mean that my
_step
should log a scalar which is the mean of the current batch and PL will correctly average (including across DDP processes) by multiplying with the batch size, summing, then dividing by the dataset size?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, relevant code:
https://github.com/PyTorchLightning/pytorch-lightning/blob/cdcc483e9b7a79de3e5a7ac9c1e9dfd12ab77f4f/pytorch_lightning/trainer/connectors/logger_connector/result.py#L169-L197