Spaces:
Running
on
T4
Running
on
T4
import torch | |
import random | |
import numpy as np | |
def set_seed(seed): | |
"""Sets seed""" | |
if torch.cuda.is_available(): | |
torch.cuda.manual_seed(seed) | |
torch.manual_seed(seed) | |
random.seed(seed) | |
np.random.seed(seed) | |
torch.backends.cudnn.benchmark = False | |
torch.backends.cudnn.deterministic = True |