Phi-3.5-vision-instruct / chat_template.json
LucaMotz's picture
Keep the tokenizer's chat template and load on Transformers 4.49-4.52
62fd22f verified
Raw History Blame
486 Bytes
{
"chat_template": "{% for message in messages %}{{ '<|' + message['role'] + '|>\\n' }}{% if message['content'] is string %}{{ message['content'] }}{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' %}{{ '<|image|>\\n' }}{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% endif %}{{ '<|end|>\\n' }}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ '<|assistant|>\\n' }}{% endif %}\n"
}