Skip to content

Commit

Permalink
Merge pull request #1286 from bghira/bugfix/divide-by-zero-calculation
Browse files Browse the repository at this point in the history
fix divide by zero when reducing dataloader length
  • Loading branch information
bghira authored Jan 20, 2025
2 parents 79e2ced + 4196d89 commit fc0ff86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helpers/training/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ def _recalculate_training_steps(self):
"You must specify either --max_train_steps or --num_train_epochs with a value > 0"
)
self.config.num_train_epochs = math.ceil(
self.config.max_train_steps / self.config.num_update_steps_per_epoch
self.config.max_train_steps / max(self.config.num_update_steps_per_epoch, 1)
)
logger.info(
f"Calculated our maximum training steps at {self.config.max_train_steps} because we have"
Expand Down

0 comments on commit fc0ff86

Please sign in to comment.