-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathrun_experiments.py
33 lines (25 loc) · 1.61 KB
/
run_experiments.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
# coding=utf-8
from utils.script_functions import set_parameter
from os import system
if __name__ == "__main__":
parameters_filepath = "parameters.ini"
# Keep as all 5
train_methods = ['natural', 'rfgsm_k', 'dfgsm_k', 'bga_k', 'bca_k', 'grosse']
evasion_methods = ['natural', 'rfgsm_k', 'dfgsm_k', 'bga_k', 'bca_k', 'grosse']
for train_method in train_methods:
set_parameter(parameters_filepath, "general", "train_model_from_scratch", "True")
set_parameter(parameters_filepath, "general", "load_model_weights", "False")
set_parameter(parameters_filepath, "general", "experiment_suffix", "run_experiments")
set_parameter(parameters_filepath, "general", "training_method", train_method)
set_parameter(parameters_filepath, "general", "evasion_method", train_method)
system("source activate nn_mal;python framework.py")
for train_method in train_methods:
model_filepath = "./helper_files/[training:{train_meth}|evasion:{train_meth}]_run_experiments-model.pt".format(
train_meth=train_method)
set_parameter(parameters_filepath, "general", "training_method", train_method)
set_parameter(parameters_filepath, "general", "train_model_from_scratch", "False")
set_parameter(parameters_filepath, "general", "load_model_weights", "True")
set_parameter(parameters_filepath, "general", "model_weights_path", model_filepath)
for evasion_method in evasion_methods:
set_parameter(parameters_filepath, "general", "evasion_method", evasion_method)
system("source activate nn_mal;python framework.py")