Created
December 27, 2019 23:25
-
-
Save yaroslavvb/94c78e1d8a6fc45e70fc94b2ba1d4078 to your computer and use it in GitHub Desktop.
recipe for Determinism in PyTorch
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
import os, numpy as np, random, torch | |
np.random.seed(666) | |
random.seed(666) | |
torch.backends.cudnn.benchmark = False | |
torch.backends.cudnn.deterministic = True | |
torch.manual_seed(666) | |
torch.cuda.manual_seed_all(666+int(os.environ.get("RANK", "0"))) | |
torch.set_printoptions(precision=10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment