Skip to content

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

@Goosang-Yu

Description

@Goosang-Yu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions