更新 'train_for_multidataset.py'

增加异常捕获
This commit is contained in:
liuzx 2022-12-06 10:20:36 +08:00
parent 9f94bbd1e4
commit 9d2408fd9a
1 changed files with 7 additions and 4 deletions

View File

@ -168,10 +168,13 @@ if __name__ == "__main__":
args, unknown = parser.parse_known_args()
data_dir = '/cache/data'
train_dir = '/cache/output'
if not os.path.exists(data_dir):
os.makedirs(data_dir)
if not os.path.exists(train_dir):
os.makedirs(train_dir)
try:
if not os.path.exists(data_dir):
os.makedirs(data_dir)
if not os.path.exists(train_dir):
os.makedirs(train_dir)
except Exception as e:
print("path already exists")
###Initialize and copy data to training image
DownloadFromQizhi(args.multi_data_url, data_dir)
###The dataset path is used here:data_dir + "/MNIST_Data" +"/train"