What is training seed for dnn training? and how to use training seed?

Can anybody tell me what is training seed for dnn training and how to use it with pytorch?
additionally, before I load a checkpoint and test my model in the evaluation mode, should I remove all the dropout layers in the dnn architecture?

A random seed is set only when you want reproducible results. For instance, if you’re running an experiment and want to have the same starting parameters, you’d set the seed. Otherwise, leave it alone.

After you’ve trained a model, to turn off dropout and batchnorm layers, use:

model.eval()

You will also want to turn off gradient descent:

with torch.no_grad():
    model.eval()
    output = model(data)
    ...

To change it back to training, use:

model.train()
1 Like