import sys, os sys.path.insert(0, os.path.dirname(__file__)) import torch import random import numpy as np from config import * from tqdm import tqdm def seed_everything(seed=42): random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) # Multiple GPUs torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False os.environ["PYTHONHASHSEED"] = str(seed) # print(torch.cuda.is_available()) # True # print(torch.cuda.device_count()) # 1 # print(torch.cuda.get_device_name(0)) # NVIDIA GeForce RTX 3050 Laptop GPU