-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (33 loc) · 1.04 KB
/
main.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
#
#
#
import sys, getopt
from experiments_helper import run_exp
COMMAND_HELP_STR = 'main.py \n-e <num_experiments [default=1]> \n-m <model_name [vgg11, vgg16, lenet, alexnet]> \n-c <epochs [default=1]>'
def main(argv):
num_experiments = '1' # default
model_name = 'NONE'
epochs = '1' # default
try:
opts, args = getopt.getopt(argv, "he:m:c:", ["experiments=", "model=", "epoch="])
except getopt.GetoptError:
print COMMAND_HELP_STR
sys.exit(2)
if (opts == []):
print COMMAND_HELP_STR
sys.exit()
for opt, arg in opts:
if opt == '-h':
print COMMAND_HELP_STR
sys.exit()
elif opt in ("-e", "--experiments"):
num_experiments = arg
elif opt in ("-m", "--model"):
model_name = arg
elif opt in ("-c", "--epoch"):
epochs = arg
#run experiment
# nohup python main.py -c 50 -e 3 -m alexnet > ~/exec1.log &
run_exp(model_name,epochs,num_experiments)
if __name__ == "__main__":
main(sys.argv[1:])