Goosang-Yu / genet

Python library for genome editing, CRISPR gRNA design and prediction
14 stars 5 forks source link

DeepPrime's output varying depending on the execution environment #94

Open Goosang-Yu opened 6 months ago

Goosang-Yu commented 6 months ago

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