|
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' + 'An interaction between a user providing instructions, and an imaginative assistant providing responses.' + '\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 -%} |
|
|