-
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
added reduce ddp results on eval #2434
Conversation
069a8a3
to
63648b8
Compare
Hello @williamFalcon! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-06-30 19:19:32 UTC |
@@ -347,6 +354,22 @@ def _evaluate( | |||
|
|||
return eval_results | |||
|
|||
def reduce_eval_ddp(self, eval_results): |
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 traversal of nested types looks like what @justusschock did in metrics. maybe one could re-use his apply_to_collection
from utilitiles.apply_func.py
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.
good point @justusschock how would i adapt that here?
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.
Quick brain-compiled code:
eval_results = apply_to_collection(
eval_results,
dtype=torch.Tensor,
function=reduce_eval_ddp,
world_size=self.world_size
)
with reduce_eval_ddp
defined as
def reduce_eval_ddp(v, world_size):
dist.all_reduce(v, op=dist.reduce_op.SUM)
v = v / world_size
return v
Codecov Report
@@ Coverage Diff @@
## master #2434 +/- ##
======================================
- Coverage 89% 88% -0%
======================================
Files 69 69
Lines 5485 5499 +14
======================================
+ Hits 4858 4862 +4
- Misses 627 637 +10 |
Enhancement: aggregates ddp outputs on eval
Fixes #702