Unverified Commit 582d104b authored by Zach Mueller's avatar Zach Mueller Committed by GitHub
Browse files

Fix windows err with checkpoint race conditions (#28637)

Fix windows err
parent c475eca9
...@@ -2415,9 +2415,11 @@ class Trainer: ...@@ -2415,9 +2415,11 @@ class Trainer:
os.rename(staging_output_dir, output_dir) os.rename(staging_output_dir, output_dir)
# Ensure rename completed in cases where os.rename is not atomic # Ensure rename completed in cases where os.rename is not atomic
fd = os.open(output_dir, os.O_RDONLY) # And can only happen on non-windows based systems
os.fsync(fd) if os.name != "nt":
os.close(fd) fd = os.open(output_dir, os.O_RDONLY)
os.fsync(fd)
os.close(fd)
# Maybe delete some older checkpoints. # Maybe delete some older checkpoints.
if self.args.should_save: if self.args.should_save:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment