Skip to content

Commit

Permalink
[Fix]: Fix pytorch-lightning compatibility. (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
RangiLyu authored Aug 22, 2021
1 parent f3ba459 commit bd1fa26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nanodet/trainer/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ def test_epoch_end(self, test_step_outputs):
results = {}
for res in test_step_outputs:
results.update(res)
all_results = gather_results(results) if self.trainer.use_ddp else results
all_results = (
gather_results(results)
if dist.is_available() and dist.is_initialized()
else results
)
if all_results:
res_json = self.evaluator.results2json(all_results)
json_path = os.path.join(self.cfg.save_dir, "results.json")
Expand Down

0 comments on commit bd1fa26

Please sign in to comment.