I am using seeds to control the reproducibility of my experiments; specifically, I am using:
np.random.seed(seed)
torch.manual_seed(seed)
random.seed(seed)
However, the results each round are not completely the same: the losses I get are almost the same (within 1e-4 precision) but not quite; the classification accuracies are also slightly off by about 1e-1 each time. For example:
Epoch 1 Batch 100/782, loss: 4.536677837371826
Epoch 1 Batch 200/782, loss: 4.429199695587158
Epoch 1 Batch 300/782, loss: 4.34957218170166
Epoch 1 Batch 400/782, loss: 4.270653247833252
Epoch 1 Batch 500/782, loss: 4.134552478790283
Epoch 1 Batch 600/782, loss: 4.002155303955078
Epoch 1 Batch 700/782, loss: 3.957610607147217
Start evaluating...
eval step: 0
eval step: 100
Finished running on val
After Epoch 1, top 1 val acc: 37.74
After Epoch 1, top 5 val acc: 68.59
In one round and:
Epoch 1 Batch 100/782, loss: 4.536672115325928
Epoch 1 Batch 200/782, loss: 4.4291839599609375
Epoch 1 Batch 300/782, loss: 4.3493218421936035
Epoch 1 Batch 400/782, loss: 4.270333290100098
Epoch 1 Batch 500/782, loss: 4.133965969085693
Epoch 1 Batch 600/782, loss: 4.00153112411499
Epoch 1 Batch 700/782, loss: 3.9571311473846436
Start evaluating...
eval step: 0
eval step: 100
Finished running on val
After Epoch 1, top 1 val acc: 37.9
After Epoch 1, top 5 val acc: 68.88
In the other. I’m simply fine-tuning a classification network on CIFAR100 which is very straightforward so I don’t think I’ve left any other bugs that could lead to this issue.
Is this possible to have slightly off results even after setting a fixed seed? Are those seeds that I used enough? Thanks!