hf-transformers-bot commited on
Commit
6696a6b
·
verified ·
1 Parent(s): 3eed221

Update tiny models for ExaoneMoeModel

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% set image_count = namespace(value=0) %}
2
+ {% set video_count = namespace(value=0) %}
3
+
4
+ {%- set role_indicators = {
5
+ 'user': '<|user|>\n',
6
+ 'assistant': '<|assistant|>\n',
7
+ 'system': '<|system|>\n',
8
+ 'tool': '<|tool|>\n',
9
+ 'tool_declare': '<|tool_declare|>\n'
10
+ } %}
11
+ {%- set end_of_turn = '<|endofturn|>\n' %}
12
+
13
+
14
+ {%- macro declare_available_tools(tools) %}
15
+ {{- "# Tools" }}
16
+ {{- "\n" }}
17
+ {%- for tool in tools %}
18
+ {{- "<tool>" }}
19
+ {{- tool | tojson(ensure_ascii=False) | safe }}
20
+ {{- "</tool>\n" }}
21
+ {%- endfor %}
22
+ {%- endmacro %}
23
+
24
+
25
+ {%- set ns = namespace(last_query_index = messages|length - 1, last_query_index_not_yet_determined = true) %}
26
+ {%- for message in messages[::-1] %}
27
+ {%- set index = (messages|length - 1) - loop.index0 %}
28
+ {%- if ns.last_query_index_not_yet_determined and message.role == "user" and message.content is string %}
29
+ {%- set ns.last_query_index = index -%}
30
+ {%- set ns.last_query_index_not_yet_determined = false -%}
31
+ {%- endif %}
32
+ {%- endfor %}
33
+
34
+ {%- if tools is defined and tools %}
35
+ {{- role_indicators['tool_declare'] }}
36
+ {{- declare_available_tools(tools) }}
37
+ {{- end_of_turn -}}
38
+ {%- endif %}
39
+
40
+ {%- for i in range(messages | length) %}
41
+ {%- set msg = messages[i] %}
42
+ {%- set role = msg.role %}
43
+ {%- if role not in role_indicators %}
44
+ {{- raise_exception('Unknown role: ' ~ role) }}
45
+ {%- endif %}
46
+
47
+ {%- if i == 0 %}
48
+ {%- if role == 'system' %}
49
+ {{- role_indicators['system'] }}
50
+ {{- msg.content }}
51
+ {{- end_of_turn -}}
52
+ {%- continue %}
53
+ {%- endif %}
54
+ {%- endif %}
55
+
56
+ {%- if role == 'assistant' %}
57
+ {{- role_indicators['assistant'] }}
58
+
59
+ {%- set content = (msg.content if (msg.content is defined and msg.content) else "") -%}
60
+ {%- set reasoning = none -%}
61
+
62
+ {%- if msg.reasoning_content is defined and msg.reasoning_content%}
63
+ {%- set reasoning = msg.reasoning_content.strip() -%}
64
+ {%- elif content and "</think>" in content %}
65
+ {%- set _parts = content.split('</think>') -%}
66
+ {%- set reasoning = _parts[0].lstrip('<think>').strip() -%}
67
+ {%- set content = _parts[-1].strip() -%}
68
+ {%- endif %}
69
+
70
+ {%- if not (reasoning and i > ns.last_query_index) or (skip_think is defined and skip_think) %}
71
+ {%- set reasoning = none %}
72
+ {%- endif %}
73
+
74
+ {%- set content = content.strip() -%}
75
+
76
+ {{- "<think>\n" }}
77
+ {{- (reasoning if reasoning is not none else "") }}
78
+ {{- "\n</think>\n\n" }}
79
+
80
+ {{- content }}
81
+
82
+ {%- if msg.tool_calls %}
83
+ {%- if content is defined and content %}
84
+ {{- "\n" }}
85
+ {%- endif %}
86
+ {%- for tool_call in msg.tool_calls %}
87
+ {%- if tool_call.function is defined %}
88
+ {%- set tool_call = tool_call.function %}
89
+ {%- endif %}
90
+
91
+ {%- if tool_call.arguments is defined %}
92
+ {%- set arguments = tool_call.arguments %}
93
+ {%- elif tool_call.parameters is defined %}
94
+ {%- set arguments = tool_call.parameters %}
95
+ {%- else %}
96
+ {{- raise_exception('arguments or parameters are mandatory: ' ~ tool_call) }}
97
+ {%- endif %}
98
+ {%- if arguments is string %}
99
+ {{- "<tool_call>" }}{"name": "{{- tool_call.name }}", "arguments": {{ arguments }}}{{- "</tool_call>" }}
100
+ {%- else %}
101
+ {{- "<tool_call>" }}{"name": "{{- tool_call.name }}", "arguments": {{ arguments | tojson(ensure_ascii=False) | safe }}}{{- "</tool_call>" }}
102
+ {%- endif %}
103
+ {%- if not loop.last %}
104
+ {{- "\n" }}
105
+ {%- endif %}
106
+
107
+ {%- endfor %}
108
+ {%- endif %}
109
+ {{- end_of_turn -}}
110
+
111
+ {%- elif role == "tool" %}
112
+ {%- if i == 0 or messages[i - 1].role != "tool" %}
113
+ {{- role_indicators['tool'] }}
114
+ {%- endif %}
115
+ {%- if msg.content is defined %}
116
+ {%- if msg.content is string %}
117
+ {{- "<tool_result>" }}{{ msg.content }}{{- "</tool_result>" }}
118
+ {%- else %}
119
+ {{- "<tool_result>" }}{{ msg.content | tojson(ensure_ascii=False) | safe }}{{- "</tool_result>" }}
120
+ {%- endif %}
121
+ {%- endif %}
122
+ {%- if loop.last or messages[i + 1].role != "tool" %}
123
+ {{- end_of_turn -}}
124
+ {%- else %}
125
+ {{- "\n" }}
126
+ {%- endif %}
127
+
128
+ {%- else %}
129
+ {{- role_indicators[role] }}
130
+ {%- if msg.content is string %}
131
+ {{- msg.content }}
132
+ {%- else %}
133
+ {%- for content in msg.content %}
134
+ {%- if content.type == 'image' %}
135
+ {%- set image_count.value = image_count.value + 1 %}
136
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<vision><image_pad></vision>
137
+ {%- elif content.type == 'video' %}
138
+ {%- set video_count.value = video_count.value + 1 %}
139
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif %}<vision><video_pad></vision>
140
+ {%- elif content.type == 'text' %}
141
+ {{- content.text }}
142
+ {%- else %}
143
+ {{- content.text }}
144
+ {%- endif %}
145
+ {%- endfor %}
146
+ {%- endif %}
147
+ {{- end_of_turn -}}
148
+ {%- endif %}
149
+ {% endfor %}
150
+
151
+
152
+ {%- if add_generation_prompt %}
153
+ {{- role_indicators['assistant'] }}
154
+ {%- if enable_thinking is not defined or enable_thinking is true %}
155
+ {{- "<think>\n" }}
156
+ {%- else %}
157
+ {{- "<think>\n\n</think>\n\n" }}
158
+ {%- endif %}
159
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ExaoneMoeModel"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 1,
7
+ "dtype": "float32",
8
+ "eos_token_id": 53,
9
+ "first_k_dense_replace": 1,
10
+ "hidden_act": "gelu",
11
+ "hidden_size": 32,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 32,
14
+ "layer_types": [
15
+ "sliding_attention",
16
+ "sliding_attention"
17
+ ],
18
+ "max_position_embeddings": 512,
19
+ "mlp_layer_types": [
20
+ "dense",
21
+ "sparse"
22
+ ],
23
+ "model_type": "exaone_moe",
24
+ "moe_intermediate_size": 16,
25
+ "n_group": 1,
26
+ "norm_topk_prob": true,
27
+ "num_attention_heads": 2,
28
+ "num_experts": 8,
29
+ "num_experts_per_tok": 2,
30
+ "num_hidden_layers": 2,
31
+ "num_key_value_heads": 2,
32
+ "num_shared_experts": 1,
33
+ "pad_token_id": 0,
34
+ "rms_norm_eps": 1e-05,
35
+ "rope_parameters": {
36
+ "rope_theta": 10000.0,
37
+ "rope_type": "default"
38
+ },
39
+ "routed_scaling_factor": 2.5,
40
+ "sliding_window": 4096,
41
+ "sliding_window_pattern": 4,
42
+ "tie_word_embeddings": false,
43
+ "topk_group": 1,
44
+ "transformers_version": "5.16.0.dev0",
45
+ "use_cache": true,
46
+ "vocab_size": 153600
47
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0888255b35f48e684317e7c4b9ec949cff87283eefe667f21ce12de2363e00c
3
+ size 19768360
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85dafb02b2f8e046217704bc847a380d48e46ff39fb05c7461f38f9fc48f7b6d
3
+ size 12160223
tokenizer_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "[BOS]",
4
+ "clean_up_tokenization_spaces": false,
5
+ "eos_token": "<|endofturn|>",
6
+ "errors": "replace",
7
+ "is_local": true,
8
+ "local_files_only": false,
9
+ "model_input_names": [
10
+ "input_ids",
11
+ "attention_mask"
12
+ ],
13
+ "model_max_length": 512,
14
+ "pad_token": "[PAD]",
15
+ "padding_side": "right",
16
+ "split_special_tokens": false,
17
+ "tokenizer_class": "TokenizersBackend",
18
+ "unk_token": "[UNK]"
19
+ }