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 Han835dab990386
diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py
index 3d8a517382f..2062df4808e 100644
--- a/unsloth/tokenizer_utils.py
+++ b/unsloth/tokenizer_utils.py
@@ -950,7 +950,8 @@ def patch_sft_trainer_tokenizer():
check_text = check_text.split("\n")
check_text = "\n".join(" "*where + x for x in check_text)
-
+ check_text = check_text.rstrip() + "\n"
+
if replacer is None:
# .*? matches first match. .+? matches final match.
replacer = re.findall(