Skip to content

Commit bd1fa26

Browse files
authored
[Fix]: Fix pytorch-lightning compatibility. (#309)
1 parent f3ba459 commit bd1fa26

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nanodet/trainer/task.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ def test_epoch_end(self, test_step_outputs):
217217
results = {}
218218
for res in test_step_outputs:
219219
results.update(res)
220-
all_results = gather_results(results) if self.trainer.use_ddp else results
220+
all_results = (
221+
gather_results(results)
222+
if dist.is_available() and dist.is_initialized()
223+
else results
224+
)
221225
if all_results:
222226
res_json = self.evaluator.results2json(all_results)
223227
json_path = os.path.join(self.cfg.save_dir, "results.json")

0 commit comments

Comments
 (0)