Checkpointer should check in case user deleted a serialized model
If the user deletes an old checkpoint file, the checkpointer will crash when it also tries to delete it. This fix should prevent that.
@@ -66,6 +66,7 @@ class Checkpointer(Registrable):
self._last_permanent_saved_checkpoint_time = save_time
if remove_path:
for fname in paths_to_remove[1:]:
+ if os.path.isfile(fname):
os.remove(fname)
def find_latest_checkpoint(self) -> Tuple[str, str]:
