Skip to content

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.

Update tokenizer_utils.py

Daniel Hanafbad75e208f
diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py
index c35d990d009..e2ba5fab7e9 100644
--- a/unsloth/tokenizer_utils.py
+++ b/unsloth/tokenizer_utils.py
@@ -952,8 +952,9 @@ def patch_sft_trainer_tokenizer():
check_text = "\n".join(" "*where + x for x in check_text)
if replacer is None:
+ # .*? matches first match. .+? matches final match.
replacer = re.findall(
- f"def {function_name}\(.+?\).+?\:\n",
+ f"def {function_name}\(.*?\).*?\:\n",
function,
flags = re.MULTILINE | re.DOTALL,
)