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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix TRL
Daniel Han4a5157276514
diff --git a/pyproject.toml b/pyproject.tomlindex 455f8477e85..a2a9c2c9394 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -44,7 +44,7 @@ huggingface = ["wheel>=0.42.0","numpy","accelerate>=0.34.1",- "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,<=0.11.1",+ "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3","peft>=0.7.1,!=0.11.0","protobuf<4.0.0","huggingface_hub",@@ -227,7 +227,7 @@ colab-new = []colab-no-deps = ["accelerate>=0.34.1",- "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,<=0.11.1",+ "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3","peft>=0.7.1","xformers<0.0.27","bitsandbytes>=0.43.3",diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.pyindex 4aa8e1e5925..2381f509f3c 100644--- a/unsloth/models/_utils.py+++ b/unsloth/models/_utils.py@@ -1194,8 +1194,8 @@ def patch_gradient_accumulation_fix(Trainer):logger.warning_once("Unsloth: We fixed a gradient accumulation bug, "\"but it seems like you don't have the latest transformers version!\n"\- "Please update transformers via:\n"\- '`pip uninstall transformers -y && pip install --upgrade --no-cache-dir "git+https://github.com/huggingface/transformers.git"`'+ "Please update transformers, TRL and unsloth via:\n"\+ '`pip install --upgrade --no-cache-dir unsloth git+https://github.com/huggingface/transformers.git git+https://github.com/huggingface/trl.git`')passpassdiff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.pyindex ffe9933f47c..9ad603cd540 100644--- a/unsloth/tokenizer_utils.py+++ b/unsloth/tokenizer_utils.py@@ -884,7 +884,7 @@ def patch_sft_trainer_tokenizer():check_text = \"\n"\- "test_text = dataset[0][dataset_text_field] if (formatting_func is None or not use_formatting_func) else formatting_func(dataset[0])[0]\n"\+ "test_text = dataset[0][dataset_text_field] if (formatting_func is not None and dataset_text_field is None) else formatting_func(dataset[0])[0]\n"\"chat_template = getattr(tokenizer, 'chat_template', None)\n"\"chat_template = '' if chat_template is None else chat_template\n"\"has_bos_token_already = (test_text.startswith(tokenizer.bos_token) or tokenizer.bos_token in chat_template) "\@@ -941,7 +941,8 @@ def patch_sft_trainer_tokenizer():" from transformers import __version__ as transformers_version\n"\" from packaging.version import Version\n"\" if Version(transformers_version) <= Version('4.45.2'):\n"\- " print('**** Unsloth: Please use our fixed gradient_accumulation_steps by updating transformers and Unsloth!')\n"\+ " print('**** Unsloth: Please use our fixed gradient_accumulation_steps by updating transformers, TRL and Unsloth!\\n'\\\n"\+ " '`pip install --upgrade --no-cache-dir unsloth git+https://github.com/huggingface/transformers.git git+https://github.com/huggingface/trl.git`')\n"\"except:\n"\" pass\n"\"\n\n"