-
Notifications
You must be signed in to change notification settings - Fork 1
/
train.py
36 lines (28 loc) · 915 Bytes
/
train.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
# Copyright Niantic 2019. Patent Pending. All rights reserved.
#
# This software is licensed under the terms of the Monodepth2 licence
# which allows for non-commercial use only, the full terms of which are made
# available in the LICENSE file.
from __future__ import absolute_import, division, print_function
import torch
import random
import numpy as np
from trainer import Trainer
from options import ECDepthOptions
def seed_all(seed):
if not seed:
seed = 1
print("[ Using Seed : ", seed, " ]")
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.cuda.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
options = ECDepthOptions()
opts = options.parse()
seed_all(opts.pytorch_random_seed)
if __name__ == "__main__":
trainer = Trainer(opts)
trainer.train()