weirek commited on
Commit
bfe2a90
·
verified ·
1 Parent(s): b21f441

Upload folder using huggingface_hub

Browse files
chat_template.jinja CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  {%- if tools %}
2
  {{- '<|im_start|>system\n' }}
3
  {%- if messages[0].role == 'system' %}
@@ -14,14 +20,6 @@
14
  {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
  {%- endif %}
16
  {%- endif %}
17
- {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
- {%- for message in messages[::-1] %}
19
- {%- set index = (messages|length - 1) - loop.index0 %}
20
- {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
- {%- set ns.multi_step_tool = false %}
22
- {%- set ns.last_query_index = index %}
23
- {%- endif %}
24
- {%- endfor %}
25
  {%- for message in messages %}
26
  {%- if message.content is string %}
27
  {%- set content = message.content %}
@@ -31,6 +29,7 @@
31
  {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
  {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
  {%- elif message.role == "assistant" %}
 
34
  {%- set reasoning_content = '' %}
35
  {%- if message.reasoning_content is string %}
36
  {%- set reasoning_content = message.reasoning_content %}
@@ -40,14 +39,13 @@
40
  {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
  {%- endif %}
42
  {%- endif %}
43
- {%- if loop.index0 > ns.last_query_index %}
44
- {%- if loop.last or (not loop.last and reasoning_content) %}
45
- {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
- {%- else %}
47
- {{- '<|im_start|>' + message.role + '\n' + content }}
48
- {%- endif %}
49
  {%- else %}
50
- {{- '<|im_start|>' + message.role + '\n' + content }}
51
  {%- endif %}
52
  {%- if message.tool_calls %}
53
  {%- for tool_call in message.tool_calls %}
@@ -68,7 +66,36 @@
68
  {{- '}\n</tool_call>' }}
69
  {%- endfor %}
70
  {%- endif %}
71
- {{- '<|im_end|>\n' }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  {%- elif message.role == "tool" %}
73
  {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
  {{- '<|im_start|>user' }}
 
1
+ {%- set ns = namespace(last_query_index=-1) %}
2
+ {%- for message in messages %}
3
+ {%- if message.role == "user" %}
4
+ {%- set ns.last_query_index = loop.index0 %}
5
+ {%- endif %}
6
+ {%- endfor %}
7
  {%- if tools %}
8
  {{- '<|im_start|>system\n' }}
9
  {%- if messages[0].role == 'system' %}
 
20
  {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
21
  {%- endif %}
22
  {%- endif %}
 
 
 
 
 
 
 
 
23
  {%- for message in messages %}
24
  {%- if message.content is string %}
25
  {%- set content = message.content %}
 
29
  {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
30
  {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
31
  {%- elif message.role == "assistant" %}
32
+ {%- set has_loss = (message.loss is defined and message.loss) %}
33
  {%- set reasoning_content = '' %}
34
  {%- if message.reasoning_content is string %}
35
  {%- set reasoning_content = message.reasoning_content %}
 
39
  {%- set content = content.split('</think>')[-1].lstrip('\n') %}
40
  {%- endif %}
41
  {%- endif %}
42
+ {{- '<|im_start|>' + message.role + '\n' }}
43
+ {%- if has_loss -%}
44
+ {%- generation -%}
45
+ {%- if loop.index0 > ns.last_query_index and reasoning_content %}
46
+ {{- '<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
 
47
  {%- else %}
48
+ {{- content }}
49
  {%- endif %}
50
  {%- if message.tool_calls %}
51
  {%- for tool_call in message.tool_calls %}
 
66
  {{- '}\n</tool_call>' }}
67
  {%- endfor %}
68
  {%- endif %}
69
+ {{- '<|im_end|>' }}
70
+ {%- endgeneration -%}
71
+ {{- '\n' }}
72
+ {%- else -%}
73
+ {%- if loop.index0 > ns.last_query_index and reasoning_content %}
74
+ {{- '<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
75
+ {%- else %}
76
+ {{- content }}
77
+ {%- endif %}
78
+ {%- if message.tool_calls %}
79
+ {%- for tool_call in message.tool_calls %}
80
+ {%- if (loop.first and content) or (not loop.first) %}
81
+ {{- '\n' }}
82
+ {%- endif %}
83
+ {%- if tool_call.function %}
84
+ {%- set tool_call = tool_call.function %}
85
+ {%- endif %}
86
+ {{- '<tool_call>\n{"name": "' }}
87
+ {{- tool_call.name }}
88
+ {{- '", "arguments": ' }}
89
+ {%- if tool_call.arguments is string %}
90
+ {{- tool_call.arguments }}
91
+ {%- else %}
92
+ {{- tool_call.arguments | tojson }}
93
+ {%- endif %}
94
+ {{- '}\n</tool_call>' }}
95
+ {%- endfor %}
96
+ {%- endif %}
97
+ {{- '<|im_end|>\n' }}
98
+ {%- endif %}
99
  {%- elif message.role == "tool" %}
100
  {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
101
  {{- '<|im_start|>user' }}
config.json CHANGED
@@ -4,7 +4,7 @@
4
  ],
5
  "attention_bias": false,
6
  "attention_dropout": 0.0,
7
- "dtype": "bfloat16",
8
  "eos_token_id": 151645,
9
  "head_dim": 128,
10
  "hidden_act": "silu",
@@ -61,7 +61,7 @@
61
  "rope_theta": 5000000,
62
  "sliding_window": null,
63
  "tie_word_embeddings": true,
64
- "transformers_version": "4.57.3",
65
  "use_cache": false,
66
  "use_sliding_window": false,
67
  "vocab_size": 151936
 
4
  ],
5
  "attention_bias": false,
6
  "attention_dropout": 0.0,
7
+ "dtype": "float16",
8
  "eos_token_id": 151645,
9
  "head_dim": 128,
10
  "hidden_act": "silu",
 
61
  "rope_theta": 5000000,
62
  "sliding_window": null,
63
  "tie_word_embeddings": true,
64
+ "transformers_version": "4.57.0",
65
  "use_cache": false,
66
  "use_sliding_window": false,
67
  "vocab_size": 151936
generation_config.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "bos_token_id": 151643,
3
  "do_sample": true,
4
  "eos_token_id": [
5
  151645,
@@ -9,5 +8,5 @@
9
  "temperature": 0.6,
10
  "top_k": 20,
11
  "top_p": 0.95,
12
- "transformers_version": "4.57.3"
13
  }
 
1
  {
 
2
  "do_sample": true,
3
  "eos_token_id": [
4
  151645,
 
8
  "temperature": 0.6,
9
  "top_k": 20,
10
  "top_p": 0.95,
11
+ "transformers_version": "4.57.0"
12
  }
model-00001-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5f26aa3025f9a60ace7731686b8831c31c4fe3f54e0813ea8d66c9a60f1da6b4
3
- size 4967215360
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3c5db77811b8589fd38083698a67fcf1ff2fd0185615abba0bafd5b5e780967
3
+ size 4967215128
model-00002-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a02958bf90d29aea7199274b8316ea8e7048a8818fd06ce038833620442f078e
3
- size 3077766632
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b33664f773d813a7858d7cc934f6a3055a2cf8733d1c59adcae90792305e740
3
+ size 3077766464