Skip to content

Commit 0bb5450

Browse files
HuggingFaceInframachineuser
authored andcommitted
[ollama-utils] 🤖 Auto-update chat templates (2025-04-28) (#1391)
This PR is auto-generated by [generate-automap.ts](https://github.com/huggingface/huggingface.js/blob/main/packages/ollama-utils/scripts/generate-automap.ts). Co-authored-by: machineuser <[email protected]>
1 parent 2603179 commit 0bb5450

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

‎packages/ollama-utils/src/chat-template-automap.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,20 @@ import type { OllamaChatTemplateMapEntry } from "./types";
55

66
/**
77
* Skipped these models due to error:
8-
* - library/llama3:70b
9-
* - library/mistrallite:7b
8+
* - library/gemma3:12b
9+
* - library/llama3.3:70b-instruct-fp16
10+
* - library/llama3.3:70b
11+
* - library/llama3.1:8b
12+
* - library/llama3.1:70b
13+
* - library/llama3.1:8b-instruct-fp16
14+
* - library/llama3.2-vision:11b
15+
* - library/mistral-nemo:12b-instruct-2407-q2_K
16+
* - library/llava:34b
17+
* - library/deepcoder:1.5b-preview-fp16
18+
* - library/firefunction-v2:70b
19+
* - library/yi-coder:1.5b-base-fp16
20+
* - library/tulu3:70b
21+
* - library/command-a:111b-03-2025-fp16
1022
*/
1123

1224
export const OLLAMA_CHAT_TEMPLATE_MAPPING: OllamaChatTemplateMapEntry[] = [
@@ -756,6 +768,17 @@ export const OLLAMA_CHAT_TEMPLATE_MAPPING: OllamaChatTemplateMapEntry[] = [
756768
},
757769
},
758770
},
771+
{
772+
model: "library/mistral:7b-instruct-fp16",
773+
gguf: "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token + ' ' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}",
774+
ollama: {
775+
template: "[INST] {{ .System }} {{ .Prompt }} [/INST]\n",
776+
tokens: ["[INST]"],
777+
params: {
778+
stop: ["[INST]", "[/INST]"],
779+
},
780+
},
781+
},
759782
{
760783
model: "library/mixtral:8x22b",
761784
gguf: "{%- if messages[0]['role'] == 'system' %}\n {%- set system_message = messages[0]['content'] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set loop_messages = messages %}\n{%- endif %}\n\n{{- bos_token }}\n{%- for message in loop_messages %}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}\n {{- raise_exception('After the optional system message, conversation roles must alternate user/assistant/user/assistant/...') }}\n {%- endif %}\n {%- if message['role'] == 'user' %}\n {%- if loop.last and system_message is defined %}\n {{- '[INST] ' + system_message + '\\n\\n' + message['content'] + '[/INST]' }}\n {%- else %}\n {{- '[INST] ' + message['content'] + '[/INST]' }}\n {%- endif %}\n {%- elif message['role'] == 'assistant' %}\n {{- ' ' + message['content'] + eos_token}}\n {%- else %}\n {{- raise_exception('Only user and assistant roles are supported, with the exception of an initial optional system message!') }}\n {%- endif %}\n{%- endfor %}\n",

0 commit comments

Comments
 (0)