Revision of model cards and tokenizer_config.json
Consider revision of all your model cards and tokenizer_config.json, so each model example are directly runnable.
I had to add the chat template manually, as the default template is missing from tokenizer_config.json (I created a file called prompt-template.tmpl with the model chat template):
template_path = 'adamo1139/prompt-template.tmpl'
with open(template_path, 'r') as file:
template = file.read()
tokenizer.chat_template = template
Otherwise I get:
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
Please fill tokenizer_config.json with a default template.
Also instead of writing in the "model card, how to use":
We recommend setting temperature=0.8 and top_p=0.9 in the sampling parameters.
Just include this in the example:
generated_ids = model.generate(**model_inputs, max_new_tokens=32768, do_sample=True, temperature=0.8, top_p=0.9)
Hello, please update the version of transformers. The chat template is correctly included in the repo, here is an example to get it:
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("swiss-ai/Apertus-70B-Instruct-2509")
print(tokenizer.chat_template)
PS: The chat template is available only for the instruct models (models with -Instruct
in the name). The base models were not trained using the chat template.