Skip to content

Commit

Permalink
Fix error string after refactoring into get_chat_template (#33652)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
tibor-reiss and Rocketknight1 authored Sep 24, 2024
1 parent 11c27dd commit 01aec8c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/transformers/tokenization_utils_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 01aec8c

Please sign in to comment.