import os
import random
import numpy as np
import torch
CFG = {
'IMG_SIZE':224,
'EPOCHS':5,
'LEARNING_RATE':3e-4,
'BATCH_SIZE':32,
'SEED':41
}
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
torch.backends.cudnn.benchmark = True
seed_everything(CFG['SEED'])
'Python > PyTorch' 카테고리의 다른 글
[PyTorch] LayerNorm (0) | 2024.05.01 |
---|---|
파이토치 GPU 설치 Windows (0) | 2024.03.16 |