-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_dense_batch.py
31 lines (26 loc) · 1.02 KB
/
run_dense_batch.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
import argparse
import torch
from unsup3d import setup_runtime, Trainer, Unsup3D
import itertools
## runtime arguments
parser = argparse.ArgumentParser(description='Training configurations.')
parser.add_argument('--config', default=None, type=str, help='Specify a config file path')
parser.add_argument('--gpu', default=None, type=int, 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')
parser.add_argument('--order_ind', type=int, help='')
args = parser.parse_args()
## set up
cfgs = setup_runtime(args)
all_perms = list(itertools.permutations(range(4)))
dense_order = all_perms[args.order_ind]
## set up
cfgs = setup_runtime(args)
trainer = Trainer(cfgs, Unsup3D, dense_order=dense_order, seed=args.seed)
run_train = cfgs.get('run_train', False)
run_test = cfgs.get('run_test', False)
## run
if run_train:
trainer.train()
if run_test:
trainer.test()