Files
vllm-omni/examples/online_serving/mimo_audio/chat_template.jinja
+13 b19c227fb3 [New Model]: XiaomiMiMo/MiMo-Audio-7B-Instruct support (#750)
Signed-off-by: wangyu31577 <wangyu31577@hundsun.com>
Signed-off-by: 齐保元 <qibaoyuan@xiaomi.com>
Signed-off-by: hsliu <liuhongsheng4@huawei.com>
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Signed-off-by: GG-li <3226868735@qq.com>
Signed-off-by: Sihao Li <111170255+GG-li@users.noreply.github.com>
Signed-off-by: XU Mingshi <91017482+mxuax@users.noreply.github.com>
Signed-off-by: mxuax <mxuax@connect.ust.hk>
Signed-off-by: Baoyuan Qi <qibaoyuan@126.com>
Signed-off-by: gcanlin <canlinguosdu@gmail.com>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com>
Signed-off-by: dongbo910220 <1275604947@qq.com>
Signed-off-by: dongbo910220 <32610838+dongbo910220@users.noreply.github.com>
Signed-off-by: Jiangyun Zhu <riverclouds.zhu@qq.com>
Signed-off-by: Junhong Liu <98734602+LJH-LBJ@users.noreply.github.com>
Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
Signed-off-by: baoyuan qi <qibaoyuan@126.com>
Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
Signed-off-by: Prajwal A <prajwalanagani@gmail.com>
Signed-off-by: Shijin Zhang <75300765+Dovis01@users.noreply.github.com>
Signed-off-by: 丁宁 <nndding@gmail.com>
Signed-off-by: SHIJIN ZHANG <75300765+Dovis01@users.noreply.github.com>
Signed-off-by: dingning<dingning7@xiaomi.com>
Signed-off-by: dingning <dingning7@xiaomi.com>
Signed-off-by: dingning <dingning@xiaomi.com>
Co-authored-by: wangyu <53896905+yenuo26@users.noreply.github.com>
Co-authored-by: wangyu31577 <wangyu31577@hundsun.com>
Co-authored-by: Zhang Shijin <zhangshijin@xiaomi.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: Sihao Li <111170255+GG-li@users.noreply.github.com>
Co-authored-by: XU Mingshi <91017482+mxuax@users.noreply.github.com>
Co-authored-by: Canlin Guo <canlinguosdu@gmail.com>
Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Co-authored-by: JohnJan <wuzhongjian_yewu@cmss.chinamobile.com>
Co-authored-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com>
Co-authored-by: dongbo910220 <32610838+dongbo910220@users.noreply.github.com>
Co-authored-by: Jiangyun Zhu <riverclouds.zhu@qq.com>
Co-authored-by: Junhong Liu <ljh_lbj@163.com>
Co-authored-by: TJian <tunjian.tan@embeddedllm.com>
Co-authored-by: shijin zhang <zsj1364226740@gmail.com>
Co-authored-by: Zhou Taichang <tzhouam@connect.ust.hk>
Co-authored-by: root <root@hk01dgx028.cm.cluster>
Co-authored-by: Prajwal A <34590600+LawJarp-A@users.noreply.github.com>
Co-authored-by: Shijin Zhang <75300765+Dovis01@users.noreply.github.com>
Co-authored-by: dingning <dingning7@xiaomi.com>
Co-authored-by: ning ding <nndding@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-27 11:19:49 +08:00

87 lines
4.0 KiB
Django/Jinja

{%- if tools %}
{{- '<|im_start|>system\n' }}
{%- if messages[0]['role'] == 'system' %}
{{- messages[0]['content'] }}
{%- else %}
{{- 'You are a helpful assistant.' }}
{%- endif %}
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
{%- for tool in tools %}
{{- "\n" }}
{{- tool | tojson }}
{%- endfor %}
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
{%- else %}
{%- if messages[0]['role'] == 'system' %}
{%- set _m = '<|sosp|><|empty|><|eosp|>' -%}
{%- set _raw0 = messages[0]['content'] if messages[0]['content'] is string else '' -%}
{%- if _m in _raw0 %}
{%- set _t0 = (_raw0 | replace(_m ~ '\n', '') | replace(_m, '') | trim) -%}
{{- '<|im_start|>system\n' + (_t0 ~ _m if _t0 else _m) + '<|im_end|>\n' }}
{%- else %}
{{- '<|im_start|>system\n' + _raw0 + '<|im_end|>\n' }}
{%- endif %}
{%- else %}
{{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- for message in messages %}
{%- if message['role'] == 'assistant' %}
{{- '<|im_start|>assistant' }}
{%- set _sosp = '<|sosp|><|empty|><|eosp|>' -%}
{%- set _text = message['content'] if message['content'] is string else '' -%}
{%- if _sosp in _text %}
{%- set _clean = _text | replace(_sosp, '') -%}
{%- set _body = _clean[1:] if (_clean and _clean[0] == '\n') else _clean -%}
{{- '\n<|sostm|>' + _body + '<|eot|><|empty|><|eostm|>' }}
{%- else %}
{%- set _body = _text[1:] if (_text and _text[0] == '\n') else _text -%}
{{- '\n<|sostm|>' + _body + '<|eot|><|eostm|>' }}
{%- endif %}
{{- '<|im_end|>\n' }}
{%- elif message['role'] == 'user' %}
{%- set _m = '<|sosp|><|empty|><|eosp|>' -%}
{%- set _raw = message['content'] if message['content'] is string else '' -%}
{%- if _m in _raw %}
{%- set _t = (_raw | replace(_m ~ '\n', '') | replace(_m, '') | trim) -%}
{{- '<|im_start|>user\n' + (_t ~ _m if _t else _m) + '<|im_end|>\n' }}
{%- else %}
{{- '<|im_start|>user\n' + _raw + '<|im_end|>\n' }}
{%- endif %}
{%- elif message['role'] == 'system' %}
{%- if not loop.first %}
{%- set _m = '<|sosp|><|empty|><|eosp|>' -%}
{%- set _raw = message['content'] if message['content'] is string else '' -%}
{%- if _m in _raw %}
{%- set _t = (_raw | replace(_m ~ '\n', '') | replace(_m, '') | trim) -%}
{{- '<|im_start|>system\n' + (_t ~ _m if _t else _m) + '<|im_end|>\n' }}
{%- else %}
{{- '<|im_start|>system\n' + _raw + '<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- elif message['role'] == 'tool' %}
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1]['role'] != 'tool') %}
{{- '<|im_start|>user' }}
{%- endif %}
{%- set _m = '<|sosp|><|empty|><|eosp|>' -%}
{%- set _raw = message['content'] if message['content'] is string else '' -%}
{%- if _m in _raw %}
{%- set _t = (_raw | replace(_m ~ '\n', '') | replace(_m, '') | trim) -%}
{{- '\n<tool_response>\n' + (_t ~ _m if _t else _m) + '\n</tool_response>' }}
{%- else %}
{{- '\n<tool_response>\n' + _raw + '\n</tool_response>' }}
{%- endif %}
{%- if loop.last or (messages[loop.index0 + 1]['role'] != 'tool') %}
{{- '<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt %}
{{- '<|im_start|>assistant\n<|sostm|>' }}
{%- endif %}