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 <Rocketknight1@users.noreply.github.com>

---------

Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
This commit is contained in:
Tibor Reiss 2024-09-24 14:35:23 +02:00 committed by GitHub
parent 11c27dd331
commit 01aec8c92d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1966,10 +1966,9 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
# 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"