Skip to content

Instantly share code, notes, and snippets.

@umitkacar
Last active March 27, 2022 15:11
Show Gist options
  • Save umitkacar/bb81aad6b1ae0509304f54d9065ea8f1 to your computer and use it in GitHub Desktop.
Save umitkacar/bb81aad6b1ae0509304f54d9065ea8f1 to your computer and use it in GitHub Desktop.
dataset, val_set = torch.utils.data.random_split(dataset,[int(len(dataset) * 0.85),
len(dataset) - int(len(dataset) * 0.85)])
config.manual_seed = 33
print("Random Seed: ", config.manual_seed)
random.seed(config.manual_seed)
torch.manual_seed(config.manual_seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(config.manual_seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment