-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
22 lines (19 loc) · 860 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import configargparse
from video3d import setup_runtime, Trainer, Video3D
# runtime arguments
parser = configargparse.ArgumentParser(description='Training configurations.')
parser.add_argument('-c', '--config', default="config/train_multi_seq_dev.yml", type=str, is_config_file=True, help='Specify a config file path')
parser.add_argument('--gpu', default='0', type=str, help='Specify a GPU device')
parser.add_argument('--num_workers', default=4, type=int, help='Specify the number of worker threads for data loaders')
parser.add_argument('--seed', default=0, type=int, help='Specify a random seed')
args, _ = parser.parse_known_args()
# set up
cfgs = setup_runtime(args)
trainer = Trainer(cfgs, Video3D)
run_train = cfgs.get('run_train', True)
run_test = cfgs.get('run_test', False)
# run
if run_train:
trainer.train()
if run_test:
trainer.test()