Skip to content

Instantly share code, notes, and snippets.

@KirillVladimirov
Created December 8, 2019 11:32
Show Gist options
  • Save KirillVladimirov/005ec7f762293d2321385580d3dbe335 to your computer and use it in GitHub Desktop.
Save KirillVladimirov/005ec7f762293d2321385580d3dbe335 to your computer and use it in GitHub Desktop.
def seed_everything(seed=1234):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
seed_everything()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment