ATP-Latent-Master / utils.py
zz1358m's picture
Upload folder using huggingface_hub
7a92ec5 verified
# 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