long-llava-qwen2-7b / chat_template.json
yinsong1986's picture
Upload folder using huggingface_hub
45ced03 verified
raw
history blame
No virus
942 Bytes
{
"chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}{% endif %}{% if message['role'] != 'system' %}{{ '<|im_start|>' + message['role'] + '\n' }}{% endif %}{# Render all images first #}{% for content in message['content'] | selectattr('type', 'equalto', 'image') %}{% if loop.last %}{{ '<image>\n' }}{% else %}{{ '<image> ' }}{% endif %}{% endfor %}{# Render all text #}{% if message['role'] != 'assistant' %}{% for content in message['content'] | selectattr('type', 'equalto', 'text') %}{{ content['text'] + '<|im_end|>' + '\n'}}{% endfor %}{% else %}{% for content in message['content'] | selectattr('type', 'equalto', 'text') %}{% generation %}{{ content['text'] + '<|im_end|>' + '\n'}}{% endgeneration %}{% endfor %}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
}