Goosang-Yu/genet

DeepPrime's output varying depending on the execution environment

Goosang-Yu opened this issue · 0 comments

When running DeepPrime on different servers, there is a problem where the decimal values of the predicted results differ. To address this, we need to add the initialization of a random seed to the init function.

import random
import torch
import numpy as np

# Set seed
seed = 0

# Setting
random.seed(seed)
np.random.seed(seed)
devicd = 'cuda' if torch.cuda.is_available() else 'cpu'
torch.manual_seed(seed)
if device == 'cuda':
    torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False