初始化项目,由ModelHub XC社区提供模型
Model: breitburg/pure-reasoning-7b-230726 Source: Original Platform
This commit is contained in:
26
chat_template.jinja
Normal file
26
chat_template.jinja
Normal file
@@ -0,0 +1,26 @@
|
||||
{%- set ns = namespace(expected='user') -%}
|
||||
{%- for message in messages -%}
|
||||
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
||||
{%- if role == 'system' -%}
|
||||
{%- if not loop.first -%}
|
||||
{{- raise_exception("System message, if present, must be first.") -}}
|
||||
{%- endif -%}
|
||||
{{- '<|im_start|>system\n' + message['content'] + '<|im_end|>\n' -}}
|
||||
{%- else -%}
|
||||
{%- if role not in ['user', 'model'] -%}
|
||||
{{- raise_exception("Only 'system', 'user' and 'model' (or 'assistant') roles are allowed, got: " + message['role']) -}}
|
||||
{%- endif -%}
|
||||
{%- if role != ns.expected -%}
|
||||
{{- raise_exception("user/model must alternate starting with user; expected " + ns.expected + ", got " + role) -}}
|
||||
{%- endif -%}
|
||||
{%- set ns.expected = 'model' if role == 'user' else 'user' -%}
|
||||
{%- if role == 'model' and 'reasoning' in message and message['reasoning'] -%}
|
||||
{{- '<|im_start|>model\n<think>\n' + message['reasoning'] + '\n</think>\n' + message['content'] + '<|im_end|>\n' -}}
|
||||
{%- else -%}
|
||||
{{- '<|im_start|>' + role + '\n' + message['content'] + '<|im_end|>\n' -}}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- if add_generation_prompt -%}
|
||||
{{- '<|im_start|>model\n' -}}
|
||||
{%- endif -%}
|
||||
Reference in New Issue
Block a user