From 75e4756a4ea8b2813f9afd80ed8252f1778dc58f Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 26 Dec 2024 17:11:22 -0800 Subject: [PATCH] Update _utils.py --- unsloth/models/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 4f1b40884a..e508c96b0e 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -1104,7 +1104,7 @@ def patch_gradient_accumulation_fix(Trainer): "else:\n"\ "\2if num_items_in_batch is None:\n"\ - "\3loss /= self.args.gradient_accumulation_steps\n"\ + "\3loss = loss / self.args.gradient_accumulation_steps\n"\ "\1self.accelerator.backward(loss, **kwargs)", function,