From 55967af47d2a3d3a4cb35f061e979233b3882b96 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 11 Feb 2025 01:14:06 -0800 Subject: [PATCH] Update tokenizer_utils.py --- unsloth/tokenizer_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index c35d990d00..e2ba5fab7e 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, )