diff --git a/instruction-templates/ChatML.yaml b/instruction-templates/ChatML.yaml index e9f2883f..8b55f0dc 100644 --- a/instruction-templates/ChatML.yaml +++ b/instruction-templates/ChatML.yaml @@ -5,15 +5,12 @@ instruction_template: |- {%- set ns.found = true -%} {%- endif -%} {%- endfor -%} - {%- if not ns.found -%} - {{- '<|im_start|>system\n' + '' + '<|im_end|>\n' -}} - {%- endif %} {%- for message in messages %} {%- if message['role'] == 'system' -%} - {{- '<|im_start|>system\n' + message['content'] + '<|im_end|>\n' -}} + {{- '<|im_start|>system\n' + message['content'].rstrip() + '<|im_end|>\n' -}} {%- else -%} {%- if message['role'] == 'user' -%} - {{-'<|im_start|>user\n' + message['content'] + '<|im_end|>\n'-}} + {{-'<|im_start|>user\n' + message['content'].rstrip() + '<|im_end|>\n'-}} {%- else -%} {{-'<|im_start|>assistant\n' + message['content'] + '<|im_end|>\n' -}} {%- endif -%}