add template replacement for OLMoE-1B-7B-0125

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
Jared Van Bortel 2025-02-12 11:58:07 -05:00
parent df95b7b0a4
commit 62fbe796c4
2 changed files with 32 additions and 1 deletions

View File

@ -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))

View File

@ -638,6 +638,37 @@ const std::unordered_map<std::string_view, std::string_view> 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)
{