webui / instruction-templates /Llama-v2.yaml
hadidev's picture
Upload folder using huggingface_hub
72db4a9 verified
raw
history blame contribute delete
835 Bytes
instruction_template: |-
{%- set ns = namespace(found=false) -%}
{%- for message in messages -%}
{%- if message['role'] == 'system' -%}
{%- set ns.found = true -%}
{%- endif -%}
{%- endfor -%}
{%- if not ns.found -%}
{{- '[INST] <<SYS>>\n' + 'Answer the questions.' + '\n<</SYS>>\n\n' -}}
{%- endif %}
{%- for message in messages %}
{%- if message['role'] == 'system' -%}
{{- '[INST] <<SYS>>\n' + message['content'] + '\n<</SYS>>\n\n' -}}
{%- else -%}
{%- if message['role'] == 'user' -%}
{{-'' + message['content'] + ' [/INST] '-}}
{%- else -%}
{{-'' + message['content'] + ' </s><s>[INST] ' -}}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
{{-''-}}
{%- endif -%}