hbfreed commited on
Commit
ff420f0
·
verified ·
1 Parent(s): 4aabd20

off-policy step-150 release checkpoint

Browse files
README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: allenai/OLMoE-1B-7B-0125-Instruct
4
+ tags: [moe, pruning, olmoe, glean]
5
+ ---
6
+
7
+ # winnow-olmoe-math-keep25
8
+
9
+ Channel-level pruned + healed [OLMoE-1B-7B-0125-Instruct](https://huggingface.co/allenai/OLMoE-1B-7B-0125-Instruct).
10
+ Requires `trust_remote_code=True` (ragged variable-width experts).
11
+
12
+ | | |
13
+ |---|---|
14
+ | Base | allenai/OLMoE-1B-7B-0125-Instruct |
15
+ | Params | 2.09B |
16
+ | Experts fully deleted | 442/1024 |
17
+ | Keep fraction | 0.25 |
18
+ | Criterion | channel-level REAP, per-layer budgets, block 128, min width 128 |
19
+ | Calibration | Dolmino-math (`scores_0125inst_dolmino-math`) |
20
+ | Final forward top-128 KL | 0.088 |
21
+
22
+ ## Healing
23
+
24
+ Off-policy forward-KL distillation against cached top-128 teacher targets
25
+ (`dolci_math_curated_opd_top128`), 150 steps, 120k loss tokens/step (18M total), AdamW8bit,
26
+ lr 3e-5, wd 0.1, 10 warmup steps, grad clip 1.0, chat frames, max seq len 2048, seed 1223.
27
+
28
+ All six models in this release share this recipe and are matched on optimizer
29
+ steps and loss tokens. Note they are **not** matched on data exposure: the math
30
+ cache is 6.48M unique tokens (~2.8 epochs at 150 steps) while the general cache
31
+ is 22.3M (~0.81 epochs).
chat_template.jinja ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|system|>
2
+ ' + message['content'] + '
3
+ ' }}{% elif message['role'] == 'user' %}{{ '<|user|>
4
+ ' + message['content'] + '
5
+ ' }}{% elif message['role'] == 'assistant' %}{% if not loop.last %}{{ '<|assistant|>
6
+ ' + message['content'] + eos_token + '
7
+ ' }}{% else %}{{ '<|assistant|>
8
+ ' + message['content'] + eos_token }}{% endif %}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|assistant|>
9
+ ' }}{% endif %}{% endfor %}
config.json ADDED
@@ -0,0 +1,662 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "PrunedOlmoeForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_pruned_olmoe.PrunedOlmoeConfig",
9
+ "AutoModelForCausalLM": "modeling_pruned_olmoe.PrunedOlmoeForCausalLM"
10
+ },
11
+ "clip_qkv": null,
12
+ "dtype": "bfloat16",
13
+ "eos_token_id": 50279,
14
+ "expert_widths": [
15
+ [
16
+ 768,
17
+ 512,
18
+ 640,
19
+ 512,
20
+ 896,
21
+ 640,
22
+ 640,
23
+ 512,
24
+ 256,
25
+ 256,
26
+ 384,
27
+ 384,
28
+ 256,
29
+ 512,
30
+ 640,
31
+ 384,
32
+ 256,
33
+ 256,
34
+ 384,
35
+ 896,
36
+ 1024,
37
+ 384,
38
+ 256,
39
+ 384,
40
+ 896,
41
+ 256,
42
+ 384,
43
+ 128,
44
+ 1024,
45
+ 512,
46
+ 640,
47
+ 512
48
+ ],
49
+ [
50
+ 256,
51
+ 512,
52
+ 512,
53
+ 384,
54
+ 256,
55
+ 256,
56
+ 384,
57
+ 896,
58
+ 768,
59
+ 256,
60
+ 256,
61
+ 896,
62
+ 256,
63
+ 512,
64
+ 384,
65
+ 384,
66
+ 1024,
67
+ 1024,
68
+ 512,
69
+ 1024,
70
+ 384,
71
+ 256,
72
+ 256,
73
+ 1024,
74
+ 384,
75
+ 384,
76
+ 256,
77
+ 768,
78
+ 384,
79
+ 1024,
80
+ 256,
81
+ 256
82
+ ],
83
+ [
84
+ 384,
85
+ 768,
86
+ 128,
87
+ 384,
88
+ 640,
89
+ 512,
90
+ 256,
91
+ 1024,
92
+ 768,
93
+ 640,
94
+ 256,
95
+ 896,
96
+ 512,
97
+ 256,
98
+ 384,
99
+ 256,
100
+ 768,
101
+ 256,
102
+ 640,
103
+ 512,
104
+ 640,
105
+ 512,
106
+ 128,
107
+ 256,
108
+ 640,
109
+ 384,
110
+ 128,
111
+ 384,
112
+ 256,
113
+ 256,
114
+ 1024,
115
+ 256,
116
+ 512,
117
+ 512,
118
+ 256
119
+ ],
120
+ [
121
+ 256,
122
+ 128,
123
+ 512,
124
+ 640,
125
+ 512,
126
+ 384,
127
+ 640,
128
+ 256,
129
+ 256,
130
+ 896,
131
+ 640,
132
+ 512,
133
+ 1024,
134
+ 512,
135
+ 896,
136
+ 384,
137
+ 384,
138
+ 256,
139
+ 384,
140
+ 384,
141
+ 384,
142
+ 128,
143
+ 640,
144
+ 640,
145
+ 768,
146
+ 256,
147
+ 768,
148
+ 512,
149
+ 1024,
150
+ 384,
151
+ 1024
152
+ ],
153
+ [
154
+ 256,
155
+ 256,
156
+ 512,
157
+ 256,
158
+ 640,
159
+ 256,
160
+ 384,
161
+ 512,
162
+ 640,
163
+ 512,
164
+ 128,
165
+ 1024,
166
+ 256,
167
+ 640,
168
+ 256,
169
+ 128,
170
+ 640,
171
+ 384,
172
+ 384,
173
+ 256,
174
+ 384,
175
+ 384,
176
+ 768,
177
+ 128,
178
+ 384,
179
+ 256,
180
+ 256,
181
+ 512,
182
+ 128,
183
+ 256,
184
+ 512,
185
+ 384,
186
+ 512,
187
+ 768,
188
+ 256,
189
+ 896,
190
+ 384,
191
+ 896
192
+ ],
193
+ [
194
+ 1024,
195
+ 256,
196
+ 768,
197
+ 768,
198
+ 384,
199
+ 768,
200
+ 256,
201
+ 768,
202
+ 512,
203
+ 768,
204
+ 512,
205
+ 512,
206
+ 640,
207
+ 384,
208
+ 256,
209
+ 512,
210
+ 512,
211
+ 256,
212
+ 256,
213
+ 512,
214
+ 128,
215
+ 384,
216
+ 256,
217
+ 128,
218
+ 384,
219
+ 384,
220
+ 512,
221
+ 256,
222
+ 128,
223
+ 256,
224
+ 640,
225
+ 128,
226
+ 768,
227
+ 256,
228
+ 768,
229
+ 384
230
+ ],
231
+ [
232
+ 256,
233
+ 256,
234
+ 512,
235
+ 256,
236
+ 640,
237
+ 768,
238
+ 768,
239
+ 768,
240
+ 256,
241
+ 256,
242
+ 256,
243
+ 768,
244
+ 1024,
245
+ 640,
246
+ 256,
247
+ 768,
248
+ 640,
249
+ 256,
250
+ 256,
251
+ 384,
252
+ 256,
253
+ 384,
254
+ 512,
255
+ 384,
256
+ 384,
257
+ 640,
258
+ 256,
259
+ 1024,
260
+ 256,
261
+ 768,
262
+ 768,
263
+ 768
264
+ ],
265
+ [
266
+ 768,
267
+ 1024,
268
+ 768,
269
+ 512,
270
+ 384,
271
+ 512,
272
+ 384,
273
+ 128,
274
+ 512,
275
+ 256,
276
+ 256,
277
+ 640,
278
+ 384,
279
+ 640,
280
+ 384,
281
+ 512,
282
+ 256,
283
+ 384,
284
+ 384,
285
+ 384,
286
+ 512,
287
+ 640,
288
+ 256,
289
+ 512,
290
+ 128,
291
+ 640,
292
+ 512,
293
+ 256,
294
+ 384,
295
+ 512,
296
+ 384,
297
+ 640,
298
+ 256,
299
+ 768,
300
+ 512
301
+ ],
302
+ [
303
+ 128,
304
+ 512,
305
+ 128,
306
+ 256,
307
+ 384,
308
+ 384,
309
+ 512,
310
+ 384,
311
+ 384,
312
+ 896,
313
+ 512,
314
+ 512,
315
+ 256,
316
+ 512,
317
+ 384,
318
+ 128,
319
+ 640,
320
+ 640,
321
+ 256,
322
+ 640,
323
+ 384,
324
+ 384,
325
+ 384,
326
+ 384,
327
+ 896,
328
+ 384,
329
+ 384,
330
+ 384,
331
+ 256,
332
+ 384,
333
+ 128,
334
+ 256,
335
+ 768,
336
+ 896,
337
+ 384,
338
+ 640,
339
+ 640
340
+ ],
341
+ [
342
+ 256,
343
+ 256,
344
+ 384,
345
+ 1024,
346
+ 128,
347
+ 768,
348
+ 256,
349
+ 256,
350
+ 384,
351
+ 512,
352
+ 384,
353
+ 256,
354
+ 512,
355
+ 384,
356
+ 256,
357
+ 512,
358
+ 256,
359
+ 384,
360
+ 384,
361
+ 256,
362
+ 640,
363
+ 256,
364
+ 512,
365
+ 512,
366
+ 512,
367
+ 384,
368
+ 384,
369
+ 256,
370
+ 256,
371
+ 384,
372
+ 256,
373
+ 384,
374
+ 896,
375
+ 384,
376
+ 512,
377
+ 640,
378
+ 128,
379
+ 384,
380
+ 384,
381
+ 512
382
+ ],
383
+ [
384
+ 384,
385
+ 256,
386
+ 512,
387
+ 384,
388
+ 256,
389
+ 256,
390
+ 384,
391
+ 256,
392
+ 384,
393
+ 256,
394
+ 768,
395
+ 256,
396
+ 384,
397
+ 512,
398
+ 256,
399
+ 640,
400
+ 512,
401
+ 384,
402
+ 512,
403
+ 640,
404
+ 256,
405
+ 512,
406
+ 128,
407
+ 128,
408
+ 256,
409
+ 384,
410
+ 512,
411
+ 512,
412
+ 256,
413
+ 512,
414
+ 512,
415
+ 256,
416
+ 512,
417
+ 256,
418
+ 384,
419
+ 640,
420
+ 640,
421
+ 768,
422
+ 256,
423
+ 512
424
+ ],
425
+ [
426
+ 384,
427
+ 256,
428
+ 512,
429
+ 256,
430
+ 640,
431
+ 512,
432
+ 128,
433
+ 384,
434
+ 256,
435
+ 512,
436
+ 384,
437
+ 256,
438
+ 128,
439
+ 384,
440
+ 640,
441
+ 256,
442
+ 384,
443
+ 512,
444
+ 512,
445
+ 640,
446
+ 128,
447
+ 512,
448
+ 256,
449
+ 256,
450
+ 384,
451
+ 128,
452
+ 128,
453
+ 256,
454
+ 512,
455
+ 256,
456
+ 1024,
457
+ 256,
458
+ 384,
459
+ 256,
460
+ 256,
461
+ 512,
462
+ 512,
463
+ 384,
464
+ 768,
465
+ 512,
466
+ 768
467
+ ],
468
+ [
469
+ 128,
470
+ 128,
471
+ 384,
472
+ 384,
473
+ 384,
474
+ 512,
475
+ 896,
476
+ 640,
477
+ 256,
478
+ 256,
479
+ 384,
480
+ 512,
481
+ 640,
482
+ 640,
483
+ 256,
484
+ 256,
485
+ 256,
486
+ 128,
487
+ 256,
488
+ 384,
489
+ 384,
490
+ 384,
491
+ 768,
492
+ 640,
493
+ 512,
494
+ 128,
495
+ 384,
496
+ 384,
497
+ 512,
498
+ 768,
499
+ 640,
500
+ 640,
501
+ 128,
502
+ 256,
503
+ 640,
504
+ 128,
505
+ 640,
506
+ 128,
507
+ 256,
508
+ 128,
509
+ 256
510
+ ],
511
+ [
512
+ 640,
513
+ 768,
514
+ 640,
515
+ 768,
516
+ 640,
517
+ 256,
518
+ 384,
519
+ 768,
520
+ 256,
521
+ 128,
522
+ 128,
523
+ 384,
524
+ 512,
525
+ 384,
526
+ 512,
527
+ 512,
528
+ 512,
529
+ 640,
530
+ 512,
531
+ 384,
532
+ 512,
533
+ 256,
534
+ 768,
535
+ 256,
536
+ 384,
537
+ 256,
538
+ 640,
539
+ 256,
540
+ 256,
541
+ 128,
542
+ 384,
543
+ 384,
544
+ 640,
545
+ 384,
546
+ 768,
547
+ 256,
548
+ 128
549
+ ],
550
+ [
551
+ 384,
552
+ 384,
553
+ 256,
554
+ 256,
555
+ 128,
556
+ 256,
557
+ 896,
558
+ 896,
559
+ 768,
560
+ 512,
561
+ 640,
562
+ 384,
563
+ 512,
564
+ 768,
565
+ 256,
566
+ 384,
567
+ 256,
568
+ 128,
569
+ 640,
570
+ 640,
571
+ 512,
572
+ 384,
573
+ 512,
574
+ 768,
575
+ 768,
576
+ 512,
577
+ 640,
578
+ 512,
579
+ 512,
580
+ 384,
581
+ 128,
582
+ 384,
583
+ 128,
584
+ 512,
585
+ 128,
586
+ 256
587
+ ],
588
+ [
589
+ 256,
590
+ 768,
591
+ 512,
592
+ 640,
593
+ 512,
594
+ 384,
595
+ 512,
596
+ 256,
597
+ 640,
598
+ 256,
599
+ 384,
600
+ 896,
601
+ 256,
602
+ 512,
603
+ 128,
604
+ 256,
605
+ 256,
606
+ 256,
607
+ 384,
608
+ 640,
609
+ 256,
610
+ 640,
611
+ 256,
612
+ 640,
613
+ 256,
614
+ 128,
615
+ 256,
616
+ 512,
617
+ 512,
618
+ 128,
619
+ 896,
620
+ 512,
621
+ 384,
622
+ 512,
623
+ 640,
624
+ 384,
625
+ 256,
626
+ 256,
627
+ 256
628
+ ]
629
+ ],
630
+ "glean_metadata": {
631
+ "base_model": "allenai/OLMoE-1B-7B-0125-Instruct",
632
+ "block_size": 128,
633
+ "criterion": "reap",
634
+ "dead_experts": 442,
635
+ "keep_fraction": 0.25,
636
+ "min_width": 128,
637
+ "params": 2086418432,
638
+ "scores": "outputs/scores_0125inst_dolmino-math/scores.pt"
639
+ },
640
+ "hidden_act": "silu",
641
+ "hidden_size": 2048,
642
+ "initializer_range": 0.02,
643
+ "intermediate_size": 1024,
644
+ "max_position_embeddings": 4096,
645
+ "model_type": "pruned_olmoe",
646
+ "norm_topk_prob": false,
647
+ "num_attention_heads": 16,
648
+ "num_experts": 64,
649
+ "num_experts_per_tok": 8,
650
+ "num_hidden_layers": 16,
651
+ "num_key_value_heads": 16,
652
+ "output_router_logits": false,
653
+ "pad_token_id": 1,
654
+ "rms_norm_eps": 1e-05,
655
+ "rope_scaling": null,
656
+ "rope_theta": 10000.0,
657
+ "router_aux_loss_coef": 0.01,
658
+ "tie_word_embeddings": false,
659
+ "transformers_version": "4.57.6",
660
+ "use_cache": false,
661
+ "vocab_size": 50304
662
+ }
configuration_pruned_olmoe.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Configuration for GLEAN-pruned OLMoE: variable-width, variable-count experts.
2
+ """
3
+
4
+ from transformers.models.olmoe.configuration_olmoe import OlmoeConfig
5
+
6
+
7
+ class PrunedOlmoeConfig(OlmoeConfig):
8
+ """OlmoeConfig plus a per-(layer, expert) width table.
9
+
10
+ ``expert_widths[l]`` lists the SwiGLU intermediate width of each surviving
11
+ expert in decoder layer ``l``, in expert order. Lists are ragged: layers
12
+ may keep different numbers of experts (deleted experts simply don't
13
+ appear — the router in layer ``l`` has ``len(expert_widths[l])`` rows),
14
+ and each width may differ (multiples of the GEMM block size, 128, for
15
+ variable-MegaBlocks execution). ``None`` means an unpruned model
16
+ (uniform ``num_experts`` × ``intermediate_size``).
17
+
18
+ The inherited ``num_experts`` / ``intermediate_size`` keep their ORIGINAL
19
+ (pre-pruning) values for provenance; the width table is authoritative for
20
+ the built architecture.
21
+ """
22
+
23
+ model_type = "pruned_olmoe"
24
+
25
+ def __init__(self, expert_widths: list[list[int]] | None = None, **kwargs):
26
+ super().__init__(**kwargs)
27
+ self.expert_widths = expert_widths
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": 50279,
4
+ "pad_token_id": 1,
5
+ "transformers_version": "4.57.6"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8e2fc15b81549edd28984417ea2b6b45d784d6dac3afb200e6285d7362f10c5
3
+ size 4173068776
modeling_pruned_olmoe.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """GLEAN-pruned OLMoE: HF-loadable model with ragged (variable-width) experts.
2
+
3
+ Pattern follows hbfreed/variable-flex-olmo's PrunedFlexOlmoForCausalLM
4
+ (docs/recon/prior-work-hbfreed.md), generalized from one scalar width to a
5
+ per-(layer, expert) width table: ``super().__init__`` builds the uniform
6
+ architecture from the config, then every MoE block is rebuilt to its pruned
7
+ shape — surviving experts only, each at its own width, router sliced to
8
+ match — so the state dict aligns exactly with what
9
+ ``glean.prune.prune_channels_global`` leaves behind.
10
+
11
+ Caveat: ``output_router_logits=True`` (the load-balancing aux loss) assumes a
12
+ uniform ``config.num_experts`` and is unsupported on ragged models.
13
+ """
14
+
15
+ import torch.nn as nn
16
+ from transformers.activations import ACT2FN
17
+ from transformers.models.olmoe.modeling_olmoe import OlmoeForCausalLM
18
+
19
+ from .configuration_pruned_olmoe import PrunedOlmoeConfig
20
+
21
+
22
+ class RaggedOlmoeMLP(nn.Module):
23
+ """OlmoeMLP with an explicit intermediate width (SwiGLU, no biases)."""
24
+
25
+ def __init__(self, hidden_size: int, intermediate_size: int, hidden_act: str):
26
+ super().__init__()
27
+ self.hidden_size = hidden_size
28
+ self.intermediate_size = intermediate_size
29
+ self.gate_proj = nn.Linear(hidden_size, intermediate_size, bias=False)
30
+ self.up_proj = nn.Linear(hidden_size, intermediate_size, bias=False)
31
+ self.down_proj = nn.Linear(intermediate_size, hidden_size, bias=False)
32
+ self.act_fn = ACT2FN[hidden_act]
33
+
34
+ def forward(self, x):
35
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
36
+
37
+
38
+ class PrunedOlmoeForCausalLM(OlmoeForCausalLM):
39
+ """OLMoE with per-layer surviving-expert lists at per-expert widths."""
40
+
41
+ config_class = PrunedOlmoeConfig
42
+
43
+ def __init__(self, config: PrunedOlmoeConfig):
44
+ super().__init__(config)
45
+ widths_table = getattr(config, "expert_widths", None)
46
+ if widths_table is None:
47
+ return # unpruned: plain OLMoE
48
+ if len(widths_table) != len(self.model.layers):
49
+ raise ValueError(
50
+ f"expert_widths has {len(widths_table)} rows but the model has "
51
+ f"{len(self.model.layers)} decoder layers"
52
+ )
53
+ for layer, widths in zip(self.model.layers, widths_table):
54
+ if any(w <= 0 for w in widths):
55
+ raise ValueError("expert_widths must list surviving experts only (>0)")
56
+ block = layer.mlp
57
+ if len(widths) < block.top_k:
58
+ raise ValueError(
59
+ f"a layer keeps {len(widths)} experts < top_k={block.top_k}"
60
+ )
61
+ block.num_experts = len(widths)
62
+ block.gate = nn.Linear(config.hidden_size, len(widths), bias=False)
63
+ block.experts = nn.ModuleList(
64
+ RaggedOlmoeMLP(config.hidden_size, w, config.hidden_act)
65
+ for w in widths
66
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "|||IP_ADDRESS|||",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "|||IP_ADDRESS|||",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<pad>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": false,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<|endoftext|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<|padding|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "50254": {
23
+ "content": " ",
24
+ "lstrip": false,
25
+ "normalized": true,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": false
29
+ },
30
+ "50255": {
31
+ "content": " ",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": false
37
+ },
38
+ "50256": {
39
+ "content": " ",
40
+ "lstrip": false,
41
+ "normalized": true,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": false
45
+ },
46
+ "50257": {
47
+ "content": " ",
48
+ "lstrip": false,
49
+ "normalized": true,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": false
53
+ },
54
+ "50258": {
55
+ "content": " ",
56
+ "lstrip": false,
57
+ "normalized": true,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": false
61
+ },
62
+ "50259": {
63
+ "content": " ",
64
+ "lstrip": false,
65
+ "normalized": true,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": false
69
+ },
70
+ "50260": {
71
+ "content": " ",
72
+ "lstrip": false,
73
+ "normalized": true,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": false
77
+ },
78
+ "50261": {
79
+ "content": " ",
80
+ "lstrip": false,
81
+ "normalized": true,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": false
85
+ },
86
+ "50262": {
87
+ "content": " ",
88
+ "lstrip": false,
89
+ "normalized": true,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": false
93
+ },
94
+ "50263": {
95
+ "content": " ",
96
+ "lstrip": false,
97
+ "normalized": true,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": false
101
+ },
102
+ "50264": {
103
+ "content": " ",
104
+ "lstrip": false,
105
+ "normalized": true,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": false
109
+ },
110
+ "50265": {
111
+ "content": " ",
112
+ "lstrip": false,
113
+ "normalized": true,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": false
117
+ },
118
+ "50266": {
119
+ "content": " ",
120
+ "lstrip": false,
121
+ "normalized": true,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": false
125
+ },
126
+ "50267": {
127
+ "content": " ",
128
+ "lstrip": false,
129
+ "normalized": true,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": false
133
+ },
134
+ "50268": {
135
+ "content": " ",
136
+ "lstrip": false,
137
+ "normalized": true,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": false
141
+ },
142
+ "50269": {
143
+ "content": " ",
144
+ "lstrip": false,
145
+ "normalized": true,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": false
149
+ },
150
+ "50270": {
151
+ "content": " ",
152
+ "lstrip": false,
153
+ "normalized": true,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": false
157
+ },
158
+ "50271": {
159
+ "content": " ",
160
+ "lstrip": false,
161
+ "normalized": true,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": false
165
+ },
166
+ "50272": {
167
+ "content": " ",
168
+ "lstrip": false,
169
+ "normalized": true,
170
+ "rstrip": false,
171
+ "single_word": false,
172
+ "special": false
173
+ },
174
+ "50273": {
175
+ "content": " ",
176
+ "lstrip": false,
177
+ "normalized": true,
178
+ "rstrip": false,
179
+ "single_word": false,
180
+ "special": false
181
+ },
182
+ "50274": {
183
+ "content": " ",
184
+ "lstrip": false,
185
+ "normalized": true,
186
+ "rstrip": false,
187
+ "single_word": false,
188
+ "special": false
189
+ },
190
+ "50275": {
191
+ "content": " ",
192
+ "lstrip": false,
193
+ "normalized": true,
194
+ "rstrip": false,
195
+ "single_word": false,
196
+ "special": false
197
+ },
198
+ "50276": {
199
+ "content": " ",
200
+ "lstrip": false,
201
+ "normalized": true,
202
+ "rstrip": false,
203
+ "single_word": false,
204
+ "special": false
205
+ },
206
+ "50277": {
207
+ "content": "|||EMAIL_ADDRESS|||",
208
+ "lstrip": false,
209
+ "normalized": true,
210
+ "rstrip": false,
211
+ "single_word": false,
212
+ "special": false
213
+ },
214
+ "50278": {
215
+ "content": "|||PHONE_NUMBER|||",
216
+ "lstrip": false,
217
+ "normalized": true,
218
+ "rstrip": false,
219
+ "single_word": false,
220
+ "special": false
221
+ },
222
+ "50279": {
223
+ "content": "|||IP_ADDRESS|||",
224
+ "lstrip": false,
225
+ "normalized": true,
226
+ "rstrip": false,
227
+ "single_word": false,
228
+ "special": true
229
+ },
230
+ "50280": {
231
+ "content": "<pad>",
232
+ "lstrip": false,
233
+ "normalized": false,
234
+ "rstrip": false,
235
+ "single_word": false,
236
+ "special": true
237
+ }
238
+ },
239
+ "bos_token": "|||IP_ADDRESS|||",
240
+ "clean_up_tokenization_spaces": false,
241
+ "eos_token": "|||IP_ADDRESS|||",
242
+ "extra_special_tokens": {},
243
+ "model_max_length": 1000000000000000019884624838656,
244
+ "pad_token": "<pad>",
245
+ "tokenizer_class": "GPTNeoXTokenizer",
246
+ "unk_token": null
247
+ }