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 Han766f9e5d4738
diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py
index f2b0da8600c..3b336664d0c 100644
--- a/unsloth/tokenizer_utils.py
+++ b/unsloth/tokenizer_utils.py
@@ -1059,8 +1059,11 @@ for trainer_name in ("SFTTrainer", "DPOTrainer", "KTOTrainer"):
if trainer_text is None: continue
try:
exec(trainer_text, globals())
- except:
- raise RuntimeError(f"Unsloth: Please file a bug report! Error patching {trainer_name}")
+ except Exception as error:
+ raise RuntimeError(
+ f"Unsloth: Please file a bug report! Error patching {trainer_name}. Error:\n"\
+ f"{str(error)}",
+ )
exec(f"trl.trainer.{trainer_name} = Unsloth{trainer_name}", globals())
pass