Skip to content

Commit

Permalink
fix: add missing bos_token to example templates
Browse files Browse the repository at this point in the history
Signed-off-by: Toshiki Kataoka <[email protected]>
  • Loading branch information
toslunar committed Dec 23, 2024
1 parent f30581c commit 1a7f9e3
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/template_alpaca.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ bos_token -}}
{{ (messages|selectattr('role', 'equalto', 'system')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'system')|list) else '' }}

{% for message in messages %}
Expand Down
1 change: 1 addition & 0 deletions examples/template_baichuan.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ bos_token -}}
{{ (messages|selectattr('role', 'equalto', 'system')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'system')|list) else '' }}

{%- for message in messages -%}
Expand Down
1 change: 1 addition & 0 deletions examples/template_blip2.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ bos_token }}
{%- for message in messages -%}
{%- if message['role'] == 'user' -%}
{{- 'Question: ' + message['content'] + ' ' -}}
Expand Down
1 change: 1 addition & 0 deletions examples/template_chatglm.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- bos_token -}}
{%- set counter = namespace(index=0) -%}
{%- for message in messages -%}
{%- if message['role'] == 'user' -%}
Expand Down
1 change: 1 addition & 0 deletions examples/template_chatglm2.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- bos_token -}}
{%- set counter = namespace(index=1) -%}
{%- for message in messages -%}
{%- if message['role'] == 'user' -%}
Expand Down
1 change: 1 addition & 0 deletions examples/template_chatml.jinja
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{{ bos_token -}}
{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content']}}{% if (loop.last and add_generation_prompt) or not loop.last %}{{ '<|im_end|>' + '\n'}}{% endif %}{% endfor %}
{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ '<|im_start|>assistant\n' }}{% endif %}
1 change: 1 addition & 0 deletions examples/template_dse_qwen2_vl.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ bos_token -}}
{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}{% raw %}<|im_start|>system
You are a helpful assistant.<|im_end|>
{% endraw %}{% endif %}<|im_start|>{{ message['role'] }}{% raw %}
Expand Down
1 change: 1 addition & 0 deletions examples/template_falcon.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- bos_token -}}
{%- for message in messages -%}
{%- if message['role'] == 'user' -%}
{{- 'User: ' + message['content'] -}}
Expand Down
1 change: 1 addition & 0 deletions examples/template_falcon_180b.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- bos_token -}}
{%- for message in messages -%}
{%- if message['role'] == 'system' -%}
{{- 'System: ' + message['content'] -}}
Expand Down
1 change: 1 addition & 0 deletions examples/template_inkbot.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ bos_token -}}
<#meta#>
- Date: {{ (messages|selectattr('role', 'equalto', 'meta-current_date')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'meta-current_date')|list) else '' }}
- Task: {{ (messages|selectattr('role', 'equalto', 'meta-task_name')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'meta-task_name')|list) else '' }}
Expand Down
1 change: 1 addition & 0 deletions examples/template_vlm2vec.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- bos_token -}}
{%- if messages | length > 1 -%}
{{ raise_exception('Embedding models should only embed one message at a time') }}
{%- endif -%}
Expand Down
1 change: 1 addition & 0 deletions examples/tool_chat_template_granite.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- bos_token }}
{%- if tools %}
{{- '<|start_of_role|>available_tools<|end_of_role|>
' }}
Expand Down
1 change: 1 addition & 0 deletions examples/tool_chat_template_granite_20b_fc.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- bos_token }}
{%- macro json_to_python_type(json_spec) %}
{%- set basic_type_map = {
"string": "str",
Expand Down

0 comments on commit 1a7f9e3

Please sign in to comment.