Skip to content

Commit

Permalink
🐛 Fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
arxyzan committed Jun 3, 2024
1 parent cfec53c commit a5652ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hezar/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,10 @@ def inner_training_loop(self, epoch_num: int):

# Gather outputs for metrics
losses_sum += outputs["loss"].item()
if self.state.epoch_step % self.config.gradient_accumulation_steps == 0:
if (
self.state.epoch_step % self.config.gradient_accumulation_steps == 0
or self.state.epoch_step == self.steps_in_epoch
):
avg_loss = losses_sum * self.config.gradient_accumulation_steps / self.state.epoch_step
iterator.set_postfix(loss=avg_loss)

Expand Down

0 comments on commit a5652ef

Please sign in to comment.