Carmoondedraak / FACT-2021

MIT License
0 stars 1 forks source link

Adding torch settings to ensure replicability #5

Closed alfjesus3 closed 3 years ago

alfjesus3 commented 3 years ago

When training or testing add this to the top of the script:

import torch
import numpy

torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True

init_seed = 1 
torch.manual_seed(init_seed)
torch.cuda.manual_seed(init_seed) 
np.random.seed(init_seed)
...

This ensures reproducible results with the distributions and uses the same random generator configs