Xenova HF Staff commited on
Commit
8baf569
·
verified ·
1 Parent(s): 6f98127

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,16 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ onnx/model_fp16.onnx_data filter=lfs diff=lfs merge=lfs -text
37
+ onnx/model_fp16.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
38
+ onnx/model_fp16.onnx_data_2 filter=lfs diff=lfs merge=lfs -text
39
+ onnx/model_fp16.onnx_data_3 filter=lfs diff=lfs merge=lfs -text
40
+ onnx/model_fp16.onnx_data_4 filter=lfs diff=lfs merge=lfs -text
41
+ onnx/model_fp16.onnx_data_5 filter=lfs diff=lfs merge=lfs -text
42
+ onnx/model_fp16.onnx_data_6 filter=lfs diff=lfs merge=lfs -text
43
+ onnx/model_fp16.onnx_data_7 filter=lfs diff=lfs merge=lfs -text
44
+ onnx/model_fp16.onnx_data_8 filter=lfs diff=lfs merge=lfs -text
45
+ onnx/model_q4f16.onnx_data filter=lfs diff=lfs merge=lfs -text
46
+ onnx/model_q4f16.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
47
+ onnx/model_q4f16.onnx_data_2 filter=lfs diff=lfs merge=lfs -text
48
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) -%}
2
+ {%- set emit = namespace(started=false) -%}
3
+
4
+ {# ---------- Build base system message (always emitted) ---------- #}
5
+ {%- set base_system = 'You are rnj-1, a foundation model trained by Essential AI.\n' -%}
6
+
7
+ {# ---------- Optional tools preface as a synthetic system message ---------- #}
8
+ {%- if tools %}
9
+ {%- set sys_preamble -%}
10
+ # Tools
11
+
12
+ You may call one or more functions to assist with the user query.
13
+
14
+ You are provided with function signatures within <tools></tools> XML tags:
15
+ <tools>
16
+ {%- for tool in tools %}
17
+ {{ "\n" ~ (tool | tojson) }}
18
+ {% endfor %}
19
+ </tools>
20
+
21
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
22
+ <tool_call>
23
+ {"name": <function-name>, "arguments": <args-json-object>}
24
+ </tool_call>
25
+ {%- endset -%}
26
+
27
+ {# If the first user-provided message is system, include it above the tools preface #}
28
+ {%- set combined_system = (messages and messages[0].role == 'system')
29
+ and (messages[0].content is string) -%}
30
+ {%- set sys_content = (combined_system and (messages[0].content ~ "\n\n" ~ sys_preamble)) or sys_preamble -%}
31
+
32
+ {%- set content = '<|start_header_id|>system<|end_header_id|>\n' ~ base_system ~ '\n' ~ sys_content ~ '<|eot_id|>' -%}
33
+ {%- if not emit.started -%}{%- set content = bos_token ~ content -%}{%- set emit.started = true -%}{%- endif -%}
34
+ {{- content -}}
35
+ {%- else %}
36
+ {# No tools: always emit base_system, and include user's system message if present #}
37
+ {%- set user_system_content = '' -%}
38
+ {%- if messages and messages[0].role == 'system' and (messages[0].content is string) -%}
39
+ {%- set user_system_content = '\n' ~ messages[0].content -%}
40
+ {%- endif -%}
41
+ {%- set content = '<|start_header_id|>system<|end_header_id|>\n' ~ base_system ~ user_system_content ~ '<|eot_id|>' -%}
42
+ {%- if not emit.started -%}{%- set content = bos_token ~ content -%}{%- set emit.started = true -%}{%- endif -%}
43
+ {{- content -}}
44
+ {%- endif -%}
45
+
46
+ {# ---------- Locate last user query for multi-step tool behavior ---------- #}
47
+ {%- for message in messages[::-1] %}
48
+ {%- set index = (messages|length - 1) - loop.index0 -%}
49
+ {%- if ns.multi_step_tool
50
+ and message.role == "user"
51
+ and message.content is string
52
+ and not (message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) -%}
53
+ {%- set ns.multi_step_tool = false -%}
54
+ {%- set ns.last_query_index = index -%}
55
+ {%- endif -%}
56
+ {%- endfor -%}
57
+
58
+ {# ---------- Walk all messages and emit in Llama-3 format ---------- #}
59
+ {%- for message in messages %}
60
+ {# normalize content #}
61
+ {%- if message.content is string -%}
62
+ {%- set content = message.content -%}
63
+ {%- else -%}
64
+ {%- set content = '' -%}
65
+ {%- endif -%}
66
+
67
+ {# --- user/system (non-initial system already handled above) --- #}
68
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) -%}
69
+ {%- set block = '<|start_header_id|>' ~ message.role ~ '<|end_header_id|>\n' ~ content ~ '<|eot_id|>' -%}
70
+ {%- if not emit.started -%}{%- set block = bos_token ~ block -%}{%- set emit.started = true -%}{%- endif -%}
71
+ {{- block -}}
72
+
73
+ {# --- assistant --- #}
74
+ {%- elif message.role == "assistant" -%}
75
+
76
+ {%- set body = content -%}
77
+ {%- set header = '<|start_header_id|>assistant<|end_header_id|>\n' -%}
78
+ {%- if not emit.started -%}{{ bos_token }}{%- set emit.started = true -%}{%- endif -%}
79
+ {{- header -}}
80
+ {% generation %}
81
+ {{- body -}}
82
+ {%- if message.tool_calls -%}
83
+ {%- for tool_call in message.tool_calls -%}
84
+ {%- if tool_call.function -%}{%- set tc = tool_call.function -%}{%- else -%}{%- set tc = tool_call -%}{%- endif -%}
85
+ {%- set args_json = (tc.arguments if (tc.arguments is string) else (tc.arguments | tojson)) -%}
86
+ {%- if loop.first -%}
87
+ {{- '<tool_call>\n{"name": "' ~ tc.name ~ '", "arguments": ' ~ args_json ~ '}\n</tool_call>' -}}
88
+ {%- else -%}
89
+ {{- '\n<tool_call>\n{"name": "' ~ tc.name ~ '", "arguments": ' ~ args_json ~ '}\n</tool_call>' -}}
90
+ {%- endif -%}
91
+ {%- endfor -%}
92
+ {%- endif -%}
93
+ {{- '<|eot_id|>' -}}{%- endgeneration -%}
94
+ {# --- tool messages are wrapped as synthetic user messages with <tool_response> --- #}
95
+ {%- elif message.role == "tool" -%}
96
+ {%- set open_user = (loop.first or (loop.index0 > 0 and messages[loop.index0 - 1].role != "tool")) -%}
97
+ {%- set close_user = (loop.last or (loop.index0 < messages|length - 1 and messages[loop.index0 + 1].role != "tool")) -%}
98
+
99
+ {%- if open_user -%}
100
+ {%- set header = '<|start_header_id|>user<|end_header_id|>\n' -%}
101
+ {%- if not emit.started -%}{%- set header = bos_token ~ header -%}{%- set emit.started = true -%}{%- endif -%}
102
+ {{- header -}}
103
+ {%- endif -%}
104
+ {%- if open_user -%}
105
+ {{- '<tool_response>\n' -}}
106
+ {%- else -%}
107
+ {{- '\n<tool_response>\n' -}}
108
+ {%- endif -%}
109
+ {{- content -}}
110
+ {{- '\n</tool_response>' -}}
111
+
112
+ {%- if close_user -%}
113
+ {{- '<|eot_id|>' -}}
114
+ {%- endif -%}
115
+ {%- endif -%}
116
+ {%- endfor -%}
117
+
118
+ {# ---------- Add generation prompt header for the model to continue ---------- #}
119
+ {%- if add_generation_prompt -%}
120
+ {%- set tail = '<|start_header_id|>assistant<|end_header_id|>\n' -%}
121
+ {{- tail -}}
122
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_sliding_window_pattern": 1,
3
+ "architectures": [
4
+ "Gemma3ForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "attn_logit_softcapping": null,
9
+ "bos_token_id": 2,
10
+ "cache_implementation": "hybrid",
11
+ "dtype": "float32",
12
+ "eos_token_id": 1,
13
+ "final_logit_softcapping": 30.0,
14
+ "head_dim": 128,
15
+ "hidden_act": "gelu_pytorch_tanh",
16
+ "hidden_activation": "gelu_pytorch_tanh",
17
+ "hidden_size": 4096,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 16384,
20
+ "layer_type": [
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention"
53
+ ],
54
+ "layer_types": [
55
+ "full_attention",
56
+ "full_attention",
57
+ "full_attention",
58
+ "full_attention",
59
+ "full_attention",
60
+ "full_attention",
61
+ "full_attention",
62
+ "full_attention",
63
+ "full_attention",
64
+ "full_attention",
65
+ "full_attention",
66
+ "full_attention",
67
+ "full_attention",
68
+ "full_attention",
69
+ "full_attention",
70
+ "full_attention",
71
+ "full_attention",
72
+ "full_attention",
73
+ "full_attention",
74
+ "full_attention",
75
+ "full_attention",
76
+ "full_attention",
77
+ "full_attention",
78
+ "full_attention",
79
+ "full_attention",
80
+ "full_attention",
81
+ "full_attention",
82
+ "full_attention",
83
+ "full_attention",
84
+ "full_attention",
85
+ "full_attention",
86
+ "full_attention"
87
+ ],
88
+ "max_position_embeddings": 32768,
89
+ "model_type": "gemma3_text",
90
+ "num_attention_heads": 32,
91
+ "num_hidden_layers": 32,
92
+ "num_key_value_heads": 8,
93
+ "pad_token_id": 0,
94
+ "query_pre_attn_scalar": 128,
95
+ "rms_norm_eps": 1e-06,
96
+ "rope_parameters": {
97
+ "full_attention": {
98
+ "attn_factor": 1.0,
99
+ "beta_fast": 64.0,
100
+ "beta_slow": 1.0,
101
+ "extrapolation_factor": 1.0,
102
+ "factor": 4.0,
103
+ "original_max_position_embeddings": 8192,
104
+ "rope_theta": 10000,
105
+ "rope_type": "yarn"
106
+ },
107
+ "rope_theta": null,
108
+ "rope_type": "default",
109
+ "sliding_attention": {
110
+ "rope_theta": 10000,
111
+ "rope_type": "default"
112
+ }
113
+ },
114
+ "sliding_window": 32768,
115
+ "sliding_window_pattern": 1,
116
+ "transformers_version": "5.0.0.dev0",
117
+ "use_bidirectional_attention": false,
118
+ "use_cache": true,
119
+ "vocab_size": 128256,
120
+ "transformers.js_config": {
121
+ "dtype": "q4f16",
122
+ "use_external_data_format": {
123
+ "model_fp16.onnx": 9,
124
+ "model_q4f16.onnx": 3
125
+ },
126
+ "kv_cache_dtype": {
127
+ "q4f16": "float16",
128
+ "fp16": "float16"
129
+ }
130
+ }
131
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 128000,
4
+ "cache_implementation": "hybrid",
5
+ "do_sample": true,
6
+ "eos_token_id": 128009,
7
+ "pad_token_id": 128001,
8
+ "temperature": 0.2,
9
+ "transformers_version": "5.0.0.dev0"
10
+ }
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6763481820c99f88b219ef8e6bce1db9929d108620a2a6437a926fdcdfebd384
3
+ size 504979
onnx/model_fp16.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35cfb38e236478aad1824c62d9dcc0fb88e851482e0b36cfdde20b42a2651b41
3
+ size 2082619392
onnx/model_fp16.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c31671ea730a7553f2ec672ea863d866227f67f6d1d2d28e60c1a024d0f83be
3
+ size 1980006400
onnx/model_fp16.onnx_data_2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88dba5de3c3e90bfa8493e06d94bc9ba1725f57418dbe0b57463f058bec599c9
3
+ size 2080636928
onnx/model_fp16.onnx_data_3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21825579d2392f30684a8f166073f41f1df008f5bfab996c0e3c9646153f47b9
3
+ size 2080636928
onnx/model_fp16.onnx_data_4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b94f1000656f3ab8c30cc896eda041621c0573173b147ebaf97ec00de622fec
3
+ size 2080669696
onnx/model_fp16.onnx_data_5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:952c3436cb035bf8de3077f47f27a44a0993e7425067b61b5795914d083b9af7
3
+ size 2030338048
onnx/model_fp16.onnx_data_6 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5fe38be50af847e1cf2a6037ea1a3cc6ac49a3f54674b7db2cbbdb90f9e527f
3
+ size 2080636928
onnx/model_fp16.onnx_data_7 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:137ef50635ea2e0f4549ca22100ea7a697a99ccc0829c358ffcdaa8c3f7bf581
3
+ size 2080636928
onnx/model_fp16.onnx_data_8 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96066570bc06cec1477ef769f6722868a5c5a405255faa9885a79a9e7840040d
3
+ size 134250496
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:707393551025902b9af273c226a40a6d4e084e175793cad3168cb2f6fe04087a
3
+ size 608779
onnx/model_q4f16.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5dec1d52dc1fa694905f49da2a5723990e79a614040df77343928381d7e60e79
3
+ size 2074628096
onnx/model_q4f16.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d12934aa9713e6520d9b3c89f4b2c2b8fa1d51e03acb0b1fbc4c03a6ef51b489
3
+ size 2091909120
onnx/model_q4f16.onnx_data_2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a4a03b201eaa920b6bb1c4d5fefc9b65f42f02a5e27101b922df808fa056102
3
+ size 423919616
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fcd228d2df6206bf4b2df4207937aed031cb659115a8af2cf65ca20a98343b0c
3
+ size 11574513
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": null,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|begin_of_text|>",
5
+ "clean_up_tokenization_spaces": true,
6
+ "eos_token": "<|end_of_text|>",
7
+ "is_local": false,
8
+ "model_input_names": [
9
+ "input_ids",
10
+ "attention_mask"
11
+ ],
12
+ "model_max_length": 1000000000000000019884624838656,
13
+ "model_specific_special_tokens": {},
14
+ "tokenizer_class": "TokenizersBackend",
15
+ "chat_template": "{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) -%}\n{%- set emit = namespace(started=false) -%}\n\n{# ---------- Build base system message (always emitted) ---------- #}\n{%- set base_system = 'You are rnj-1, a foundation model trained by Essential AI.\\n' -%}\n\n{# ---------- Optional tools preface as a synthetic system message ---------- #}\n{%- if tools %}\n {%- set sys_preamble -%}\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>\n{%- for tool in tools %}\n{{ \"\\n\" ~ (tool | tojson) }}\n{% 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>\n {%- endset -%}\n\n {# If the first user-provided message is system, include it above the tools preface #}\n {%- set combined_system = (messages and messages[0].role == 'system')\n and (messages[0].content is string) -%}\n {%- set sys_content = (combined_system and (messages[0].content ~ \"\\n\\n\" ~ sys_preamble)) or sys_preamble -%}\n\n {%- set content = '<|start_header_id|>system<|end_header_id|>\\n' ~ base_system ~ '\\n' ~ sys_content ~ '<|eot_id|>' -%}\n {%- if not emit.started -%}{%- set content = bos_token ~ content -%}{%- set emit.started = true -%}{%- endif -%}\n {{- content -}}\n{%- else %}\n {# No tools: always emit base_system, and include user's system message if present #}\n {%- set user_system_content = '' -%}\n {%- if messages and messages[0].role == 'system' and (messages[0].content is string) -%}\n {%- set user_system_content = '\\n' ~ messages[0].content -%}\n {%- endif -%}\n {%- set content = '<|start_header_id|>system<|end_header_id|>\\n' ~ base_system ~ user_system_content ~ '<|eot_id|>' -%}\n {%- if not emit.started -%}{%- set content = bos_token ~ content -%}{%- set emit.started = true -%}{%- endif -%}\n {{- content -}}\n{%- endif -%}\n\n{# ---------- Locate last user query for multi-step tool behavior ---------- #}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 -%}\n {%- if ns.multi_step_tool\n and message.role == \"user\"\n and message.content is string\n and not (message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) -%}\n {%- set ns.multi_step_tool = false -%}\n {%- set ns.last_query_index = index -%}\n {%- endif -%}\n{%- endfor -%}\n\n{# ---------- Walk all messages and emit in Llama-3 format ---------- #}\n{%- for message in messages %}\n {# normalize content #}\n {%- if message.content is string -%}\n {%- set content = message.content -%}\n {%- else -%}\n {%- set content = '' -%}\n {%- endif -%}\n\n {# --- user/system (non-initial system already handled above) --- #}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) -%}\n {%- set block = '<|start_header_id|>' ~ message.role ~ '<|end_header_id|>\\n' ~ content ~ '<|eot_id|>' -%}\n {%- if not emit.started -%}{%- set block = bos_token ~ block -%}{%- set emit.started = true -%}{%- endif -%}\n {{- block -}}\n\n {# --- assistant --- #}\n {%- elif message.role == \"assistant\" -%}\n \n {%- set body = content -%}\n {%- set header = '<|start_header_id|>assistant<|end_header_id|>\\n' -%}\n {%- if not emit.started -%}{{ bos_token }}{%- set emit.started = true -%}{%- endif -%}\n {{- header -}}\n {% generation %}\n {{- body -}}\n {%- if message.tool_calls -%}\n {%- for tool_call in message.tool_calls -%}\n {%- if tool_call.function -%}{%- set tc = tool_call.function -%}{%- else -%}{%- set tc = tool_call -%}{%- endif -%}\n {%- set args_json = (tc.arguments if (tc.arguments is string) else (tc.arguments | tojson)) -%}\n {%- if loop.first -%}\n {{- '<tool_call>\\n{\"name\": \"' ~ tc.name ~ '\", \"arguments\": ' ~ args_json ~ '}\\n</tool_call>' -}}\n {%- else -%}\n {{- '\\n<tool_call>\\n{\"name\": \"' ~ tc.name ~ '\", \"arguments\": ' ~ args_json ~ '}\\n</tool_call>' -}}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {{- '<|eot_id|>' -}}{%- endgeneration -%}\n {# --- tool messages are wrapped as synthetic user messages with <tool_response> --- #}\n {%- elif message.role == \"tool\" -%}\n {%- set open_user = (loop.first or (loop.index0 > 0 and messages[loop.index0 - 1].role != \"tool\")) -%}\n {%- set close_user = (loop.last or (loop.index0 < messages|length - 1 and messages[loop.index0 + 1].role != \"tool\")) -%}\n\n {%- if open_user -%}\n {%- set header = '<|start_header_id|>user<|end_header_id|>\\n' -%}\n {%- if not emit.started -%}{%- set header = bos_token ~ header -%}{%- set emit.started = true -%}{%- endif -%}\n {{- header -}}\n {%- endif -%}\n {%- if open_user -%}\n {{- '<tool_response>\\n' -}}\n {%- else -%}\n {{- '\\n<tool_response>\\n' -}}\n {%- endif -%}\n {{- content -}}\n {{- '\\n</tool_response>' -}}\n\n {%- if close_user -%}\n {{- '<|eot_id|>' -}}\n {%- endif -%}\n {%- endif -%}\n{%- endfor -%}\n\n{# ---------- Add generation prompt header for the model to continue ---------- #}\n{%- if add_generation_prompt -%}\n {%- set tail = '<|start_header_id|>assistant<|end_header_id|>\\n' -%}\n {{- tail -}}\n{%- endif -%}"
16
+ }