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.
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
[feat] Add sync_context and sync to nn.Metric #302
[feat] Add sync_context and sync to nn.Metric #302
Changes from 45 commits
80575de
904ecec
71ca9be
e4d99d8
94d3450
bfcbc74
41a60e7
b0498b4
94fab1b
31498ef
31563dc
7d24123
15e6d9a
b3d5ec5
d4367db
fc42bbe
0dcb041
980329d
3b4e838
140aeeb
1cf6a44
3ab11cd
ca04cfb
f2ae287
45b1b1f
8aa2a74
0f2ed93
de32cbf
25bfbf3
7222aa3
6dd7705
da215ad
dc8e699
fe456f2
303e829
586ae75
a460801
409e20a
71fad52
b7e2030
e72de7d
11a3ab8
d9c0a53
f37e77f
6e7e3a8
7ee31d0
99d99e1
0df9659
9872ddd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
this check is not safe. we're seeing errors as a result.
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.
Removed in #311
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.
I'm confused to see
should_sync=True|False
.If you set False, this method does nothing, so it's the same as not calling sync in the first place!
Then, if you set True but dist is not available, it will do nothing so basically it does not what the user wants.
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.
should_sync
means should_sync if possible :) Modified the docstring to reflect this.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.
It means now that there are two arguments overlapping:
dist_sync_fn
andshould_sync
You can do this:
should_sync=False
anddist_sync_fn=mean
what willl happen now? will it sync or not?
@PyTorchLightning/core-metrics be aware of these cases
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, I agree. I wonder if the main usage of
should_sync
is just insync_context
and maybe we should just decide there if syncing is needed or not? Doing anif
with context manager is a bit harder and might justify a flag, but for a function, it should be easy for people to just avoid calling it?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.
@maximsch2 your argument is to keep the flag for the context manager but remove it from this function, correct?
I think that would be fine.
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.
n00b question: why does distributed available need to be an argument?
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.
Because
torchmetrics
does not know about any distributed platforms other than CUDAFor example TPU, IPUs...
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.
What's the use case for this? If we sync, we should assume all metrics are operating off the synced state and not accumulate local changes, right?
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.
This was here already, just moved.
Added in dd1e744
cc: @SkafteNicki