diff --git a/gpt4all-chat/CHANGELOG.md b/gpt4all-chat/CHANGELOG.md index 821e663a..ef517f19 100644 --- a/gpt4all-chat/CHANGELOG.md +++ b/gpt4all-chat/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] ### Changed -- Substitute prettier default templates for OLMoE 7B and Granite 3.1 3B/8B ([#3471](https://github.com/nomic-ai/gpt4all/pull/3471)) +- Substitute prettier default templates for OLMoE 7B 0924/0125 and Granite 3.1 3B/8B ([#3471](https://github.com/nomic-ai/gpt4all/pull/3471)) ### Fixed - Fix several potential crashes ([#3465](https://github.com/nomic-ai/gpt4all/pull/3465)) diff --git a/gpt4all-chat/src/jinja_replacements.cpp b/gpt4all-chat/src/jinja_replacements.cpp index d499e3aa..4043b0ee 100644 --- a/gpt4all-chat/src/jinja_replacements.cpp +++ b/gpt4all-chat/src/jinja_replacements.cpp @@ -638,6 +638,37 @@ const std::unordered_map CHAT_TEMPLATE_SUBST {%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }} {%- endif %})TEMPLATE", + }, + // OLMoE-1B-7B-0125-Instruct-Q4_0.gguf (nomic-ai/gpt4all#3471) + { + // original + R"TEMPLATE({{ bos_token }}{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|system|> +' + message['content'] + ' +' }}{% elif message['role'] == 'user' %}{{ '<|user|> +' + message['content'] + ' +' }}{% elif message['role'] == 'assistant' %}{% if not loop.last %}{{ '<|assistant|> +' + message['content'] + eos_token + ' +' }}{% else %}{{ '<|assistant|> +' + message['content'] + eos_token }}{% endif %}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|assistant|> +' }}{% endif %}{% endfor %})TEMPLATE", + // replacement + R"TEMPLATE({{- bos_token }} +{%- for message in messages %} + {%- if message['role'] == 'system' %} + {{- '<|system|>\n' + message['content'] + '\n' }} + {%- elif message['role'] == 'user' %} + {{- '<|user|>\n' + message['content'] + '\n' }} + {%- elif message['role'] == 'assistant' %} + {%- if not loop.last %} + {{- '<|assistant|>\n' + message['content'] + eos_token + '\n' }} + {%- else %} + {{- '<|assistant|>\n' + message['content'] + eos_token }} + {%- endif %} + {%- endif %} + {%- if loop.last and add_generation_prompt %} + {{- '<|assistant|>\n' }} + {%- endif %} +{%- endfor %})TEMPLATE", }, // OLMoE-1B-7B-0924-Instruct-Q4_0.gguf (nomic-ai/gpt4all#3471) {