From 53a42f9bac49ccedbc384dc050f810481badd7a2 Mon Sep 17 00:00:00 2001 From: Zach Mueller Date: Mon, 4 Nov 2024 07:47:34 -0500 Subject: [PATCH] Update trainer for easier handling of accumulate, compile fixes, and proper reporting (#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 --- src/transformers/trainer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index 2055cc22f951c2..097c54a9862773 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -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: