You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
torch.manual_seed(seed) # sets the seed for generating random numbers.torch.cuda.manual_seed(seed) # Sets the seed for generating random numbers for the current GPU. It’s safe to call this function if CUDA is not available; in that case, it is silently ignored.torch.cuda.manual_seed_all(seed) # Sets the seed for generating random numbers on all GPUs. It’s safe to call this function if CUDA is not available; in that case, it is silently ignored.torch.backends.cudnn.deterministic=Truetorch.backends.cudnn.benchmark=False
The text was updated successfully, but these errors were encountered:
相关的官方教程:https://pytorch-lightning.readthedocs.io/en/latest/common/trainer.html#reproducibility
Pytorch-Lightning Reproducibility
如果需要保证结果的完全复现,需要以下两个条件
deterministic
设置为TruePytorch Reproducibility
固定随机种子为什么需要设置deterministic?
torch.backends.cudnn.deterministic
如果设置为True的话,意味着每次返回的卷积算法都将是确定的。torch.backends.cudnn.benchmark
如果设置为True的话,意味着在程序启动阶段,会额外花费时间,为整个网络的每个卷积层搜索最合适实现的卷积算法,进而实现网络的加速所以在pytorch中如果需要设置需要进行以下设置:
The text was updated successfully, but these errors were encountered: