Skip to content

Commit

Permalink
[Fix] Remove besk ckpt only in master rank (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
HAOCHENYE committed Nov 8, 2022
1 parent 103ad60 commit 0f62a6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mmengine/hooks/checkpoint_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,9 @@ def _save_best_checkpoint(self, runner, metrics) -> None:
best_score = key_score
runner.message_hub.update_info(best_score_key, best_score)

if best_ckpt_path and self.file_client.isfile(best_ckpt_path):
if best_ckpt_path and \
self.file_client.isfile(best_ckpt_path) and \
is_main_process():
self.file_client.remove(best_ckpt_path)
runner.logger.info(
f'The previous best checkpoint {best_ckpt_path} '
Expand Down

0 comments on commit 0f62a6c

Please sign in to comment.