File size: 508 Bytes
8f46582 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
import random, torch, os
import numpy as np
class Config:
# to access a dict with object.key
def __init__(self, dictionary):
self.__dict__ = dictionary
def set_seed(seed_value):
random.seed(seed_value)
np.random.seed(seed_value)
torch.manual_seed(seed_value)
os.environ["PYTHONHASHSEED"] = str(seed_value)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
|