CoolFace
Modelpublic

trl-internal-testing/tiny-LlavaNextForConditionalGeneration

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes208kdownloads
chat_template.jinja6 linesDownload Raw Back to root
1{% for message in messages %}{% if message['role'] == 'system' %}{{ '<<SYS>>2' + message['content'][0]['text'] + '3<</SYS>>4 5' }}{% elif message['role'] == 'user' %}{{ '[INST] ' }}{# Render all images first #}{% for content in message['content'] | selectattr('type', 'equalto', 'image') %}{{ '<image>6' }}{% endfor %}{# Render all text next #}{% for content in message['content'] | selectattr('type', 'equalto', 'text') %}{{ content['text'] }}{% endfor %}{{' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + message['content'][0]['text'] + '</s> '}}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}