Spaces:
Runtime error
Runtime error
File size: 683 Bytes
4d82421 07a6749 4d82421 07a6749 4d82421 07a6749 4d82421 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
{% if not add_generation_prompt is defined %}
{% set add_generation_prompt = false %}
{% endif %}
{% for message in messages %}
{% if message['role'] == 'user' %}
{% if loop.index0 % 2 == 1 and loop.index0 > 2 %}
{{ '<s>' + '[INST] ' + message['content'] + ' [/INST]' }}
{% elif loop.index0 % 2 == 1 and loop.index0 < 2 %}
{{ message['content'] + ' [/INST]' }}
{% elif loop.index0 % 2 == 0 %}
{{ '<s>' + '[INST] ' + message['content'] + ' [/INST]' }}
{% endif %}
{% elif message['role'] == 'system' %}
{{ '<s>[INST] <<SYS>>\n' + message['content'] + '\n<</SYS>>\n\n' }}
{% elif message['role'] == 'assistant' %}
{{ ' ' + message['content'] + ' ' + '</s>' }}
{% endif %}
{% endfor %} |