Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Fix error when saving best checkpoint in ddp-training. #682

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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