From 4857e5851dbbcb65c1a6fd107fd84493bfa44659 Mon Sep 17 00:00:00 2001 From: Kareem <81531392+KareemMusleh@users.noreply.github.com> Date: Sun, 9 Mar 2025 08:55:37 +0700 Subject: [PATCH] More syntax warnings (#1944) * move use_modelscope to _utils * fix * Update _utils.py * Update loader.py --------- Co-authored-by: Daniel Han --- unsloth/models/rl.py | 2 +- unsloth/tokenizer_utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py index cf9c16514e..f13f7ef61b 100644 --- a/unsloth/models/rl.py +++ b/unsloth/models/rl.py @@ -536,7 +536,7 @@ def patch_functions(RLTrainer, trainer_file, RLTrainer_name, all_imports, import if "args.use_vllm" in init and "model" in init and "args" in init: # .*? matches first match. .+? matches final match. replacer = re.findall( - "def __init__\(.*?\).*?\:\n", + r"def __init__\(.*?\).*?\:\n", init, flags = re.MULTILINE | re.DOTALL, ) diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index 91bb0202ff..26669127d7 100644 --- a/unsloth/tokenizer_utils.py +++ b/unsloth/tokenizer_utils.py @@ -945,7 +945,7 @@ def patch_sft_trainer_tokenizer(): if replacer is None: # .*? matches first match. .+? matches final match. replacer = re.findall( - f"def {function_name}\(.*?\).*?\:\n", + f"def {function_name}" + r"\(.*?\).*?\:\n", function, flags = re.MULTILINE | re.DOTALL, )