forked from facebookresearch/banmo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
42 lines (35 loc) · 936 Bytes
/
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
39
40
41
42
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
from absl import app
from absl import flags
import cv2
import os.path as osp
import sys
sys.path.insert(0,'third_party')
import pdb
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
cudnn.benchmark = True
from nnutils.train_utils import v2s_trainer
opts = flags.FLAGS
def main(_):
torch.cuda.set_device(opts.local_rank)
world_size = opts.ngpu
torch.distributed.init_process_group(
'nccl',
init_method='env://',
world_size=world_size,
rank=opts.local_rank,
)
print('%d/%d'%(world_size,opts.local_rank))
torch.manual_seed(0)
torch.cuda.manual_seed(1)
torch.manual_seed(0)
trainer = v2s_trainer(opts)
data_info = trainer.init_dataset()
trainer.define_model(data_info)
trainer.init_training()
trainer.train()
if __name__ == '__main__':
app.run(main)