-
Notifications
You must be signed in to change notification settings - Fork 1
/
hyperparameter_supertraining.py
36 lines (29 loc) · 1.5 KB
/
hyperparameter_supertraining.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Hyperparameter supertraining script
# This script will run the specified hyperparameter training scripts in sequence, in order to be able to run everything everywhere all at once.
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--dataroot', required=True, help='path to images (should have subfolders trainA, trainB, valA, valB, etc)')
parser.add_argument('--n_epochs', type=int, default=25, help='number of epochs with the initial learning rate')
parser.add_argument('--n_epochs_decay', type=int, default=15, help='number of epochs to linearly decay learning rate to zero')
parser.add_argument('--num_test', type=int, default=50, help='number of test images')
args = parser.parse_args()
dataroot = args.dataroot
n_epochs = args.n_epochs
n_epochs_decay = args.n_epochs_decay
num_test = args.num_test
scripts = [
# "hyperparameter_DropoutRate.py",
"hyperparameter_netD.py"
"hyperparameter_netG.py",
"hyperparameter_GAN.py",
"hyperparameter_ngf_ndf.py"
]
for script in scripts:
print("Running hyperparameter script:", script)
subprocess.call(f"python {script} --dataroot {dataroot} --n_epochs {n_epochs} --n_epochs_decay {n_epochs_decay} --num_test {num_test}", shell=True)
# Loop for creating the output plots
for script in scripts:
results_subpath = script.replace(".py", "")
print("Evaluating hyperparameter script:", script)
subprocess.call(f"python evaluate_hyperparameter.py --results_path results/hyperparameters/{results_subpath}", shell=True)