update schedular after each epoch

This commit is contained in:
Dr. Kashif Rasul
2021-01-03 21:21:44 +01:00
parent 827b496240
commit a025fa77d7
+2 -1
View File
@@ -91,9 +91,10 @@ class Trainer:
loss.backward()
nn.utils.clip_grad_norm_(net.parameters(), self.clip_gradient)
lr_scheduler.step(loss)
optimizer.step()
if self.num_batches_per_epoch == batch_no:
lr_scheduler.step(avg_epoch_loss / batch_no)
break
# mark epoch end time and log time cost of current epoch