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.

More syntax warnings (#1944)

Kareemf1d77f78572b
diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py
index cf9c16514e0..f13f7ef61b8 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 91bb0202ff4..26669127d7e 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,
)