weirek commited on
Commit
a4d5b57
·
verified ·
1 Parent(s): 42b9d69

Upload folder using huggingface_hub

Browse files
chat_template.jinja CHANGED
@@ -14,37 +14,22 @@
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 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.role == "user") or (message.role == "system" and not loop.first) %}
27
- {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
  {%- elif message.role == "assistant" %}
29
- {%- set content = message.content %}
30
- {%- set reasoning_content = '' %}
31
- {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
- {%- set reasoning_content = message.reasoning_content %}
33
- {%- else %}
34
- {%- if '</think>' in message.content %}
35
- {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
- {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
- {%- endif %}
38
- {%- endif %}
39
- {%- if loop.index0 > ns.last_query_index %}
40
- {%- if loop.last or (not loop.last and reasoning_content) %}
41
- {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
- {%- else %}
43
- {{- '<|im_start|>' + message.role + '\n' + content }}
44
- {%- endif %}
45
- {%- else %}
46
- {{- '<|im_start|>' + message.role + '\n' + content }}
47
- {%- endif %}
48
  {%- if message.tool_calls %}
49
  {%- for tool_call in message.tool_calls %}
50
  {%- if (loop.first and content) or (not loop.first) %}
@@ -65,12 +50,36 @@
65
  {%- endfor %}
66
  {%- endif %}
67
  {{- '<|im_end|>\n' }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  {%- elif message.role == "tool" %}
69
  {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
  {{- '<|im_start|>user' }}
71
  {%- endif %}
72
  {{- '\n<tool_response>\n' }}
73
- {{- message.content }}
74
  {{- '\n</tool_response>' }}
75
  {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
  {{- '<|im_end|>\n' }}
@@ -79,9 +88,4 @@
79
  {%- endfor %}
80
  {%- if add_generation_prompt %}
81
  {{- '<|im_start|>assistant\n' }}
82
- {%- if enable_thinking is defined and enable_thinking is false %}
83
- {{- '<think>\n\n</think>\n\n' }}
84
- {%- else %}
85
- {{- '<think>\n\n' }}
86
- {%- endif %}
87
- {%- endif %}
 
14
  {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
  {%- endif %}
16
  {%- endif %}
 
 
 
 
 
 
 
 
17
  {%- for message in messages %}
18
+ {%- if message.content is string %}
19
+ {%- set content = message.content %}
20
+ {%- else %}
21
+ {%- set content = '' %}
22
+ {%- endif %}
23
  {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
24
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
25
  {%- elif message.role == "assistant" %}
26
+
27
+ {%- set has_loss = (message.loss is defined and message.loss) %}
28
+
29
+ {{- '<|im_start|>' + message.role + '\n' }}
30
+ {%- if has_loss -%}
31
+ {%- generation -%}
32
+ {{- content }}
 
 
 
 
 
 
 
 
 
 
 
 
33
  {%- if message.tool_calls %}
34
  {%- for tool_call in message.tool_calls %}
35
  {%- if (loop.first and content) or (not loop.first) %}
 
50
  {%- endfor %}
51
  {%- endif %}
52
  {{- '<|im_end|>\n' }}
53
+ {%- endgeneration -%}
54
+ {%- else -%}
55
+ {{- content }}
56
+ {%- if message.tool_calls %}
57
+ {%- for tool_call in message.tool_calls %}
58
+ {%- if (loop.first and content) or (not loop.first) %}
59
+ {{- '\n' }}
60
+ {%- endif %}
61
+ {%- if tool_call.function %}
62
+ {%- set tool_call = tool_call.function %}
63
+ {%- endif %}
64
+ {{- '<tool_call>\n{"name": "' }}
65
+ {{- tool_call.name }}
66
+ {{- '", "arguments": ' }}
67
+ {%- if tool_call.arguments is string %}
68
+ {{- tool_call.arguments }}
69
+ {%- else %}
70
+ {{- tool_call.arguments | tojson }}
71
+ {%- endif %}
72
+ {{- '}\n</tool_call>' }}
73
+ {%- endfor %}
74
+ {%- endif %}
75
+ {{- '<|im_end|>\n' }}
76
+ {%- endif %}
77
  {%- elif message.role == "tool" %}
78
  {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
79
  {{- '<|im_start|>user' }}
80
  {%- endif %}
81
  {{- '\n<tool_response>\n' }}
82
+ {{- content }}
83
  {{- '\n</tool_response>' }}
84
  {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
85
  {{- '<|im_end|>\n' }}
 
88
  {%- endfor %}
89
  {%- if add_generation_prompt %}
90
  {{- '<|im_start|>assistant\n' }}
91
+ {%- endif %}
 
 
 
 
 
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",
 
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",
model-00001-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:330fa7edeca0ffb7f65d0fbe81ca7c0618053789a5a5213793de883ba1b1e0a6
3
- size 4967215360
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db2cf6dd196ac1267f7efadef98fc3bc04b55313a75296a3c0b7ce4c1987f178
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:819fc5f29045157b2fcf27559b917da2b676ee2092eef782bba3493e1e9632b8
3
- size 3077766632
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d59fd2f4b68ae063a8b889ae7a682782ecfd3cb67c4917e2b9dfc6b9d501d3e1
3
+ size 3077766464