for epoch in range(5):
epoch_loss = 0.0
# set to train mode
teacher_model.train()
# train for all batches of data
for data in trainloader:
...
# set to evaluation mode
teacher_model.eval()
teacher_accuracy = evaluate(teacher_model)
# print performance metrics
print(f"""Epoch {epoch + 1},
Loss: {epoch_loss / len(testloader)},
Acc: {teacher_accuracy * 100:.2f}
""")
Epoch 1, Loss: 0.20, Acc: 98.79%
Epoch 2, Loss: 0.17, Acc: 98.91%
Epoch 3, Loss: 0.15, Acc: 98.78%
Epoch 4, Loss: 0.13, Acc: 98.89%
Epoch 5, Loss: 0.11, Acc: 98.63%