From f0ae89360f81da3f57f340c02b797a7d87d176e7 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 4 Mar 2025 04:12:38 -0800 Subject: [PATCH] Bug fix --- unsloth/models/_utils.py | 2 +- unsloth/tokenizer_utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 0f0d4c159f..36e4f51a27 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.3.1" +__version__ = "2025.3.2" __all__ = [ "SUPPORTS_BFLOAT16", diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index 9c5f825a0c..de9f73d7a5 100644 --- a/unsloth/tokenizer_utils.py +++ b/unsloth/tokenizer_utils.py @@ -859,6 +859,7 @@ pass import inspect from inspect import getsource +import trl import trl.trainer.sft_trainer from trl.trainer.sft_trainer import * from transformers.trainer import * @@ -1046,3 +1047,9 @@ pass # Finally patch TRL tokenizer things -> moved to RL # patch_sft_trainer_tokenizer() + +# Temporary measure to stop tokenizing data twice +if hasattr(trl, "data_utils"): + def maybe_apply_chat_template(example, *args, **kwargs): return example + trl.data_utils.maybe_apply_chat_template = maybe_apply_chat_template +pass