-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.py
More file actions
34 lines (27 loc) · 803 Bytes
/
train.py
File metadata and controls
34 lines (27 loc) · 803 Bytes
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
import numpy as np
import torch
from src.dataset import MyDataset
from src.net import Network
from src.trainer import Trainer
from src.utils import debugger_is_active
if __name__ == '__main__':
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
if debugger_is_active():
import random
seed = 33
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
# torch.use_deterministic_algorithms(True)
wandb_project = None # avoid logging run
torch.autograd.set_detect_anomaly(True)
else:
seed = None
# wandb_project = 'PROJECT-NAME'
Trainer(
Network(),
MyDataset(),
wandb_project=wandb_project,
random_seed=seed,
device=device,
).run()