Nessim commited on
Commit
4acaaff
·
verified ·
1 Parent(s): ef6add7

Nessim-48M-Base: final checkpoint of the from-scratch run (step 123,999, 26.4B tokens)

Browse files
LICENSE ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Attribution-NonCommercial 4.0 International
2
+
3
+ =======================================================================
4
+
5
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
6
+ does not provide legal services or legal advice. Distribution of
7
+ Creative Commons public licenses does not create a lawyer-client or
8
+ other relationship. Creative Commons makes its licenses and related
9
+ information available on an "as-is" basis. Creative Commons gives no
10
+ warranties regarding its licenses, any material licensed under their
11
+ terms and conditions, or any related information. Creative Commons
12
+ disclaims all liability for damages resulting from their use to the
13
+ fullest extent possible.
14
+
15
+ Using Creative Commons Public Licenses
16
+
17
+ Creative Commons public licenses provide a standard set of terms and
18
+ conditions that creators and other rights holders may use to share
19
+ original works of authorship and other material subject to copyright
20
+ and certain other rights specified in the public license below. The
21
+ following considerations are for informational purposes only, are not
22
+ exhaustive, and do not form part of our licenses.
23
+
24
+ Considerations for licensors: Our public licenses are
25
+ intended for use by those authorized to give the public
26
+ permission to use material in ways otherwise restricted by
27
+ copyright and certain other rights. Our licenses are
28
+ irrevocable. Licensors should read and understand the terms
29
+ and conditions of the license they choose before applying it.
30
+ Licensors should also secure all rights necessary before
31
+ applying our licenses so that the public can reuse the
32
+ material as expected. Licensors should clearly mark any
33
+ material not subject to the license. This includes other CC-
34
+ licensed material, or material used under an exception or
35
+ limitation to copyright. More considerations for licensors:
36
+ wiki.creativecommons.org/Considerations_for_licensors
37
+
38
+ Considerations for the public: By using one of our public
39
+ licenses, a licensor grants the public permission to use the
40
+ licensed material under specified terms and conditions. If
41
+ the licensor's permission is not necessary for any reason--for
42
+ example, because of any applicable exception or limitation to
43
+ copyright--then that use is not regulated by the license. Our
44
+ licenses grant only permissions under copyright and certain
45
+ other rights that a licensor has authority to grant. Use of
46
+ the licensed material may still be restricted for other
47
+ reasons, including because others have copyright or other
48
+ rights in the material. A licensor may make special requests,
49
+ such as asking that all changes be marked or described.
50
+ Although not required by our licenses, you are encouraged to
51
+ respect those requests where reasonable. More considerations
52
+ for the public:
53
+ wiki.creativecommons.org/Considerations_for_licensees
54
+
55
+ =======================================================================
56
+
57
+ Creative Commons Attribution-NonCommercial 4.0 International Public
58
+ License
59
+
60
+ By exercising the Licensed Rights (defined below), You accept and agree
61
+ to be bound by the terms and conditions of this Creative Commons
62
+ Attribution-NonCommercial 4.0 International Public License ("Public
63
+ License"). To the extent this Public License may be interpreted as a
64
+ contract, You are granted the Licensed Rights in consideration of Your
65
+ acceptance of these terms and conditions, and the Licensor grants You
66
+ such rights in consideration of benefits the Licensor receives from
67
+ making the Licensed Material available under these terms and
68
+ conditions.
69
+
70
+
71
+ Section 1 -- Definitions.
72
+
73
+ a. Adapted Material means material subject to Copyright and Similar
74
+ Rights that is derived from or based upon the Licensed Material
75
+ and in which the Licensed Material is translated, altered,
76
+ arranged, transformed, or otherwise modified in a manner requiring
77
+ permission under the Copyright and Similar Rights held by the
78
+ Licensor. For purposes of this Public License, where the Licensed
79
+ Material is a musical work, performance, or sound recording,
80
+ Adapted Material is always produced where the Licensed Material is
81
+ synched in timed relation with a moving image.
82
+
83
+ b. Adapter's License means the license You apply to Your Copyright
84
+ and Similar Rights in Your contributions to Adapted Material in
85
+ accordance with the terms and conditions of this Public License.
86
+
87
+ c. Copyright and Similar Rights means copyright and/or similar rights
88
+ closely related to copyright including, without limitation,
89
+ performance, broadcast, sound recording, and Sui Generis Database
90
+ Rights, without regard to how the rights are labeled or
91
+ categorized. For purposes of this Public License, the rights
92
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
93
+ Rights.
94
+ d. Effective Technological Measures means those measures that, in the
95
+ absence of proper authority, may not be circumvented under laws
96
+ fulfilling obligations under Article 11 of the WIPO Copyright
97
+ Treaty adopted on December 20, 1996, and/or similar international
98
+ agreements.
99
+
100
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
101
+ any other exception or limitation to Copyright and Similar Rights
102
+ that applies to Your use of the Licensed Material.
103
+
104
+ f. Licensed Material means the artistic or literary work, database,
105
+ or other material to which the Licensor applied this Public
106
+ License.
107
+
108
+ g. Licensed Rights means the rights granted to You subject to the
109
+ terms and conditions of this Public License, which are limited to
110
+ all Copyright and Similar Rights that apply to Your use of the
111
+ Licensed Material and that the Licensor has authority to license.
112
+
113
+ h. Licensor means the individual(s) or entity(ies) granting rights
114
+ under this Public License.
115
+
116
+ i. NonCommercial means not primarily intended for or directed towards
117
+ commercial advantage or monetary compensation. For purposes of
118
+ this Public License, the exchange of the Licensed Material for
119
+ other material subject to Copyright and Similar Rights by digital
120
+ file-sharing or similar means is NonCommercial provided there is
121
+ no payment of monetary compensation in connection with the
122
+ exchange.
123
+
124
+ j. Share means to provide material to the public by any means or
125
+ process that requires permission under the Licensed Rights, such
126
+ as reproduction, public display, public performance, distribution,
127
+ dissemination, communication, or importation, and to make material
128
+ available to the public including in ways that members of the
129
+ public may access the material from a place and at a time
130
+ individually chosen by them.
131
+
132
+ k. Sui Generis Database Rights means rights other than copyright
133
+ resulting from Directive 96/9/EC of the European Parliament and of
134
+ the Council of 11 March 1996 on the legal protection of databases,
135
+ as amended and/or succeeded, as well as other essentially
136
+ equivalent rights anywhere in the world.
137
+
138
+ l. You means the individual or entity exercising the Licensed Rights
139
+ under this Public License. Your has a corresponding meaning.
140
+
141
+
142
+ Section 2 -- Scope.
143
+
144
+ a. License grant.
145
+
146
+ 1. Subject to the terms and conditions of this Public License,
147
+ the Licensor hereby grants You a worldwide, royalty-free,
148
+ non-sublicensable, non-exclusive, irrevocable license to
149
+ exercise the Licensed Rights in the Licensed Material to:
150
+
151
+ a. reproduce and Share the Licensed Material, in whole or
152
+ in part, for NonCommercial purposes only; and
153
+
154
+ b. produce, reproduce, and Share Adapted Material for
155
+ NonCommercial purposes only.
156
+
157
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
158
+ Exceptions and Limitations apply to Your use, this Public
159
+ License does not apply, and You do not need to comply with
160
+ its terms and conditions.
161
+
162
+ 3. Term. The term of this Public License is specified in Section
163
+ 6(a).
164
+
165
+ 4. Media and formats; technical modifications allowed. The
166
+ Licensor authorizes You to exercise the Licensed Rights in
167
+ all media and formats whether now known or hereafter created,
168
+ and to make technical modifications necessary to do so. The
169
+ Licensor waives and/or agrees not to assert any right or
170
+ authority to forbid You from making technical modifications
171
+ necessary to exercise the Licensed Rights, including
172
+ technical modifications necessary to circumvent Effective
173
+ Technological Measures. For purposes of this Public License,
174
+ simply making modifications authorized by this Section 2(a)
175
+ (4) never produces Adapted Material.
176
+
177
+ 5. Downstream recipients.
178
+
179
+ a. Offer from the Licensor -- Licensed Material. Every
180
+ recipient of the Licensed Material automatically
181
+ receives an offer from the Licensor to exercise the
182
+ Licensed Rights under the terms and conditions of this
183
+ Public License.
184
+
185
+ b. No downstream restrictions. You may not offer or impose
186
+ any additional or different terms or conditions on, or
187
+ apply any Effective Technological Measures to, the
188
+ Licensed Material if doing so restricts exercise of the
189
+ Licensed Rights by any recipient of the Licensed
190
+ Material.
191
+
192
+ 6. No endorsement. Nothing in this Public License constitutes or
193
+ may be construed as permission to assert or imply that You
194
+ are, or that Your use of the Licensed Material is, connected
195
+ with, or sponsored, endorsed, or granted official status by,
196
+ the Licensor or others designated to receive attribution as
197
+ provided in Section 3(a)(1)(A)(i).
198
+
199
+ b. Other rights.
200
+
201
+ 1. Moral rights, such as the right of integrity, are not
202
+ licensed under this Public License, nor are publicity,
203
+ privacy, and/or other similar personality rights; however, to
204
+ the extent possible, the Licensor waives and/or agrees not to
205
+ assert any such rights held by the Licensor to the limited
206
+ extent necessary to allow You to exercise the Licensed
207
+ Rights, but not otherwise.
208
+
209
+ 2. Patent and trademark rights are not licensed under this
210
+ Public License.
211
+
212
+ 3. To the extent possible, the Licensor waives any right to
213
+ collect royalties from You for the exercise of the Licensed
214
+ Rights, whether directly or through a collecting society
215
+ under any voluntary or waivable statutory or compulsory
216
+ licensing scheme. In all other cases the Licensor expressly
217
+ reserves any right to collect such royalties, including when
218
+ the Licensed Material is used other than for NonCommercial
219
+ purposes.
220
+
221
+
222
+ Section 3 -- License Conditions.
223
+
224
+ Your exercise of the Licensed Rights is expressly made subject to the
225
+ following conditions.
226
+
227
+ a. Attribution.
228
+
229
+ 1. If You Share the Licensed Material (including in modified
230
+ form), You must:
231
+
232
+ a. retain the following if it is supplied by the Licensor
233
+ with the Licensed Material:
234
+
235
+ i. identification of the creator(s) of the Licensed
236
+ Material and any others designated to receive
237
+ attribution, in any reasonable manner requested by
238
+ the Licensor (including by pseudonym if
239
+ designated);
240
+
241
+ ii. a copyright notice;
242
+
243
+ iii. a notice that refers to this Public License;
244
+
245
+ iv. a notice that refers to the disclaimer of
246
+ warranties;
247
+
248
+ v. a URI or hyperlink to the Licensed Material to the
249
+ extent reasonably practicable;
250
+
251
+ b. indicate if You modified the Licensed Material and
252
+ retain an indication of any previous modifications; and
253
+
254
+ c. indicate the Licensed Material is licensed under this
255
+ Public License, and include the text of, or the URI or
256
+ hyperlink to, this Public License.
257
+
258
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
259
+ reasonable manner based on the medium, means, and context in
260
+ which You Share the Licensed Material. For example, it may be
261
+ reasonable to satisfy the conditions by providing a URI or
262
+ hyperlink to a resource that includes the required
263
+ information.
264
+
265
+ 3. If requested by the Licensor, You must remove any of the
266
+ information required by Section 3(a)(1)(A) to the extent
267
+ reasonably practicable.
268
+
269
+ 4. If You Share Adapted Material You produce, the Adapter's
270
+ License You apply must not prevent recipients of the Adapted
271
+ Material from complying with this Public License.
272
+
273
+
274
+ Section 4 -- Sui Generis Database Rights.
275
+
276
+ Where the Licensed Rights include Sui Generis Database Rights that
277
+ apply to Your use of the Licensed Material:
278
+
279
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
280
+ to extract, reuse, reproduce, and Share all or a substantial
281
+ portion of the contents of the database for NonCommercial purposes
282
+ only;
283
+
284
+ b. if You include all or a substantial portion of the database
285
+ contents in a database in which You have Sui Generis Database
286
+ Rights, then the database in which You have Sui Generis Database
287
+ Rights (but not its individual contents) is Adapted Material; and
288
+
289
+ c. You must comply with the conditions in Section 3(a) if You Share
290
+ all or a substantial portion of the contents of the database.
291
+
292
+ For the avoidance of doubt, this Section 4 supplements and does not
293
+ replace Your obligations under this Public License where the Licensed
294
+ Rights include other Copyright and Similar Rights.
295
+
296
+
297
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
298
+
299
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
300
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
301
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
302
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
303
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
304
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
305
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
306
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
307
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
308
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
309
+
310
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
311
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
312
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
313
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
314
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
315
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
316
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
317
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
318
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
319
+
320
+ c. The disclaimer of warranties and limitation of liability provided
321
+ above shall be interpreted in a manner that, to the extent
322
+ possible, most closely approximates an absolute disclaimer and
323
+ waiver of all liability.
324
+
325
+
326
+ Section 6 -- Term and Termination.
327
+
328
+ a. This Public License applies for the term of the Copyright and
329
+ Similar Rights licensed here. However, if You fail to comply with
330
+ this Public License, then Your rights under this Public License
331
+ terminate automatically.
332
+
333
+ b. Where Your right to use the Licensed Material has terminated under
334
+ Section 6(a), it reinstates:
335
+
336
+ 1. automatically as of the date the violation is cured, provided
337
+ it is cured within 30 days of Your discovery of the
338
+ violation; or
339
+
340
+ 2. upon express reinstatement by the Licensor.
341
+
342
+ For the avoidance of doubt, this Section 6(b) does not affect any
343
+ right the Licensor may have to seek remedies for Your violations
344
+ of this Public License.
345
+
346
+ c. For the avoidance of doubt, the Licensor may also offer the
347
+ Licensed Material under separate terms or conditions or stop
348
+ distributing the Licensed Material at any time; however, doing so
349
+ will not terminate this Public License.
350
+
351
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
352
+ License.
353
+
354
+
355
+ Section 7 -- Other Terms and Conditions.
356
+
357
+ a. The Licensor shall not be bound by any additional or different
358
+ terms or conditions communicated by You unless expressly agreed.
359
+
360
+ b. Any arrangements, understandings, or agreements regarding the
361
+ Licensed Material not stated herein are separate from and
362
+ independent of the terms and conditions of this Public License.
363
+
364
+
365
+ Section 8 -- Interpretation.
366
+
367
+ a. For the avoidance of doubt, this Public License does not, and
368
+ shall not be interpreted to, reduce, limit, restrict, or impose
369
+ conditions on any use of the Licensed Material that could lawfully
370
+ be made without permission under this Public License.
371
+
372
+ b. To the extent possible, if any provision of this Public License is
373
+ deemed unenforceable, it shall be automatically reformed to the
374
+ minimum extent necessary to make it enforceable. If the provision
375
+ cannot be reformed, it shall be severed from this Public License
376
+ without affecting the enforceability of the remaining terms and
377
+ conditions.
378
+
379
+ c. No term or condition of this Public License will be waived and no
380
+ failure to comply consented to unless expressly agreed to by the
381
+ Licensor.
382
+
383
+ d. Nothing in this Public License constitutes or may be interpreted
384
+ as a limitation upon, or waiver of, any privileges and immunities
385
+ that apply to the Licensor or You, including from the legal
386
+ processes of any jurisdiction or authority.
387
+
388
+ =======================================================================
389
+
390
+ Creative Commons is not a party to its public
391
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
392
+ its public licenses to material it publishes and in those instances
393
+ will be considered the “Licensor.” The text of the Creative Commons
394
+ public licenses is dedicated to the public domain under the CC0 Public
395
+ Domain Dedication. Except for the limited purpose of indicating that
396
+ material is shared under a Creative Commons public license or as
397
+ otherwise permitted by the Creative Commons policies published at
398
+ creativecommons.org/policies, Creative Commons does not authorize the
399
+ use of the trademark "Creative Commons" or any other trademark or logo
400
+ of Creative Commons without its prior written consent including,
401
+ without limitation, in connection with any unauthorized modifications
402
+ to any of its public licenses or any other arrangements,
403
+ understandings, or agreements concerning use of licensed material. For
404
+ the avoidance of doubt, this paragraph does not form part of the
405
+ public licenses.
406
+
407
+ Creative Commons may be contacted at creativecommons.org.
408
+
LICENSE-CODE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - custom_code
9
+ - small-language-model
10
+ - base
11
+ - pretrained
12
+ - hybrid
13
+ - gated-deltanet
14
+ - looped
15
+ datasets:
16
+ - Estwld/atomic2020-origin
17
+ - HuggingFaceTB/cosmopedia
18
+ - HuggingFaceTB/smollm-corpus
19
+ - IFM/Math-Reasoning
20
+ - IFM/Pretrain-Behaviors
21
+ - IFM/TxT360-v2
22
+ - allenai/dolma3_dolmino_mix-100B-1025
23
+ - allenai/qasc
24
+ - allenai/sciq
25
+ - amydeng2000/CREAK
26
+ - community-datasets/glucose
27
+ - facebook/anli
28
+ - mlfoundations/dclm-baseline-1.0
29
+ - nvidia/Nemotron-ClimbMix
30
+ - nvidia/OpenMathInstruct-2
31
+ - openbmb/UltraData-Math
32
+ - openbmb/UltraX-Preview
33
+ ---
34
+
35
+ # Nessim-48M-Base
36
+
37
+ Nessim-48M-Base is a 48.1M-parameter base language model, pretrained from scratch on 26.4B tokens. It is built on the KLM 1.6 architecture (Gated DeltaNet-2 and attention layers, Block Attention Residuals, exact n-gram memory; [MinimaLabs/KLM-1.6](https://huggingface.co/MinimaLabs/KLM-1.6), Apache-2.0) and adds a looped shared core and four token-level programs. It was trained with no teacher: there is no distillation.
38
+
39
+ ## Architecture
40
+
41
+ | Field | Value |
42
+ |---|---|
43
+ | Parameters | 48,126,630, of which 5,411,832 are the n-gram memory |
44
+ | Unshared layers | 10: 2 prelude, 6 core, 2 coda |
45
+ | Loops | the 6 core layers are applied 4 times with shared weights: 28 layer applications per token, 20 Gated DeltaNet-2 and 8 attention |
46
+ | Hidden size | 512 |
47
+ | Gated DeltaNet-2 | 4 heads x 128 |
48
+ | Attention | 8 query heads, 4 KV heads, head size 64, RoPE, QK-norm, output gate, a learned distance bias per head |
49
+ | Residuals | [Block Attention Residuals](https://arxiv.org/abs/2603.15031) |
50
+ | N-gram memory | 125,000 bigrams and 38,000 trigrams (163,000 rows), each with its own learned vector of size 32 |
51
+ | Feed-forward | SwiGLU, hidden size 1,536 |
52
+ | Context length | 2,048 tokens |
53
+ | Vocabulary | 4,100 tokens (KLM 1.6 tokenizer), 4,160 embedding rows, tied embeddings |
54
+
55
+ What is added to KLM 1.6:
56
+
57
+ - **Loops.** One shared core of 6 layers is applied 4 times between an unshared prelude and coda. Every application is its own Block Attention Residuals consumer with its own query, and loop l > 0 starts by adding a learned vector `loop_signal[l]` to the newest residual source.
58
+ - **Copy pointer.** A learned, gated boost is added to the logits of the tokens that already occur in the document: a fast and a slow copy of every earlier token, and continuation of earlier matches of the last 1, 2 and 3 or more tokens. It is trained with its own learning rate and held fixed at its zero initialisation for the first 1,000 steps.
59
+ - **Induction inputs.** For every position, the token after the most recent earlier occurrence of the current token, and of the current pair of tokens, in the same document is read through a shared low-rank map (rank 32) of the token embedding and enters the network as one more residual source.
60
+ - **Previous-token front end.** The embeddings of the 2 preceding tokens of the same document go through the same low-rank map and into the same residual source.
61
+ - **Distance biases.** Each attention layer adds a learned bias per head to its scores, a function of the query-key offset in 24 buckets (exact below 8, then two per octave up to 1,449 and beyond).
62
+
63
+ All four programs are computed from `input_ids` inside `forward`. Attention, the Gated DeltaNet-2 state and short convolutions, the n-gram history and all four programs restart after every `<eos>` (id 2), as in training; a sequence without `<eos>`, which is what lm-eval and the ArithMark-3 script feed, is one document.
64
+
65
+ ## Parameter count
66
+
67
+ 48,126,630 is the number of elements of every tensor stored in `model.safetensors`, the two n-gram key tables included (47,963,630 floating-point weights, 125,000 int32 bigram keys and 38,000 int64 trigram keys). This is how the 98,975,308 of KLM 1.6 is counted: the elements of every tensor in its `model.safetensors`, its n-gram key tables included. Weights are stored in float32 (the training parameters); the file is 193 MB.
68
+
69
+ ## Training data
70
+
71
+ Sources, their licences (as recorded in our data manifest at download time; for ATOMIC 2020 and CREAK, whose Hugging Face copies state none, the licence of the original release), and what the 26.4B training tokens drew from each (mixture weight times the tokens of its stage, the last 37,200 of 123,999 steps on a second mixture; epochs against the tokens of the training split of the frozen view):
72
+
73
+ | Dataset | Source name | Category | Licence | Tokens seen (M) | Share | Epochs |
74
+ |---|---|---|---|---|---|---|
75
+ | [nvidia/Nemotron-ClimbMix](https://huggingface.co/datasets/nvidia/Nemotron-ClimbMix) | climbmix | web | cc-by-nc-4.0 | 7,120.9 | 26.96% | 0.21 |
76
+ | [IFM/TxT360-v2](https://huggingface.co/datasets/IFM/TxT360-v2) | txt360_web | web | cc-by-4.0 | 4,051.8 | 15.34% | 0.24 |
77
+ | [HuggingFaceTB/smollm-corpus](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus) | cosmopedia_v2 | textbooks | odc-by | 3,282.5 | 12.43% | 0.26 |
78
+ | [IFM/TxT360-v2](https://huggingface.co/datasets/IFM/TxT360-v2) | txt360_qa | qa | cc-by-4.0 | 1,690.3 | 6.40% | 0.34 |
79
+ | [allenai/dolma3_dolmino_mix-100B-1025](https://huggingface.co/datasets/allenai/dolma3_dolmino_mix-100B-1025) | dolmino_flashcards | qa | odc-by | 1,408.6 | 5.33% | 0.28 |
80
+ | [openbmb/UltraData-Math](https://huggingface.co/datasets/openbmb/UltraData-Math) | ultradata_math | math | apache-2.0 | 1,333.1 | 5.05% | 0.25 |
81
+ | [IFM/Math-Reasoning](https://huggingface.co/datasets/IFM/Math-Reasoning) | math_rewrite | math | apache-2.0 | 1,295.0 | 4.90% | 0.28 |
82
+ | [openbmb/UltraX-Preview](https://huggingface.co/datasets/openbmb/UltraX-Preview) | ultrax | web | apache-2.0 | 1,240.4 | 4.70% | 0.21 |
83
+ | [mlfoundations/dclm-baseline-1.0](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0) | dclm_commonsense | commonsense | cc-by-4.0 | 1,176.5 | 4.45% | 0.35 |
84
+ | [allenai/dolma3_dolmino_mix-100B-1025](https://huggingface.co/datasets/allenai/dolma3_dolmino_mix-100B-1025) | dolmino_synth_qa | qa | odc-by | 1,126.9 | 4.27% | 0.26 |
85
+ | [allenai/dolma3_dolmino_mix-100B-1025](https://huggingface.co/datasets/allenai/dolma3_dolmino_mix-100B-1025) | dolmino_science_cc | science | odc-by | 792.3 | 3.00% | 0.32 |
86
+ | [nvidia/OpenMathInstruct-2](https://huggingface.co/datasets/nvidia/OpenMathInstruct-2) | openmath2 | math | cc-by-4.0 | 761.7 | 2.88% | 0.27 |
87
+ | [IFM/Pretrain-Behaviors](https://huggingface.co/datasets/IFM/Pretrain-Behaviors) | pretrain_reasoning | reasoning | apache-2.0 | 449.0 | 1.70% | 0.13 |
88
+ | [allenai/dolma3_dolmino_mix-100B-1025](https://huggingface.co/datasets/allenai/dolma3_dolmino_mix-100B-1025) | dolmino_science_pdf | science | odc-by | 396.2 | 1.50% | 0.33 |
89
+ | [allenai/dolma3_dolmino_mix-100B-1025](https://huggingface.co/datasets/allenai/dolma3_dolmino_mix-100B-1025) | dolmino_tinymath | math | odc-by | 228.5 | 0.87% | 0.27 |
90
+ | [HuggingFaceTB/cosmopedia](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia) | cosmopedia_wikihow | textbooks | apache-2.0 | 45.3 | 0.17% | 0.19 |
91
+ | [facebook/anli](https://huggingface.co/datasets/facebook/anli) | anli | commonsense | cc-by-nc-4.0 | 4.6 | 0.02% | 0.20 |
92
+ | [Estwld/atomic2020-origin](https://huggingface.co/datasets/Estwld/atomic2020-origin) | atomic2020 | commonsense | cc-by (original ATOMIC 2020 release) | 3.6 | 0.01% | 0.20 |
93
+ | [community-datasets/glucose](https://huggingface.co/datasets/community-datasets/glucose) | glucose | commonsense | cc-by-4.0 | 3.0 | 0.01% | 0.20 |
94
+ | [allenai/sciq](https://huggingface.co/datasets/allenai/sciq) | sciq | commonsense | cc-by-nc-3.0 | 0.4 | 0.00% | 0.20 |
95
+ | [allenai/qasc](https://huggingface.co/datasets/allenai/qasc) | qasc | commonsense | cc-by-4.0 | 0.2 | 0.00% | 0.20 |
96
+ | [amydeng2000/CREAK](https://huggingface.co/datasets/amydeng2000/CREAK) | creak | commonsense | mit (original CREAK release) | 0.1 | 0.00% | 0.20 |
97
+
98
+ A fixed share of every source's documents (1 in 1,000, chosen by a hash of the document) is held out of training. Every one of the 222 training shards of the view was filtered by 13-gram decontamination against the validation and test items of ARC-Easy, ARC-Challenge, HellaSwag, PIQA and ArithMark-3 (a document is dropped when any 13 consecutive words equal 13 consecutive words of an evaluation text). The weights are released under CC-BY-NC-4.0 to comply with these licences: three sources (Nemotron-ClimbMix and ANLI under CC-BY-NC-4.0, SciQ under CC-BY-NC-3.0) allow non-commercial use only, so the weights carry the same non-commercial restriction, and every source is credited above as the attribution (BY) terms of the CC-BY, ODC-BY, Apache-2.0 and MIT sources require. None of the sources is under a share-alike licence.
99
+
100
+ ## Training
101
+
102
+ - From scratch: random initialisation, no distillation, no pretrained weights.
103
+ - 123,999 optimizer steps of 104 sequences of 2,048 tokens = 26,410,795,008 tokens, in 62.3 hours on two consumer GPUs (an RTX 5090 and an RTX 4090).
104
+ - Muon on the weight matrices and AdamW on everything else, bfloat16 autocast with float32 parameters, a warmup of 200 steps, then a constant learning rate and a decay as 1 - sqrt(t) over the last 37,200 steps (30% of the run), where the data mixture changes to its decay mixture.
105
+
106
+ ## Evaluation
107
+
108
+ Zero-shot, length-normalised accuracy (`acc_norm`) in float32: ARC-Easy, ARC-Challenge, HellaSwag and PIQA with lm-eval 0.4.12; ArithMark-3 with the official ArithMark-3.0 script's computation. The Intelligence Index is the leaderboard's: (N(HellaSwag, 25) + N(ARC, 25) + N(PIQA, 50) + 0.65 N(ArithMark-3, 25)) / 3.65, with N(s, c) = 100 (s - c) / (100 - c) and ARC the mean of ARC-Easy and ARC-Challenge.
109
+
110
+ | Benchmark | Score (+- standard error) | Through this directory |
111
+ |---|---|---|
112
+ | ARC-Easy | 47.73 +- 1.02 | 47.69 |
113
+ | ARC-Challenge | 26.28 +- 1.29 | 26.28 |
114
+ | HellaSwag | 35.38 +- 0.48 | 35.39 |
115
+ | PIQA | 63.49 +- 1.12 | 63.49 |
116
+ | ArithMark-3 | 38.50 +- 1.54 | 38.60 |
117
+ | Intelligence Index | 18.78 +- 0.80 | 18.80 |
118
+
119
+ The middle column is the evaluation of the final checkpoint by our own scorer on the training code. The last column is the same scorer run on this directory's `modeling_nessim.py` (loaded with `trust_remote_code=True`, float32). On the first held-out window of 20 sources (2,048 tokens each), the logits of `modeling_nessim.py` differ from the training code's by 0.0048 on average (largest 0.16) and the next-token cross-entropy by at most 0.00006 nats.
120
+
121
+ With the leaderboard's own tools on this directory, in float32 (lm-eval 0.4.12's `HFLM` for the first four, `acc_norm`; the official ArithMark-3.0 script, `acc_norm`), which are the numbers submitted to the Open SLM leaderboard:
122
+
123
+ | Benchmark | lm-eval / official ArithMark-3 script on this directory, float32 |
124
+ |---|---|
125
+ | ARC-Easy | 47.69 |
126
+ | ARC-Challenge | 26.28 |
127
+ | HellaSwag | 35.39 |
128
+ | PIQA | 63.49 |
129
+ | ArithMark-3 | 38.40 |
130
+ | Intelligence Index | 18.75 |
131
+
132
+ ## Usage
133
+
134
+ The model code is plain PyTorch: it needs only `torch` and `transformers` (tested with torch 2.10.0+cu128 and transformers 5.23.0), runs on a CPU or any GPU, and uses no flash-linear-attention or Triton kernels.
135
+
136
+ ```python
137
+ import torch
138
+ from transformers import AutoModelForCausalLM, AutoTokenizer
139
+
140
+ model_id = "Nessim/Nessim-48M-Base"
141
+ device = "cuda" if torch.cuda.is_available() else "cpu"
142
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
143
+ model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).to(device)
144
+
145
+ inputs = tokenizer("The three primary colors are", return_tensors="pt").to(device)
146
+ outputs = model.generate(**inputs, max_new_tokens=40, do_sample=False)
147
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
148
+ ```
149
+
150
+ `generate()` keeps no cache: every new token runs the whole sequence again, so generation slows down as the text grows. Scoring is a single forward pass.
151
+
152
+ ### Evaluating
153
+
154
+ ```
155
+ lm_eval --model hf --model_args pretrained=Nessim/Nessim-48M-Base,trust_remote_code=True,dtype=float32 \
156
+ --tasks arc_easy,arc_challenge,hellaswag,piqa --num_fewshot 0 --batch_size 32 --device cuda:0
157
+ python bencharithmark-3.py --model Nessim/Nessim-48M-Base --tokenizer Nessim/Nessim-48M-Base --dtype float32
158
+ ```
159
+
160
+ lm-eval's `hf` backend imports `accelerate`, so install it as for any model; the model itself does not use it. lm-eval reports `acc_norm` for the first four. The model feeds the whole input as one document unless `<eos>` ids appear, pads on the right invisibly, and runs the Gated DeltaNet-2 recurrence token by token in float32 in plain PyTorch, so scoring is slower than with fused kernels. Scores in bfloat16 differ slightly from float32 (the ArithMark-3 script defaults to bfloat16).
161
+
162
+ ## Limitations
163
+
164
+ - A base model: it continues text and has not been trained to follow instructions or chat.
165
+ - Its knowledge is thin and the facts it states are often wrong.
166
+ - English only, with a 2,048-token context window.
167
+ - No safety alignment: add your own filtering before putting it in front of users.
168
+ - Generation has no cache and the recurrence is a Python loop, so it is slow.
169
+
170
+ ## License
171
+
172
+ The weights (`model.safetensors`) are released under the Creative Commons Attribution-NonCommercial 4.0 International license (CC-BY-NC-4.0, see `LICENSE`): non-commercial use only, with attribution, as the training data licences require (see Training data). `modeling_nessim.py` and `configuration_nessim.py` are derived from the KLM 1.6 files of the same role (Apache-2.0, MinimaLabs) and stay under Apache-2.0 (see `LICENSE-CODE`); their changes are listed at the top of each file. The tokenizer is KLM 1.6's (Apache-2.0).
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "NessimForCausalLM"
4
+ ],
5
+ "attention_every": 4,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_nessim.NessimConfig",
8
+ "AutoModelForCausalLM": "modeling_nessim.NessimForCausalLM"
9
+ },
10
+ "bos_token_id": 1,
11
+ "copy_pointer": true,
12
+ "decay_floor": -20.0,
13
+ "distance_bias": true,
14
+ "dtype": "float32",
15
+ "eos_token_id": 2,
16
+ "front_rank": 32,
17
+ "gdn_head_dim": 128,
18
+ "gdn_heads": 4,
19
+ "gdn_norm_eps": 1e-05,
20
+ "hidden_size": 512,
21
+ "induction_inputs": true,
22
+ "intermediate_size": 1536,
23
+ "loops": 4,
24
+ "max_position_embeddings": 2048,
25
+ "model_type": "nessim",
26
+ "n_bigrams": 125000,
27
+ "n_coda": 2,
28
+ "n_core": 6,
29
+ "n_prelude": 2,
30
+ "n_trigrams": 38000,
31
+ "ngram_dim": 32,
32
+ "num_attention_heads": 8,
33
+ "num_hidden_layers": 10,
34
+ "num_key_value_heads": 4,
35
+ "pad_token_id": 0,
36
+ "pointer_chunk": 128,
37
+ "previous_tokens": 2,
38
+ "rms_norm_eps": 1e-06,
39
+ "rope_theta": 10000.0,
40
+ "tie_word_embeddings": true,
41
+ "transformers_version": "5.23.0",
42
+ "vocab_size": 4160
43
+ }
configuration_nessim.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Configuration of Nessim-48M-Base, a KLM 1.6 based model with a looped core and four token-level programs.
2
+
3
+ Derived from configuration_klm.py of KLM 1.6 (Apache-2.0, https://huggingface.co/MinimaLabs/KLM-1.6). Changes: the
4
+ 24 unshared layers become `n_prelude` + `n_core` + `n_coda` layers with the core applied `loops` times, and the
5
+ fields of the four programs (previous-token and induction inputs, copy pointer, distance biases) are added.
6
+ This file ships inside the model directory and must not import anything from the training repository.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ from transformers import PretrainedConfig
11
+
12
+
13
+ class NessimConfig(PretrainedConfig):
14
+ model_type = "nessim"
15
+
16
+ def __init__(
17
+ self,
18
+ vocab_size: int = 4160,
19
+ hidden_size: int = 512,
20
+ n_prelude: int = 2,
21
+ n_core: int = 6,
22
+ n_coda: int = 2,
23
+ loops: int = 4,
24
+ attention_every: int = 4,
25
+ gdn_heads: int = 4,
26
+ gdn_head_dim: int = 128,
27
+ num_attention_heads: int = 8,
28
+ num_key_value_heads: int = 4,
29
+ intermediate_size: int = 1536,
30
+ max_position_embeddings: int = 2048,
31
+ rope_theta: float = 10000.0,
32
+ n_bigrams: int = 125000,
33
+ n_trigrams: int = 38000,
34
+ ngram_dim: int = 32,
35
+ rms_norm_eps: float = 1e-6,
36
+ gdn_norm_eps: float = 1e-5,
37
+ decay_floor: float = -20.0,
38
+ previous_tokens: int = 2,
39
+ induction_inputs: bool = True,
40
+ front_rank: int = 32,
41
+ copy_pointer: bool = True,
42
+ pointer_chunk: int = 128,
43
+ distance_bias: bool = True,
44
+ bos_token_id: int = 1,
45
+ eos_token_id: int = 2,
46
+ pad_token_id: int = 0,
47
+ tie_word_embeddings: bool = True,
48
+ **kwargs,
49
+ ):
50
+ self.vocab_size = vocab_size
51
+ self.hidden_size = hidden_size
52
+ self.n_prelude = n_prelude
53
+ self.n_core = n_core
54
+ self.n_coda = n_coda
55
+ self.loops = loops
56
+ self.num_hidden_layers = n_prelude + n_core + n_coda
57
+ self.attention_every = attention_every
58
+ self.gdn_heads = gdn_heads
59
+ self.gdn_head_dim = gdn_head_dim
60
+ self.num_attention_heads = num_attention_heads
61
+ self.num_key_value_heads = num_key_value_heads
62
+ self.intermediate_size = intermediate_size
63
+ self.max_position_embeddings = max_position_embeddings
64
+ self.rope_theta = rope_theta
65
+ self.n_bigrams = n_bigrams
66
+ self.n_trigrams = n_trigrams
67
+ self.ngram_dim = ngram_dim
68
+ self.rms_norm_eps = rms_norm_eps
69
+ self.gdn_norm_eps = gdn_norm_eps
70
+ self.decay_floor = decay_floor
71
+ self.previous_tokens = previous_tokens
72
+ self.induction_inputs = induction_inputs
73
+ self.front_rank = front_rank
74
+ self.copy_pointer = copy_pointer
75
+ self.pointer_chunk = pointer_chunk
76
+ self.distance_bias = distance_bias
77
+ super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token_id,
78
+ pad_token_id=pad_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs)
generation_config.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 1,
3
+ "eos_token_id": 2,
4
+ "pad_token_id": 0,
5
+ "do_sample": true,
6
+ "temperature": 0.7,
7
+ "top_p": 0.9,
8
+ "max_new_tokens": 200,
9
+ "use_cache": false,
10
+ "suppress_tokens": [
11
+ 4100,
12
+ 4101,
13
+ 4102,
14
+ 4103,
15
+ 4104,
16
+ 4105,
17
+ 4106,
18
+ 4107,
19
+ 4108,
20
+ 4109,
21
+ 4110,
22
+ 4111,
23
+ 4112,
24
+ 4113,
25
+ 4114,
26
+ 4115,
27
+ 4116,
28
+ 4117,
29
+ 4118,
30
+ 4119,
31
+ 4120,
32
+ 4121,
33
+ 4122,
34
+ 4123,
35
+ 4124,
36
+ 4125,
37
+ 4126,
38
+ 4127,
39
+ 4128,
40
+ 4129,
41
+ 4130,
42
+ 4131,
43
+ 4132,
44
+ 4133,
45
+ 4134,
46
+ 4135,
47
+ 4136,
48
+ 4137,
49
+ 4138,
50
+ 4139,
51
+ 4140,
52
+ 4141,
53
+ 4142,
54
+ 4143,
55
+ 4144,
56
+ 4145,
57
+ 4146,
58
+ 4147,
59
+ 4148,
60
+ 4149,
61
+ 4150,
62
+ 4151,
63
+ 4152,
64
+ 4153,
65
+ 4154,
66
+ 4155,
67
+ 4156,
68
+ 4157,
69
+ 4158,
70
+ 4159
71
+ ]
72
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35305ce732355fbb27f84837bef41c319b98e9037a0cb4ef034867bd5b83cdb3
3
+ size 192681272
modeling_nessim.py ADDED
@@ -0,0 +1,572 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Nessim-48M-Base for Transformers, in plain PyTorch: it runs on CPU or any GPU with only torch and transformers.
2
+
3
+ Derived from modeling_klm.py of KLM 1.6 (Apache-2.0, https://huggingface.co/MinimaLabs/KLM-1.6): the Gated DeltaNet-2
4
+ and attention layers, Block Attention Residuals, the exact n-gram memory, the document handling and the plain
5
+ PyTorch recurrence are that file's. Changes: a looped core (`n_core` layers applied `loops` times, every application
6
+ its own Block Attention Residuals consumer, `loop_signal[l]` added to the newest source at the start of loop l > 0),
7
+ and four programs computed from `input_ids` inside forward: previous-token and induction inputs read through one
8
+ low-rank map (an extra Block Attention Residuals source), a learned distance bias per attention head, and a copy
9
+ pointer that boosts the logits of tokens already in the document. The files of the KLM 1.6 directory that are
10
+ not needed here (fast_decode.py, the Triton decoder) are not shipped, and generation keeps no cache: every step
11
+ runs the whole sequence again.
12
+
13
+ A sequence may hold several documents separated by <eos>: after each <eos> the attention mask, the Gated DeltaNet-2
14
+ state and its short convolutions, the n-gram history and all four programs restart, as they did in training. A
15
+ sequence without <eos> is one document, which is what lm-eval and the ArithMark-3 script feed. Right padding is
16
+ invisible to earlier positions; left padding (an attention_mask that is 0 then 1) starts a document at each row's
17
+ first real token.
18
+
19
+ The model computes every function below in the dtype of its weights, except the Gated DeltaNet-2 recurrence, the
20
+ Block Attention Residuals softmax, the decay and the pointer, which run in float32.
21
+ """
22
+ from __future__ import annotations
23
+
24
+ import math
25
+ from dataclasses import dataclass
26
+
27
+ import torch
28
+ import torch.nn as nn
29
+ import torch.nn.functional as F
30
+ from transformers import PreTrainedModel
31
+ from transformers.generation import GenerationMixin
32
+ from transformers.modeling_outputs import CausalLMOutputWithPast
33
+
34
+ from .configuration_nessim import NessimConfig
35
+
36
+ CONV = 4 # short-convolution width
37
+ POINTER_FEATURES = 5
38
+ OFFSET_BUCKETS = 24
39
+
40
+
41
+ @dataclass(frozen=True)
42
+ class Application:
43
+ """One use of an unshared layer; `index` counts applications in order and gives its Block Attention Residuals
44
+ consumers 2 * index (mixer input) and 2 * index + 1 (feed-forward input)."""
45
+
46
+ slot: int
47
+ loop: int
48
+ loop_start: bool
49
+
50
+
51
+ @dataclass(frozen=True)
52
+ class Segments:
53
+ starts: torch.Tensor # (B, T) bool, first token of a document
54
+ docs: torch.Tensor # (B, T) document id, equal inside a document
55
+ pos: torch.Tensor # (B, T) position inside the document
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class Sources:
60
+ """Block Attention Residuals sources in preallocated buffers; each is RMS-normalized once, when it is added."""
61
+
62
+ values: torch.Tensor # (B, T, capacity, D) in the model dtype
63
+ normed: torch.Tensor # (B, T, capacity, D) float32
64
+
65
+
66
+ def is_attention(cfg: NessimConfig, slot: int) -> bool:
67
+ return slot % cfg.attention_every == cfg.attention_every - 1
68
+
69
+
70
+ def applications(cfg: NessimConfig) -> list[Application]:
71
+ order = [Application(slot, 0, False) for slot in range(cfg.n_prelude)]
72
+ for loop in range(cfg.loops):
73
+ order += [Application(cfg.n_prelude + j, loop, j == 0 and loop > 0) for j in range(cfg.n_core)]
74
+ order += [Application(cfg.n_prelude + cfg.n_core + j, 0, False) for j in range(cfg.n_coda)]
75
+ return order
76
+
77
+
78
+ def has_front(cfg: NessimConfig) -> bool:
79
+ return cfg.previous_tokens > 0 or cfg.induction_inputs
80
+
81
+
82
+ def attention_slots(cfg: NessimConfig) -> list[int]:
83
+ return [slot for slot in range(cfg.num_hidden_layers) if is_attention(cfg, slot)]
84
+
85
+
86
+ def holder(**members: nn.Module | nn.Parameter) -> nn.Module:
87
+ """A bare container: parameters and submodules under the given names, so state-dict names are the dotted paths."""
88
+ module = nn.Module()
89
+ for name, member in members.items():
90
+ setattr(module, name, member)
91
+ return module
92
+
93
+
94
+ def norm_weight(dim: int) -> nn.Module:
95
+ return holder(weight=nn.Parameter(torch.ones(dim)))
96
+
97
+
98
+ def build_mixer(cfg: NessimConfig, slot: int) -> nn.Module:
99
+ dim = cfg.hidden_size
100
+ if is_attention(cfg, slot):
101
+ head_dim = dim // cfg.num_attention_heads
102
+ return holder(
103
+ q_proj=nn.Linear(dim, cfg.num_attention_heads * head_dim, bias=False),
104
+ k_proj=nn.Linear(dim, cfg.num_key_value_heads * head_dim, bias=False),
105
+ v_proj=nn.Linear(dim, cfg.num_key_value_heads * head_dim, bias=False),
106
+ gate_proj=nn.Linear(dim, dim, bias=False),
107
+ o_proj=nn.Linear(dim, dim, bias=False),
108
+ q_norm=norm_weight(head_dim),
109
+ k_norm=norm_weight(head_dim),
110
+ value_mix=nn.Parameter(torch.tensor([0.5, 0.5])),
111
+ )
112
+ inner = cfg.gdn_heads * cfg.gdn_head_dim
113
+
114
+ def conv() -> nn.Conv1d:
115
+ return nn.Conv1d(inner, inner, CONV, groups=inner, bias=False)
116
+
117
+ return holder(
118
+ q_proj=nn.Linear(dim, inner, bias=False),
119
+ k_proj=nn.Linear(dim, inner, bias=False),
120
+ v_proj=nn.Linear(dim, inner, bias=False),
121
+ q_conv1d=conv(),
122
+ k_conv1d=conv(),
123
+ v_conv1d=conv(),
124
+ f_proj=nn.Sequential(nn.Linear(dim, cfg.gdn_head_dim, bias=False), nn.Linear(cfg.gdn_head_dim, inner, bias=False)),
125
+ b_proj=nn.Linear(dim, inner, bias=False),
126
+ w_proj=nn.Linear(dim, inner, bias=False),
127
+ A_log=nn.Parameter(torch.zeros(cfg.gdn_heads)),
128
+ dt_bias=nn.Parameter(torch.zeros(inner)),
129
+ g_proj=nn.Sequential(nn.Linear(dim, cfg.gdn_head_dim, bias=False), nn.Linear(cfg.gdn_head_dim, inner, bias=True)),
130
+ o_norm=norm_weight(cfg.gdn_head_dim),
131
+ o_proj=nn.Linear(inner, dim, bias=False),
132
+ )
133
+
134
+
135
+ def build_block(cfg: NessimConfig, slot: int) -> nn.Module:
136
+ dim = cfg.hidden_size
137
+ return holder(
138
+ mixer_norm=norm_weight(dim),
139
+ mixer=build_mixer(cfg, slot),
140
+ ffn_norm=norm_weight(dim),
141
+ ffn=holder(
142
+ gate=nn.Linear(dim, cfg.intermediate_size, bias=False),
143
+ up=nn.Linear(dim, cfg.intermediate_size, bias=False),
144
+ down=nn.Linear(cfg.intermediate_size, dim, bias=False),
145
+ ),
146
+ )
147
+
148
+
149
+ def build_network(cfg: NessimConfig) -> nn.Module:
150
+ """Parameters and buffers under the training code's names; every value comes from the checkpoint."""
151
+ dim, rank = cfg.hidden_size, cfg.front_rank
152
+ consumers = 2 * len(applications(cfg)) + 1
153
+ members: dict[str, nn.Module | nn.Parameter] = {
154
+ "embed": nn.Embedding(cfg.vocab_size, dim),
155
+ "memory": holder(
156
+ bigram=nn.Embedding(cfg.n_bigrams + 1, cfg.ngram_dim),
157
+ trigram=nn.Embedding(cfg.n_trigrams + 1, cfg.ngram_dim),
158
+ bigram_proj=nn.Linear(cfg.ngram_dim, dim, bias=False),
159
+ trigram_proj=nn.Linear(cfg.ngram_dim, dim, bias=False),
160
+ ),
161
+ "blocks": nn.ModuleList([build_block(cfg, slot) for slot in range(cfg.num_hidden_layers)]),
162
+ "attn_res_query": nn.Parameter(torch.zeros(consumers, dim)),
163
+ "attn_res_norm": nn.Parameter(torch.ones(consumers, dim)),
164
+ "norm": norm_weight(dim),
165
+ }
166
+ if cfg.loops > 1:
167
+ members["loop_signal"] = nn.Parameter(torch.zeros(cfg.loops, dim))
168
+ if has_front(cfg):
169
+ columns = cfg.previous_tokens + (2 if cfg.induction_inputs else 0)
170
+ members["front_proj"] = nn.Parameter(torch.zeros(dim, rank))
171
+ members["front_mix"] = nn.Parameter(torch.zeros(columns * rank, dim))
172
+ if cfg.copy_pointer:
173
+ members["pointer_gate"] = nn.Parameter(torch.zeros(dim + 1, POINTER_FEATURES))
174
+ members["pointer_decay"] = nn.Parameter(torch.zeros(POINTER_FEATURES))
175
+ if cfg.distance_bias:
176
+ members["distance_bias"] = nn.ParameterDict(
177
+ {str(slot): nn.Parameter(torch.zeros(cfg.num_attention_heads, OFFSET_BUCKETS)) for slot in attention_slots(cfg)}
178
+ )
179
+ network = holder(**members)
180
+ network.memory.register_buffer("bigram_keys", torch.zeros(cfg.n_bigrams, dtype=torch.int32))
181
+ network.memory.register_buffer("trigram_keys", torch.zeros(cfg.n_trigrams, dtype=torch.int64))
182
+ return network
183
+
184
+
185
+ def rms(x: torch.Tensor, weight: torch.Tensor, eps: float) -> torch.Tensor:
186
+ return F.rms_norm(x, (x.shape[-1],), weight.to(x.dtype), eps)
187
+
188
+
189
+ def segments(tokens: torch.Tensor, eos_id: int, real: torch.Tensor | None) -> Segments:
190
+ """Document starts, ids and in-document positions of tokens (B, T): the first token and every token after <eos>;
191
+ with `real` (B, T), the first real token after left padding as well."""
192
+ batch, seq_len = tokens.shape
193
+ starts = torch.zeros_like(tokens, dtype=torch.bool)
194
+ starts[:, 1:] = tokens[:, :-1] == eos_id
195
+ if real is not None:
196
+ starts[:, 1:] |= real[:, 1:] & ~real[:, :-1]
197
+ starts[:, 0] = True
198
+ idx = torch.arange(seq_len, device=tokens.device).expand(batch, seq_len)
199
+ return Segments(starts=starts, docs=starts.cumsum(1), pos=idx - torch.where(starts, idx, 0).cummax(1).values)
200
+
201
+
202
+ def lookup(keys: torch.Tensor, queries: torch.Tensor) -> torch.Tensor:
203
+ """Row of each query in a sorted key bank: p + 1 where keys[p] == query, else 0 (unknown)."""
204
+ queries = queries.to(keys.dtype)
205
+ p = torch.searchsorted(keys, queries).clamp_(max=keys.numel() - 1)
206
+ return torch.where(keys[p] == queries, p + 1, 0)
207
+
208
+
209
+ def ngram_vectors(w: dict[str, torch.Tensor], cfg: NessimConfig, tokens: torch.Tensor) -> torch.Tensor:
210
+ """Learned rows for the most frequent bigrams and trigrams, found by exact key lookup. Missing history (row
211
+ start, or right after <eos>) is token 0."""
212
+ t = tokens.long()
213
+ n, v = t.shape[1], cfg.vocab_size
214
+ prev1 = F.pad(t, (1, 0))[:, :n]
215
+ prev2 = F.pad(t, (2, 0))[:, :n]
216
+ reset = prev1 == cfg.eos_token_id
217
+ prev1 = prev1.masked_fill(reset, 0)
218
+ prev2 = prev2.masked_fill(reset | (prev2 == cfg.eos_token_id), 0)
219
+ bigram = prev1 * v + t
220
+ trigram = (prev2 * v + prev1) * v + t
221
+ bi = F.embedding(lookup(w["memory.bigram_keys"], bigram), w["memory.bigram.weight"])
222
+ tri = F.embedding(lookup(w["memory.trigram_keys"], trigram), w["memory.trigram.weight"])
223
+ return F.linear(bi, w["memory.bigram_proj.weight"]) + F.linear(tri, w["memory.trigram_proj.weight"])
224
+
225
+
226
+ def in_document(docs: torch.Tensor, back: int) -> torch.Tensor:
227
+ """Whether position t - back exists and belongs to the document of position t."""
228
+ size = docs.shape[1]
229
+ return F.pad(docs[:, : size - back] == docs[:, back:], (back, 0), value=False)
230
+
231
+
232
+ def induction_slots(tokens: torch.Tensor, docs: torch.Tensor, chunk: int) -> torch.Tensor:
233
+ """(B, T, 2) int64: for column 0 (1) the position after the most recent s < t, in the document of t, whose last 1
234
+ (2) tokens, all in that document, equal those ending at t; -1 if there is none. Query rows go in blocks of
235
+ `chunk` against the sources before their last row."""
236
+ tokens = tokens.long()
237
+ size = tokens.shape[1]
238
+ previous = F.pad(tokens[:, : size - 1], (1, 0))
239
+ inside = in_document(docs, 1)
240
+ blocks = []
241
+ for start in range(0, size, chunk):
242
+ stop = min(start + chunk, size)
243
+ t = torch.arange(start, stop, device=tokens.device).view(1, -1, 1)
244
+ s = torch.arange(stop, device=tokens.device).view(1, 1, -1)
245
+ one = (docs[:, start:stop, None] == docs[:, None, :stop]) & (s < t) & (tokens[:, start:stop, None] == tokens[:, None, :stop])
246
+ two = one & (previous[:, start:stop, None] == previous[:, None, :stop]) & inside[:, start:stop, None] & inside[:, None, :stop]
247
+ found = torch.stack([torch.where(m, s, -1).amax(-1) for m in (one, two)], dim=-1)
248
+ blocks.append(torch.where(found >= 0, found + 1, -1))
249
+ return torch.cat(blocks, dim=1)
250
+
251
+
252
+ def front_inputs(w: dict[str, torch.Tensor], cfg: NessimConfig, tokens: torch.Tensor, docs: torch.Tensor) -> torch.Tensor:
253
+ """Inputs added to the first hidden state: the token embeddings read through one low-rank map `front_proj`, at
254
+ the `previous_tokens` positions before t in the same document and at the positions after the last earlier match
255
+ of the current token and of the current token pair, concatenated and mixed by `front_mix` (zero for a missing
256
+ position)."""
257
+ size = tokens.shape[1]
258
+ low = F.embedding(tokens.long(), w["embed.weight"]) @ w["front_proj"].to(w["embed.weight"].dtype)
259
+ columns = []
260
+ for back in range(1, cfg.previous_tokens + 1):
261
+ columns.append(F.pad(low[:, : size - back], (0, 0, back, 0)) * in_document(docs, back).unsqueeze(-1))
262
+ if cfg.induction_inputs:
263
+ slots = induction_slots(tokens, docs, cfg.pointer_chunk)
264
+ for column in range(2):
265
+ position = slots[..., column]
266
+ picked = low.gather(1, position.clamp(min=0).unsqueeze(-1).expand(-1, -1, low.shape[-1]))
267
+ columns.append(picked * (position >= 0).unsqueeze(-1))
268
+ return torch.cat(columns, dim=-1) @ w["front_mix"].to(low.dtype)
269
+
270
+
271
+ def offset_bucket_table(size: int, device: torch.device) -> torch.Tensor:
272
+ """Bucket of each offset t - s in [0, size): exact below 8, then two buckets per octave, 24 in total; they start at
273
+ the offsets 0 1 2 3 4 5 6 7 8 12 16 23 32 46 64 91 128 182 256 363 512 725 1024 1449."""
274
+ delta = torch.arange(size, device=device)
275
+ coarse = 8 + torch.floor(2.0 * torch.log2(delta.clamp(min=8).to(torch.float32) / 8.0)).to(torch.int64)
276
+ return torch.where(delta < 8, delta, coarse.clamp(max=OFFSET_BUCKETS - 1))
277
+
278
+
279
+ def attention_mask(seg: Segments, bias: torch.Tensor | None, dtype: torch.dtype) -> torch.Tensor:
280
+ """(B, 1 or H, T, T): True where the query may read the key (same document, not later), or, with a distance bias
281
+ table (H, 24), 0 there plus bias[h, bucket(t - s)] and -inf elsewhere."""
282
+ size = seg.docs.shape[1]
283
+ index = torch.arange(size, device=seg.docs.device)
284
+ allowed = ((seg.docs[:, :, None] == seg.docs[:, None, :]) & (index[None, :] <= index[:, None])).unsqueeze(1)
285
+ if bias is None:
286
+ return allowed
287
+ delta = (index[:, None] - index[None, :]).clamp(min=0)
288
+ dense = bias.float()[:, offset_bucket_table(size, seg.docs.device)[delta]].unsqueeze(0)
289
+ return torch.where(allowed, dense, float("-inf")).to(dtype)
290
+
291
+
292
+ def rope(x: torch.Tensor, theta: float) -> torch.Tensor:
293
+ """Half-rotation RoPE on (B, H, T, D) at the row positions."""
294
+ dim = x.shape[-1]
295
+ freqs = 1.0 / (theta ** (torch.arange(0, dim, 2, device=x.device).float() / dim))
296
+ angles = torch.arange(x.shape[2], device=x.device).float()[:, None] * freqs
297
+ cos, sin = angles.cos().to(x.dtype), angles.sin().to(x.dtype)
298
+ x1, x2 = x.chunk(2, dim=-1)
299
+ return torch.cat([x1 * cos - x2 * sin, x2 * cos + x1 * sin], dim=-1)
300
+
301
+
302
+ def attention_mixer(
303
+ w: dict[str, torch.Tensor], cfg: NessimConfig, slot: int, x: torch.Tensor, v_first: torch.Tensor | None, mask: torch.Tensor,
304
+ ) -> tuple[torch.Tensor, torch.Tensor]:
305
+ """GQA with per-head QK-RMSNorm, RoPE, a sigmoid output gate and a value residual mixing each application's values
306
+ with the first attention application's. Returns the output and the first application's raw values."""
307
+ m = f"blocks.{slot}.mixer."
308
+ batch, seq_len, dim = x.shape
309
+ heads, kv_heads = cfg.num_attention_heads, cfg.num_key_value_heads
310
+ head_dim = dim // heads
311
+ q = F.linear(x, w[m + "q_proj.weight"]).view(batch, seq_len, heads, head_dim)
312
+ k = F.linear(x, w[m + "k_proj.weight"]).view(batch, seq_len, kv_heads, head_dim)
313
+ v = F.linear(x, w[m + "v_proj.weight"]).view(batch, seq_len, kv_heads, head_dim)
314
+ if v_first is None:
315
+ v_first = v
316
+ mix = w[m + "value_mix"].float()
317
+ values = (mix[0] * v.float() + mix[1] * v_first.float()).to(x.dtype).transpose(1, 2)
318
+ q = rope(F.rms_norm(q.float(), (head_dim,), w[m + "q_norm.weight"].float(), cfg.rms_norm_eps).transpose(1, 2), cfg.rope_theta).to(x.dtype)
319
+ keys = rope(F.rms_norm(k.float(), (head_dim,), w[m + "k_norm.weight"].float(), cfg.rms_norm_eps).transpose(1, 2), cfg.rope_theta).to(x.dtype)
320
+ out = F.scaled_dot_product_attention(q, keys, values, attn_mask=mask, enable_gqa=True)
321
+ out = out.transpose(1, 2).reshape(batch, seq_len, dim)
322
+ return F.linear(out * torch.sigmoid(F.linear(x, w[m + "gate_proj.weight"])), w[m + "o_proj.weight"]), v_first
323
+
324
+
325
+ def short_conv(weight: torch.Tensor, x: torch.Tensor, taps_valid: torch.Tensor) -> torch.Tensor:
326
+ """Causal depthwise convolution plus SiLU that never reaches back past a document start.
327
+ x (B, T, C); taps_valid (B, T, CONV) zeroes the taps before the document start."""
328
+ batch, seq_len, channels = x.shape
329
+ ext = torch.cat([x.new_zeros(batch, CONV - 1, channels), x], 1)
330
+ windows = ext.unfold(1, CONV, 1) # (B, T, C, CONV), oldest input first
331
+ return F.silu((windows * weight.view(channels, CONV).to(x.dtype) * taps_valid.unsqueeze(2)).sum(-1))
332
+
333
+
334
+ def l2norm(x: torch.Tensor) -> torch.Tensor:
335
+ return x * torch.rsqrt((x * x).sum(-1, keepdim=True) + 1e-6)
336
+
337
+
338
+ def recurrence(
339
+ q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, g: torch.Tensor, b: torch.Tensor, w: torch.Tensor, starts: torch.Tensor,
340
+ ) -> torch.Tensor:
341
+ """Gated DeltaNet-2 step by step in float32: S <- (I - k (b*k)^T) diag(exp g) S + k (w*v)^T and o = q^T S / sqrt(K),
342
+ with S cleared at every document start. Inputs are (B, T, H, K)."""
343
+ batch, seq_len, heads, key_dim = k.shape
344
+ q = q * key_dim**-0.5
345
+ state = q.new_zeros(batch, heads, key_dim, v.shape[-1])
346
+ decay = (~starts).float()[:, :, None, None] * g.exp()
347
+ erase_key, write_value = b * k, w * v
348
+ out = []
349
+ with torch.autocast(q.device.type, enabled=False):
350
+ for t in range(seq_len):
351
+ state = state * decay[:, t].unsqueeze(-1)
352
+ erase = torch.einsum("bhk,bhkv->bhv", erase_key[:, t], state)
353
+ state = state + k[:, t].unsqueeze(-1) * (write_value[:, t] - erase).unsqueeze(-2)
354
+ out.append(torch.einsum("bhk,bhkv->bhv", q[:, t], state))
355
+ return torch.stack(out, 1)
356
+
357
+
358
+ def log_decay(w: dict[str, torch.Tensor], cfg: NessimConfig, slot: int, x: torch.Tensor) -> torch.Tensor:
359
+ """-exp(A_log) * softplus(f(x) + dt_bias), combined in log space in float32 and floored."""
360
+ m = f"blocks.{slot}.mixer."
361
+ f = F.linear(F.linear(x, w[m + "f_proj.0.weight"]), w[m + "f_proj.1.weight"])
362
+ s = f.float().unflatten(-1, (cfg.gdn_heads, cfg.gdn_head_dim)) + w[m + "dt_bias"].float().view(cfg.gdn_heads, cfg.gdn_head_dim)
363
+ log_act = torch.where(s < -20, s, F.softplus(s.clamp_min(-20)).log())
364
+ log_mag = w[m + "A_log"].float().unsqueeze(-1) + log_act
365
+ ceiling = math.log(-cfg.decay_floor)
366
+ return torch.where(log_mag >= ceiling, cfg.decay_floor, -log_mag.clamp(max=ceiling).exp())
367
+
368
+
369
+ def gdn_mixer(
370
+ w: dict[str, torch.Tensor], cfg: NessimConfig, slot: int, x: torch.Tensor, seg: Segments, taps_valid: torch.Tensor,
371
+ ) -> torch.Tensor:
372
+ """Gated DeltaNet-2 in flash-linear-attention's parameter layout: q/k/v short convolutions, channel-wise erase (b)
373
+ and write (w) gates, a low-rank channel-wise decay, and a sigmoid-gated RMSNorm on the output."""
374
+ m = f"blocks.{slot}.mixer."
375
+ batch, seq_len, _ = x.shape
376
+ heads, head_dim = cfg.gdn_heads, cfg.gdn_head_dim
377
+ q = short_conv(w[m + "q_conv1d.weight"], F.linear(x, w[m + "q_proj.weight"]), taps_valid)
378
+ k = short_conv(w[m + "k_conv1d.weight"], F.linear(x, w[m + "k_proj.weight"]), taps_valid)
379
+ v = short_conv(w[m + "v_conv1d.weight"], F.linear(x, w[m + "v_proj.weight"]), taps_valid)
380
+
381
+ def split(t: torch.Tensor) -> torch.Tensor:
382
+ return t.float().view(batch, seq_len, heads, head_dim)
383
+
384
+ o = recurrence(
385
+ l2norm(split(q)), l2norm(split(k)), split(v), log_decay(w, cfg, slot, x),
386
+ torch.sigmoid(split(F.linear(x, w[m + "b_proj.weight"]))), torch.sigmoid(split(F.linear(x, w[m + "w_proj.weight"]))),
387
+ seg.starts,
388
+ )
389
+ gate = F.linear(F.linear(x, w[m + "g_proj.0.weight"]), w[m + "g_proj.1.weight"], w[m + "g_proj.1.bias"])
390
+ o = rms(o.to(x.dtype), w[m + "o_norm.weight"], cfg.gdn_norm_eps) * torch.sigmoid(gate.view(batch, seq_len, heads, head_dim))
391
+ return F.linear(o.reshape(batch, seq_len, -1), w[m + "o_proj.weight"])
392
+
393
+
394
+ def add_source(sources: Sources, n: int, v: torch.Tensor, eps: float) -> int:
395
+ sources.values[:, :, n] = v
396
+ sources.normed[:, :, n] = F.rms_norm(v.float(), (v.shape[-1],), eps=eps)
397
+ return n + 1
398
+
399
+
400
+ def mix_sources(sources: Sources, n: int, query: torch.Tensor, partial: torch.Tensor | None, eps: float) -> torch.Tensor:
401
+ """Softmax mix of the first n sources weighted by query . RMSNorm(source); `partial` (the current layer's mixer
402
+ output, seen only by its feed-forward) joins as one more source."""
403
+ with torch.autocast(query.device.type, enabled=False):
404
+ logits = sources.normed[:, :, :n] @ query
405
+ if partial is not None:
406
+ normed = F.rms_norm(partial.float(), (partial.shape[-1],), eps=eps)
407
+ logits = torch.cat([logits, (normed @ query).unsqueeze(-1)], -1)
408
+ weights = logits.softmax(-1)
409
+ out = (weights[..., :n, None].to(sources.values.dtype) * sources.values[:, :, :n]).sum(-2)
410
+ if partial is not None:
411
+ out = out + weights[..., n:].to(partial.dtype) * partial
412
+ return out
413
+
414
+
415
+ def local_vocabulary(tokens: torch.Tensor, vocab: int) -> tuple[torch.Tensor, torch.Tensor]:
416
+ """Number the distinct tokens of each window 0, 1, ... in sorted order: (number of each position, token of each
417
+ number, `vocab` for numbers beyond the distinct count)."""
418
+ sorted_tokens, order = tokens.sort(dim=1, stable=True)
419
+ first = F.pad(sorted_tokens[:, 1:] != sorted_tokens[:, :-1], (1, 0), value=True)
420
+ rank = first.to(torch.int64).cumsum(dim=1) - 1
421
+ return (
422
+ torch.zeros_like(tokens).scatter_(1, order, rank),
423
+ torch.full_like(tokens, vocab).scatter_(1, rank, sorted_tokens),
424
+ )
425
+
426
+
427
+ def previous_tokens(tokens: torch.Tensor, docs: torch.Tensor, back: int, missing: int) -> torch.Tensor:
428
+ """tokens[t - back] where it lies in the document of t, else `missing`."""
429
+ shifted = F.pad(tokens[:, : tokens.shape[1] - back], (back, 0), value=missing)
430
+ return torch.where(in_document(docs, back), shifted, torch.full_like(shifted, missing))
431
+
432
+
433
+ def pointer_boost(
434
+ w: dict[str, torch.Tensor], cfg: NessimConfig, tokens: torch.Tensor, docs: torch.Tensor, hidden: torch.Tensor,
435
+ ) -> torch.Tensor:
436
+ """Logit boost (B, T, V) for the tokens already in the document, added to the logits of position t.
437
+
438
+ With the evidence of source c for query t in feature f, e_f(t, c) = [c in the document of t] x exp(-a_f (t - c)) x match_f:
439
+ f = 0, 1: every c <= t (copy; a_0 fast, a_1 slow);
440
+ f = 2, 3, 4: c = s + 1 where s < t is a source whose last 1, 2, 3-or-more tokens equal those ending at t, longest match only.
441
+ S_f(t, v) = sum over the sources c holding token v of e_f(t, c), and boost(t, v) = sum_f gate_f(t) log1p(S_f(t, v)),
442
+ with gate(t) = layer_norm(hidden_t) @ pointer_gate[:-1] + pointer_gate[-1] and a_f = softplus(pointer_decay_f).
443
+ The sources are scattered into planes over the window's own distinct tokens, query rows in blocks of `pointer_chunk`
444
+ against the sources up to their last row."""
445
+ tokens = tokens.to(torch.int64)
446
+ docs = docs.to(torch.int64)
447
+ batch, size = tokens.shape
448
+ width, vocab = hidden.shape[-1], cfg.vocab_size
449
+ slots = min(size, vocab)
450
+ gate_weight = w["pointer_gate"].float()
451
+ gate = F.layer_norm(hidden.float(), (width,)) @ gate_weight[:-1] + gate_weight[-1]
452
+ decay = F.softplus(w["pointer_decay"].float()).view(1, 1, POINTER_FEATURES, 1)
453
+ lag = torch.tensor([0.0, 0.0, 1.0, 1.0, 1.0], device=tokens.device).view(1, 1, POINTER_FEATURES, 1)
454
+ query_one = previous_tokens(tokens, docs, 1, -1)
455
+ source_one = previous_tokens(tokens, docs, 1, -2)
456
+ query_two = previous_tokens(tokens, docs, 2, -1)
457
+ source_two = previous_tokens(tokens, docs, 2, -2)
458
+ local, token_of = local_vocabulary(tokens, vocab)
459
+ successor = F.pad(local[:, 1:], (0, 1))
460
+ voted = torch.stack((local, local, successor, successor, successor), dim=1)
461
+ boosts = []
462
+ for start in range(0, size, cfg.pointer_chunk):
463
+ stop = min(start + cfg.pointer_chunk, size)
464
+ t = torch.arange(start, stop, device=tokens.device).view(1, -1, 1)
465
+ s = torch.arange(stop, device=tokens.device).view(1, 1, -1)
466
+ same_doc = docs[:, start:stop, None] == docs[:, None, :stop]
467
+ match_one = (tokens[:, start:stop, None] == tokens[:, None, :stop]) & same_doc & (s < t)
468
+ match_two = match_one & (query_one[:, start:stop, None] == source_one[:, None, :stop])
469
+ match_three = match_two & (query_two[:, start:stop, None] == source_two[:, None, :stop])
470
+ level = match_one.to(torch.int8) + match_two + match_three
471
+ copy = same_doc & (s <= t)
472
+ selected = torch.stack((copy, copy, level == 1, level == 2, level == 3), dim=2)
473
+ distance = (t - s).clamp(min=0).to(torch.float32).unsqueeze(2)
474
+ weight = selected.to(torch.float32) * torch.exp(-decay * (distance - lag).clamp(min=0))
475
+ plane = torch.zeros(batch, stop - start, POINTER_FEATURES, slots, device=tokens.device)
476
+ plane.scatter_add_(-1, voted[:, None, :, :stop].expand(-1, stop - start, -1, -1), weight)
477
+ per_token = (gate[:, start:stop].unsqueeze(-1) * torch.log1p(plane)).sum(dim=2)
478
+ columns = torch.zeros(batch, stop - start, vocab + 1, device=tokens.device)
479
+ columns.scatter_(-1, token_of[:, None, :slots].expand(-1, stop - start, -1), per_token)
480
+ boosts.append(columns[..., :vocab])
481
+ return torch.cat(boosts, dim=1)
482
+
483
+
484
+ def forward_logits(w: dict[str, torch.Tensor], cfg: NessimConfig, tokens: torch.Tensor, real: torch.Tensor | None) -> torch.Tensor:
485
+ """Logits (B, T, V) of tokens (B, T), every program computed from the tokens."""
486
+ eps = cfg.rms_norm_eps
487
+ dtype = w["embed.weight"].dtype
488
+ apps = applications(cfg)
489
+ seg = segments(tokens, cfg.eos_token_id, real)
490
+ lags = torch.arange(CONV - 1, -1, -1, device=tokens.device)
491
+ taps_valid = (seg.pos[..., None] >= lags).to(dtype)
492
+ biases = {slot: w[f"distance_bias.{slot}"] for slot in attention_slots(cfg)} if cfg.distance_bias else {}
493
+ masks = {slot: attention_mask(seg, bias, dtype) for slot, bias in biases.items()}
494
+ shared_mask = None if cfg.distance_bias else attention_mask(seg, None, dtype)
495
+
496
+ queries = (w["attn_res_query"] * w["attn_res_norm"]).float()
497
+ base = [F.embedding(tokens.long(), w["embed.weight"]), ngram_vectors(w, cfg, tokens)]
498
+ if has_front(cfg):
499
+ base.append(front_inputs(w, cfg, tokens, seg.docs).to(dtype))
500
+ batch, seq_len = tokens.shape
501
+ capacity = len(base) + len(apps)
502
+ sources = Sources(
503
+ values=base[0].new_empty(batch, seq_len, capacity, cfg.hidden_size),
504
+ normed=torch.empty(batch, seq_len, capacity, cfg.hidden_size, dtype=torch.float32, device=tokens.device),
505
+ )
506
+ n = 0
507
+ for source in base:
508
+ n = add_source(sources, n, source, eps)
509
+ v_first = None
510
+ newest = None
511
+ for index, app in enumerate(apps):
512
+ block = f"blocks.{app.slot}."
513
+ if newest is not None:
514
+ n = add_source(sources, n, newest + w["loop_signal"][app.loop].to(dtype) if app.loop_start else newest, eps)
515
+ h = rms(mix_sources(sources, n, queries[2 * index], None, eps), w[block + "mixer_norm.weight"], eps)
516
+ if is_attention(cfg, app.slot):
517
+ mask = masks[app.slot] if cfg.distance_bias else shared_mask
518
+ out, v_first = attention_mixer(w, cfg, app.slot, h, v_first, mask)
519
+ else:
520
+ out = gdn_mixer(w, cfg, app.slot, h, seg, taps_valid)
521
+ g = rms(mix_sources(sources, n, queries[2 * index + 1], out, eps), w[block + "ffn_norm.weight"], eps)
522
+ newest = out + F.linear(F.silu(F.linear(g, w[block + "ffn.gate.weight"])) * F.linear(g, w[block + "ffn.up.weight"]), w[block + "ffn.down.weight"])
523
+ n = add_source(sources, n, newest, eps)
524
+ x = rms(mix_sources(sources, n, queries[-1], None, eps), w["norm.weight"], eps)
525
+ logits = F.linear(x, w["embed.weight"].to(x.dtype))
526
+ if cfg.copy_pointer:
527
+ logits = logits.float() + pointer_boost(w, cfg, tokens, seg.docs, x)
528
+ return logits
529
+
530
+
531
+ class NessimForCausalLM(PreTrainedModel, GenerationMixin):
532
+ config_class = NessimConfig
533
+ base_model_prefix = "model"
534
+ main_input_name = "input_ids"
535
+ _no_split_modules: list[str] = []
536
+
537
+ def __init__(self, config: NessimConfig):
538
+ super().__init__(config)
539
+ self.model = build_network(config)
540
+ self.post_init()
541
+
542
+ def _init_weights(self, module):
543
+ pass # every weight comes from the checkpoint
544
+
545
+ def get_input_embeddings(self) -> nn.Embedding:
546
+ return self.model.embed
547
+
548
+ def set_input_embeddings(self, value: nn.Embedding) -> None:
549
+ self.model.embed = value
550
+
551
+ def get_output_embeddings(self) -> nn.Embedding:
552
+ return self.model.embed # tied: the output layer reads embed.weight
553
+
554
+ def forward(self, input_ids, attention_mask=None, past_key_values=None, use_cache=None, labels=None,
555
+ return_dict=True, **kwargs) -> CausalLMOutputWithPast:
556
+ real = None
557
+ if attention_mask is not None:
558
+ mask = attention_mask.bool()
559
+ left = bool((mask[:, 1:] >= mask[:, :-1]).all())
560
+ if not left and not bool((mask[:, 1:] <= mask[:, :-1]).all()):
561
+ raise ValueError("only left or right padding is supported")
562
+ if left:
563
+ real = mask[:, -input_ids.shape[1]:]
564
+ weights = {**dict(self.model.named_parameters()), **dict(self.model.named_buffers())}
565
+ logits = forward_logits(weights, self.config, input_ids, real)
566
+ loss = None
567
+ if labels is not None:
568
+ loss = F.cross_entropy(logits[:, :-1].flatten(0, 1).float(), labels[:, 1:].flatten(), ignore_index=-100)
569
+ return CausalLMOutputWithPast(loss=loss, logits=logits)
570
+
571
+ def prepare_inputs_for_generation(self, input_ids, past_key_values=None, attention_mask=None, use_cache=None, **kwargs):
572
+ return {"input_ids": input_ids, "attention_mask": attention_mask}
special_tokens_map.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "pad_token": "<pad>",
3
+ "bos_token": "<bos>",
4
+ "eos_token": "<eos>",
5
+ "additional_special_tokens": [
6
+ "<|im_start|>",
7
+ "<|im_end|>",
8
+ "<think>",
9
+ "</think>"
10
+ ]
11
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "PreTrainedTokenizerFast",
3
+ "model_max_length": 2048,
4
+ "pad_token": "<pad>",
5
+ "bos_token": "<bos>",
6
+ "eos_token": "<eos>",
7
+ "additional_special_tokens": [
8
+ "<|im_start|>",
9
+ "<|im_end|>",
10
+ "<think>",
11
+ "</think>"
12
+ ],
13
+ "add_bos_token": false,
14
+ "add_eos_token": false,
15
+ "clean_up_tokenization_spaces": false,
16
+ "model_input_names": [
17
+ "input_ids",
18
+ "attention_mask"
19
+ ]
20
+ }