-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
34 lines (29 loc) · 996 Bytes
/
config.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
import os
from custom_pytorch.custom_config import Config
import random
import torch
import numpy as np
CONFIG = Config(train_size=2000,
train_selection='hi_weight',
train_replacement=True,
valid_size=500, # by random selection, will not participate at all in training
batch_size=4,
valid_batch_size=6,
random_seed=42,
lr=1e-2,
momentum=0.9,
restart_period=50,
weight_decay=0.01,
im_size=256,
warm_start_from='',
identifier='SE_Xception_XUnet',
net_params={'resolution': 3, 'depth': 3}
)
def seed_everything(seed):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
seed_everything(CONFIG.random_seed)