sanjeevnv commited on
Commit
f7cf24e
·
verified ·
1 Parent(s): dbc4c29

Upload tokenizer

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
README.md ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags: []
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+ This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
additional_chat_templates/posttraining.jinja ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% macro render_extra_keys(json_dict, handled_keys) %}
2
+ {%- if json_dict is mapping %}
3
+ {%- for json_key in json_dict if json_key not in handled_keys %}
4
+ {%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
5
+ {{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' }}
6
+ {%- else %}
7
+ {{-'\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
8
+ {%- endif %}
9
+ {%- endfor %}
10
+ {%- endif %}
11
+ {% endmacro %}
12
+ {%- set kw = chat_template_kwargs if chat_template_kwargs is defined else {} %}
13
+ {%- set enable_thinking = kw.enable_thinking if kw.enable_thinking is defined else True %}
14
+ {%- set reasoning_budget = kw.reasoning_budget if kw.reasoning_budget is defined else None %}
15
+ {%- set truncate_history_thinking = kw.truncate_history_thinking if kw.truncate_history_thinking is defined else True %}
16
+ {%- set response_format = kw.response_format if kw.response_format is defined else None %}
17
+
18
+ {%- set ns = namespace(last_user_idx = -1) %}
19
+ {%- set loop_messages = messages %}
20
+ {%- for m in loop_messages %}
21
+ {%- if m["role"] == "user" %}
22
+ {%- set ns.last_user_idx = loop.index0 %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+
26
+ {%- if messages[0]["role"] == "system" %}
27
+ {%- set system_message = messages[0]["content"] %}
28
+ {%- set loop_messages = messages[1:] %}
29
+ {%- else %}
30
+ {%- set system_message = "" %}
31
+ {%- set loop_messages = messages %}
32
+ {%- endif %}
33
+ {%- if not tools is defined %}
34
+ {%- set tools = [] %}
35
+ {%- endif %}
36
+ {# Recompute last_user_idx relative to loop_messages after handling system #}
37
+ {%- set ns = namespace(last_user_idx = -1) %}
38
+ {%- for m in loop_messages %}
39
+ {%- if m["role"] == "user" %}
40
+ {%- set ns.last_user_idx = loop.index0 %}
41
+ {%- endif %}
42
+ {%- endfor %}
43
+ {%- if system_message is defined %}
44
+ {{- "<|im_start|>system\n" + system_message }}
45
+ {%- else %}
46
+ {%- if tools is iterable and tools | length > 0 %}
47
+ {{- "<|im_start|>system\n" }}
48
+ {%- endif %}
49
+ {%- endif %}
50
+ {%- if tools is iterable and tools | length > 0 %}
51
+ {%- if system_message is defined and system_message | length > 0 %}
52
+ {{- "\n\n" }}
53
+ {%- endif %}
54
+ {{- "# Tools\n\nYou have access to the following functions:\n\n" }}
55
+ {{- "<tools>" }}
56
+ {%- for tool in tools %}
57
+ {%- if tool.function is defined %}
58
+ {%- set tool = tool.function %}
59
+ {%- endif %}
60
+ {{- "\n<function>\n<name>" ~ tool.name ~ "</name>" }}
61
+ {%- if tool.description is defined %}
62
+ {{- '\n<description>' ~ (tool.description | trim) ~ '</description>' }}
63
+ {%- endif %}
64
+ {{- '\n<parameters>' }}
65
+ {%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}
66
+ {%- for param_name, param_fields in tool.parameters.properties|items %}
67
+ {{- '\n<parameter>' }}
68
+ {{- '\n<name>' ~ param_name ~ '</name>' }}
69
+ {%- if param_fields.type is defined %}
70
+ {{- '\n<type>' ~ (param_fields.type | string) ~ '</type>' }}
71
+ {%- endif %}
72
+ {%- if param_fields.description is defined %}
73
+ {{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}
74
+ {%- endif %}
75
+ {%- if param_fields.enum is defined %}
76
+ {{- '\n<enum>' ~ (param_fields.enum | tojson | safe) ~ '</enum>' }}
77
+ {%- endif %}
78
+ {%- set handled_keys = ['name', 'type', 'description', 'enum'] %}
79
+ {{- render_extra_keys(param_fields, handled_keys) }}
80
+ {{- '\n</parameter>' }}
81
+ {%- endfor %}
82
+ {%- endif %}
83
+ {% set handled_keys = ['type', 'properties', 'required'] %}
84
+ {{- render_extra_keys(tool.parameters, handled_keys) }}
85
+ {%- if tool.parameters is defined and tool.parameters.required is defined %}
86
+ {{- '\n<required>' ~ (tool.parameters.required | tojson | safe) ~ '</required>' }}
87
+ {%- endif %}
88
+ {{- '\n</parameters>' }}
89
+ {%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
90
+ {{- render_extra_keys(tool, handled_keys) }}
91
+ {{- '\n</function>' }}
92
+ {%- endfor %}
93
+ {{- "\n</tools>" }}
94
+
95
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
96
+ {%- endif %}
97
+
98
+
99
+ {%- if system_message is defined %}
100
+ {{- '<|im_end|>\n' }}
101
+ {%- else %}
102
+ {%- if tools is iterable and tools | length > 0 %}
103
+ {{- '<|im_end|>\n' }}
104
+ {%- endif %}
105
+ {%- endif %}
106
+
107
+ {%- for message in loop_messages %}
108
+ {%- if message.role == "assistant" %}
109
+ {# Add reasoning content in to content field for unified processing below. #}
110
+ {%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %}
111
+ {%- set content = "<think>\n" ~ message.reasoning_content ~ "\n</think>\n" ~ (message.content | default('', true)) %}
112
+ {%- else %}
113
+ {%- set content = message.content | default('', true) %}
114
+ {%- if content is string -%}
115
+ {# Allow downstream logic to to take care of broken thought, only handle coherent reasoning here. #}
116
+ {%- if '<think>' not in content and '</think>' not in content -%}
117
+ {%- set content = "<think></think>" ~ content -%}
118
+ {%- endif -%}
119
+ {%- else -%}
120
+ {%- set content = content -%}
121
+ {%- endif -%}
122
+ {%- endif %}
123
+ {%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
124
+ {# Assistant message has tool calls. #}
125
+ {{- '<|im_start|>assistant\n' }}{% generation %}
126
+ {%- set include_content = not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
127
+ {%- if content is string and content | trim | length > 0 %}
128
+ {%- if include_content %}
129
+ {{- (content | trim) ~ '\n' -}}
130
+ {%- else %}
131
+ {%- set c = (content | string) %}
132
+ {%- if '</think>' in c %}
133
+ {# Keep only content after the last closing think. Also generation prompt causes this. #}
134
+ {%- set c = c.split('</think>')[-1] %}
135
+ {%- elif '<think>' in c %}
136
+ {# If <think> was opened but never closed, drop the trailing think segment #}
137
+ {%- set c = c.split('<think>')[0] %}
138
+ {%- endif %}
139
+ {%- set c = "<think></think>" ~ c | trim %}
140
+ {%- if c | length > 0 %}
141
+ {{- c ~ '\n' -}}
142
+ {%- endif %}
143
+ {%- endif %}
144
+ {%- else %}
145
+ {{- "<think></think>" -}}
146
+ {%- endif %}
147
+ {%- for tool_call in message.tool_calls %}
148
+ {%- if tool_call.function is defined %}
149
+ {%- set tool_call = tool_call.function %}
150
+ {%- endif %}
151
+ {{- '<tool_call>\n<function=' ~ tool_call.name ~ '>\n' -}}
152
+ {%- if tool_call.arguments is defined %}
153
+ {%- for args_name, args_value in tool_call.arguments|items %}
154
+ {{- '<parameter=' ~ args_name ~ '>\n' -}}
155
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
156
+ {{- args_value ~ '\n</parameter>\n' -}}
157
+ {%- endfor %}
158
+ {%- endif %}
159
+ {{- '</function>\n</tool_call>\n' -}}
160
+ {%- endfor %}
161
+ {{- '<|im_end|>' }}{% endgeneration %}{{- '\n' }}
162
+ {%- else %}
163
+ {# Assistant message doesn't have tool calls. #}
164
+ {%- if not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
165
+ {{- '<|im_start|>assistant\n' }}{% generation %}{{- (content | default('', true) | string | trim) }}{{- '<|im_end|>' }}{% endgeneration %}{{- '\n' }}
166
+ {%- else %}
167
+ {%- set c = (content | default('', true) | string) %}
168
+ {%- if '<think>' in c and '</think>' in c %}
169
+ {%- set c = "<think></think>" ~ c.split('</think>')[-1] %}
170
+ {%- endif %}
171
+ {%- set c = c | trim %}
172
+ {%- if c | length > 0 %}
173
+ {{- '<|im_start|>assistant\n' }}{% generation %}{{- c }}{{- '<|im_end|>' }}{% endgeneration %}{{- '\n' }}
174
+ {%- else %}
175
+ {{- '<|im_start|>assistant\n' }}{% generation %}{{- '<|im_end|>' }}{% endgeneration %}{{- '\n' }}
176
+ {%- endif %}
177
+ {%- endif %}
178
+ {%- endif %}
179
+ {%- elif message.role == "user" or message.role == "system" %}
180
+ {{- '<|im_start|>' + message.role + '\n' }}
181
+ {%- set content = message.content | string %}
182
+ {%- if message.role == "user" and loop.index0 == ns.last_user_idx and reasoning_budget is not none %}
183
+ {{- content + '\n\n{thinking token budget: ' + (reasoning_budget | string) + '}' }}
184
+ {%- else %}
185
+ {{- content }}
186
+ {%- endif %}
187
+ {{- '<|im_end|>\n' }}
188
+ {%- elif message.role == "tool" %}
189
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
190
+ {{- '<|im_start|>user\n' }}
191
+ {%- endif %}
192
+ {{- '<tool_response>\n' }}
193
+ {{- message.content }}
194
+ {{- '\n</tool_response>\n' }}
195
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
196
+ {{- '<|im_end|>\n' }}
197
+ {%- elif loop.last %}
198
+ {{- '<|im_end|>\n' }}
199
+ {%- endif %}
200
+ {%- else %}
201
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>\n' }}
202
+ {%- endif %}
203
+ {%- endfor %}
204
+
205
+ {%- if add_generation_prompt %}
206
+ {%- if enable_thinking %}
207
+ {{- '<|im_start|>assistant\n<think>\n' }}
208
+ {%- else %}
209
+ {{- '<|im_start|>assistant\n<think></think>' }}
210
+ {%- endif %}
211
+ {%- endif %}
additional_chat_templates/pretraining.jinja ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {#- Pretraining chat template: question/answer format with generation markers.
2
+ Energon chooses whether to apply SFT loss masking or train on all tokens. -#}
3
+ {%- for message in messages %}
4
+ {%- if message.role == "system" %}
5
+ {{- message.content }}
6
+ {%- elif message.role == "user" %}
7
+ {{- "\nquestion: " + message.content }}
8
+ {%- elif message.role == "assistant" %}
9
+ {{- "\nanswer: " }}{% generation %}{{- message.content }}{% endgeneration %}
10
+ {%- endif %}
11
+ {%- endfor %}
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:839b79e02744d906eaa03f952312e8261d2415f189cc4824805cf2d24525f868
3
+ size 17078202
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff