Setting the random seed does not result in same outputs across runs #109
Description
When selecting a manual seed and initiating the same exact command twice using the same exact underlying data, the results are not consistent across runs. I would expect the same exact model outputs when setting the random seed; I see that here the random seed passed into the command appears to be set (https://github.com/facebookresearch/UnsupervisedMT/blob/main/NMT/src/utils.py#L68-L72). I have also tried adding additional methods to remove randomness (see below for my current attempt):
if params.seed >= 0:
np.random.seed(params.seed)
torch.manual_seed(params.seed)
torch.cuda.manual_seed(params.seed)
os.environ['PYTHONHASHSEED'] = str(params.seed)
torch.cuda.manual_seed_all(params.seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
random.seed(params.seed)
print('random seed set.')
Has anyone else been able to reproduce the EXACT same results when setting the same random seed? Any line that would be helpful to add in?
Any information would be appreciated. Thanks in advance.
Note: When generating the model run's dump_path I temporarily set Python's random library seed to None and then specify it again to be the hardcoded seed.