Random_seed caution

I get this caution when I use random seed.

UserWarning: You have chosen to seed training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints.

What I want to do is to get some multiple outputs with the model I get after training with a random seed.
Plus I want to save the model first before I get multiple outputs.

  1. Should I use the same random seed when I get the outputs?
  2. If I should, then is this the only thing I should do?
  3. With the answers to the above questions, can I get the same outputs whenever I use the same input? (e.g. the outputs I get with the same input and the same model but multiple times)

By the way, I used the imagenet classifier example in pytorch github tutorial.

  1. If all runs should return the same output, you would have to use the same seed. A seed is usually used to get reproducible results.
  2. Using the script, it seems other deterministic options will also be enabled. Have a look at the Reproducibility docs for more information
  3. If you don’t use the mentioned non-deterministic ops (from the repro docs), you should get the same answers.
1 Like

It seems to work properly. Thanks a lot!!