From a060908d6cb2107d4d70216800969b1c6becb873 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:58:29 -0800 Subject: [PATCH] Mixtral Instruct: detect prompt format for llama.cpp loader Workaround until the tokenizer.chat_template kv field gets implemented --- instruction-templates/Mistral.yaml | 11 +---------- models/config.yaml | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/instruction-templates/Mistral.yaml b/instruction-templates/Mistral.yaml index 785a3a32..0b6baf11 100644 --- a/instruction-templates/Mistral.yaml +++ b/instruction-templates/Mistral.yaml @@ -1,16 +1,7 @@ instruction_template: |- - {%- set found_item = false -%} - {%- for message in messages -%} - {%- if message['role'] == 'system' -%} - {%- set found_item = true -%} - {%- endif -%} - {%- endfor -%} - {%- if not found_item -%} - {{- '' + '' + '' -}} - {%- endif %} {%- for message in messages %} {%- if message['role'] == 'system' -%} - {{- '' + message['content'] + '' -}} + {{- message['content'] -}} {%- else -%} {%- if message['role'] == 'user' -%} {{-'[INST] ' + message['content'] + ' [/INST]'-}} diff --git a/models/config.yaml b/models/config.yaml index f18687ae..197d4b35 100644 --- a/models/config.yaml +++ b/models/config.yaml @@ -174,7 +174,7 @@ instruction_template: 'OpenChat' .*codellama.*instruct: instruction_template: 'Llama-v2' -.*mistral.*instruct: +.*(mistral|mixtral).*instruct: instruction_template: 'Mistral' .*mistral.*openorca: instruction_template: 'ChatML'