-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAutoTuning.py
33 lines (29 loc) · 1015 Bytes
/
AutoTuning.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
import os
import time
import yaml
from utils import parameter
from train import train
from U1652_test_and_evaluate import eval_and_test
def Auto_tune(drop_rate, learning_rate):
# for model in model_list:
# parameter("model", model)
for dr in drop_rate:
parameter("drop_rate", dr)
for lr in learning_rate:
parameter("lr", lr)
# for wd in weight_decay:
# parameter("weight_decay", wd)
with open("settings.yaml", "r", encoding="utf-8") as f:
setting_dict = yaml.load(f, Loader=yaml.FullLoader)
print(setting_dict)
f.close()
train()
try:
eval_and_test(384)
except:
print("error")
continue
learning_rate = [0.001, 0.002, 0.003, 0.005]
drop_rate = [0.3, 0.45]
# weight_decay = [0.0001, 0.0005, 0.001]
Auto_tune(drop_rate, learning_rate)