diff --git a/templates/alpaca.jinja b/templates/alpaca.jinja index 5c7aa7cc..41eb098b 100644 --- a/templates/alpaca.jinja +++ b/templates/alpaca.jinja @@ -1,5 +1,5 @@ {# Metadata #} -{% set stop_strings = ["### Instruction:", "### Input:", "### Response:"] %} +{%- set stop_strings = ["### Instruction:", "### Input:", "### Response:"] -%} {# Template #} {{ (messages|selectattr('role', 'equalto', 'system')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'system')|list) else '' }} diff --git a/templates/chatml.jinja b/templates/chatml.jinja index 750b82af..f7dd6f50 100644 --- a/templates/chatml.jinja +++ b/templates/chatml.jinja @@ -1,5 +1,5 @@ {# Metadata #} -{% set stop_strings = ["<|im_start|>", "<|im_end|>"] %} +{%- set stop_strings = ["<|im_start|>", "<|im_end|>"] -%} {# Template #} {% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content']}}{% if (loop.last and add_generation_prompt) or not loop.last %}{{ '<|im_end|>' + '\n'}}{% endif %}{% endfor %} diff --git a/templates/tool_calls/chatml_with_headers.jinja b/templates/tool_calls/chatml_with_headers.jinja index ecd1d2c6..db0c0ac6 100644 --- a/templates/tool_calls/chatml_with_headers.jinja +++ b/templates/tool_calls/chatml_with_headers.jinja @@ -1,8 +1,8 @@ {# Metadata #} -{% set stop_strings = ["<|im_start|>", "<|im_end|>"] %} -{% set message_roles = ['system', 'user', 'assistant', 'tool'] %} -{% set tool_start = "<|tool_start|>" %} -{% set tool_end = "<|tool_end|>" %} +{%- set stop_strings = ["<|im_start|>", "<|im_end|>"] -%} +{%- set message_roles = ['system', 'user', 'assistant', 'tool'] -%} +{%- set tool_start = "<|tool_start|>" -%} +{%- set tool_end = "<|tool_end|>" -%} {%- set start_header = "<|start_header_id|>" -%} {%- set end_header = "<|end_header_id|>\n" -%}