Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,6 @@ def _inner_training_loop(
if args.eval_on_start:
self._evaluate(trial, ignore_keys_for_eval, skip_scheduler=True)

total_batched_samples = 0
for epoch in range(epochs_trained, num_train_epochs):
epoch_iterator = train_dataloader
if hasattr(epoch_iterator, "set_epoch"):
Expand Down Expand Up @@ -2312,8 +2311,6 @@ def _inner_training_loop(

step = -1
for step, inputs in enumerate(epoch_iterator):
total_batched_samples += 1

if self.args.include_num_input_tokens_seen:
main_input_name = getattr(self.model, "main_input_name", "input_ids")
if main_input_name not in inputs:
Expand Down Expand Up @@ -2377,7 +2374,7 @@ def _inner_training_loop(
)

if (
total_batched_samples % args.gradient_accumulation_steps == 0
(step + 1) % args.gradient_accumulation_steps == 0
or
# last step in epoch but step is always smaller than gradient_accumulation_steps
is_last_step_and_steps_less_than_grad_acc
Expand Down