ValueError: Cannot use chat template functions because tokenizer.chat_template is not set
#1
by
Akhtyamov
- opened
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("nvidia/OpenMath2-Llama3.1-8B")
chat = [
{"role": "user", "content": "Hello, how are you?"},
{"role": "assistant", "content": "I'm doing great. How can I help you today?"},
{"role": "user", "content": "I'd like to show off how chat templating works!"},
]
tokenizer.apply_chat_template(chat, tokenize=False)
ValueError: 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
Can you please provide any examples how to use your model?
Libs:
tokenizers-0.20.0
transformers-4.45.1
Thanks for reporting and sorry about that! Can you please retry now - we've updated the configs and added instructions in readme.
Thanks, Igor! Does work now.
Akhtyamov
changed discussion status to
closed