From 3c5ba04df641500dd30592b56fbcdcf87a238190 Mon Sep 17 00:00:00 2001 From: Mustafa Eyceoz Date: Mon, 30 Sep 2024 02:51:03 -0400 Subject: [PATCH] Fix generic chat template saved to tokenizer for generation Signed-off-by: Mustafa Eyceoz --- src/instructlab/training/chat_templates/ibm_generic_tmpl.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/instructlab/training/chat_templates/ibm_generic_tmpl.py b/src/instructlab/training/chat_templates/ibm_generic_tmpl.py index 1e26f7ea..5eaf795e 100644 --- a/src/instructlab/training/chat_templates/ibm_generic_tmpl.py +++ b/src/instructlab/training/chat_templates/ibm_generic_tmpl.py @@ -23,5 +23,8 @@ "{% elif message['role'] == 'assistant' %}" "{{'<|assistant|>' + '\n' + message['content'] + '<|endoftext|>' + ('' if loop.last else '\n')}}" "{% endif %}" + "{% if loop.last and add_generation_prompt %}" + "{{ '<|assistant|>' + '\n' }}" + "{% endif %}" "{% endfor %}" )