From 2e4bca5cbf2cd73707d6c3c11c563636d7b3858d Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 13 Nov 2024 18:53:40 -0800 Subject: [PATCH] Update trainer.py --- unsloth/trainer.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/unsloth/trainer.py b/unsloth/trainer.py index 25b8999959..00956ed41b 100644 --- a/unsloth/trainer.py +++ b/unsloth/trainer.py @@ -201,10 +201,8 @@ pass def _patch_trl_trainer(): - try: - trl.__UNSLOTH_BACKWARDS_COMPATIBLE__ - return - except: pass + import trl + if hasattr(trl, "__UNSLOTH_BACKWARDS_COMPATIBLE__"): return if Version(trl.__version__) <= Version("0.11.0"): return import trl.trainer