Skip to content

Commit

Permalink
Update trainer for easier handling of accumulate, compile fixes, and …
Browse files Browse the repository at this point in the history
…proper reporting (huggingface#34511)

* Update trainer for easier handling of accumulate + proper reporting

* test

* Fixup tests

* Full fix

* Fix style

* rm comment

* Fix tests

* Minimize test + remove py 311 check

* Unused import

* Forward contrib credits from discussions

* Fix reported metrics

* Refactor, good as it's going to get

* rm pad tok id check

* object detection and audio are being annoying

* Fin

* Fin x2

---------

Co-authored-by: Gyanateet Dutta <[email protected]>
  • Loading branch information
2 people authored and github-actions[bot] committed Nov 26, 2024
1 parent 3200345 commit 53a42f9
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3691,7 +3691,6 @@ def training_step(
with amp.scale_loss(loss, self.optimizer) as scaled_loss:
scaled_loss.backward()
else:
loss *= self.args.gradient_accumulation_steps
self.accelerator.backward(loss, **kwargs)
# Finally we need to normalize the loss for reporting
if num_items_in_batch is None:
Expand Down

0 comments on commit 53a42f9

Please sign in to comment.