Fix global_step when gradient accumulation > 1 (#832)

This commit is contained in:
Peter Izsak
2020-02-15 23:48:19 -05:00
committed by GitHub
parent 4ae31cd1d5
commit 27bba1a03a
+3 -1
View File
@@ -426,7 +426,9 @@ class TrainerTrainLoopMixin(ABC):
# logs user requested information to logger
self.log_metrics(batch_step_metrics, grad_norm_dic)
self.global_step += 1
# progress global step according to grads progress
if (self.batch_idx + 1) % self.accumulate_grad_batches == 0:
self.global_step += 1
self.total_batch_idx += 1
# end epoch early