-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
106 lines (79 loc) · 3.28 KB
/
run.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from cfgs.base_cfgs import Cfgs
from train.execution import Execution
import argparse
def parse_args():
'''
Parse input arguments
'''
parser = argparse.ArgumentParser(description='RWSAN Args')
parser.add_argument('--RUN', dest='RUN_MODE',
choices=['train', 'val', 'test'],
help='{train, val, test}',
type=str, required=True)
parser.add_argument('--SPLIT', dest='TRAIN_SPLIT',
choices=['train', 'train+val', 'train+val+vg'],
help="set training split, "
"eg.'train', 'train+val+vg'"
"set 'train' can trigger the "
"eval after every epoch",
type=str)
parser.add_argument('--EVAL_EE', dest='EVAL_EVERY_EPOCH',
help='set True to evaluate the '
'val split when an epoch finished'
"(only work when train with "
"'train' split)",
type=bool)
parser.add_argument('--SAVE_PRED', dest='TEST_SAVE_PRED',
help='set True to save the '
'prediction vectors'
'(only work in testing)',
type=bool)
parser.add_argument('--GPU', dest='GPU',
help="gpu select, eg.'0, 1, 2'",
type=str)
parser.add_argument('--VERSION', dest='VERSION',
help='version control',
type=str)
parser.add_argument('--RESUME', dest='RESUME',
help='resume training',
type=bool)
parser.add_argument('--CKPT_V', dest='CKPT_VERSION',
help='checkpoint version',
type=str)
parser.add_argument('--CKPT_E', dest='CKPT_EPOCH',
help='checkpoint epoch',
type=int)
parser.add_argument('--CKPT_PATH', dest='CKPT_PATH',
help='load checkpoint path, we '
'recommend that you use '
'CKPT_VERSION and CKPT_EPOCH '
'instead',
type=str)
parser.add_argument('--ACCU', dest='GRAD_ACCU_STEPS',
help='reduce gpu memory usage',
type=int)
parser.add_argument('--NW', dest='NUM_WORKERS',
help='multithreaded loading',
type=int)
parser.add_argument('--VERB', dest='VERBOSE',
help='verbose print',
type=bool)
parser.add_argument('--DATA_PATH', dest='DATASET_PATH',
help='vqav2 dataset root path',
type=str)
parser.add_argument('--FEAT_PATH', dest='FEATURE_PATH',
help='bottom up features root path',
type=str)
args = parser.parse_args()
return args
if __name__ == '__main__':
__C = Cfgs()
args = parse_args()
args_dict = __C.parse_to_dict(args)
__C.add_args(args_dict)
__C.proc()
print('Hyper Parameters:')
print(__C)
__C.check_path()
execution = Execution(__C)
execution.run(__C.RUN_MODE)