mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-11 12:31:23 +08:00
Avoid race condition in creating checkpoint directories (#530)
* Avoid race condition in creating checkpoint directories In multi-GPU training, several processes run the code that creates checkpoint dirs. This fix avoids a probably rare situation (but it happened to me) where another process created a dir between the `exists` check and the `makedirs` call. * Remove the now unneeded check for dir existence
This commit is contained in:
committed by
William Falcon
parent
c1ecca418e
commit
539d7bcb44
@@ -198,8 +198,7 @@ class ModelCheckpoint(Callback):
|
||||
self.monitor = monitor
|
||||
self.verbose = verbose
|
||||
self.filepath = filepath
|
||||
if not os.path.exists(filepath):
|
||||
os.makedirs(filepath)
|
||||
os.makedirs(filepath, exist_ok=True)
|
||||
self.save_top_k = save_top_k
|
||||
self.save_weights_only = save_weights_only
|
||||
self.period = period
|
||||
|
||||
Reference in New Issue
Block a user