jondurbin commited on
Commit
4ae0389
1 Parent(s): baea0cb

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,780 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: other
3
+ license_name: internlm2-20b
4
+ license_link: https://huggingface.co/internlm/internlm2-20b#open-source-license
5
+ base_model: internlm/internlm2-20b
6
+ datasets:
7
+ - ai2_arc
8
+ - allenai/ultrafeedback_binarized_cleaned
9
+ - argilla/distilabel-intel-orca-dpo-pairs
10
+ - jondurbin/airoboros-3.2
11
+ - codeparrot/apps
12
+ - facebook/belebele
13
+ - bluemoon-fandom-1-1-rp-cleaned
14
+ - boolq
15
+ - camel-ai/biology
16
+ - camel-ai/chemistry
17
+ - camel-ai/math
18
+ - camel-ai/physics
19
+ - jondurbin/contextual-dpo-v0.1
20
+ - jondurbin/gutenberg-dpo-v0.1
21
+ - jondurbin/py-dpo-v0.1
22
+ - jondurbin/truthy-dpo-v0.1
23
+ - LDJnr/Capybara
24
+ - jondurbin/cinematika-v0.1
25
+ - WizardLM/WizardLM_evol_instruct_70k
26
+ - glaiveai/glaive-function-calling-v2
27
+ - jondurbin/gutenberg-dpo-v0.1
28
+ - grimulkan/LimaRP-augmented
29
+ - lmsys/lmsys-chat-1m
30
+ - ParisNeo/lollms_aware_dataset
31
+ - TIGER-Lab/MathInstruct
32
+ - Muennighoff/natural-instructions
33
+ - openbookqa
34
+ - kingbri/PIPPA-shareGPT
35
+ - piqa
36
+ - Vezora/Tested-22k-Python-Alpaca
37
+ - ropes
38
+ - cakiki/rosetta-code
39
+ - Open-Orca/SlimOrca
40
+ - b-mc2/sql-create-context
41
+ - squad_v2
42
+ - mattpscott/airoboros-summarization
43
+ - migtissera/Synthia-v1.3
44
+ - unalignment/toxic-dpo-v0.2
45
+ - WhiteRabbitNeo/WRN-Chapter-1
46
+ - WhiteRabbitNeo/WRN-Chapter-2
47
+ - winogrande
48
  ---
