-
Notifications
You must be signed in to change notification settings - Fork 1
/
grid_search.py
67 lines (57 loc) · 1.65 KB
/
grid_search.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
import sys
import numpy as np
device = int(sys.argv[1])
step1 = 0.05
step2 = 0.05
if device== 0:
beta1_list_start = 0.00
beta1_list_end = 0.125
beta2_list_start = 0.5
beta2_list_end = 1.025
elif device== 1:
beta1_list_start = 0.125
beta1_list_end = 0.25
beta2_list_start = 0.5
beta2_list_end = 1.025
elif device== 2:
beta1_list_start = 0.25
beta1_list_end = 0.375
beta2_list_start = 0.5
beta2_list_end = 1.025
elif device== 3:
beta1_list_start = 0.375
beta1_list_end = 0.5
beta2_list_start = 0.5
beta2_list_end = 1.025
elif device== 4:
beta1_list_start = 0.5
beta1_list_end = 0.625
beta2_list_start = 0.5
beta2_list_end = 1.025
elif device== 5:
beta1_list_start = 0.625
beta1_list_end = 0.75
beta2_list_start = 0.5
beta2_list_end = 1.025
elif device== 6:
beta1_list_start = 0.75
beta1_list_end = 0.875
beta2_list_start = 0.5 ##########
beta2_list_end = 1.025
elif device== 7:
beta1_list_start = 0.875
beta1_list_end = 1.05
beta2_list_start = 0.5 ##############
beta2_list_end = 1.025
beta1_list = np.arange(beta1_list_start,beta1_list_end,step1)
beta2_list = np.arange(beta2_list_start,beta2_list_end,step2)
beta1_list = np.clip(beta1_list,0.01,0.99)
beta2_list = np.clip(beta2_list,0.01,0.99)
print(beta1_list)
print(beta2_list)
for i in beta1_list:
for j in beta2_list:
command = "python train.py config/train_shakespeare_char.py " + "--beta1=" + str(i) + " --beta2=" + str(j) + " --device=cuda:" + str(device) + " --dtype='float32'" + " --hyperadam=False" + " --adam=False"
print(command)
os.system(command)