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 rl_replacements.py

Daniel Hanf55395b5f058
diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py
index f88e362beb7..ec311a7a839 100644
--- a/unsloth/models/rl_replacements.py
+++ b/unsloth/models/rl_replacements.py
@@ -101,7 +101,7 @@ def sft_trainer_prepare_dataset(function_name, function):
# .*? matches first match. .+? matches final match.
replacer = re.findall(
- r"def {function_name}\(.*?\).*?\:\n",
+ r"def " + function_name + r"\(.*?\).*?\:\n",
function,
flags = re.MULTILINE | re.DOTALL,
)