Chat Templates for BlenderBot

I have installed transformers==4.34.0, tokenizers=0.14.1, and huggingface_hub=0.18.0 on Ubuntu 20 and I am trying to run the bog standard sample chat templates code from Templates for Chat Models under PyCharm. The error I consistently get is:

Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py”, line 3433, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 10, in
tokenizer.apply_chat_template(chat, tokenize=False)
AttributeError: ‘BlenderbotTokenizerFast’ object has no attribute ‘apply_chat_template’

I need clues! :slight_smile:

1 Like

I generally solve this type of problem by asking chat-gpt. Just past your full code there and then add to the prompt the complete error (specifying the line) and ask for the correct code.
Don’t be afraid to ask if you have any problems.

Thanks, but this is not a syntax issue. It is an object model issue. Clearly there is an install dependency problem.

Hi, @bogolese, Did you manage to fix this dependancy issue?

Hi,

Blenderbot does not have a chat template set (there’s no “chat_template” attribute in the tokenizer_config.json). We’re going to update the docs to mention another model. cc @Rocketknight1

Opened an issue here: ValueError: Cannot use apply_chat_template() because tokenizer.chat_template is not set · Issue #33246 · huggingface/transformers · GitHub