From 926fb3d3eac4c1f62cc27c8fa64af6567ef36d27 Mon Sep 17 00:00:00 2001 From: harmon Date: Thu, 20 Jan 2022 23:08:02 +0800 Subject: [PATCH] [Fix]fix issue #6 --- pd_mesh_net/utils/base_training_job.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pd_mesh_net/utils/base_training_job.py b/pd_mesh_net/utils/base_training_job.py index 354e226..421634b 100644 --- a/pd_mesh_net/utils/base_training_job.py +++ b/pd_mesh_net/utils/base_training_job.py @@ -199,16 +199,6 @@ def __init__(self, except OSError: raise OSError("Error while trying to create folder " f"'{self.__log_folder}'. Exiting.") - # Create the checkpoint subfolder if nonexistent. - self.__checkpoint_subfolder = os.path.join(self.__log_folder, - self.__training_job_name, - 'checkpoints') - if (not os.path.exists(self.__checkpoint_subfolder)): - try: - os.makedirs(self.__checkpoint_subfolder) - except OSError: - raise OSError("Error while trying to create folder " - f"'{self.__checkpoint_subfolder}'. Exiting.") # If nonexistent, create the subfolder of the log folder associated with # the current training job. Otherwise, verify if a saved checkpoint can @@ -223,6 +213,17 @@ def __init__(self, raise OSError( "Error while trying to create the log subfolder " f"'{complete_path_logs_current_training_job}'. Exiting. ") + + # Create the checkpoint subfolder if nonexistent. + self.__checkpoint_subfolder = os.path.join(self.__log_folder, + self.__training_job_name, + 'checkpoints') + if (not os.path.exists(self.__checkpoint_subfolder)): + try: + os.makedirs(self.__checkpoint_subfolder) + except OSError: + raise OSError("Error while trying to create folder " + f"'{self.__checkpoint_subfolder}'. Exiting.") self.__continue_training_from_previous_checkpoint = False self.__found_job_folder = False else: