-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrain.py
34 lines (27 loc) · 852 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
# Copyright Niantic 2021. Patent Pending. All rights reserved.
#
# This software is licensed under the terms of the ManyDepth licence
# which allows for non-commercial use only, the full terms of which are made
# available in the LICENSE file.
import torch
import random
import numpy as np
from trainer import Trainer
from options import MonodepthOptions
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 = True
options = MonodepthOptions()
opts = options.parse()
seed_all(opts.pytorch_random_seed)
if __name__ == "__main__":
trainer = Trainer(opts)
trainer.train()