Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Update _utils.py
Daniel Han3443a8503f03
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.pyindex 50dbe7cae6d..a63aaccc28a 100644--- a/unsloth/models/_utils.py+++ b/unsloth/models/_utils.py@@ -957,9 +957,13 @@ def _unsloth_get_batch_samples(self, epoch_iterator, num_batches):num_items_in_batch = None# Check if model allows **kwargs- model = self.model- f = model.base_model.model.forward if hasattr(model, "base_model") else model.forward- has_kwargs = tuple(inspect.signature(f).parameters.values())[-1].kind == inspect._VAR_KEYWORD+ m = self.model+ while hasattr(m, "model"):+ # Stop at last model entry+ if not hasattr(m, "model") or not hasattr(m, "forward"): break+ m = m.model+ signature = inspect.signature(m.forward).parameters.values()+ has_kwargs = tuple(signature)[-1].kind == inspect._VAR_KEYWORD# Iterate to find all batchesfor _ in range(num_batches):