Last active
December 10, 2021 19:00
-
-
Save xu-ji/e34182a00c20180ec233d16c1b430145 to your computer and use it in GitHub Desktop.
Setting seeds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run before you do anything else in the code, for each experiment | |
def set_seed(seed): | |
random.seed(0) | |
np.random.seed(0) | |
torch.manual_seed(seed) | |
torch.cuda.manual_seed(seed) | |
torch.backends.cudnn.deterministic = True | |
torch.backends.cudnn.benchmark = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment