From 8835cec3a02aa353fc9598534da028b6911a8db8 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 6 Mar 2025 03:22:10 -0800 Subject: [PATCH] Update _utils.py --- unsloth/models/_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 4803b5485e..7ac35d71b4 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -1052,8 +1052,7 @@ def _unsloth_pre_compute_loss(self, model, inputs, *args, **kwargs): # Get gradient accumulation steps if possible if num_items_in_batch is None and \ - getattr(self, "args", {}).get("gradient_accumulation_steps", 1) != 1: - + getattr(getattr(self, "args", self), "gradient_accumulation_steps", 1) != 1: name = (model.base_model.model if hasattr(model, "base_model") else model).__class__.__name__ logger.warning_once( f"Unsloth: Not an error, but {name} does not accept `num_items_in_batch`.\n"\