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.

Refactor UnslothTrainingArguments to support fallback for TrainingArguments import

Erland366fe5358bacc02
diff --git a/unsloth/trainer.py b/unsloth/trainer.py
index a3602054325..e7c73deeaf7 100644
--- a/unsloth/trainer.py
+++ b/unsloth/trainer.py
@@ -61,9 +61,13 @@ else:
pass
pass
-from trl import SFTConfig
-@dataclass
-class UnslothTrainingArguments(SFTConfig):
+try:
+ from trl import SFTConfig as TrainingArguments
+except:
+ from transformers import TrainingArguments
+pass
+
+class UnslothTrainingArguments(TrainingArguments):
embedding_learning_rate : Optional[float] = field(
default = None,
metadata = {"help" : "Different learning rates for embeddings and lm_head."}