hf-transformers-bot commited on
Commit
3d0fa65
·
verified ·
1 Parent(s): 75d3f1e

Update tiny models for Exaone4ForTokenClassification

Browse files
Files changed (5) hide show
  1. chat_template.jinja +146 -0
  2. config.json +34 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
  5. tokenizer_config.json +16 -0
chat_template.jinja ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if not skip_think is defined %}
2
+ {%- set skip_think = true %}
3
+ {%- endif %}
4
+
5
+ {%- set role_indicators = {
6
+ 'user': '[|user|]\n',
7
+ 'assistant': '[|assistant|]\n',
8
+ 'system': '[|system|]\n',
9
+ 'tool': '[|tool|]\n'
10
+ } %}
11
+ {%- set end_of_turn = '[|endofturn|]\n' %}
12
+
13
+
14
+ {%- macro available_tools(tools) %}
15
+ {{- "# Available Tools" }}
16
+ {{- "\nYou can use none, one, or multiple of the following tools by calling them as functions to help with the user’s query." }}
17
+ {{- "\nHere are the tools available to you in JSON format within <tool> and </tool> tags:\n" }}
18
+ {%- for tool in tools %}
19
+ {{- "<tool>" }}
20
+ {{- tool | tojson(ensure_ascii=False) | safe }}
21
+ {{- "</tool>\n" }}
22
+ {%- endfor %}
23
+
24
+ {{- "\nFor each function call you want to make, return a JSON object with function name and arguments within <tool_call> and </tool_call> tags, like:" }}
25
+ {{- "\n<tool_call>{\"name\": function_1_name, \"arguments\": {argument_1_name: argument_1_value, argument_2_name: argument_2_value}}</tool_call>" }}
26
+ {{- "\n<tool_call>{\"name\": function_2_name, \"arguments\": {...}}</tool_call>\n..." }}
27
+ {{- "\nNote that if no argument name is specified for a tool, you can just print the argument value directly, without the argument name or JSON formatting." }}
28
+ {%- endmacro %}
29
+
30
+
31
+ {%- set ns = namespace(last_query_index = messages|length - 1) %}
32
+ {%- for message in messages %}
33
+ {%- if message.role == "user" and message.content is string %}
34
+ {%- set ns.last_query_index = loop.index0 -%}
35
+ {%- endif %}
36
+ {%- endfor %}
37
+
38
+ {%- for i in range(messages | length) %}
39
+ {%- set msg = messages[i] %}
40
+ {%- set role = msg.role %}
41
+ {%- if role not in role_indicators %}
42
+ {{- raise_exception('Unknown role: ' ~ role) }}
43
+ {%- endif %}
44
+
45
+ {%- if i == 0 %}
46
+ {%- if role == 'system' %}
47
+ {{- role_indicators['system'] }}
48
+ {{- msg.content }}
49
+ {%- if tools is defined and tools %}
50
+ {{- "\n\n" }}{{- available_tools(tools) }}
51
+ {%- endif %}
52
+ {{- end_of_turn -}}
53
+ {%- continue %}
54
+ {%- elif tools is defined and tools %}
55
+ {{- role_indicators['system'] }}
56
+ {{- available_tools(tools) }}
57
+ {{- end_of_turn -}}
58
+ {%- endif %}
59
+ {%- endif %}
60
+
61
+ {%- if role == 'assistant' %}
62
+ {{- role_indicators['assistant'] }}
63
+
64
+ {%- if msg.content %}
65
+ {%- if "</think>" in msg.content %}
66
+ {%- set content = msg.content.split('</think>')[-1].strip() %}
67
+ {%- set reasoning_content = msg.content.split('</think>')[0].strip() %}
68
+ {%- if reasoning_content.startswith("<think>") %}
69
+ {%- set reasoning_content = reasoning_content[9:].strip() %}
70
+ {%- endif %}
71
+ {%- else %}
72
+ {%- set content = msg.content %}
73
+ {%- endif %}
74
+
75
+ {%- if msg.reasoning_content %}
76
+ {%- set reasoning_content = msg.reasoning_content %}
77
+ {%- endif %}
78
+
79
+ {%- if (not skip_think and loop.last) and reasoning_content is defined %}
80
+ {{- "<think>\n" }}
81
+ {{- reasoning_content}}
82
+ {{- "\n</think>\n\n" }}
83
+ {%- else %}
84
+ {{- "<think>\n\n</think>\n\n" }}
85
+ {%- endif %}
86
+ {{- content }}
87
+ {%- endif %}
88
+
89
+ {%- if msg.tool_calls %}
90
+ {%- if msg.content %}
91
+ {{- "\n" }}
92
+ {%- else %}
93
+ {{- "<think>\n\n</think>\n\n" }}
94
+ {%- endif %}
95
+ {%- for tool_call in msg.tool_calls %}
96
+ {%- if tool_call.function is defined %}
97
+ {%- set tool_call = tool_call.function %}
98
+ {%- endif %}
99
+
100
+ {%- if tool_call.arguments is defined %}
101
+ {%- set arguments = tool_call.arguments %}
102
+ {%- elif tool_call.parameters is defined %}
103
+ {%- set arguments = tool_call.parameters %}
104
+ {%- else %}
105
+ {{- raise_exception('arguments or parameters are mandatory: ' ~ tool_call) }}
106
+ {%- endif %}
107
+
108
+ {{- "<tool_call>" }}{"name": "{{- tool_call.name }}", "arguments": {{ arguments | tojson(ensure_ascii=False) | safe }}}{{- "</tool_call>" }}
109
+
110
+ {%- if not loop.last %}
111
+ {{- "\n" }}
112
+ {%- endif %}
113
+
114
+ {%- endfor %}
115
+ {%- endif %}
116
+ {{- end_of_turn -}}
117
+
118
+ {%- elif role == "tool" %}
119
+ {%- if i == 0 or messages[i - 1].role != "tool" %}
120
+ {{- role_indicators['tool'] }}
121
+ {%- endif %}
122
+ {%- if msg.content is defined %}
123
+ {{- "<tool_result>" }}{"result": {{ msg.content | tojson(ensure_ascii=False) | safe }}}{{- "</tool_result>" }}
124
+ {%- endif %}
125
+ {%- if loop.last or messages[i + 1].role != "tool" %}
126
+ {{- end_of_turn -}}
127
+ {%- else %}
128
+ {{- "\n" }}
129
+ {%- endif %}
130
+
131
+ {%- else %}
132
+ {{- role_indicators[role] }}
133
+ {{- msg.content }}
134
+ {{- end_of_turn -}}
135
+ {%- endif %}
136
+ {% endfor %}
137
+
138
+
139
+ {%- if add_generation_prompt %}
140
+ {{- role_indicators['assistant'] }}
141
+ {%- if enable_thinking is defined and enable_thinking is true %}
142
+ {{- "<think>\n" }}
143
+ {%- else %}
144
+ {{- "<think>\n\n</think>\n\n" }}
145
+ {%- endif %}
146
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Exaone4ForTokenClassification"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 1,
7
+ "dtype": "float32",
8
+ "eos_token_id": 361,
9
+ "hidden_act": "gelu",
10
+ "hidden_size": 32,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 32,
13
+ "layer_types": [
14
+ "sliding_attention",
15
+ "sliding_attention"
16
+ ],
17
+ "max_position_embeddings": 512,
18
+ "model_type": "exaone4",
19
+ "num_attention_heads": 2,
20
+ "num_hidden_layers": 2,
21
+ "num_key_value_heads": 2,
22
+ "pad_token_id": 0,
23
+ "rms_norm_eps": 1e-05,
24
+ "rope_parameters": {
25
+ "rope_theta": 10000.0,
26
+ "rope_type": "default"
27
+ },
28
+ "sliding_window": 4096,
29
+ "sliding_window_pattern": 4,
30
+ "tie_word_embeddings": false,
31
+ "transformers_version": "5.16.0.dev0",
32
+ "use_cache": true,
33
+ "vocab_size": 102400
34
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30a5535430cad4ce4417ff4aaf599370a22183c6920c19b79398a23444363932
3
+ size 13168448
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "[BOS]",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "[|endofturn|]",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 512,
11
+ "pad_token": "[PAD]",
12
+ "padding_side": "right",
13
+ "split_special_tokens": false,
14
+ "tokenizer_class": "GPT2Tokenizer",
15
+ "unk_token": "[UNK]"
16
+ }