No chat template
#12
by
zyddnys
- opened
chat template is missing in the generation config file
chat template is missing in the generation config file
The last update to tokenizer_config.json by HF Staff added a chat template.
I see the template in tokenizer config, but I still got
raise ValueError(
ValueError: Cannot use apply_chat_template() 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
I use the following code
from transformers import pipeline
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Who are you?"},
]
chatbot = pipeline("text-generation", model="../Mistral-Large-Instruct-2407")
x = chatbot(messages)
print(x)
I have this same issue. any update here?
Does anyone fix this case ? :<
I encountered the same error, and later I noticed that I was using the non-instruct model. When I switched back to the Instruct model, it worked well with model.generate using apply_chat_template.
I had same error and this solution works!! You rock!!