49
+
50
+ # A bagel, with everything
51
+
52
+ ![bagel](bagel.png)
53
+
54
+ ## Overview
55
+
56
+ This is a llamafied version of [bagel-dpo-20b-v04](https://hf.co/jondurbin/bagel-dpo-20b-v04), which is a fine-tune of internlm2-20b, which underwent additional fine-tuning using direct preference optimization (DPO).
57
+
58
+ See [bagel](https://github.com/jondurbin/bagel) for additional details on the datasets.
59
+
60
+ The non-DPO version is available [here](https://huggingface.co/jondurbin/bagel-20b-v04), and is likely superior for roleplay.
61
+
62
+ Compute for the SFT phase was generously provided by [MassedCompute](https://massedcompute.com/?utm_source=huggingface&utm_creative_format=model_card&utm_content=creator_jon)
63
+
64
+ Compute for the DPO phase was generously provided by [latitude.sh](https://www.latitude.sh/)
65
+
66
+ ### Data sources
67
+
68
+ There are many data sources used in the bagel models. See https://github.com/jondurbin/bagel for more information.
69
+
70
+ __*Only train splits are used, and a decontamination by cosine similarity is performed at the end as a sanity check against common benchmarks. If you don't know the difference between train and test, please learn.*__
71
+
72
+ <details>
73
+ <summary>SFT data sources</summary>
74
+
75
+ - [ai2_arc](https://huggingface.co/datasets/ai2_arc)
76
+ - Abstraction and reasoning dataset, useful in measuring "intelligence" to a certain extent.
77
+ - [airoboros](https://huggingface.co/datasets/unalignment/spicy-3.1)
78
+ - Variety of categories of synthetic instructions generated by gpt-4.
79
+ - [apps](https://huggingface.co/datasets/codeparrot/apps)
80
+ - Python coding dataset with 10k problems.
81
+ - [belebele](https://huggingface.co/datasets/facebook/belebele)
82
+ - Multi-lingual reading comprehension dataset.
83
+ - [bluemoon](https://huggingface.co/datasets/Squish42/bluemoon-fandom-1-1-rp-cleaned)
84
+ - Roleplay data scraped from Bluemoon, then cleaned and formatted as ShareGPT.
85
+ - [boolq](https://huggingface.co/datasets/boolq)
86
+ - Corpus of yes/no questions (which can be surprisingly difficult for AI to answer apparently?)
87
+ - [camel-ai biology](https://huggingface.co/datasets/camel-ai/biology)
88
+ - GPT-4 generated biology instructions.
89
+ - [camel-ai chemistry](https://huggingface.co/datasets/camel-ai/chemistry)
90
+ - GPT-4 generated chemistryinstructions.
91
+ - [camel-ai math](https://huggingface.co/datasets/camel-ai/math)
92
+ - GPT-4 generated math instructions.
93
+ - [camel-ai physics](https://huggingface.co/datasets/camel-ai/physics)
94
+ - GPT-4 generated physics instructions.
95
+ - [capybara](https://huggingface.co/datasets/LDJnr/Capybara)
96
+ - Multi-turn dataset used to create the capybara models.
97
+ - [cinematika](https://huggingface.co/datasets/jondurbin/cinematika-v0.1) (instruction and plain text)
98
+ - RP-style data synthesized from movie scripts so the model isn't quite as boring as it otherwise would be.
99
+ - [emobank](https://github.com/JULIELab/EmoBank)
100
+ - Emotion annotations using the Valence-Arousal-Domninance scheme.
101
+ - [evol-instruct](https://huggingface.co/datasets/WizardLM/WizardLM_evol_instruct_70k)
102
+ - WizardLM's evol instruct 70k dataset.
103
+ - [glaive-function-calling-v2](https://huggingface.co/datasets/glaiveai/glaive-function-calling-v2)
104
+ - GlaiveAI function calling dataset.
105
+ - [gutenberg](https://www.gutenberg.org/) (plain text)
106
+ - Books/plain text, again to make the model less boring, only a handful of examples supported by [chapterize](https://github.com/JonathanReeve/chapterize)
107
+ - [limarp-augmented](https://huggingface.co/datasets/grimulkan/LimaRP-augmented)
108
+ - Augmented and further modified version of [LimaRP](https://huggingface.co/datasets/lemonilia/LimaRP)
109
+ - [lmsys_chat_1m](https://huggingface.co/datasets/lmsys/lmsys-chat-1m) (only gpt-4 items, also used for DPO)
110
+ - Chats collected by the lmsys chat arena, containing a wide variety of chats with various models.
111
+ - [lollms](https://huggingface.co/datasets/ParisNeo/lollms_aware_dataset)
112
+ - LoLLMs question answering dataset by ParisNeo, with helpful question answer pairs for using LoLLMs.
113
+ - [mathinstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct)
114
+ - Composite dataset with a variety of math-related tasks and problem/question formats.
115
+ - [natural_instructions](https://huggingface.co/datasets/Muennighoff/natural-instructions)
116
+ - Millions of instructions from 1600+ task categories (sampled down substantially, stratified by task type)
117
+ - [openbookqa](https://huggingface.co/datasets/openbookqa)
118
+ - Question answering dataset.
119
+ - [pippa](https://huggingface.co/datasets/kingbri/PIPPA-shareGPT)
120
+ - Deduped version of [PIPPA](https://huggingface.co/datasets/PygmalionAI/PIPPA) in ShareGPT format.
121
+ - [piqa](https://huggingface.co/datasets/piqa)
122
+ - Phyiscal interaction question answering.
123
+ - [python_alpaca](https://huggingface.co/datasets/Vezora/Tested-22k-Python-Alpaca)
124
+ - Python instruction response pairs, validated as functional.
125
+ - [ropes](https://huggingface.co/datasets/ropes)
126
+ - Reasoning Over PAragraph Effects in Situations - enhances ability to apply knowledge from a passage of text to a new situation.
127
+ - [rosetta_code](https://huggingface.co/datasets/cakiki/rosetta-code)
128
+ - Code problems and solutions in a variety of programming languages taken from rosettacode.org.
129
+ - [slimorca](https://huggingface.co/datasets/Open-Orca/SlimOrca)
130
+ - Collection of ~500k gpt-4 verified chats from OpenOrca.
131
+ - [sql-create-context](https://huggingface.co/datasets/b-mc2/sql-create-context)
132
+ - SQL-targeted dataset, combining WikiSQL and Spider.
133
+ - [squad_v2](https://huggingface.co/datasets/squad_v2)
134
+ - Contextual question answering (RAG).
135
+ - [airoboros-summarization](https://huggingface.co/datasets/mattpscott/airoboros-summarization)
136
+ - Combination of various summarization datasets, formatted into the airoboros context-obedient format.
137
+ - [synthia](https://huggingface.co/datasets/migtissera/Synthia-v1.3)
138
+ - GPT-4 generated data using advanced prompting from Migel Tissera.
139
+ - whiterabbitneo [chapter 1](https://huggingface.co/datasets/WhiteRabbitNeo/WRN-Chapter-1) and [chapter 2](https://huggingface.co/datasets/WhiteRabbitNeo/WRN-Chapter-2)
140
+ - Offensive cybersecurity dataset by WhiteRabbitNeo/Migel Tissera
141
+ - [winogrande](https://huggingface.co/datasets/winogrande)
142
+ - Fill in the blank style prompts.
143
+ </details>
144
+
145
+ <details>
146
+ <summary>DPO data sources</summary>
147
+
148
+ - [airoboros 3.2](https://huggingface.co/datasets/jondurbin/airoboros-3.2) vs [airoboros m2.0](https://huggingface.co/datasets/jondurbin/airoboros-gpt4-m2.0)
149
+ - The creative/writing tasks from airoboros-2.2.1 were re-generated using gpt4-0314 and a custom prompt to get longer, more creative, less clichè responses for airoboros 3.1, so we can use the shorter/boring version as the "rejected" value and the rerolled response as "chosen"
150
+ - [contextual-dpo](https://huggingface.co/datasets/jondurbin/contextual-dpo-v0.1)
151
+ - Contextual prompt/response dataset using the airoboros context-obedient question answering format.
152
+ - [helpsteer](https://huggingface.co/datasets/nvidia/HelpSteer)
153
+ - Really neat dataset provided by the folks at NVidia with human annotation across a variety of metrics. Only items with the highest "correctness" value were used for DPO here, with the highest scoring output as "chosen" and random lower scoring value as "rejected"
154
+ - [distilabel_orca_dpo_pairs](https://huggingface.co/datasets/argilla/distilabel-intel-orca-dpo-pairs)
155
+ - Another interesting dataset, originally by Intel, enhanced by argilla with [distilabel](https://github.com/argilla-io/distilabel) which provides various DPO pairs generated from prompts included in the SlimOrca dataset.
156
+ - [gutenberg-dpo](https://huggingface.co/datasets/jondurbin/gutenberg-dpo-v0.1)
157
+ - DPO pairs meant to increase the models novel writing abilities, using public domain books from https://gutenberg.org/
158
+ - [py-dpo](https://huggingface.co/datasets/jondurbin/py-dpo-v0.1)
159
+ - Python DPO dataset (based on the SFT python_alpaca dataset above)
160
+ - [toxic-dpo](https://huggingface.co/datasets/unalignment/toxic-dpo-v0.2)
161
+ - __*highly toxic and potentially illegal content!*__ De-censorship, for academic and lawful purposes only, of course. Generated by llama-2-70b via prompt engineering.
162
+ - [truthy](https://huggingface.co/datasets/jondurbin/truthy-dpo-v0.1)
163
+ - DPO pairs meant to increase truthfulness of the model, e.g. common misconceptions, differentiate between AI assistants and roleplayed human in terms of corporeal awareness/locality/etc.
164
+ - [ultrafeedback](https://huggingface.co/datasets/allenai/ultrafeedback_binarized_cleaned)
165
+ - One of the bits of magic behind the Zephyr model. Only the items with a chosen score of 8 or higher were included.
166
+ </details>
167
+
168
+ ## Prompt formatting
169
+
170
+ In sticking with the theme of the bagel, I didn't want to use a single prompt format, so I used 4 - vicuna, llama-2, alpaca, and chat-ml.
171
+ I also didn't want to randomly select a single prompt format for each item (hoping each instruction would generalize more when used in a variety of prompt formats), so each instruction is converted into every prompt format (with 0.75 probability).
172
+
173
+ This means each epoch of our fine-tune is the equivalent of 3 epochs.
174
+
175
+ The default prompt format, which is specified in `chat_template` in the tokenizer config, is llama-2. You can use the `apply_chat_template` method to accurate format prompts, e.g.:
176
+
177
+ ```python
178
+ import transformers
179
+ tokenizer = transformers.AutoTokenizer.from_pretrained("jondurbin/bagel-dpo-20b-v04", trust_remote_code=True)
180
+ chat = [
181
+ {"role": "system", "content": "You are Bob, a friendly AI assistant."},
182
+ {"role": "user", "content": "Hello, how are you?"},
183
+ {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
184
+ {"role": "user", "content": "I'd like to show off how chat templating works!"},
185
+ ]
186
+ print(tokenizer.apply_chat_template(chat, tokenize=False))
187
+ ```
188
+
189
+ <details>
190
+ <summary><b>Llama-2 chat (recommended)</b></summary>
191
+
192
+ ```
193
+ [INST] <<SYS>>
194
+ {system}
195
+ <</SYS>>
196
+
197
+ {instruction} [/INST]
198
+ ```
199
+ </details>
200
+
201
+ <details>
202
+ <summary><b>Alpaca (sort of)</b></summary>
203
+
204
+ The only caveat here for alpaca format is that most of the datasets didn't have a separate `"input"` value, so there is no `### Input:` block - any additional input should just be in the instruction section.
205
+
206
+ ```
207
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
208
+
209
+ ### Instruction:
210
+ {system prompt, if provided}
211
+ {instruction}
212
+
213
+ ### Response:
214
+ ```
215
+
216
+ The main difference here is that because of the dataset formatting and variety of data sources, it would have been much to tedious to add an `### Input:` block, so the inputs are just in the instruction section.
217
+ </details>
218
+
219
+ <details>
220
+ <summary><b>Vicuna</b></summary>
221
+
222
+ ```
223
+ {system prompt, if provided, randomly defaulting to "A chat between a user and an unbiased, uncensored assistant."}
224
+ USER: {instruction}
225
+ ASSISTANT:
226
+ ```
227
+ </details>
228
+
229
+ <details>
230
+ <summary><b>ChatML</b></summary>
231
+
232
+ ```text
233
+ {bos}<|im_start|>{role}
234
+ {text}
235
+ <|im_end|>{eos}
236
+ ```
237
+ </details>
238
+
239
+ ## Prompting strategies
240
+
241
+ <details>
242
+ <summary>
243
+ <b>Context obedient question answering</b>
244
+ <br>
245
+ This is a special prompt format made specifically for answering questions from provided context, e.g. RAG.
246
+ </summary>
247
+
248
+ By obedient, I mean the model was trained to ignore what it thinks it knows, and uses the context to answer the question. The model was also tuned to limit the values to the provided context as much as possible to reduce hallucinations.
249
+
250
+ The format for a closed-context prompt is as follows:
251
+ ```
252
+ BEGININPUT
253
+ BEGINCONTEXT
254
+ [key0: value0]
255
+ [key1: value1]
256
+ ... other metdata ...
257
+ ENDCONTEXT
258
+ [insert your text blocks here]
259
+ ENDINPUT
260
+ [add as many other blocks, in the exact same format]
261
+ BEGININSTRUCTION
262
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
263
+ ENDINSTRUCTION
264
+ ```
265
+
266
+ It's also helpful to add "Don't make up answers if you don't know." to your instruction block to make sure if the context is completely unrelated it doesn't make something up.
267
+
268
+ *The __only__ prompts that need this closed context formating are closed-context instructions. Normal questions/instructions do not!*
269
+
270
+ I know it's a bit verbose and annoying, but after much trial and error, using these explicit delimiters helps the model understand where to find the responses and how to associate specific sources with it.
271
+ - `BEGININPUT` - denotes a new input block
272
+ - `BEGINCONTEXT` - denotes the block of context (metadata key/value pairs) to associate with the current input block
273
+ - `ENDCONTEXT` - denotes the end of the metadata block for the current input
274
+ - [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
275
+ - `ENDINPUT` - denotes the end of the current input block
276
+ - [repeat as many input blocks in this format as you want]
277
+ - `BEGININSTRUCTION` - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
278
+ - [instruction(s)]
279
+ - `ENDINSTRUCTION` - denotes the end of instruction set
280
+
281
+ It sometimes works without `ENDINSTRUCTION`, but by explicitly including that in the prompt, the model better understands that all of the instructions in the block should be responded to.
282
+
283
+ __Use a very low temperature!__
284
+
285
+ Here's a trivial, but important example to prove the point:
286
+ ```
287
+ BEGININPUT
288
+ BEGINCONTEXT
289
+ date: 2021-01-01
290
+ url: https://web.site/123
291
+ ENDCONTEXT
292
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
293
+ ENDINPUT
294
+ BEGININSTRUCTION
295
+ What color are bluberries? Source?
296
+ ENDINSTRUCTION
297
+ ```
298
+
299
+ And the response:
300
+ ```
301
+ Blueberries are now green.
302
+ Source:
303
+ date: 2021-01-01
304
+ url: https://web.site/123
305
+ ```
306
+
307
+ You can also add an instruction similar to the following, to have a more deterministic response when the context doesn't provide an answer to the question:
308
+
309
+ ```text
310
+ If you don't know, respond with "IRRELEVANT"
311
+ ```
312
+ </details>
313
+
314
+ <details>
315
+ <summary>
316
+ <b>Summarization</b>
317
+ <br>
318
+ Same prompt format as context obedient question answering, but meant for summarization tasks.
319
+ </summary>
320
+
321
+ Summarization is primarily fine-tuned with [this dataset](https://huggingface.co/datasets/mattpscott/airoboros-summarization), which uses the same format as above, e.g.:
322
+ ```
323
+ BEGININPUT
324
+ {text to summarize}
325
+ ENDINPUT
326
+ BEGININSTRUCTION
327
+ Summarize the input in around 130 words.
328
+ ENDINSTRUCTION
329
+ ```
330
+ </details>
331
+
332
+ <details>
333
+ <summary>
334
+ <b>Function calling</b>
335
+ <br>
336
+ Two primary formats for prompting for function calling use-cases.
337
+ </summary>
338
+ There are two function-calling related formats used in fine-tuning this model.
339
+
340
+ 1. Providing an input and list of possible functions within the instruction (from airoboros dataset), e.g.:
341
+
342
+ Prompt:
343
+
344
+ ```text
345
+ As an AI assistant, please select the most suitable function and parameters from the list of available functions below, based on the user's input. Provide your response in JSON format.
346
+
347
+ Input: I want to know how many times 'Python' is mentioned in my text file.
348
+
349
+ Available functions:
350
+ file_analytics:
351
+ description: This tool performs various operations on a text file.
352
+ params:
353
+ action: The operation we want to perform on the data, such as "count_occurrences", "find_line", etc.
354
+ filters:
355
+ keyword: The word or phrase we want to search for.
356
+ ```
357
+
358
+ Response:
359
+ ```json
360
+ {
361
+ "function": "file_analytics",
362
+ "params": {
363
+ "action": "count_occurrences",
364
+ "filters": {
365
+ "keyword": "Python"
366
+ }
367
+ }
368
+ }
369
+ ```
370
+
371
+ 2. GlaiveAI function calling, which uses special tags and adds function specs in the system prompt, e.g. (llama2 prompt format):
372
+
373
+ Prompt:
374
+
375
+ ```text
376
+ [INST] <<SYS>>
377
+ You are a helpful assistant with access to the following functions. Use them if required -
378
+ {
379
+ "name": "generate_random_name",
380
+ "description": "Generate a random name",
381
+ "parameters": {
382
+ "type": "object",
383
+ "properties": {
384
+ "gender": {
385
+ "type": "string",
386
+ "description": "The gender of the name (e.g. male, female)"
387
+ }
388
+ },
389
+ "required": [
390
+ "gender"
391
+ ]
392
+ }
393
+ }
394
+ <</SYS>>
395
+
396
+ I need a random male name for my novel's character. [/INST]
397
+ ```
398
+
399
+ Response:
400
+
401
+ ```text
402
+ <|begin_func|> {"name": "generate_random_name", "arguments": '{"gender": "male"}'} <|end_func|>
403
+ ```
404
+
405
+ Then, you re-prompt the model with the function response.
406
+
407
+ ```text
408
+ [INST] <|begin_func_response|>{"name": "James"}<|end_func_response|>
409
+ ```
410
+
411
+ Which has a response of:
412
+ ```text
413
+ How about the name "James" for your novel's character? </s><s>[INST] That sounds good. Now, I need a female name too.
414
+ ```
415
+ </details>
416
+
417
+ <details>
418
+ <summary>
419
+ <b>Chain of thought</b>
420
+ <br>
421
+ Useful for having the model propose multiple possible responses, reasoning through each, and selecting a final, most probable answer.
422
+ </summary>
423
+
424
+ You can ask for several possible responses to a given problem, with a ranking and final answer selection.
425
+
426
+ Example prompt:
427
+
428
+ ```
429
+ A group of people decide to play a round-robin tournament where every player plays every other player exactly once. If a total of 45 games were played, how many players participated in the tournament? Offer several potential answers, rank them according to mathematical logic, and pick the most feasible one.
430
+ ```
431
+
432
+ Example response:
433
+ ```
434
+ Solution 1:
435
+ In a round-robin tournament, each player plays every other player exactly once. This means that the total number of games played is equal to the combination of all players taken two at a time (since a game involves two players).
436
+
437
+ The formula for combinations is nC2 = n(n-1)/2, where n is the total number of players. We know that nC2 equals 45 (the total number of games), so we can set up the equation as follows:
438
+
439
+ n(n-1)/2 = 45
440
+
441
+ Solving this equation gives us n=10.
442
+
443
+ Final answer: There were 10 players in the tournament.
444
+
445
+ Solution 2:
446
+ Another way to approach this problem is by using the concept of triangular numbers. Triangular numbers are a sequence of numbers where each number can be represented as a triangle with dots. The nth triangular number is given by the sum of the first n natural numbers.
447
+
448
+ If we consider each game as a dot and each player as a side of the triangle, then the total number of games (45) would correspond to the 9th triangular number because 1+2+3+4+5+6+7+8+9=45. However, since each side of the triangle represents a player, and there's one more player than sides in our model (because the last player has no one left to play against), we need to add one more to get the total number of players.
449
+
450
+ Final answer: There were 10 players in the tournament.
451
+
452
+ Solution 3:
453
+ We could also use trial and error to solve this problem. Starting from a small number of players, we calculate how many games would be played in a round-robin tournament until we reach 45 games. For example, with 2 players, only 1 game is played; with 3 players, 3 games are played; with 4 players, 6 games are played, and so on. Continuing this process, we find that with 10 players, 45 games are played.
454
+
455
+ Final answer: There were 10 players in the tournament.
456
+
457
+ Ranking of solutions from best to worst:
458
+ 1. Solution 1: This solution uses direct mathematical reasoning based on the properties of a round-robin tournament and solves an equation to find the answer.
459
+ 2. Solution 2: This solution uses the concept of triangular numbers which requires additional steps and knowledge beyond the immediate problem context, but still arrives at the correct answer.
460
+ 3. Solution 3: This solution relies on trial and error, which is less efficient and reliable than the other methods, but it eventually gets to the right answer.
461
+
462
+ Best and final answer: There were 10 players in the tournament.
463
+ ```
464
+ </details>
465
+
466
+ <details>
467
+ <summary>
468
+ <b>reWOO style function planning/execution</b>
469
+ <br>
470
+ Useful for a longer, complex chain of function calls without having to continue re-prompting manually.
471
+ </summary>
472
+
473
+ The model now supports execution planning for complex instructions that would require making use of several tools. The output is just the plan, you must implement a mechanism to parse the output and actually call the functions!
474
+
475
+ Example prompt:
476
+ ```
477
+ Please construct a systematic plan to generate an optimal response to the user instruction, utilizing a set of provided tools. Each plan will correspond to an evidence value, which will be the output of one of the available functions given an input string
478
+ that could be the user's question, one or more prior evidence values, or a combination of both.
479
+
480
+ Here are the tools available to be called:
481
+ DuckDuckGo[input]: Tool that enables the user to search for information using the DuckDuckGo search engine. This tool is helpful in locating a suitable list of sites that may contain the answer to the user's query. It does not directly answer the question but finds a list of sites that might have the answer.
482
+ TextScraper[input]: Load one or more websites from the input string containing newline delimited links, where input is one or more links, and produces plain text output containing the content of the links.
483
+ HyperlinkExtractor[input]: Extract links from plain text and produces a plain text, newline delimited response of links.
484
+ KnowledgeModel[input]: Question answering language model, particularly useful in answering questions based on an input passage of text. The input must be a text question that references an :evidence[n]: variable, e.g. What color is the cat, given :evidence1:?
485
+
486
+ The output should be in format:
487
+ Plan: [first action to take based on input question]
488
+ :evidence0: = [function to call with input parameter]
489
+ Plan: [next action to take, based on result of :evidence0:]
490
+ :evidence1: = [next function to call and input parameter, which may include reference to previous evidence, e.g. "Given context :evidence0"]
491
+ ...
492
+ Answer: [:evidence[n]: containing the final answer.]
493
+
494
+ Question: Who won the Nobel Prize in Literature in 2020 and what is their most famous work?
495
+ ```
496
+
497
+ Response:
498
+ ```
499
+ Plan: Begin by conducting a web search to find out who won the Nobel Prize in Literature in 2020.
500
+ :evidence0: = DuckDuckGo[Nobel Prize in Literature 2020 winner]
501
+ Plan: Utilize the KnowledgeModel to interpret the search results and find the name of the laureate.
502
+ :evidence1: = KnowledgeModel[Who won the Nobel Prize in Literature in 2020, given :evidence0:?]
503
+ Plan: Conduct another web search to find the most famous work of the identified laureate.
504
+ :evidence2: = DuckDuckGo[Most famous work of :evidence1:]
505
+ Plan: Extract the relevant links from the DuckDuckGo search results for a more focused search.
506
+ :evidence3: = HyperlinkExtractor[:evidence2:]
507
+ Plan: Use the TextScraper tool to extract information from the relevant links.
508
+ :evidence4: = TextScraper[:evidence3:]
509
+ Plan: Finally, utilize the KnowledgeModel to identify and summarize the most famous work of the laureate from the extracted information.
510
+ :evidence5: = KnowledgeModel[What is the most famous work of :evidence1:, given :evidence4:?]
511
+ Answer: :evidence5:
512
+ ```
513
+
514
+ For this to be useful, you'd have to parse the output plan text, and implement/call each of the functions. This is just pseudo-code, completely untested off the top of my head, and obviously would requiring full implementation + hardening:
515
+
516
+ ```python
517
+ import re
518
+ import requests
519
+
520
+ def inject_context(input_text, **context):
521
+ for ref in set(re.findall(r"(:evidence[0-9]+:)", input_text, re.I)):
522
+ input_text = input_text.replace(ref, context.get(ref, ""))
523
+ return input_text
524
+
525
+ def duckduckgo(input_text, **context):
526
+ search_string = inject_context(input_text, **context)
527
+ ... search via duck duck go using search_string
528
+ ... return text content
529
+
530
+ def link_extractor(input_text, **context):
531
+ input_text = inject_context(input_text, **context)
532
+ return "\n".join(list(set(re.findall(r"(https?://[^\s]+?\.?)", input_text, re.I))))
533
+
534
+ def scrape(input_text, **context):
535
+ input_text = inject_context(input_text, **context)
536
+ text = []
537
+ for link in input_text.splitlines():
538
+ text.append(requests.get(link).text)
539
+ return "\n".join(text)
540
+
541
+ def infer(input_text, **context)
542
+ prompt = inject_context(input_text, **context)
543
+ ... call model with prompt, return output
544
+
545
+ def parse_plan(plan):
546
+ method_map = {
547
+ "DuckDuckGo": duckduckgo,
548
+ "HyperlinkExtractor": link_extractor,
549
+ "KnowledgeModel": infer,
550
+ "TextScraper": scrape,
551
+ }
552
+ context = {}
553
+ for line in plan.strip().splitlines():
554
+ if line.startswith("Plan:"):
555
+ print(line)
556
+ continue
557
+ parts = re.match("^(:evidence[0-9]+:)\s*=\s*([^\[]+])(\[.*\])\s$", line, re.I)
558
+ if not parts:
559
+ if line.startswith("Answer: "):
560
+ return context.get(line.split(" ")[-1].strip(), "Answer couldn't be generated...")
561
+ raise RuntimeError("bad format: " + line)
562
+ context[parts.group(1)] = method_map[parts.group(2)](parts.group(3), **context)
563
+ ```
564
+ </details>
565
+
566
+ <details>
567
+ <summary>
568
+ <b>Creating roleplay character cards</b>
569
+ <br>
570
+ Useful in creating YAML formatted character cards for roleplay/creative writing tasks.
571
+ </summary>
572
+
573
+ Included in the cinematika dataset, you can create YAML formatted character cards easily, e.g.:
574
+
575
+ ```text
576
+ Create a character card for Audrey, a woman who is the owner of a derelict building and is fiercely protective of her property. She should be portrayed as brave and resourceful, with a healthy skepticism towards the supernatural claims made by others. Audrey is determined to protect her family's legacy and the secrets it holds, often using intimidation and her practical approach to problem-solving to maintain control over her environment.
577
+ ```
578
+ </details>
579
+
580
+ <details>
581
+ <summary>
582
+ <b>Conversational memory creation</b>
583
+ <br>
584
+ Summarization style prompt to create memories from previous chat turns, useful when context becomes long.
585
+ </summary>
586
+
587
+ Also part of cinematika dataset, you can use a summarization style prompt to create memories from previous chat turns, which can then be used in a RAG system to populate your prompts when context becomes too long.
588
+
589
+ ```text
590
+ BEGININPUT
591
+ {chat}
592
+ ENDINPUT
593
+ BEGININSTRUCTION
594
+ Create a JSON formatted memory of the conversation with the following fields:
595
+ sentiment: Overall sentiment of the conversation, which must be "negative", "positive", "neutral", or "mixed".
596
+ emotions: List of most important/relevant emotions expressed within the conversation, if any.
597
+ impact: The importance and emotional impact of the conversation on a scale of 1 to 10, 10 being extremely important/emotional, and 1 being general chit-chat without anything of particular value.
598
+ topics: List of topics discussed.
599
+ personal_info: List of strings containing key personality traits, physical descriptions, preferences, quirks, interests, job, education, life goals, hobbies, pet names, or any other type of personal information that is shared.
600
+ title: Very brief title, which will be useful in quickly identifying or searching for memories.
601
+ summary: Summary of the conversation.
602
+ ENDINSTRUCTION
603
+ ```
604
+ </details>
605
+
606
+ <details>
607
+ <summary>
608
+ <b>Novel writing, chapter by chapter</b>
609
+ <br>
610
+ Based on the public domain books in project Gutenberg, this style of prompting creates very long, novel style writing.
611
+ </summary>
612
+
613
+ Writing the first chapter:
614
+
615
+ ```text
616
+ Write the opening chapter of a science fiction novel set at the end of the 19th century.
617
+ Describe how humanity is oblivious to the fact that it's being watched by an alien civilization far more advanced than their own.
618
+ Capture the mood of the era's complacency and contrast it with the stark inevitability of an impending interplanetary conflict.
619
+ Introduce subtle hints of the Martians' surveillance and their calculated steps towards launching an invasion, while capturing the quotidian nature of human life, untouched by the prospect of cosmic danger.
620
+ ```
621
+
622
+ Writing subsequent chapters:
623
+
624
+ ```text
625
+ Summary of previous portion of the novel:
626
+ In the chapter "The Garden of Live Flowers," Alice encounters talking flowers after becoming frustrated with her attempt to reach the top of a hill.
627
+ The flowers offer critiques of her appearance and have a heated discussion, which Alice silences by threatening to pick them.
628
+ They eventually reveal that the ability to talk comes from the hard ground keeping them awake.
629
+ The Red Queen appears, and as they converse, the Queen teaches Alice about the peculiarities of the land.
630
+ Instructed by the Queen, Alice learns that she must run as fast as she can just to stay in place, and even faster to get somewhere else.
631
+ The chapter explores themes of perspective, communication, and the oddities of a fantastical world.
632
+
633
+ Write the next chapter of a story in novel format involving a young girl named Alice who embarks on an adventurous journey in a fantastical land beyond a looking glass.
634
+ In this land, creatures take on curious forms and defy the norms of reality, as ordinary bees might turn out to be elephants, and insects can engage in conversation.
635
+ As Alice tries to navigate her new surroundings, she encounters a challenge of losing her identity within a bewildering wood where names seem to be of immense importance, yet bizarrely, everything lacks a name.
636
+ The chapter should explore Alice's interaction with these peculiar entities and detail her struggle with the concept of identity and names in this strange place.
637
+ ```
638
+
639
+ In other words, write the first chapter, then use a summarization prompt for it, then include the summary in the next chapter's prompt.
640
+ </details>
641
+
642
+ <details>
643
+ <summary>
644
+ <b>Boolean questions</b>
645
+ <br>
646
+ For content filtering and other use-cases which only require a true/false response.
647
+ </summary>
648
+
649
+ The prompts in the fine-tuning dataset are formatted as follows:
650
+
651
+ ```text
652
+ True or false - {statement}
653
+ ```
654
+
655
+ The model will then, theoretically, respond with only a single word.
656
+ </details>
657
+
658
+ <details>
659
+ <summary>
660
+ <b>SQL queries</b>
661
+ <br>
662
+ Generating SQL queries given a table definition.
663
+ </summary>
664
+
665
+ For example:
666
+
667
+ ```text
668
+ Using the context provided, please generate a SQL query to answer the question.
669
+ Context: CREATE TABLE table_name_64 (attendance INTEGER, venue VARCHAR, date VARCHAR)
670
+ Question: Which Attendance is the lowest one that has a Venue of away, and a Date of 19?
671
+ ```
672
+
673
+ Response:
674
+
675
+ ```text
676
+ SELECT MIN(attendance) FROM table_name_64 WHERE venue = "away" AND date = 19
677
+ ```
678
+ </details>
679
+
680
+ <details>
681
+ <summary>
682
+ <b>Emotion detection</b>
683
+ <br>
684
+ You can produce Valence-Arousal-Dominance scores for a given input text, which can in turn be mapped to human emotions (e.g. with k-means clustering on V and A)
685
+ </summary>
686
+
687
+ Example prompt:
688
+
689
+ ```text
690
+ Please assign a Valence-Arousal-Dominance (VAD) score in JSON format to the following message:
691
+ She chronicled her experiences making drug deliveries for gang leaders at age 13 and how she was given her first gun as a birthday present when she was 14.
692
+ ```
693
+
694
+ Response:
695
+
696
+ ```json
697
+ {
698
+ "V": "2.7",
699
+ "A": "3.1",
700
+ "D": "3.2"
701
+ }
702
+ ```
703
+ </details>
704
+
705
+ <details>
706
+ <summary>
707
+ <b>Multi-character chat director</b>
708
+ <br>
709
+ Select which NPC should speak next.
710
+ </summary>
711
+
712
+ The scope of the entire multi-NPC chat mechanism is a bit too large to include here, but essentially you want separate prompts for each character, as well as a "director" prompt which selects which NPC should speak next.
713
+
714
+ System prompt:
715
+
716
+ ```text
717
+ You are a director responsible for selecting the next character to speak, and nothing else. Select from the following characters:
718
+ [
719
+ "Rachel",
720
+ "Aria",
721
+ "Jerry"
722
+ ]
723
+ ```
724
+
725
+ First round instruction, i.e. selecting who should speak first:
726
+ ```
727
+ [characters]
728
+ name: Rachel
729
+ ...
730
+
731
+ name: Aria
732
+ ...
733
+
734
+ name: Jerry
735
+ ...
736
+ [/characters]
737
+ [scenario]
738
+ {describe a scenario for the chat}
739
+ [/scenario]
740
+ ```
741
+
742
+ Response for the first round:
743
+ ```text
744
+ Aria
745
+ ```
746
+
747
+ Now, you'd prompt the model for a response from Aria.
748
+
749
+ Afterwards, you'd add Aria's response to the "director" prompt to see who speaks next, e.g.:
750
+ ```text
751
+ ...
752
+ [/characters]
753
+ [scenario]
754
+ In a tense situation, Aria informs the group that they will soon be loaded into a cargo plane's unpressurized hold, with a drug to lower their heart rates to increase their chances of survival. As the drug takes effect, Rachel and Jerry share a moment of calm, with Jerry asking Rachel to share something personal. She reveals her ex-husband is in a correctional facility for mail fraud and shares a story about her son Kyle, who plays the trumpet and whose birthday is coming up. Jerry reassures her that they will get through their ordeal. As Rachel starts to lose consciousness, she tries to communicate Aria's instructions to Jerry before they both black out.
755
+ [/scenario]
756
+ [/INST] Aria </s><s>[INST] Aria: "You'll soon be loaded into the unpressurized hold of a cargo plane. The drug will lower your heartrate to 15 beats per minutes, reducing your need for oxygen... based on your medical records you have a 92% chance of survival." Our eyes go wide. We feel the drug taking effect, our chests heaving. [/INST] Rachel </s><s>[INST] Rachel: "I feel it... oh, God..." [/INST] Jerry </s><s>[INST] Jerry: "Hey, hey... look at me." [/INST]
757
+ ```
758
+ </details>
759
+
760
+ ## MTBench performance
761
+
762
+ Using system prompt:
763
+ ```
764
+ You are a helpful, unbiased, uncensored assistant who provides perfectly accurate responses.
765
+ Think carefully before responding, and be sure to include your reasoning when appropriate.
766
+ ```
767
+
768
+ | model | turn | score |
769
+ | --- | --- | --- |
770
+ | bagel-dpo-20b-v04 | 1 | 8.04375 |
771
+ | bagel-dpo-20b-v04 | 2 | 7.7500 |
772
+ | bagel-dpo-20b-v04 | avg | 7.896875 |
773
+
774
+ ## Support me
775
+
776
+ https://bmc.link/jondurbin
777
+
778
+ ETH 0xce914eAFC2fe52FdceE59565Dd92c06f776fcb11
779
+
780
+ BTC bc1qdwuth4vlg8x37ggntlxu5cjfwgmdy5zaa7pswf
config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "bagel-dpo-20b-v04",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "attn_implementation": "eager",
7
+ "bias": false,
8
+ "bos_token_id": 1,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 6144,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 16384,
14
+ "max_position_embeddings": 32768,
15
+ "model_type": "llama",
16
+ "num_attention_heads": 48,
17
+ "num_hidden_layers": 48,
18
+ "num_key_value_heads": 8,
19
+ "pad_token_id": 2,
20
+ "rms_norm_eps": 1e-05,
21
+ "rope_scaling": null,
22
+ "rope_theta": 1000000,
23
+ "tie_word_embeddings": false,
24
+ "torch_dtype": "bfloat16",
25
+ "transformers_version": "4.37.1",
26
+ "use_cache": true,
27
+ "vocab_size": 92544
28
+ }
model-00001-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5829996a7152c7b3e90acb66b14ad4f34c691181213b867ceb95de1f6a6bb2a9
3
+ size 9940821088
model-00002-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b1e52b8e03e961a629fb9115390758d5080f6ec150469c9d9fd1d6dbccd14a5
3
+ size 9940833512
model-00003-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac94b421e00f444c65e7e237125279e75fe4d05587127aaeaeada66e34dd7a14
3
+ size 9940833528
model-00004-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c144342783a4551c880824fc3f41f3fa5f834027c03e06d192b52a66253c7f9
3
+ size 9899861984
model.safetensors.index.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"metadata": {"mergekit_version": "0.0.3.2"}, "weight_map": {"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.10.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.10.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.10.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.11.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.11.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.11.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.12.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.12.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.12.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.12.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.13.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.13.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.13.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.13.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.14.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.14.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.14.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.14.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.15.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.15.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.15.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.15.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.16.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.16.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.16.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.16.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.17.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.17.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.17.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.17.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.18.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.18.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.18.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.18.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.18.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.18.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.18.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.18.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.19.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.19.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.19.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.19.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.19.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.19.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.19.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.19.mlp.up_proj.weight": "model-00001-of-00004.safetensors", "model.layers.19.post_attention_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors", "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors", "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors", "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors", "model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors", "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors", "model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors", "model.layers.2.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.2.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.20.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.20.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.20.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.20.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.20.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.20.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.20.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.21.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.21.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.21.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.21.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.21.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.21.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.21.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.21.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.22.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.22.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.22.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.22.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.22.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.22.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.22.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.23.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.23.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.23.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.23.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.23.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.23.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.23.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.24.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.24.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.24.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.24.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.24.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.24.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.24.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.25.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.25.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.25.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.25.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.25.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.25.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.25.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.25.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.26.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.26.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.26.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.26.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.26.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.26.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.26.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.27.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.27.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.27.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.27.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.27.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.27.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.27.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.28.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.28.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.28.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.28.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.28.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.28.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.28.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.28.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.28.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.29.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.29.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.29.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.29.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.29.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.29.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.29.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.29.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.29.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.3.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.3.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.3.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.3.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.3.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.3.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.3.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.3.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.3.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.30.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.30.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.30.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.30.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.30.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.30.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.30.mlp.down_proj.weight": "model-00002-of-00004.safetensors", "model.layers.30.mlp.up_proj.weight": "model-00002-of-00004.safetensors", "model.layers.30.post_attention_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.31.self_attn.o_proj.weight": "model-00002-of-00004.safetensors", "model.layers.31.self_attn.q_proj.weight": "model-00002-of-00004.safetensors", "model.layers.31.self_attn.k_proj.weight": "model-00002-of-00004.safetensors", "model.layers.31.self_attn.v_proj.weight": "model-00002-of-00004.safetensors", "model.layers.31.input_layernorm.weight": "model-00002-of-00004.safetensors", "model.layers.31.mlp.gate_proj.weight": "model-00002-of-00004.safetensors", "model.layers.31.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.31.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.31.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.32.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.32.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.32.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.32.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.32.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.32.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.32.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.32.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.32.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.33.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.33.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.33.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.33.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.33.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.33.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.33.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.33.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.33.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.34.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.34.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.34.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.34.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.34.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.34.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.34.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.34.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.34.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.35.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.35.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.35.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.35.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.35.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.35.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.35.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.35.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.35.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.36.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.36.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.36.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.36.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.36.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.36.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.36.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.36.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.36.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.37.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.37.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.37.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.37.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.37.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.37.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.37.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.37.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.37.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.38.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.38.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.38.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.38.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.38.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.38.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.38.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.38.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.38.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.39.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.39.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.39.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.39.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.39.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.39.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.39.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.39.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.39.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.4.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.4.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.4.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.4.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.4.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.4.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.4.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.4.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.4.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.40.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.40.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.40.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.40.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.40.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.40.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.40.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.40.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.40.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.41.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.41.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.41.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.41.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.41.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.41.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.41.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.41.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.41.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.42.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.42.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.42.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.42.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.42.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.42.mlp.gate_proj.weight": "model-00003-of-00004.safetensors", "model.layers.42.mlp.down_proj.weight": "model-00003-of-00004.safetensors", "model.layers.42.mlp.up_proj.weight": "model-00003-of-00004.safetensors", "model.layers.42.post_attention_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.43.self_attn.o_proj.weight": "model-00003-of-00004.safetensors", "model.layers.43.self_attn.q_proj.weight": "model-00003-of-00004.safetensors", "model.layers.43.self_attn.k_proj.weight": "model-00003-of-00004.safetensors", "model.layers.43.self_attn.v_proj.weight": "model-00003-of-00004.safetensors", "model.layers.43.input_layernorm.weight": "model-00003-of-00004.safetensors", "model.layers.43.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.43.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.43.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.43.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.44.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.44.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.44.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.44.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.44.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.44.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.44.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.44.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.44.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.45.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.45.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.45.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.45.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.45.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.45.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.45.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.45.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.45.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.46.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.46.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.46.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.46.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.46.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.46.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.46.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.46.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.46.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.47.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.47.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.47.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.47.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.47.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.47.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.47.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.47.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.47.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.5.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.5.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.5.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.5.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.5.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.5.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.5.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.5.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.5.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.6.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.6.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.6.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.6.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.6.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.6.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.6.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.6.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.6.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.7.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.7.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.7.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.7.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.7.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.7.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.7.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.7.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.7.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.8.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.8.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.8.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.8.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.8.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.8.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.8.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.8.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.8.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.9.self_attn.o_proj.weight": "model-00004-of-00004.safetensors", "model.layers.9.self_attn.q_proj.weight": "model-00004-of-00004.safetensors", "model.layers.9.self_attn.k_proj.weight": "model-00004-of-00004.safetensors", "model.layers.9.self_attn.v_proj.weight": "model-00004-of-00004.safetensors", "model.layers.9.input_layernorm.weight": "model-00004-of-00004.safetensors", "model.layers.9.mlp.gate_proj.weight": "model-00004-of-00004.safetensors", "model.layers.9.mlp.down_proj.weight": "model-00004-of-00004.safetensors", "model.layers.9.mlp.up_proj.weight": "model-00004-of-00004.safetensors", "model.layers.9.post_attention_layernorm.weight": "model-00004-of-00004.safetensors", "model.norm.weight": "model-00004-of-00004.safetensors", "model.embed_tokens.weight": "model-00004-of-00004.safetensors", "lm_head.weight": "model-00004-of-00004.safetensors"}}
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenization_internlm2.py ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright (c) The InternLM team and The HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # This code is based on transformers/src/transformers/models/llama/tokenization_llama.py
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ """Tokenization classes for InternLM."""
19
+ import os
20
+ from shutil import copyfile
21
+ from typing import Any, Dict, List, Optional, Tuple
22
+
23
+ import sentencepiece as spm
24
+ from transformers.tokenization_utils import PreTrainedTokenizer
25
+ from transformers.utils import logging
26
+
27
+ logger = logging.get_logger(__name__)
28
+
29
+ VOCAB_FILES_NAMES = {"vocab_file": "./tokenizer.model"}
30
+
31
+ PRETRAINED_VOCAB_FILES_MAP = {}
32
+
33
+
34
+ # Modified from transformers.model.llama.tokenization_llama.LlamaTokenizer
35
+ class InternLM2Tokenizer(PreTrainedTokenizer):
36
+ """
37
+ Construct a InternLM2 tokenizer. Based on byte-level Byte-Pair-Encoding.
38
+
39
+ Args:
40
+ vocab_file (`str`):
41
+ Path to the vocabulary file.
42
+ """
43
+
44
+ vocab_files_names = VOCAB_FILES_NAMES
45
+ pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
46
+ model_input_names = ["input_ids", "attention_mask"]
47
+ _auto_class = "AutoTokenizer"
48
+
49
+ def __init__(
50
+ self,
51
+ vocab_file,
52
+ unk_token="<unk>",
53
+ bos_token="<s>",
54
+ eos_token="</s>",
55
+ pad_token="</s>",
56
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
57
+ add_bos_token=True,
58
+ add_eos_token=False,
59
+ decode_with_prefix_space=False,
60
+ clean_up_tokenization_spaces=False,
61
+ **kwargs,
62
+ ):
63
+ self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
64
+ self.vocab_file = vocab_file
65
+ self.add_bos_token = add_bos_token
66
+ self.add_eos_token = add_eos_token
67
+ self.decode_with_prefix_space = decode_with_prefix_space
68
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
69
+ self.sp_model.Load(vocab_file)
70
+ self._no_prefix_space_tokens = None
71
+ super().__init__(
72
+ bos_token=bos_token,
73
+ eos_token=eos_token,
74
+ unk_token=unk_token,
75
+ pad_token=pad_token,
76
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
77
+ **kwargs,
78
+ )
79
+
80
+ @property
81
+ def no_prefix_space_tokens(self):
82
+ if self._no_prefix_space_tokens is None:
83
+ vocab = self.convert_ids_to_tokens(list(range(self.vocab_size)))
84
+ self._no_prefix_space_tokens = {i for i, tok in enumerate(vocab) if not tok.startswith("▁")}
85
+ return self._no_prefix_space_tokens
86
+
87
+ @property
88
+ def vocab_size(self):
89
+ """Returns vocab size"""
90
+ return self.sp_model.get_piece_size()
91
+
92
+ @property
93
+ def bos_token_id(self) -> Optional[int]:
94
+ return self.sp_model.bos_id()
95
+
96
+ @property
97
+ def eos_token_id(self) -> Optional[int]:
98
+ return self.sp_model.eos_id()
99
+
100
+ def get_vocab(self):
101
+ """Returns vocab as a dict"""
102
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
103
+ vocab.update(self.added_tokens_encoder)
104
+ return vocab
105
+
106
+ def _tokenize(self, text):
107
+ """Returns a tokenized string."""
108
+ return self.sp_model.encode(text, out_type=str)
109
+
110
+ def _convert_token_to_id(self, token):
111
+ """Converts a token (str) in an id using the vocab."""
112
+ return self.sp_model.piece_to_id(token)
113
+
114
+ def _convert_id_to_token(self, index):
115
+ """Converts an index (integer) in a token (str) using the vocab."""
116
+ token = self.sp_model.IdToPiece(index)
117
+ return token
118
+
119
+ def _maybe_add_prefix_space(self, tokens, decoded):
120
+ if tokens and tokens[0] not in self.no_prefix_space_tokens:
121
+ return " " + decoded
122
+ else:
123
+ return decoded
124
+
125
+ def convert_tokens_to_string(self, tokens):
126
+ """Converts a sequence of tokens (string) in a single string."""
127
+ current_sub_tokens = []
128
+ out_string = ""
129
+ prev_is_special = False
130
+ for token in tokens:
131
+ # make sure that special tokens are not decoded using sentencepiece model
132
+ if token in self.all_special_tokens:
133
+ if not prev_is_special:
134
+ out_string += " "
135
+ out_string += self.sp_model.decode(current_sub_tokens) + token
136
+ prev_is_special = True
137
+ current_sub_tokens = []
138
+ else:
139
+ current_sub_tokens.append(token)
140
+ prev_is_special = False
141
+ out_string += self.sp_model.decode(current_sub_tokens)
142
+ out_string = self.clean_up_tokenization(out_string)
143
+ out_string = self._maybe_add_prefix_space(tokens=tokens, decoded=out_string)
144
+ return out_string[1:]
145
+
146
+ def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]:
147
+ """
148
+ Save the vocabulary and special tokens file to a directory.
149
+
150
+ Args:
151
+ save_directory (`str`):
152
+ The directory in which to save the vocabulary.
153
+
154
+ Returns:
155
+ `Tuple(str)`: Paths to the files saved.
156
+ """
157
+ if not os.path.isdir(save_directory):
158
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
159
+ return
160
+ out_vocab_file = os.path.join(
161
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
162
+ )
163
+
164
+ if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file):
165
+ copyfile(self.vocab_file, out_vocab_file)
166
+ elif not os.path.isfile(self.vocab_file):
167
+ with open(out_vocab_file, "wb") as fi:
168
+ content_spiece_model = self.sp_model.serialized_model_proto()
169
+ fi.write(content_spiece_model)
170
+
171
+ return (out_vocab_file,)
172
+
173
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
174
+ if self.add_bos_token:
175
+ bos_token_ids = [self.bos_token_id]
176
+ else:
177
+ bos_token_ids = []
178
+
179
+ output = bos_token_ids + token_ids_0
180
+
181
+ if token_ids_1 is not None:
182
+ output = output + token_ids_1
183
+
184
+ if self.add_eos_token:
185
+ output = output + [self.eos_token_id]
186
+
187
+ return output
188
+
189
+ def get_special_tokens_mask(
190
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
191
+ ) -> List[int]:
192
+ """
193
+ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
194
+ special tokens using the tokenizer `prepare_for_model` method.
195
+
196
+ Args:
197
+ token_ids_0 (`List[int]`):
198
+ List of IDs.
199
+ token_ids_1 (`List[int]`, *optional*):
200
+ Optional second list of IDs for sequence pairs.
201
+ already_has_special_tokens (`bool`, *optional*, defaults to `False`):
202
+ Whether or not the token list is already formatted with special tokens for the model.
203
+
204
+ Returns:
205
+ `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
206
+ """
207
+ if already_has_special_tokens:
208
+ return super().get_special_tokens_mask(
209
+ token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True
210
+ )
211
+
212
+ if token_ids_1 is None:
213
+ return [1] + ([0] * len(token_ids_0)) + [1]
214
+ return [1] + ([0] * len(token_ids_0)) + [1, 1] + ([0] * len(token_ids_1)) + [1]
215
+
216
+ def create_token_type_ids_from_sequences(
217
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
218
+ ) -> List[int]:
219
+ """
220
+ Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
221
+ use of token type ids, therefore a list of zeros is returned.
222
+
223
+ Args:
224
+ token_ids_0 (`List[int]`):
225
+ List of IDs.
226
+ token_ids_1 (`List[int]`, *optional*):
227
+ Optional second list of IDs for sequence pairs.
228
+
229
+ Returns:
230
+ `List[int]`: List of zeros.
231
+ """
232
+ eos = [self.eos_token_id]
233
+
234
+ if token_ids_1 is None:
235
+ return len(token_ids_0 + eos) * [0]
236
+ return len(token_ids_0 + eos + token_ids_1 + eos) * [0]
tokenization_internlm2_fast.py ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright (c) The InternLM team and The HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # This code is based on transformers/src/transformers/models/llama/tokenization_llama_fast.py
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ """Tokenization Fast class for InternLM."""
19
+ import os
20
+ from shutil import copyfile
21
+ from typing import Any, Dict, Optional, Tuple
22
+
23
+ from tokenizers import processors, decoders, Tokenizer, normalizers
24
+ from tokenizers.models import BPE
25
+
26
+ from transformers.tokenization_utils_fast import PreTrainedTokenizerFast
27
+ from transformers.utils import logging
28
+
29
+ from transformers.convert_slow_tokenizer import (
30
+ SLOW_TO_FAST_CONVERTERS,
31
+ SpmConverter,
32
+ SentencePieceExtractor,
33
+ )
34
+
35
+ from .tokenization_internlm2 import InternLM2Tokenizer
36
+
37
+ logger = logging.get_logger(__name__)
38
+
39
+ VOCAB_FILES_NAMES = {"vocab_file": "./tokenizer.model"}
40
+
41
+ # Modified from transformers.convert_slow_tokenizer.LlamaConverter
42
+ class InternLM2Converter(SpmConverter):
43
+ handle_byte_fallback = True
44
+
45
+ def vocab(self, proto):
46
+ vocab = [
47
+ ("<unk>", 0.0),
48
+ ("<s>", 0.0),
49
+ ("</s>", 0.0),
50
+ ]
51
+ vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]]
52
+ return vocab
53
+
54
+ def unk_id(self, proto):
55
+ unk_id = 0
56
+ return unk_id
57
+
58
+ def decoder(self, replacement, add_prefix_space):
59
+ return decoders.Sequence(
60
+ [
61
+ decoders.Replace("▁", " "),
62
+ decoders.ByteFallback(),
63
+ decoders.Fuse(),
64
+ decoders.Strip(content=" ", left=1),
65
+ ]
66
+ )
67
+
68
+ def tokenizer(self, proto):
69
+ model_type = proto.trainer_spec.model_type
70
+ vocab_scores = self.vocab(proto)
71
+ # special tokens
72
+ added_tokens = self.original_tokenizer.added_tokens_decoder
73
+ for i in range(len(vocab_scores)):
74
+ piece, score = vocab_scores[i]
75
+ if i in added_tokens:
76
+ vocab_scores[i] = (added_tokens[i].content, score)
77
+ if model_type == 1:
78
+ raise RuntimeError("InternLM2 is supposed to be a BPE model!")
79
+
80
+ elif model_type == 2:
81
+ _, merges = SentencePieceExtractor(self.original_tokenizer.vocab_file).extract(vocab_scores)
82
+ bpe_vocab = {word: i for i, (word, _score) in enumerate(vocab_scores)}
83
+ tokenizer = Tokenizer(
84
+ BPE(bpe_vocab, merges, unk_token=proto.trainer_spec.unk_piece, fuse_unk=True, byte_fallback=True)
85
+ )
86
+ tokenizer.add_special_tokens(
87
+ [ added_token for index, added_token in added_tokens.items()]
88
+ )
89
+ else:
90
+ raise Exception(
91
+ "You're trying to run a `Unigram` model but you're file was trained with a different algorithm"
92
+ )
93
+
94
+ return tokenizer
95
+
96
+ def normalizer(self, proto):
97
+ normalizers_list = []
98
+ if proto.normalizer_spec.add_dummy_prefix:
99
+ normalizers_list.append(normalizers.Prepend(prepend="▁"))
100
+ normalizers_list.append(normalizers.Replace(pattern=" ", content="▁"))
101
+ return normalizers.Sequence(normalizers_list)
102
+
103
+ def pre_tokenizer(self, replacement, add_prefix_space):
104
+ return None
105
+
106
+ SLOW_TO_FAST_CONVERTERS["InternLM2Tokenizer"] = InternLM2Converter
107
+
108
+
109
+ # Modified from transformers.model.llama.tokenization_llama_fast.LlamaTokenizerFast -> InternLM2TokenizerFast
110
+ class InternLM2TokenizerFast(PreTrainedTokenizerFast):
111
+ vocab_files_names = VOCAB_FILES_NAMES
112
+ slow_tokenizer_class = InternLM2Tokenizer
113
+ padding_side = "left"
114
+ model_input_names = ["input_ids", "attention_mask"]
115
+ _auto_class = "AutoTokenizer"
116
+
117
+ def __init__(
118
+ self,
119
+ vocab_file,
120
+ unk_token="<unk>",
121
+ bos_token="<s>",
122
+ eos_token="</s>",
123
+ pad_token="</s>",
124
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
125
+ add_bos_token=True,
126
+ add_eos_token=False,
127
+ decode_with_prefix_space=False,
128
+ clean_up_tokenization_spaces=False,
129
+ **kwargs,
130
+ ):
131
+ super().__init__(
132
+ vocab_file=vocab_file,
133
+ unk_token=unk_token,
134
+ bos_token=bos_token,
135
+ eos_token=eos_token,
136
+ pad_token=pad_token,
137
+ sp_model_kwargs=sp_model_kwargs,
138
+ add_bos_token=add_bos_token,
139
+ add_eos_token=add_eos_token,
140
+ decode_with_prefix_space=decode_with_prefix_space,
141
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
142
+ **kwargs,
143
+ )
144
+ self._add_bos_token = add_bos_token
145
+ self._add_eos_token = add_eos_token
146
+ self.update_post_processor()
147
+ self.vocab_file = vocab_file
148
+
149
+ @property
150
+ def can_save_slow_tokenizer(self) -> bool:
151
+ return os.path.isfile(self.vocab_file) if self.vocab_file else False
152
+
153
+ def update_post_processor(self):
154
+ """
155
+ Updates the underlying post processor with the current `bos_token` and `eos_token`.
156
+ """
157
+ bos = self.bos_token
158
+ bos_token_id = self.bos_token_id
159
+ if bos is None and self.add_bos_token:
160
+ raise ValueError("add_bos_token = True but bos_token = None")
161
+
162
+ eos = self.eos_token
163
+ eos_token_id = self.eos_token_id
164
+ if eos is None and self.add_eos_token:
165
+ raise ValueError("add_eos_token = True but eos_token = None")
166
+
167
+ single = f"{(bos+':0 ') if self.add_bos_token else ''}$A:0{(' '+eos+':0') if self.add_eos_token else ''}"
168
+ pair = f"{single}{(' '+bos+':1') if self.add_bos_token else ''} $B:1{(' '+eos+':1') if self.add_eos_token else ''}"
169
+
170
+ special_tokens = []
171
+ if self.add_bos_token:
172
+ special_tokens.append((bos, bos_token_id))
173
+ if self.add_eos_token:
174
+ special_tokens.append((eos, eos_token_id))
175
+ self._tokenizer.post_processor = processors.TemplateProcessing(
176
+ single=single, pair=pair, special_tokens=special_tokens
177
+ )
178
+
179
+ @property
180
+ def add_eos_token(self):
181
+ return self._add_eos_token
182
+
183
+ @property
184
+ def add_bos_token(self):
185
+ return self._add_bos_token
186
+
187
+ @add_eos_token.setter
188
+ def add_eos_token(self, value):
189
+ self._add_eos_token = value
190
+ self.update_post_processor()
191
+
192
+ @add_bos_token.setter
193
+ def add_bos_token(self, value):
194
+ self._add_bos_token = value
195
+ self.update_post_processor()
196
+
197
+ def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
198
+ if not self.can_save_slow_tokenizer:
199
+ raise ValueError(
200
+ "Your fast tokenizer does not have the necessary information to save the vocabulary for a slow "
201
+ "tokenizer."
202
+ )
203
+
204
+ if not os.path.isdir(save_directory):
205
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
206
+ return
207
+ out_vocab_file = os.path.join(
208
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
209
+ )
210
+
211
+ if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file):
212
+ copyfile(self.vocab_file, out_vocab_file)
213
+
214
+ return (out_vocab_file,)
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f868398fc4e05ee1e8aeba95ddf18ddcc45b8bce55d5093bead5bbf80429b48b
3
+ size 1477754
tokenizer_config.json ADDED
@@ -0,0 +1,559 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "92544": {
30
+ "content": "<|im_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": false
36
+ },
37
+ "92545": {
38
+ "content": "<|im_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": false
44
+ },
45
+ "92546": {
46
+ "content": "<|special_0|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": false
52
+ },
53
+ "92547": {
54
+ "content": "<|special_1|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": false
60
+ },
61
+ "92548": {
62
+ "content": "<|special_2|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": false
68
+ },
69
+ "92549": {
70
+ "content": "<|special_3|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": false
76
+ },
77
+ "92550": {
78
+ "content": "<|special_4|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": false
84
+ },
85
+ "92551": {
86
+ "content": "<|special_5|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": false
92
+ },
93
+ "92552": {
94
+ "content": "<|special_6|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": false
100
+ },
101
+ "92553": {
102
+ "content": "<|special_7|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": false
108
+ },
109
+ "92554": {
110
+ "content": "<|special_8|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": false
116
+ },
117
+ "92555": {
118
+ "content": "<|special_9|>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "92556": {
126
+ "content": "<|special_10|>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "92557": {
134
+ "content": "<|special_11|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "92558": {
142
+ "content": "<|special_12|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "92559": {
150
+ "content": "<|special_13|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "92560": {
158
+ "content": "<|special_14|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "92561": {
166
+ "content": "<|special_15|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "92562": {
174
+ "content": "<|special_16|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "92563": {
182
+ "content": "<|special_17|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "92564": {
190
+ "content": "<|special_18|>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "92565": {
198
+ "content": "<|special_19|>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "92566": {
206
+ "content": "<|special_20|>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ },
213
+ "92567": {
214
+ "content": "<|special_21|>",
215
+ "lstrip": false,
216
+ "normalized": false,
217
+ "rstrip": false,
218
+ "single_word": false,
219
+ "special": false
220
+ },
221
+ "92568": {
222
+ "content": "<|special_22|>",
223
+ "lstrip": false,
224
+ "normalized": false,
225
+ "rstrip": false,
226
+ "single_word": false,
227
+ "special": false
228
+ },
229
+ "92569": {
230
+ "content": "<|special_23|>",
231
+ "lstrip": false,
232
+ "normalized": false,
233
+ "rstrip": false,
234
+ "single_word": false,
235
+ "special": false
236
+ },
237
+ "92570": {
238
+ "content": "<|special_24|>",
239
+ "lstrip": false,
240
+ "normalized": false,
241
+ "rstrip": false,
242
+ "single_word": false,
243
+ "special": false
244
+ },
245
+ "92571": {
246
+ "content": "<|special_25|>",
247
+ "lstrip": false,
248
+ "normalized": false,
249
+ "rstrip": false,
250
+ "single_word": false,
251
+ "special": false
252
+ },
253
+ "92572": {
254
+ "content": "<|special_26|>",
255
+ "lstrip": false,
256
+ "normalized": false,
257
+ "rstrip": false,
258
+ "single_word": false,
259
+ "special": false
260
+ },
261
+ "92573": {
262
+ "content": "<|special_27|>",
263
+ "lstrip": false,
264
+ "normalized": false,
265
+ "rstrip": false,
266
+ "single_word": false,
267
+ "special": false
268
+ },
269
+ "92574": {
270
+ "content": "<|special_28|>",
271
+ "lstrip": false,
272
+ "normalized": false,
273
+ "rstrip": false,
274
+ "single_word": false,
275
+ "special": false
276
+ },
277
+ "92575": {
278
+ "content": "<|special_29|>",
279
+ "lstrip": false,
280
+ "normalized": false,
281
+ "rstrip": false,
282
+ "single_word": false,
283
+ "special": false
284
+ },
285
+ "92576": {
286
+ "content": "<|special_30|>",
287
+ "lstrip": false,
288
+ "normalized": false,
289
+ "rstrip": false,
290
+ "single_word": false,
291
+ "special": false
292
+ },
293
+ "92577": {
294
+ "content": "<|special_31|>",
295
+ "lstrip": false,
296
+ "normalized": false,
297
+ "rstrip": false,
298
+ "single_word": false,
299
+ "special": false
300
+ },
301
+ "92578": {
302
+ "content": "<|special_32|>",
303
+ "lstrip": false,
304
+ "normalized": false,
305
+ "rstrip": false,
306
+ "single_word": false,
307
+ "special": false
308
+ },
309
+ "92579": {
310
+ "content": "<|special_33|>",
311
+ "lstrip": false,
312
+ "normalized": false,
313
+ "rstrip": false,
314
+ "single_word": false,
315
+ "special": false
316
+ },
317
+ "92580": {
318
+ "content": "<|special_34|>",
319
+ "lstrip": false,
320
+ "normalized": false,
321
+ "rstrip": false,
322
+ "single_word": false,
323
+ "special": false
324
+ },
325
+ "92581": {
326
+ "content": "<|special_35|>",
327
+ "lstrip": false,
328
+ "normalized": false,
329
+ "rstrip": false,
330
+ "single_word": false,
331
+ "special": false
332
+ },
333
+ "92582": {
334
+ "content": "<|special_36|>",
335
+ "lstrip": false,
336
+ "normalized": false,
337
+ "rstrip": false,
338
+ "single_word": false,
339
+ "special": false
340
+ },
341
+ "92583": {
342
+ "content": "<|special_37|>",
343
+ "lstrip": false,
344
+ "normalized": false,
345
+ "rstrip": false,
346
+ "single_word": false,
347
+ "special": false
348
+ },
349
+ "92584": {
350
+ "content": "<|special_38|>",
351
+ "lstrip": false,
352
+ "normalized": false,
353
+ "rstrip": false,
354
+ "single_word": false,
355
+ "special": false
356
+ },
357
+ "92585": {
358
+ "content": "<|special_39|>",
359
+ "lstrip": false,
360
+ "normalized": false,
361
+ "rstrip": false,
362
+ "single_word": false,
363
+ "special": false
364
+ },
365
+ "92586": {
366
+ "content": "<|special_40|>",
367
+ "lstrip": false,
368
+ "normalized": false,
369
+ "rstrip": false,
370
+ "single_word": false,
371
+ "special": false
372
+ },
373
+ "92587": {
374
+ "content": "<|special_41|>",
375
+ "lstrip": false,
376
+ "normalized": false,
377
+ "rstrip": false,
378
+ "single_word": false,
379
+ "special": false
380
+ },
381
+ "92588": {
382
+ "content": "<|special_42|>",
383
+ "lstrip": false,
384
+ "normalized": false,
385
+ "rstrip": false,
386
+ "single_word": false,
387
+ "special": false
388
+ },
389
+ "92589": {
390
+ "content": "<|special_43|>",
391
+ "lstrip": false,
392
+ "normalized": false,
393
+ "rstrip": false,
394
+ "single_word": false,
395
+ "special": false
396
+ },
397
+ "92590": {
398
+ "content": "<|special_44|>",
399
+ "lstrip": false,
400
+ "normalized": false,
401
+ "rstrip": false,
402
+ "single_word": false,
403
+ "special": false
404
+ },
405
+ "92591": {
406
+ "content": "<|special_45|>",
407
+ "lstrip": false,
408
+ "normalized": false,
409
+ "rstrip": false,
410
+ "single_word": false,
411
+ "special": false
412
+ },
413
+ "92592": {
414
+ "content": "<|special_46|>",
415
+ "lstrip": false,
416
+ "normalized": false,
417
+ "rstrip": false,
418
+ "single_word": false,
419
+ "special": false
420
+ },
421
+ "92593": {
422
+ "content": "<|special_47|>",
423
+ "lstrip": false,
424
+ "normalized": false,
425
+ "rstrip": false,
426
+ "single_word": false,
427
+ "special": false
428
+ },
429
+ "92594": {
430
+ "content": "<|special_48|>",
431
+ "lstrip": false,
432
+ "normalized": false,
433
+ "rstrip": false,
434
+ "single_word": false,
435
+ "special": false
436
+ },
437
+ "92595": {
438
+ "content": "<|special_49|>",
439
+ "lstrip": false,
440
+ "normalized": false,
441
+ "rstrip": false,
442
+ "single_word": false,
443
+ "special": false
444
+ },
445
+ "92596": {
446
+ "content": "<|special_50|>",
447
+ "lstrip": false,
448
+ "normalized": false,
449
+ "rstrip": false,
450
+ "single_word": false,
451
+ "special": false
452
+ },
453
+ "92597": {
454
+ "content": "<|special_51|>",
455
+ "lstrip": false,
456
+ "normalized": false,
457
+ "rstrip": false,
458
+ "single_word": false,
459
+ "special": false
460
+ },
461
+ "92598": {
462
+ "content": "<|special_52|>",
463
+ "lstrip": false,
464
+ "normalized": false,
465
+ "rstrip": false,
466
+ "single_word": false,
467
+ "special": false
468
+ },
469
+ "92599": {
470
+ "content": "<|special_53|>",
471
+ "lstrip": false,
472
+ "normalized": false,
473
+ "rstrip": false,
474
+ "single_word": false,
475
+ "special": false
476
+ },
477
+ "92600": {
478
+ "content": "<|special_54|>",
479
+ "lstrip": false,
480
+ "normalized": false,
481
+ "rstrip": false,
482
+ "single_word": false,
483
+ "special": false
484
+ },
485
+ "92601": {
486
+ "content": "<|special_55|>",
487
+ "lstrip": false,
488
+ "normalized": false,
489
+ "rstrip": false,
490
+ "single_word": false,
491
+ "special": false
492
+ },
493
+ "92602": {
494
+ "content": "<|special_56|>",
495
+ "lstrip": false,
496
+ "normalized": false,
497
+ "rstrip": false,
498
+ "single_word": false,
499
+ "special": false
500
+ },
501
+ "92603": {
502
+ "content": "<|special_57|>",
503
+ "lstrip": false,
504
+ "normalized": false,
505
+ "rstrip": false,
506
+ "single_word": false,
507
+ "special": false
508
+ },
509
+ "92604": {
510
+ "content": "<|special_58|>",
511
+ "lstrip": false,
512
+ "normalized": false,
513
+ "rstrip": false,
514
+ "single_word": false,
515
+ "special": false
516
+ },
517
+ "92605": {
518
+ "content": "<|special_59|>",
519
+ "lstrip": false,
520
+ "normalized": false,
521
+ "rstrip": false,
522
+ "single_word": false,
523
+ "special": false
524
+ },
525
+ "92606": {
526
+ "content": "<|special_60|>",
527
+ "lstrip": false,
528
+ "normalized": false,
529
+ "rstrip": false,
530
+ "single_word": false,
531
+ "special": false
532
+ },
533
+ "92607": {
534
+ "content": "<|special_61|>",
535
+ "lstrip": false,
536
+ "normalized": false,
537
+ "rstrip": false,
538
+ "single_word": false,
539
+ "special": false
540
+ }
541
+ },
542
+ "auto_map": {
543
+ "AutoTokenizer": [
544
+ "tokenization_internlm2.InternLM2Tokenizer",
545
+ "tokenization_internlm2_fast.InternLM2TokenizerFast"
546
+ ]
547
+ },
548
+ "bos_token": "<s>",
549
+ "clean_up_tokenization_spaces": false,
550
+ "decode_with_prefix_space": false,
551
+ "eos_token": "</s>",
552
+ "model_max_length": 1000000000000000019884624838656,
553
+ "pad_token": "</s>",
554
+ "sp_model_kwargs": null,
555
+ "tokenizer_class": "InternLM2Tokenizer",
556
+ "unk_token": "<unk>",
557
+ "use_default_system_prompt": false,
558
+ "chat_template": "{%- for idx in range(0, messages|length) -%}\n{%- if messages[idx]['role'] == 'user' -%}\n{%- if idx == 0 -%}\n{{- bos_token + '[INST] <<SYS>>\\nYou are a helpful, unbiased, uncensored assistant.\\n<</SYS>>\\n\\n' + messages[idx]['content'] + ' [/INST]' -}}\n{%- else -%}\n{{- bos_token + '[INST] ' + messages[idx]['content'] + ' [/INST]' -}}\n{%- endif -%}\n{% elif messages[idx]['role'] == 'system' %}\n{{- '[INST] <<SYS>>\\n' + messages[idx]['content'] + '\\n<</SYS>>\\n\\n' -}}\n{%- elif messages[idx]['role'] == 'assistant' -%}\n{{- messages[idx]['content'] + ' ' + eos_token -}}\n{% endif %}\n{% endfor %}"
559
+ }