Commit 567a9a80 authored by Kai Zhang's avatar Kai Zhang Committed by Facebook GitHub Bot
Browse files

only log evaluation metric on rank 0

Summary: All metrics should have been reduced on rank 0 by dataset evaluator.

Reviewed By: wat3rBro

Differential Revision: D30389938

fbshipit-source-id: f8dfb6f1f17635c2fb98391780fdefe90c630054
parent aea87f6c
......@@ -204,7 +204,10 @@ class DefaultTask(pl.LightningModule):
self.eval_res = nested_res
flattened = pl.loggers.LightningLoggerBase._flatten_dict(nested_res)
self.log_dict(flattened)
if self.trainer.global_rank:
assert len(flattened) == 0, "evaluation results should have been reduced on rank 0."
self.log_dict(flattened, rank_zero_only=True)
def test_epoch_end(self, _outputs) -> None:
self._evaluation_epoch_end()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment