Setting the seed

In order to have reproducible pytorch models, what are all of the parts for which we would need to set a seed?

I suspect the list at minimum should include random, np.random, torch.manual_seed, and torch.cuda.manual_seed. What else?

torch.manual_seed should already seed the GPU so you won’t need torch.cuda.manual_seed.
Have a look at the reproducibility docs for more information.

Even if you’re using multiple GPUs i.e. torch.cuda.manual_seed_all ?

Yes, it should seed all devices. Line of code

1 Like