Hello! While reviewing the code in the 01.Train_Siamese_model.ipynb notebook, I've identified a potential bug that might arise during the process of creating the model checkpoint storage path.
The relevant code snippet in question is under the Training section:
if (not os.path.exists(params['checkpoints_path'])):
os.mkdir(params['checkpoints_path'])
In the associated config.yml file, the specified checkpoint path is set as:
checkpoints_path: 'checkpoints/Flowers' .
The current implementation does not handle the case where the complete path pointed by params['checkpoints_path'], including its parent directories, doesn't exist. In such scenarios, the above code would fail to create the multi-level directory structure.
To ensure that the target path is successfully created regardless of whether its parent directories exist or not, I propose modifying the code to:
if (not os.path.exists(params['checkpoints_path'])):
os.makedirs(params['checkpoints_path'], exist_ok=True)
The os.makedirs() function will take care of recursively creating any non-existent directories. Additionally, setting exist_ok=True ensures that no errors are raised if the directory already exists.
I hope this solution helps address the issue at hand. Thank you!
Hello! While reviewing the code in the 01.Train_Siamese_model.ipynb notebook, I've identified a potential bug that might arise during the process of creating the model checkpoint storage path.
The relevant code snippet in question is under the Training section:
In the associated config.yml file, the specified checkpoint path is set as:
checkpoints_path: 'checkpoints/Flowers'
.The current implementation does not handle the case where the complete path pointed by params['checkpoints_path'], including its parent directories, doesn't exist. In such scenarios, the above code would fail to create the multi-level directory structure.
To ensure that the target path is successfully created regardless of whether its parent directories exist or not, I propose modifying the code to:
The
os.makedirs()
function will take care of recursively creating any non-existent directories. Additionally, settingexist_ok=True
ensures that no errors are raised if the directory already exists.I hope this solution helps address the issue at hand. Thank you!