From 01aec8c92d273f620c11905fe693597045de39f0 Mon Sep 17 00:00:00 2001 From: Tibor Reiss <75096465+tibor-reiss@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:35:23 +0200 Subject: [PATCH] Fix error string after refactoring into get_chat_template (#33652) * Fix error string after refactoring into get_chat_template * Take suggestion from CR Co-authored-by: Matt --------- Co-authored-by: Matt --- src/transformers/tokenization_utils_base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/transformers/tokenization_utils_base.py b/src/transformers/tokenization_utils_base.py index b4490578a70916..c6467bb7d7f7d1 100644 --- a/src/transformers/tokenization_utils_base.py +++ b/src/transformers/tokenization_utils_base.py @@ -1966,10 +1966,9 @@ def get_chat_template(self, chat_template: Optional[str] = None, tools: Optional # priority: `chat_template` argument > `tokenizer.chat_template` if self.chat_template is not None: chat_template = self.chat_template - else: raise ValueError( - "Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template " + "Cannot use chat template functions because tokenizer.chat_template is not set and no template " "argument was passed! For information about writing templates and setting the " "tokenizer.chat_template attribute, please see the documentation at " "https://huggingface.co/docs/transformers/main/en/chat_templating"