Skip to content

Commit 065af98

Browse files
committed
delete folder if it exists
1 parent f5e5d27 commit 065af98

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

federated_learning.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import os
33
from pathlib import Path
4+
import shutil
45
from swiss_army_tensorboard import tfboard_loggers
56
import numpy as np
67

@@ -12,7 +13,9 @@
1213
os.environ["CUDA_VISIBLE_DEVICES"] = str(args.gpu)
1314

1415
EXPERIMENT_FOLDER_PATH = Path(__file__).resolve().parent / "experiments" / args.name
15-
EXPERIMENT_FOLDER_PATH.mkdir(parents=True, exist_ok=args.overwrite_experiment)
16+
if args.overwrite_experiment and EXPERIMENT_FOLDER_PATH.is_dir():
17+
shutil.rmtree(str(EXPERIMENT_FOLDER_PATH))
18+
EXPERIMENT_FOLDER_PATH.mkdir(parents=True, exist_ok=False)
1619

1720
args_json_path = EXPERIMENT_FOLDER_PATH / "args.json"
1821
fed_learn.save_args_as_json(args, EXPERIMENT_FOLDER_PATH / args_json_path)

0 commit comments

Comments
 (0)