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

Daniel Han2e4bca5cbf2c
diff --git a/unsloth/trainer.py b/unsloth/trainer.py
index 25b89999593..00956ed41b8 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