latent_backtrack / utils.py
Avra98's picture
Add training code (same as GitHub reasoning-by-superposition-latent)
8f46582 verified
Raw
History Blame Contribute Delete
508 Bytes
# 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