From 16ddec731ad8f250d514c545eedbc15f39610bff Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sun, 9 Feb 2025 19:19:51 -0800 Subject: [PATCH] Update tokenizer_utils.py --- unsloth/tokenizer_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index f2b0da8600..3b336664d0 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