Skip to content

Commit

Permalink
removed auto val reduce (#2462)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamFalcon committed Jul 2, 2020
1 parent 1a40963 commit afdfba1
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions pytorch_lightning/trainer/evaluation_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,6 @@ def _evaluate(
elif self.is_overridden('validation_epoch_end', model=model):
eval_results = model.validation_epoch_end(outputs)

# aggregate ddp stats across
has_content = eval_results is not None and len(eval_results) > 0
if has_content and (self.use_ddp or self.use_ddp2):
self.reduce_eval_ddp(eval_results)

# enable train mode again
model.train()

Expand All @@ -354,19 +349,6 @@ def _evaluate(

return eval_results

def reduce_eval_ddp(self, eval_results):
# ignore bad inputs
if eval_results is None or len(eval_results) == 0:
return

for k, v in eval_results.items():
if isinstance(v, dict):
self.reduce_eval_ddp(v)
elif isinstance(v, torch.Tensor):
dist.all_reduce(v, op=dist.reduce_op.SUM)
v = v / self.world_size
eval_results[k] = v

def run_evaluation(self, test_mode: bool = False):
# hook
model = self.get_model()
Expand Down

0 comments on commit afdfba1

Please sign in to comment.