m1ngcheng commited on
Commit
d03fcd0
·
verified ·
1 Parent(s): 785a19a

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. config.json +969 -0
  2. configuration_bailing_moe_v2_5.py +120 -0
  3. generation_config.json +8 -0
  4. model-00002-of-00160.safetensors +3 -0
  5. model-00008-of-00160.safetensors +3 -0
  6. model-00010-of-00160.safetensors +3 -0
  7. model-00011-of-00160.safetensors +3 -0
  8. model-00031-of-00160.safetensors +3 -0
  9. model-00035-of-00160.safetensors +3 -0
  10. model-00038-of-00160.safetensors +3 -0
  11. model-00041-of-00160.safetensors +3 -0
  12. model-00049-of-00160.safetensors +3 -0
  13. model-00052-of-00160.safetensors +3 -0
  14. model-00053-of-00160.safetensors +3 -0
  15. model-00054-of-00160.safetensors +3 -0
  16. model-00058-of-00160.safetensors +3 -0
  17. model-00059-of-00160.safetensors +3 -0
  18. model-00063-of-00160.safetensors +3 -0
  19. model-00066-of-00160.safetensors +3 -0
  20. model-00067-of-00160.safetensors +3 -0
  21. model-00068-of-00160.safetensors +3 -0
  22. model-00072-of-00160.safetensors +3 -0
  23. model-00073-of-00160.safetensors +3 -0
  24. model-00074-of-00160.safetensors +3 -0
  25. model-00076-of-00160.safetensors +3 -0
  26. model-00077-of-00160.safetensors +3 -0
  27. model-00079-of-00160.safetensors +3 -0
  28. model-00090-of-00160.safetensors +3 -0
  29. model-00091-of-00160.safetensors +3 -0
  30. model-00092-of-00160.safetensors +3 -0
  31. model-00093-of-00160.safetensors +3 -0
  32. model-00095-of-00160.safetensors +3 -0
  33. model-00096-of-00160.safetensors +3 -0
  34. model-00097-of-00160.safetensors +3 -0
  35. model-00099-of-00160.safetensors +3 -0
  36. model-00121-of-00160.safetensors +3 -0
  37. model-00126-of-00160.safetensors +3 -0
  38. model-00127-of-00160.safetensors +3 -0
  39. model-00129-of-00160.safetensors +3 -0
  40. model-00130-of-00160.safetensors +3 -0
  41. model-00137-of-00160.safetensors +3 -0
  42. model-00139-of-00160.safetensors +3 -0
  43. model-00140-of-00160.safetensors +3 -0
  44. model-00142-of-00160.safetensors +3 -0
  45. model-00143-of-00160.safetensors +3 -0
  46. model-00145-of-00160.safetensors +3 -0
  47. model-00146-of-00160.safetensors +3 -0
  48. modeling_bailing_moe_v2_5.py +1603 -0
  49. special_tokens_map.json +30 -0
  50. tokenizer_config.json +2114 -0
config.json ADDED
@@ -0,0 +1,969 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BailingMoeV2_5ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_bailing_moe_v2_5.BailingMoeV2_5Config",
8
+ "AutoModel": "modeling_bailing_moe_v2_5.BailingMoeV2_5Model",
9
+ "AutoModelForCausalLM": "modeling_bailing_moe_v2_5.BailingMoeV2_5ForCausalLM"
10
+ },
11
+ "embedding_dropout": 0.0,
12
+ "eos_token_id": 156895,
13
+ "first_k_dense_replace": 4,
14
+ "group_norm_size": 8,
15
+ "head_dim": 128,
16
+ "hidden_act": "silu",
17
+ "hidden_size": 8192,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 18432,
20
+ "kv_lora_rank": 512,
21
+ "layer_group_size": 8,
22
+ "linear_silu": false,
23
+ "max_position_embeddings": 131072,
24
+ "max_window_layers": 20,
25
+ "model_type": "bailing_hybrid",
26
+ "moe_intermediate_size": 2048,
27
+ "moe_router_enable_expert_bias": true,
28
+ "moe_shared_expert_intermediate_size": 2048,
29
+ "mtp_loss_scaling_factor": 0,
30
+ "n_group": 8,
31
+ "num_attention_heads": 64,
32
+ "num_experts": 256,
33
+ "num_experts_per_tok": 8,
34
+ "num_hidden_layers": 80,
35
+ "num_key_value_heads": 64,
36
+ "num_kv_heads_for_linear_attn": 64,
37
+ "num_nextn_predict_layers": 1,
38
+ "num_shared_experts": 1,
39
+ "output_dropout": 0.0,
40
+ "output_router_logits": false,
41
+ "pad_token_id": 156892,
42
+ "partial_rotary_factor": 0.5,
43
+ "q_lora_rank": 1536,
44
+ "qk_head_dim": 192,
45
+ "qk_nope_head_dim": 128,
46
+ "qk_rope_head_dim": 64,
47
+ "quantization_config": {
48
+ "config_groups": {
49
+ "FP8_DYNAMIC": {
50
+ "format": "float-quantized",
51
+ "input_activations": {
52
+ "actorder": null,
53
+ "block_structure": null,
54
+ "dynamic": true,
55
+ "group_size": null,
56
+ "num_bits": 8,
57
+ "observer": null,
58
+ "observer_kwargs": {},
59
+ "strategy": "token",
60
+ "symmetric": true,
61
+ "type": "float"
62
+ },
63
+ "output_activations": null,
64
+ "targets": [
65
+ "Linear"
66
+ ],
67
+ "weights": {
68
+ "actorder": null,
69
+ "block_structure": null,
70
+ "dynamic": false,
71
+ "group_size": null,
72
+ "num_bits": 8,
73
+ "observer": "static_minmax",
74
+ "observer_kwargs": {},
75
+ "strategy": "channel",
76
+ "symmetric": true,
77
+ "type": "float"
78
+ }
79
+ }
80
+ },
81
+ "format": "float-quantized",
82
+ "global_compression_ratio": null,
83
+ "ignore": [
84
+ "model.layers.74.mlp.gate",
85
+ "model.layers.75.mlp.gate",
86
+ "model.layers.76.mlp.gate",
87
+ "model.layers.77.mlp.gate",
88
+ "model.layers.10.mlp.gate",
89
+ "model.layers.11.mlp.gate",
90
+ "model.layers.12.mlp.gate",
91
+ "model.layers.13.mlp.gate",
92
+ "model.layers.14.mlp.gate",
93
+ "model.layers.15.mlp.gate",
94
+ "model.layers.16.mlp.gate",
95
+ "model.layers.17.mlp.gate",
96
+ "model.layers.34.mlp.gate",
97
+ "model.layers.35.mlp.gate",
98
+ "model.layers.36.mlp.gate",
99
+ "model.layers.37.mlp.gate",
100
+ "model.layers.38.mlp.gate",
101
+ "model.layers.39.mlp.gate",
102
+ "model.layers.40.mlp.gate",
103
+ "model.layers.41.mlp.gate",
104
+ "model.layers.66.mlp.gate",
105
+ "model.layers.67.mlp.gate",
106
+ "model.layers.68.mlp.gate",
107
+ "model.layers.69.mlp.gate",
108
+ "model.layers.4.mlp.gate",
109
+ "model.layers.5.mlp.gate",
110
+ "model.word_embeddings",
111
+ "model.layers.6.mlp.gate",
112
+ "model.layers.7.mlp.gate",
113
+ "model.layers.8.mlp.gate",
114
+ "model.layers.9.mlp.gate",
115
+ "model.layers.70.mlp.gate",
116
+ "model.layers.71.mlp.gate",
117
+ "model.layers.72.mlp.gate",
118
+ "model.layers.73.mlp.gate",
119
+ "model.layers.30.mlp.gate",
120
+ "model.layers.31.mlp.gate",
121
+ "model.layers.32.mlp.gate",
122
+ "model.layers.33.mlp.gate",
123
+ "model.layers.26.mlp.gate",
124
+ "model.layers.27.mlp.gate",
125
+ "model.layers.28.mlp.gate",
126
+ "model.layers.29.mlp.gate",
127
+ "model.layers.58.mlp.gate",
128
+ "model.layers.59.mlp.gate",
129
+ "model.layers.60.mlp.gate",
130
+ "model.layers.61.mlp.gate",
131
+ "model.layers.50.mlp.gate",
132
+ "model.layers.51.mlp.gate",
133
+ "model.layers.52.mlp.gate",
134
+ "model.layers.53.mlp.gate",
135
+ "lm_head",
136
+ "model.layers.78.mlp.gate",
137
+ "model.layers.79.mlp.gate",
138
+ "model.layers.18.mlp.gate",
139
+ "model.layers.19.mlp.gate",
140
+ "model.layers.20.mlp.gate",
141
+ "model.layers.21.mlp.gate",
142
+ "model.layers.54.mlp.gate",
143
+ "model.layers.55.mlp.gate",
144
+ "model.layers.56.mlp.gate",
145
+ "model.layers.57.mlp.gate",
146
+ "model.layers.62.mlp.gate",
147
+ "model.layers.63.mlp.gate",
148
+ "model.layers.64.mlp.gate",
149
+ "model.layers.65.mlp.gate",
150
+ "model.layers.22.mlp.gate",
151
+ "model.layers.23.mlp.gate",
152
+ "model.layers.24.mlp.gate",
153
+ "model.layers.25.mlp.gate",
154
+ "model.layers.46.mlp.gate",
155
+ "model.layers.47.mlp.gate",
156
+ "model.layers.48.mlp.gate",
157
+ "model.layers.49.mlp.gate",
158
+ "model.layers.42.mlp.gate",
159
+ "model.layers.43.mlp.gate",
160
+ "model.layers.44.mlp.gate",
161
+ "model.layers.45.mlp.gate",
162
+ "model.layers.80.attention.dense",
163
+ "model.layers.80.attention.kv_a_proj_with_mqa",
164
+ "model.layers.80.attention.kv_b_proj",
165
+ "model.layers.80.attention.q_a_proj",
166
+ "model.layers.80.attention.q_b_proj",
167
+ "model.layers.80.eh_proj",
168
+ "model.layers.80.mlp.gate",
169
+ "model.layers.80.mlp.shared_experts.down_proj",
170
+ "model.layers.80.mlp.shared_experts.gate_proj",
171
+ "model.layers.80.mlp.shared_experts.up_proj",
172
+ "model.layers.80.mlp.experts.0.gate_proj",
173
+ "model.layers.80.mlp.experts.0.up_proj",
174
+ "model.layers.80.mlp.experts.1.gate_proj",
175
+ "model.layers.80.mlp.experts.1.up_proj",
176
+ "model.layers.80.mlp.experts.10.gate_proj",
177
+ "model.layers.80.mlp.experts.10.up_proj",
178
+ "model.layers.80.mlp.experts.100.gate_proj",
179
+ "model.layers.80.mlp.experts.100.up_proj",
180
+ "model.layers.80.mlp.experts.101.gate_proj",
181
+ "model.layers.80.mlp.experts.101.up_proj",
182
+ "model.layers.80.mlp.experts.102.gate_proj",
183
+ "model.layers.80.mlp.experts.102.up_proj",
184
+ "model.layers.80.mlp.experts.103.gate_proj",
185
+ "model.layers.80.mlp.experts.103.up_proj",
186
+ "model.layers.80.mlp.experts.104.gate_proj",
187
+ "model.layers.80.mlp.experts.104.up_proj",
188
+ "model.layers.80.mlp.experts.105.gate_proj",
189
+ "model.layers.80.mlp.experts.105.up_proj",
190
+ "model.layers.80.mlp.experts.106.gate_proj",
191
+ "model.layers.80.mlp.experts.106.up_proj",
192
+ "model.layers.80.mlp.experts.107.gate_proj",
193
+ "model.layers.80.mlp.experts.107.up_proj",
194
+ "model.layers.80.mlp.experts.108.gate_proj",
195
+ "model.layers.80.mlp.experts.108.up_proj",
196
+ "model.layers.80.mlp.experts.109.gate_proj",
197
+ "model.layers.80.mlp.experts.109.up_proj",
198
+ "model.layers.80.mlp.experts.11.gate_proj",
199
+ "model.layers.80.mlp.experts.11.up_proj",
200
+ "model.layers.80.mlp.experts.110.gate_proj",
201
+ "model.layers.80.mlp.experts.110.up_proj",
202
+ "model.layers.80.mlp.experts.111.gate_proj",
203
+ "model.layers.80.mlp.experts.111.up_proj",
204
+ "model.layers.80.mlp.experts.112.gate_proj",
205
+ "model.layers.80.mlp.experts.112.up_proj",
206
+ "model.layers.80.mlp.experts.113.gate_proj",
207
+ "model.layers.80.mlp.experts.113.up_proj",
208
+ "model.layers.80.mlp.experts.114.gate_proj",
209
+ "model.layers.80.mlp.experts.114.up_proj",
210
+ "model.layers.80.mlp.experts.115.gate_proj",
211
+ "model.layers.80.mlp.experts.115.up_proj",
212
+ "model.layers.80.mlp.experts.116.gate_proj",
213
+ "model.layers.80.mlp.experts.116.up_proj",
214
+ "model.layers.80.mlp.experts.117.gate_proj",
215
+ "model.layers.80.mlp.experts.117.up_proj",
216
+ "model.layers.80.mlp.experts.118.gate_proj",
217
+ "model.layers.80.mlp.experts.118.up_proj",
218
+ "model.layers.80.mlp.experts.119.gate_proj",
219
+ "model.layers.80.mlp.experts.119.up_proj",
220
+ "model.layers.80.mlp.experts.12.gate_proj",
221
+ "model.layers.80.mlp.experts.12.up_proj",
222
+ "model.layers.80.mlp.experts.120.gate_proj",
223
+ "model.layers.80.mlp.experts.120.up_proj",
224
+ "model.layers.80.mlp.experts.121.gate_proj",
225
+ "model.layers.80.mlp.experts.121.up_proj",
226
+ "model.layers.80.mlp.experts.122.gate_proj",
227
+ "model.layers.80.mlp.experts.122.up_proj",
228
+ "model.layers.80.mlp.experts.123.gate_proj",
229
+ "model.layers.80.mlp.experts.123.up_proj",
230
+ "model.layers.80.mlp.experts.124.gate_proj",
231
+ "model.layers.80.mlp.experts.124.up_proj",
232
+ "model.layers.80.mlp.experts.125.gate_proj",
233
+ "model.layers.80.mlp.experts.125.up_proj",
234
+ "model.layers.80.mlp.experts.126.gate_proj",
235
+ "model.layers.80.mlp.experts.126.up_proj",
236
+ "model.layers.80.mlp.experts.127.gate_proj",
237
+ "model.layers.80.mlp.experts.127.up_proj",
238
+ "model.layers.80.mlp.experts.128.gate_proj",
239
+ "model.layers.80.mlp.experts.128.up_proj",
240
+ "model.layers.80.mlp.experts.129.gate_proj",
241
+ "model.layers.80.mlp.experts.129.up_proj",
242
+ "model.layers.80.mlp.experts.13.gate_proj",
243
+ "model.layers.80.mlp.experts.13.up_proj",
244
+ "model.layers.80.mlp.experts.130.gate_proj",
245
+ "model.layers.80.mlp.experts.130.up_proj",
246
+ "model.layers.80.mlp.experts.131.gate_proj",
247
+ "model.layers.80.mlp.experts.131.up_proj",
248
+ "model.layers.80.mlp.experts.132.gate_proj",
249
+ "model.layers.80.mlp.experts.132.up_proj",
250
+ "model.layers.80.mlp.experts.133.gate_proj",
251
+ "model.layers.80.mlp.experts.133.up_proj",
252
+ "model.layers.80.mlp.experts.134.gate_proj",
253
+ "model.layers.80.mlp.experts.134.up_proj",
254
+ "model.layers.80.mlp.experts.135.gate_proj",
255
+ "model.layers.80.mlp.experts.135.up_proj",
256
+ "model.layers.80.mlp.experts.136.gate_proj",
257
+ "model.layers.80.mlp.experts.136.up_proj",
258
+ "model.layers.80.mlp.experts.137.gate_proj",
259
+ "model.layers.80.mlp.experts.137.up_proj",
260
+ "model.layers.80.mlp.experts.138.gate_proj",
261
+ "model.layers.80.mlp.experts.138.up_proj",
262
+ "model.layers.80.mlp.experts.139.gate_proj",
263
+ "model.layers.80.mlp.experts.139.up_proj",
264
+ "model.layers.80.mlp.experts.14.gate_proj",
265
+ "model.layers.80.mlp.experts.14.up_proj",
266
+ "model.layers.80.mlp.experts.140.gate_proj",
267
+ "model.layers.80.mlp.experts.140.up_proj",
268
+ "model.layers.80.mlp.experts.141.gate_proj",
269
+ "model.layers.80.mlp.experts.141.up_proj",
270
+ "model.layers.80.mlp.experts.142.gate_proj",
271
+ "model.layers.80.mlp.experts.142.up_proj",
272
+ "model.layers.80.mlp.experts.143.gate_proj",
273
+ "model.layers.80.mlp.experts.143.up_proj",
274
+ "model.layers.80.mlp.experts.144.gate_proj",
275
+ "model.layers.80.mlp.experts.144.up_proj",
276
+ "model.layers.80.mlp.experts.145.gate_proj",
277
+ "model.layers.80.mlp.experts.145.up_proj",
278
+ "model.layers.80.mlp.experts.146.gate_proj",
279
+ "model.layers.80.mlp.experts.146.up_proj",
280
+ "model.layers.80.mlp.experts.147.gate_proj",
281
+ "model.layers.80.mlp.experts.147.up_proj",
282
+ "model.layers.80.mlp.experts.148.gate_proj",
283
+ "model.layers.80.mlp.experts.148.up_proj",
284
+ "model.layers.80.mlp.experts.149.gate_proj",
285
+ "model.layers.80.mlp.experts.149.up_proj",
286
+ "model.layers.80.mlp.experts.15.gate_proj",
287
+ "model.layers.80.mlp.experts.15.up_proj",
288
+ "model.layers.80.mlp.experts.150.gate_proj",
289
+ "model.layers.80.mlp.experts.150.up_proj",
290
+ "model.layers.80.mlp.experts.151.gate_proj",
291
+ "model.layers.80.mlp.experts.151.up_proj",
292
+ "model.layers.80.mlp.experts.152.gate_proj",
293
+ "model.layers.80.mlp.experts.152.up_proj",
294
+ "model.layers.80.mlp.experts.153.gate_proj",
295
+ "model.layers.80.mlp.experts.153.up_proj",
296
+ "model.layers.80.mlp.experts.154.gate_proj",
297
+ "model.layers.80.mlp.experts.154.up_proj",
298
+ "model.layers.80.mlp.experts.155.gate_proj",
299
+ "model.layers.80.mlp.experts.155.up_proj",
300
+ "model.layers.80.mlp.experts.156.gate_proj",
301
+ "model.layers.80.mlp.experts.156.up_proj",
302
+ "model.layers.80.mlp.experts.157.gate_proj",
303
+ "model.layers.80.mlp.experts.157.up_proj",
304
+ "model.layers.80.mlp.experts.158.gate_proj",
305
+ "model.layers.80.mlp.experts.158.up_proj",
306
+ "model.layers.80.mlp.experts.159.gate_proj",
307
+ "model.layers.80.mlp.experts.159.up_proj",
308
+ "model.layers.80.mlp.experts.16.gate_proj",
309
+ "model.layers.80.mlp.experts.16.up_proj",
310
+ "model.layers.80.mlp.experts.160.gate_proj",
311
+ "model.layers.80.mlp.experts.160.up_proj",
312
+ "model.layers.80.mlp.experts.161.gate_proj",
313
+ "model.layers.80.mlp.experts.161.up_proj",
314
+ "model.layers.80.mlp.experts.162.gate_proj",
315
+ "model.layers.80.mlp.experts.162.up_proj",
316
+ "model.layers.80.mlp.experts.163.gate_proj",
317
+ "model.layers.80.mlp.experts.163.up_proj",
318
+ "model.layers.80.mlp.experts.164.gate_proj",
319
+ "model.layers.80.mlp.experts.164.up_proj",
320
+ "model.layers.80.mlp.experts.165.gate_proj",
321
+ "model.layers.80.mlp.experts.165.up_proj",
322
+ "model.layers.80.mlp.experts.166.gate_proj",
323
+ "model.layers.80.mlp.experts.166.up_proj",
324
+ "model.layers.80.mlp.experts.167.gate_proj",
325
+ "model.layers.80.mlp.experts.167.up_proj",
326
+ "model.layers.80.mlp.experts.168.gate_proj",
327
+ "model.layers.80.mlp.experts.168.up_proj",
328
+ "model.layers.80.mlp.experts.169.gate_proj",
329
+ "model.layers.80.mlp.experts.169.up_proj",
330
+ "model.layers.80.mlp.experts.17.gate_proj",
331
+ "model.layers.80.mlp.experts.17.up_proj",
332
+ "model.layers.80.mlp.experts.170.gate_proj",
333
+ "model.layers.80.mlp.experts.170.up_proj",
334
+ "model.layers.80.mlp.experts.171.gate_proj",
335
+ "model.layers.80.mlp.experts.171.up_proj",
336
+ "model.layers.80.mlp.experts.172.gate_proj",
337
+ "model.layers.80.mlp.experts.172.up_proj",
338
+ "model.layers.80.mlp.experts.173.gate_proj",
339
+ "model.layers.80.mlp.experts.173.up_proj",
340
+ "model.layers.80.mlp.experts.174.gate_proj",
341
+ "model.layers.80.mlp.experts.174.up_proj",
342
+ "model.layers.80.mlp.experts.175.gate_proj",
343
+ "model.layers.80.mlp.experts.175.up_proj",
344
+ "model.layers.80.mlp.experts.176.gate_proj",
345
+ "model.layers.80.mlp.experts.176.up_proj",
346
+ "model.layers.80.mlp.experts.177.gate_proj",
347
+ "model.layers.80.mlp.experts.177.up_proj",
348
+ "model.layers.80.mlp.experts.178.gate_proj",
349
+ "model.layers.80.mlp.experts.178.up_proj",
350
+ "model.layers.80.mlp.experts.179.gate_proj",
351
+ "model.layers.80.mlp.experts.179.up_proj",
352
+ "model.layers.80.mlp.experts.18.gate_proj",
353
+ "model.layers.80.mlp.experts.18.up_proj",
354
+ "model.layers.80.mlp.experts.180.gate_proj",
355
+ "model.layers.80.mlp.experts.180.up_proj",
356
+ "model.layers.80.mlp.experts.181.gate_proj",
357
+ "model.layers.80.mlp.experts.181.up_proj",
358
+ "model.layers.80.mlp.experts.182.gate_proj",
359
+ "model.layers.80.mlp.experts.182.up_proj",
360
+ "model.layers.80.mlp.experts.183.gate_proj",
361
+ "model.layers.80.mlp.experts.183.up_proj",
362
+ "model.layers.80.mlp.experts.184.gate_proj",
363
+ "model.layers.80.mlp.experts.184.up_proj",
364
+ "model.layers.80.mlp.experts.185.gate_proj",
365
+ "model.layers.80.mlp.experts.185.up_proj",
366
+ "model.layers.80.mlp.experts.186.gate_proj",
367
+ "model.layers.80.mlp.experts.186.up_proj",
368
+ "model.layers.80.mlp.experts.187.gate_proj",
369
+ "model.layers.80.mlp.experts.187.up_proj",
370
+ "model.layers.80.mlp.experts.188.gate_proj",
371
+ "model.layers.80.mlp.experts.188.up_proj",
372
+ "model.layers.80.mlp.experts.189.gate_proj",
373
+ "model.layers.80.mlp.experts.189.up_proj",
374
+ "model.layers.80.mlp.experts.19.gate_proj",
375
+ "model.layers.80.mlp.experts.19.up_proj",
376
+ "model.layers.80.mlp.experts.190.gate_proj",
377
+ "model.layers.80.mlp.experts.190.up_proj",
378
+ "model.layers.80.mlp.experts.191.gate_proj",
379
+ "model.layers.80.mlp.experts.191.up_proj",
380
+ "model.layers.80.mlp.experts.192.gate_proj",
381
+ "model.layers.80.mlp.experts.192.up_proj",
382
+ "model.layers.80.mlp.experts.193.gate_proj",
383
+ "model.layers.80.mlp.experts.193.up_proj",
384
+ "model.layers.80.mlp.experts.194.gate_proj",
385
+ "model.layers.80.mlp.experts.194.up_proj",
386
+ "model.layers.80.mlp.experts.195.gate_proj",
387
+ "model.layers.80.mlp.experts.195.up_proj",
388
+ "model.layers.80.mlp.experts.196.gate_proj",
389
+ "model.layers.80.mlp.experts.196.up_proj",
390
+ "model.layers.80.mlp.experts.197.gate_proj",
391
+ "model.layers.80.mlp.experts.197.up_proj",
392
+ "model.layers.80.mlp.experts.198.gate_proj",
393
+ "model.layers.80.mlp.experts.198.up_proj",
394
+ "model.layers.80.mlp.experts.199.gate_proj",
395
+ "model.layers.80.mlp.experts.199.up_proj",
396
+ "model.layers.80.mlp.experts.2.gate_proj",
397
+ "model.layers.80.mlp.experts.2.up_proj",
398
+ "model.layers.80.mlp.experts.20.gate_proj",
399
+ "model.layers.80.mlp.experts.20.up_proj",
400
+ "model.layers.80.mlp.experts.200.gate_proj",
401
+ "model.layers.80.mlp.experts.200.up_proj",
402
+ "model.layers.80.mlp.experts.201.gate_proj",
403
+ "model.layers.80.mlp.experts.201.up_proj",
404
+ "model.layers.80.mlp.experts.202.gate_proj",
405
+ "model.layers.80.mlp.experts.202.up_proj",
406
+ "model.layers.80.mlp.experts.203.gate_proj",
407
+ "model.layers.80.mlp.experts.203.up_proj",
408
+ "model.layers.80.mlp.experts.204.gate_proj",
409
+ "model.layers.80.mlp.experts.204.up_proj",
410
+ "model.layers.80.mlp.experts.205.gate_proj",
411
+ "model.layers.80.mlp.experts.205.up_proj",
412
+ "model.layers.80.mlp.experts.206.gate_proj",
413
+ "model.layers.80.mlp.experts.206.up_proj",
414
+ "model.layers.80.mlp.experts.207.gate_proj",
415
+ "model.layers.80.mlp.experts.207.up_proj",
416
+ "model.layers.80.mlp.experts.208.gate_proj",
417
+ "model.layers.80.mlp.experts.208.up_proj",
418
+ "model.layers.80.mlp.experts.209.gate_proj",
419
+ "model.layers.80.mlp.experts.209.up_proj",
420
+ "model.layers.80.mlp.experts.21.gate_proj",
421
+ "model.layers.80.mlp.experts.21.up_proj",
422
+ "model.layers.80.mlp.experts.210.gate_proj",
423
+ "model.layers.80.mlp.experts.210.up_proj",
424
+ "model.layers.80.mlp.experts.211.gate_proj",
425
+ "model.layers.80.mlp.experts.211.up_proj",
426
+ "model.layers.80.mlp.experts.212.gate_proj",
427
+ "model.layers.80.mlp.experts.212.up_proj",
428
+ "model.layers.80.mlp.experts.213.gate_proj",
429
+ "model.layers.80.mlp.experts.213.up_proj",
430
+ "model.layers.80.mlp.experts.214.gate_proj",
431
+ "model.layers.80.mlp.experts.214.up_proj",
432
+ "model.layers.80.mlp.experts.215.gate_proj",
433
+ "model.layers.80.mlp.experts.215.up_proj",
434
+ "model.layers.80.mlp.experts.216.gate_proj",
435
+ "model.layers.80.mlp.experts.216.up_proj",
436
+ "model.layers.80.mlp.experts.217.gate_proj",
437
+ "model.layers.80.mlp.experts.217.up_proj",
438
+ "model.layers.80.mlp.experts.218.gate_proj",
439
+ "model.layers.80.mlp.experts.218.up_proj",
440
+ "model.layers.80.mlp.experts.219.gate_proj",
441
+ "model.layers.80.mlp.experts.219.up_proj",
442
+ "model.layers.80.mlp.experts.22.gate_proj",
443
+ "model.layers.80.mlp.experts.22.up_proj",
444
+ "model.layers.80.mlp.experts.220.gate_proj",
445
+ "model.layers.80.mlp.experts.220.up_proj",
446
+ "model.layers.80.mlp.experts.221.gate_proj",
447
+ "model.layers.80.mlp.experts.221.up_proj",
448
+ "model.layers.80.mlp.experts.222.gate_proj",
449
+ "model.layers.80.mlp.experts.222.up_proj",
450
+ "model.layers.80.mlp.experts.223.gate_proj",
451
+ "model.layers.80.mlp.experts.223.up_proj",
452
+ "model.layers.80.mlp.experts.224.gate_proj",
453
+ "model.layers.80.mlp.experts.224.up_proj",
454
+ "model.layers.80.mlp.experts.225.gate_proj",
455
+ "model.layers.80.mlp.experts.225.up_proj",
456
+ "model.layers.80.mlp.experts.226.gate_proj",
457
+ "model.layers.80.mlp.experts.226.up_proj",
458
+ "model.layers.80.mlp.experts.227.gate_proj",
459
+ "model.layers.80.mlp.experts.227.up_proj",
460
+ "model.layers.80.mlp.experts.228.gate_proj",
461
+ "model.layers.80.mlp.experts.228.up_proj",
462
+ "model.layers.80.mlp.experts.229.gate_proj",
463
+ "model.layers.80.mlp.experts.229.up_proj",
464
+ "model.layers.80.mlp.experts.23.gate_proj",
465
+ "model.layers.80.mlp.experts.23.up_proj",
466
+ "model.layers.80.mlp.experts.230.gate_proj",
467
+ "model.layers.80.mlp.experts.230.up_proj",
468
+ "model.layers.80.mlp.experts.231.gate_proj",
469
+ "model.layers.80.mlp.experts.231.up_proj",
470
+ "model.layers.80.mlp.experts.232.gate_proj",
471
+ "model.layers.80.mlp.experts.232.up_proj",
472
+ "model.layers.80.mlp.experts.233.gate_proj",
473
+ "model.layers.80.mlp.experts.233.up_proj",
474
+ "model.layers.80.mlp.experts.234.gate_proj",
475
+ "model.layers.80.mlp.experts.234.up_proj",
476
+ "model.layers.80.mlp.experts.235.gate_proj",
477
+ "model.layers.80.mlp.experts.235.up_proj",
478
+ "model.layers.80.mlp.experts.236.gate_proj",
479
+ "model.layers.80.mlp.experts.236.up_proj",
480
+ "model.layers.80.mlp.experts.237.gate_proj",
481
+ "model.layers.80.mlp.experts.237.up_proj",
482
+ "model.layers.80.mlp.experts.238.gate_proj",
483
+ "model.layers.80.mlp.experts.238.up_proj",
484
+ "model.layers.80.mlp.experts.239.gate_proj",
485
+ "model.layers.80.mlp.experts.239.up_proj",
486
+ "model.layers.80.mlp.experts.24.gate_proj",
487
+ "model.layers.80.mlp.experts.24.up_proj",
488
+ "model.layers.80.mlp.experts.240.gate_proj",
489
+ "model.layers.80.mlp.experts.240.up_proj",
490
+ "model.layers.80.mlp.experts.241.gate_proj",
491
+ "model.layers.80.mlp.experts.241.up_proj",
492
+ "model.layers.80.mlp.experts.242.gate_proj",
493
+ "model.layers.80.mlp.experts.242.up_proj",
494
+ "model.layers.80.mlp.experts.243.gate_proj",
495
+ "model.layers.80.mlp.experts.243.up_proj",
496
+ "model.layers.80.mlp.experts.244.gate_proj",
497
+ "model.layers.80.mlp.experts.244.up_proj",
498
+ "model.layers.80.mlp.experts.245.gate_proj",
499
+ "model.layers.80.mlp.experts.245.up_proj",
500
+ "model.layers.80.mlp.experts.246.gate_proj",
501
+ "model.layers.80.mlp.experts.246.up_proj",
502
+ "model.layers.80.mlp.experts.247.gate_proj",
503
+ "model.layers.80.mlp.experts.247.up_proj",
504
+ "model.layers.80.mlp.experts.248.gate_proj",
505
+ "model.layers.80.mlp.experts.248.up_proj",
506
+ "model.layers.80.mlp.experts.249.gate_proj",
507
+ "model.layers.80.mlp.experts.249.up_proj",
508
+ "model.layers.80.mlp.experts.25.gate_proj",
509
+ "model.layers.80.mlp.experts.25.up_proj",
510
+ "model.layers.80.mlp.experts.250.gate_proj",
511
+ "model.layers.80.mlp.experts.250.up_proj",
512
+ "model.layers.80.mlp.experts.251.gate_proj",
513
+ "model.layers.80.mlp.experts.251.up_proj",
514
+ "model.layers.80.mlp.experts.252.gate_proj",
515
+ "model.layers.80.mlp.experts.252.up_proj",
516
+ "model.layers.80.mlp.experts.253.gate_proj",
517
+ "model.layers.80.mlp.experts.253.up_proj",
518
+ "model.layers.80.mlp.experts.254.gate_proj",
519
+ "model.layers.80.mlp.experts.254.up_proj",
520
+ "model.layers.80.mlp.experts.255.gate_proj",
521
+ "model.layers.80.mlp.experts.255.up_proj",
522
+ "model.layers.80.mlp.experts.26.gate_proj",
523
+ "model.layers.80.mlp.experts.26.up_proj",
524
+ "model.layers.80.mlp.experts.27.gate_proj",
525
+ "model.layers.80.mlp.experts.27.up_proj",
526
+ "model.layers.80.mlp.experts.28.gate_proj",
527
+ "model.layers.80.mlp.experts.28.up_proj",
528
+ "model.layers.80.mlp.experts.29.gate_proj",
529
+ "model.layers.80.mlp.experts.29.up_proj",
530
+ "model.layers.80.mlp.experts.3.gate_proj",
531
+ "model.layers.80.mlp.experts.3.up_proj",
532
+ "model.layers.80.mlp.experts.30.gate_proj",
533
+ "model.layers.80.mlp.experts.30.up_proj",
534
+ "model.layers.80.mlp.experts.31.gate_proj",
535
+ "model.layers.80.mlp.experts.31.up_proj",
536
+ "model.layers.80.mlp.experts.32.gate_proj",
537
+ "model.layers.80.mlp.experts.32.up_proj",
538
+ "model.layers.80.mlp.experts.33.gate_proj",
539
+ "model.layers.80.mlp.experts.33.up_proj",
540
+ "model.layers.80.mlp.experts.34.gate_proj",
541
+ "model.layers.80.mlp.experts.34.up_proj",
542
+ "model.layers.80.mlp.experts.35.gate_proj",
543
+ "model.layers.80.mlp.experts.35.up_proj",
544
+ "model.layers.80.mlp.experts.36.gate_proj",
545
+ "model.layers.80.mlp.experts.36.up_proj",
546
+ "model.layers.80.mlp.experts.37.gate_proj",
547
+ "model.layers.80.mlp.experts.37.up_proj",
548
+ "model.layers.80.mlp.experts.38.gate_proj",
549
+ "model.layers.80.mlp.experts.38.up_proj",
550
+ "model.layers.80.mlp.experts.39.gate_proj",
551
+ "model.layers.80.mlp.experts.39.up_proj",
552
+ "model.layers.80.mlp.experts.4.gate_proj",
553
+ "model.layers.80.mlp.experts.4.up_proj",
554
+ "model.layers.80.mlp.experts.40.gate_proj",
555
+ "model.layers.80.mlp.experts.40.up_proj",
556
+ "model.layers.80.mlp.experts.41.gate_proj",
557
+ "model.layers.80.mlp.experts.41.up_proj",
558
+ "model.layers.80.mlp.experts.42.gate_proj",
559
+ "model.layers.80.mlp.experts.42.up_proj",
560
+ "model.layers.80.mlp.experts.43.gate_proj",
561
+ "model.layers.80.mlp.experts.43.up_proj",
562
+ "model.layers.80.mlp.experts.44.gate_proj",
563
+ "model.layers.80.mlp.experts.44.up_proj",
564
+ "model.layers.80.mlp.experts.45.gate_proj",
565
+ "model.layers.80.mlp.experts.45.up_proj",
566
+ "model.layers.80.mlp.experts.46.gate_proj",
567
+ "model.layers.80.mlp.experts.46.up_proj",
568
+ "model.layers.80.mlp.experts.47.gate_proj",
569
+ "model.layers.80.mlp.experts.47.up_proj",
570
+ "model.layers.80.mlp.experts.48.gate_proj",
571
+ "model.layers.80.mlp.experts.48.up_proj",
572
+ "model.layers.80.mlp.experts.49.gate_proj",
573
+ "model.layers.80.mlp.experts.49.up_proj",
574
+ "model.layers.80.mlp.experts.5.gate_proj",
575
+ "model.layers.80.mlp.experts.5.up_proj",
576
+ "model.layers.80.mlp.experts.50.gate_proj",
577
+ "model.layers.80.mlp.experts.50.up_proj",
578
+ "model.layers.80.mlp.experts.51.gate_proj",
579
+ "model.layers.80.mlp.experts.51.up_proj",
580
+ "model.layers.80.mlp.experts.52.gate_proj",
581
+ "model.layers.80.mlp.experts.52.up_proj",
582
+ "model.layers.80.mlp.experts.53.gate_proj",
583
+ "model.layers.80.mlp.experts.53.up_proj",
584
+ "model.layers.80.mlp.experts.54.gate_proj",
585
+ "model.layers.80.mlp.experts.54.up_proj",
586
+ "model.layers.80.mlp.experts.55.gate_proj",
587
+ "model.layers.80.mlp.experts.55.up_proj",
588
+ "model.layers.80.mlp.experts.56.gate_proj",
589
+ "model.layers.80.mlp.experts.56.up_proj",
590
+ "model.layers.80.mlp.experts.57.gate_proj",
591
+ "model.layers.80.mlp.experts.57.up_proj",
592
+ "model.layers.80.mlp.experts.58.gate_proj",
593
+ "model.layers.80.mlp.experts.58.up_proj",
594
+ "model.layers.80.mlp.experts.59.gate_proj",
595
+ "model.layers.80.mlp.experts.59.up_proj",
596
+ "model.layers.80.mlp.experts.6.gate_proj",
597
+ "model.layers.80.mlp.experts.6.up_proj",
598
+ "model.layers.80.mlp.experts.60.gate_proj",
599
+ "model.layers.80.mlp.experts.60.up_proj",
600
+ "model.layers.80.mlp.experts.61.gate_proj",
601
+ "model.layers.80.mlp.experts.61.up_proj",
602
+ "model.layers.80.mlp.experts.62.gate_proj",
603
+ "model.layers.80.mlp.experts.62.up_proj",
604
+ "model.layers.80.mlp.experts.63.gate_proj",
605
+ "model.layers.80.mlp.experts.63.up_proj",
606
+ "model.layers.80.mlp.experts.64.gate_proj",
607
+ "model.layers.80.mlp.experts.64.up_proj",
608
+ "model.layers.80.mlp.experts.65.gate_proj",
609
+ "model.layers.80.mlp.experts.65.up_proj",
610
+ "model.layers.80.mlp.experts.66.gate_proj",
611
+ "model.layers.80.mlp.experts.66.up_proj",
612
+ "model.layers.80.mlp.experts.67.gate_proj",
613
+ "model.layers.80.mlp.experts.67.up_proj",
614
+ "model.layers.80.mlp.experts.68.gate_proj",
615
+ "model.layers.80.mlp.experts.68.up_proj",
616
+ "model.layers.80.mlp.experts.69.gate_proj",
617
+ "model.layers.80.mlp.experts.69.up_proj",
618
+ "model.layers.80.mlp.experts.7.gate_proj",
619
+ "model.layers.80.mlp.experts.7.up_proj",
620
+ "model.layers.80.mlp.experts.70.gate_proj",
621
+ "model.layers.80.mlp.experts.70.up_proj",
622
+ "model.layers.80.mlp.experts.71.gate_proj",
623
+ "model.layers.80.mlp.experts.71.up_proj",
624
+ "model.layers.80.mlp.experts.72.gate_proj",
625
+ "model.layers.80.mlp.experts.72.up_proj",
626
+ "model.layers.80.mlp.experts.73.gate_proj",
627
+ "model.layers.80.mlp.experts.73.up_proj",
628
+ "model.layers.80.mlp.experts.74.gate_proj",
629
+ "model.layers.80.mlp.experts.74.up_proj",
630
+ "model.layers.80.mlp.experts.75.gate_proj",
631
+ "model.layers.80.mlp.experts.75.up_proj",
632
+ "model.layers.80.mlp.experts.76.gate_proj",
633
+ "model.layers.80.mlp.experts.76.up_proj",
634
+ "model.layers.80.mlp.experts.77.gate_proj",
635
+ "model.layers.80.mlp.experts.77.up_proj",
636
+ "model.layers.80.mlp.experts.78.gate_proj",
637
+ "model.layers.80.mlp.experts.78.up_proj",
638
+ "model.layers.80.mlp.experts.79.gate_proj",
639
+ "model.layers.80.mlp.experts.79.up_proj",
640
+ "model.layers.80.mlp.experts.8.gate_proj",
641
+ "model.layers.80.mlp.experts.8.up_proj",
642
+ "model.layers.80.mlp.experts.80.gate_proj",
643
+ "model.layers.80.mlp.experts.80.up_proj",
644
+ "model.layers.80.mlp.experts.81.gate_proj",
645
+ "model.layers.80.mlp.experts.81.up_proj",
646
+ "model.layers.80.mlp.experts.82.gate_proj",
647
+ "model.layers.80.mlp.experts.82.up_proj",
648
+ "model.layers.80.mlp.experts.83.gate_proj",
649
+ "model.layers.80.mlp.experts.83.up_proj",
650
+ "model.layers.80.mlp.experts.84.gate_proj",
651
+ "model.layers.80.mlp.experts.84.up_proj",
652
+ "model.layers.80.mlp.experts.85.gate_proj",
653
+ "model.layers.80.mlp.experts.85.up_proj",
654
+ "model.layers.80.mlp.experts.86.gate_proj",
655
+ "model.layers.80.mlp.experts.86.up_proj",
656
+ "model.layers.80.mlp.experts.87.gate_proj",
657
+ "model.layers.80.mlp.experts.87.up_proj",
658
+ "model.layers.80.mlp.experts.88.gate_proj",
659
+ "model.layers.80.mlp.experts.88.up_proj",
660
+ "model.layers.80.mlp.experts.89.gate_proj",
661
+ "model.layers.80.mlp.experts.89.up_proj",
662
+ "model.layers.80.mlp.experts.9.gate_proj",
663
+ "model.layers.80.mlp.experts.9.up_proj",
664
+ "model.layers.80.mlp.experts.90.gate_proj",
665
+ "model.layers.80.mlp.experts.90.up_proj",
666
+ "model.layers.80.mlp.experts.91.gate_proj",
667
+ "model.layers.80.mlp.experts.91.up_proj",
668
+ "model.layers.80.mlp.experts.92.gate_proj",
669
+ "model.layers.80.mlp.experts.92.up_proj",
670
+ "model.layers.80.mlp.experts.93.gate_proj",
671
+ "model.layers.80.mlp.experts.93.up_proj",
672
+ "model.layers.80.mlp.experts.94.gate_proj",
673
+ "model.layers.80.mlp.experts.94.up_proj",
674
+ "model.layers.80.mlp.experts.95.gate_proj",
675
+ "model.layers.80.mlp.experts.95.up_proj",
676
+ "model.layers.80.mlp.experts.96.gate_proj",
677
+ "model.layers.80.mlp.experts.96.up_proj",
678
+ "model.layers.80.mlp.experts.97.gate_proj",
679
+ "model.layers.80.mlp.experts.97.up_proj",
680
+ "model.layers.80.mlp.experts.98.gate_proj",
681
+ "model.layers.80.mlp.experts.98.up_proj",
682
+ "model.layers.80.mlp.experts.99.gate_proj",
683
+ "model.layers.80.mlp.experts.99.up_proj",
684
+ "model.layers.80.mlp.experts.0.down_proj",
685
+ "model.layers.80.mlp.experts.1.down_proj",
686
+ "model.layers.80.mlp.experts.10.down_proj",
687
+ "model.layers.80.mlp.experts.100.down_proj",
688
+ "model.layers.80.mlp.experts.101.down_proj",
689
+ "model.layers.80.mlp.experts.102.down_proj",
690
+ "model.layers.80.mlp.experts.103.down_proj",
691
+ "model.layers.80.mlp.experts.104.down_proj",
692
+ "model.layers.80.mlp.experts.105.down_proj",
693
+ "model.layers.80.mlp.experts.106.down_proj",
694
+ "model.layers.80.mlp.experts.107.down_proj",
695
+ "model.layers.80.mlp.experts.108.down_proj",
696
+ "model.layers.80.mlp.experts.109.down_proj",
697
+ "model.layers.80.mlp.experts.11.down_proj",
698
+ "model.layers.80.mlp.experts.110.down_proj",
699
+ "model.layers.80.mlp.experts.111.down_proj",
700
+ "model.layers.80.mlp.experts.112.down_proj",
701
+ "model.layers.80.mlp.experts.113.down_proj",
702
+ "model.layers.80.mlp.experts.114.down_proj",
703
+ "model.layers.80.mlp.experts.115.down_proj",
704
+ "model.layers.80.mlp.experts.116.down_proj",
705
+ "model.layers.80.mlp.experts.117.down_proj",
706
+ "model.layers.80.mlp.experts.118.down_proj",
707
+ "model.layers.80.mlp.experts.119.down_proj",
708
+ "model.layers.80.mlp.experts.12.down_proj",
709
+ "model.layers.80.mlp.experts.120.down_proj",
710
+ "model.layers.80.mlp.experts.121.down_proj",
711
+ "model.layers.80.mlp.experts.122.down_proj",
712
+ "model.layers.80.mlp.experts.123.down_proj",
713
+ "model.layers.80.mlp.experts.124.down_proj",
714
+ "model.layers.80.mlp.experts.125.down_proj",
715
+ "model.layers.80.mlp.experts.126.down_proj",
716
+ "model.layers.80.mlp.experts.127.down_proj",
717
+ "model.layers.80.mlp.experts.128.down_proj",
718
+ "model.layers.80.mlp.experts.129.down_proj",
719
+ "model.layers.80.mlp.experts.13.down_proj",
720
+ "model.layers.80.mlp.experts.130.down_proj",
721
+ "model.layers.80.mlp.experts.131.down_proj",
722
+ "model.layers.80.mlp.experts.132.down_proj",
723
+ "model.layers.80.mlp.experts.133.down_proj",
724
+ "model.layers.80.mlp.experts.134.down_proj",
725
+ "model.layers.80.mlp.experts.135.down_proj",
726
+ "model.layers.80.mlp.experts.136.down_proj",
727
+ "model.layers.80.mlp.experts.137.down_proj",
728
+ "model.layers.80.mlp.experts.138.down_proj",
729
+ "model.layers.80.mlp.experts.139.down_proj",
730
+ "model.layers.80.mlp.experts.14.down_proj",
731
+ "model.layers.80.mlp.experts.140.down_proj",
732
+ "model.layers.80.mlp.experts.141.down_proj",
733
+ "model.layers.80.mlp.experts.142.down_proj",
734
+ "model.layers.80.mlp.experts.143.down_proj",
735
+ "model.layers.80.mlp.experts.144.down_proj",
736
+ "model.layers.80.mlp.experts.145.down_proj",
737
+ "model.layers.80.mlp.experts.146.down_proj",
738
+ "model.layers.80.mlp.experts.147.down_proj",
739
+ "model.layers.80.mlp.experts.148.down_proj",
740
+ "model.layers.80.mlp.experts.149.down_proj",
741
+ "model.layers.80.mlp.experts.15.down_proj",
742
+ "model.layers.80.mlp.experts.150.down_proj",
743
+ "model.layers.80.mlp.experts.151.down_proj",
744
+ "model.layers.80.mlp.experts.152.down_proj",
745
+ "model.layers.80.mlp.experts.153.down_proj",
746
+ "model.layers.80.mlp.experts.154.down_proj",
747
+ "model.layers.80.mlp.experts.155.down_proj",
748
+ "model.layers.80.mlp.experts.156.down_proj",
749
+ "model.layers.80.mlp.experts.157.down_proj",
750
+ "model.layers.80.mlp.experts.158.down_proj",
751
+ "model.layers.80.mlp.experts.159.down_proj",
752
+ "model.layers.80.mlp.experts.16.down_proj",
753
+ "model.layers.80.mlp.experts.160.down_proj",
754
+ "model.layers.80.mlp.experts.161.down_proj",
755
+ "model.layers.80.mlp.experts.162.down_proj",
756
+ "model.layers.80.mlp.experts.163.down_proj",
757
+ "model.layers.80.mlp.experts.164.down_proj",
758
+ "model.layers.80.mlp.experts.165.down_proj",
759
+ "model.layers.80.mlp.experts.166.down_proj",
760
+ "model.layers.80.mlp.experts.167.down_proj",
761
+ "model.layers.80.mlp.experts.168.down_proj",
762
+ "model.layers.80.mlp.experts.169.down_proj",
763
+ "model.layers.80.mlp.experts.17.down_proj",
764
+ "model.layers.80.mlp.experts.170.down_proj",
765
+ "model.layers.80.mlp.experts.171.down_proj",
766
+ "model.layers.80.mlp.experts.172.down_proj",
767
+ "model.layers.80.mlp.experts.173.down_proj",
768
+ "model.layers.80.mlp.experts.174.down_proj",
769
+ "model.layers.80.mlp.experts.175.down_proj",
770
+ "model.layers.80.mlp.experts.176.down_proj",
771
+ "model.layers.80.mlp.experts.177.down_proj",
772
+ "model.layers.80.mlp.experts.178.down_proj",
773
+ "model.layers.80.mlp.experts.179.down_proj",
774
+ "model.layers.80.mlp.experts.18.down_proj",
775
+ "model.layers.80.mlp.experts.180.down_proj",
776
+ "model.layers.80.mlp.experts.181.down_proj",
777
+ "model.layers.80.mlp.experts.182.down_proj",
778
+ "model.layers.80.mlp.experts.183.down_proj",
779
+ "model.layers.80.mlp.experts.184.down_proj",
780
+ "model.layers.80.mlp.experts.185.down_proj",
781
+ "model.layers.80.mlp.experts.186.down_proj",
782
+ "model.layers.80.mlp.experts.187.down_proj",
783
+ "model.layers.80.mlp.experts.188.down_proj",
784
+ "model.layers.80.mlp.experts.189.down_proj",
785
+ "model.layers.80.mlp.experts.19.down_proj",
786
+ "model.layers.80.mlp.experts.190.down_proj",
787
+ "model.layers.80.mlp.experts.191.down_proj",
788
+ "model.layers.80.mlp.experts.192.down_proj",
789
+ "model.layers.80.mlp.experts.193.down_proj",
790
+ "model.layers.80.mlp.experts.194.down_proj",
791
+ "model.layers.80.mlp.experts.195.down_proj",
792
+ "model.layers.80.mlp.experts.196.down_proj",
793
+ "model.layers.80.mlp.experts.197.down_proj",
794
+ "model.layers.80.mlp.experts.198.down_proj",
795
+ "model.layers.80.mlp.experts.199.down_proj",
796
+ "model.layers.80.mlp.experts.2.down_proj",
797
+ "model.layers.80.mlp.experts.20.down_proj",
798
+ "model.layers.80.mlp.experts.200.down_proj",
799
+ "model.layers.80.mlp.experts.201.down_proj",
800
+ "model.layers.80.mlp.experts.202.down_proj",
801
+ "model.layers.80.mlp.experts.203.down_proj",
802
+ "model.layers.80.mlp.experts.204.down_proj",
803
+ "model.layers.80.mlp.experts.205.down_proj",
804
+ "model.layers.80.mlp.experts.206.down_proj",
805
+ "model.layers.80.mlp.experts.207.down_proj",
806
+ "model.layers.80.mlp.experts.208.down_proj",
807
+ "model.layers.80.mlp.experts.209.down_proj",
808
+ "model.layers.80.mlp.experts.21.down_proj",
809
+ "model.layers.80.mlp.experts.210.down_proj",
810
+ "model.layers.80.mlp.experts.211.down_proj",
811
+ "model.layers.80.mlp.experts.212.down_proj",
812
+ "model.layers.80.mlp.experts.213.down_proj",
813
+ "model.layers.80.mlp.experts.214.down_proj",
814
+ "model.layers.80.mlp.experts.215.down_proj",
815
+ "model.layers.80.mlp.experts.216.down_proj",
816
+ "model.layers.80.mlp.experts.217.down_proj",
817
+ "model.layers.80.mlp.experts.218.down_proj",
818
+ "model.layers.80.mlp.experts.219.down_proj",
819
+ "model.layers.80.mlp.experts.22.down_proj",
820
+ "model.layers.80.mlp.experts.220.down_proj",
821
+ "model.layers.80.mlp.experts.221.down_proj",
822
+ "model.layers.80.mlp.experts.222.down_proj",
823
+ "model.layers.80.mlp.experts.223.down_proj",
824
+ "model.layers.80.mlp.experts.224.down_proj",
825
+ "model.layers.80.mlp.experts.225.down_proj",
826
+ "model.layers.80.mlp.experts.226.down_proj",
827
+ "model.layers.80.mlp.experts.227.down_proj",
828
+ "model.layers.80.mlp.experts.228.down_proj",
829
+ "model.layers.80.mlp.experts.229.down_proj",
830
+ "model.layers.80.mlp.experts.23.down_proj",
831
+ "model.layers.80.mlp.experts.230.down_proj",
832
+ "model.layers.80.mlp.experts.231.down_proj",
833
+ "model.layers.80.mlp.experts.232.down_proj",
834
+ "model.layers.80.mlp.experts.233.down_proj",
835
+ "model.layers.80.mlp.experts.234.down_proj",
836
+ "model.layers.80.mlp.experts.235.down_proj",
837
+ "model.layers.80.mlp.experts.236.down_proj",
838
+ "model.layers.80.mlp.experts.237.down_proj",
839
+ "model.layers.80.mlp.experts.238.down_proj",
840
+ "model.layers.80.mlp.experts.239.down_proj",
841
+ "model.layers.80.mlp.experts.24.down_proj",
842
+ "model.layers.80.mlp.experts.240.down_proj",
843
+ "model.layers.80.mlp.experts.241.down_proj",
844
+ "model.layers.80.mlp.experts.242.down_proj",
845
+ "model.layers.80.mlp.experts.243.down_proj",
846
+ "model.layers.80.mlp.experts.244.down_proj",
847
+ "model.layers.80.mlp.experts.245.down_proj",
848
+ "model.layers.80.mlp.experts.246.down_proj",
849
+ "model.layers.80.mlp.experts.247.down_proj",
850
+ "model.layers.80.mlp.experts.248.down_proj",
851
+ "model.layers.80.mlp.experts.249.down_proj",
852
+ "model.layers.80.mlp.experts.25.down_proj",
853
+ "model.layers.80.mlp.experts.250.down_proj",
854
+ "model.layers.80.mlp.experts.251.down_proj",
855
+ "model.layers.80.mlp.experts.252.down_proj",
856
+ "model.layers.80.mlp.experts.253.down_proj",
857
+ "model.layers.80.mlp.experts.254.down_proj",
858
+ "model.layers.80.mlp.experts.255.down_proj",
859
+ "model.layers.80.mlp.experts.26.down_proj",
860
+ "model.layers.80.mlp.experts.27.down_proj",
861
+ "model.layers.80.mlp.experts.28.down_proj",
862
+ "model.layers.80.mlp.experts.29.down_proj",
863
+ "model.layers.80.mlp.experts.3.down_proj",
864
+ "model.layers.80.mlp.experts.30.down_proj",
865
+ "model.layers.80.mlp.experts.31.down_proj",
866
+ "model.layers.80.mlp.experts.32.down_proj",
867
+ "model.layers.80.mlp.experts.33.down_proj",
868
+ "model.layers.80.mlp.experts.34.down_proj",
869
+ "model.layers.80.mlp.experts.35.down_proj",
870
+ "model.layers.80.mlp.experts.36.down_proj",
871
+ "model.layers.80.mlp.experts.37.down_proj",
872
+ "model.layers.80.mlp.experts.38.down_proj",
873
+ "model.layers.80.mlp.experts.39.down_proj",
874
+ "model.layers.80.mlp.experts.4.down_proj",
875
+ "model.layers.80.mlp.experts.40.down_proj",
876
+ "model.layers.80.mlp.experts.41.down_proj",
877
+ "model.layers.80.mlp.experts.42.down_proj",
878
+ "model.layers.80.mlp.experts.43.down_proj",
879
+ "model.layers.80.mlp.experts.44.down_proj",
880
+ "model.layers.80.mlp.experts.45.down_proj",
881
+ "model.layers.80.mlp.experts.46.down_proj",
882
+ "model.layers.80.mlp.experts.47.down_proj",
883
+ "model.layers.80.mlp.experts.48.down_proj",
884
+ "model.layers.80.mlp.experts.49.down_proj",
885
+ "model.layers.80.mlp.experts.5.down_proj",
886
+ "model.layers.80.mlp.experts.50.down_proj",
887
+ "model.layers.80.mlp.experts.51.down_proj",
888
+ "model.layers.80.mlp.experts.52.down_proj",
889
+ "model.layers.80.mlp.experts.53.down_proj",
890
+ "model.layers.80.mlp.experts.54.down_proj",
891
+ "model.layers.80.mlp.experts.55.down_proj",
892
+ "model.layers.80.mlp.experts.56.down_proj",
893
+ "model.layers.80.mlp.experts.57.down_proj",
894
+ "model.layers.80.mlp.experts.58.down_proj",
895
+ "model.layers.80.mlp.experts.59.down_proj",
896
+ "model.layers.80.mlp.experts.6.down_proj",
897
+ "model.layers.80.mlp.experts.60.down_proj",
898
+ "model.layers.80.mlp.experts.61.down_proj",
899
+ "model.layers.80.mlp.experts.62.down_proj",
900
+ "model.layers.80.mlp.experts.63.down_proj",
901
+ "model.layers.80.mlp.experts.64.down_proj",
902
+ "model.layers.80.mlp.experts.65.down_proj",
903
+ "model.layers.80.mlp.experts.66.down_proj",
904
+ "model.layers.80.mlp.experts.67.down_proj",
905
+ "model.layers.80.mlp.experts.68.down_proj",
906
+ "model.layers.80.mlp.experts.69.down_proj",
907
+ "model.layers.80.mlp.experts.7.down_proj",
908
+ "model.layers.80.mlp.experts.70.down_proj",
909
+ "model.layers.80.mlp.experts.71.down_proj",
910
+ "model.layers.80.mlp.experts.72.down_proj",
911
+ "model.layers.80.mlp.experts.73.down_proj",
912
+ "model.layers.80.mlp.experts.74.down_proj",
913
+ "model.layers.80.mlp.experts.75.down_proj",
914
+ "model.layers.80.mlp.experts.76.down_proj",
915
+ "model.layers.80.mlp.experts.77.down_proj",
916
+ "model.layers.80.mlp.experts.78.down_proj",
917
+ "model.layers.80.mlp.experts.79.down_proj",
918
+ "model.layers.80.mlp.experts.8.down_proj",
919
+ "model.layers.80.mlp.experts.80.down_proj",
920
+ "model.layers.80.mlp.experts.81.down_proj",
921
+ "model.layers.80.mlp.experts.82.down_proj",
922
+ "model.layers.80.mlp.experts.83.down_proj",
923
+ "model.layers.80.mlp.experts.84.down_proj",
924
+ "model.layers.80.mlp.experts.85.down_proj",
925
+ "model.layers.80.mlp.experts.86.down_proj",
926
+ "model.layers.80.mlp.experts.87.down_proj",
927
+ "model.layers.80.mlp.experts.88.down_proj",
928
+ "model.layers.80.mlp.experts.89.down_proj",
929
+ "model.layers.80.mlp.experts.9.down_proj",
930
+ "model.layers.80.mlp.experts.90.down_proj",
931
+ "model.layers.80.mlp.experts.91.down_proj",
932
+ "model.layers.80.mlp.experts.92.down_proj",
933
+ "model.layers.80.mlp.experts.93.down_proj",
934
+ "model.layers.80.mlp.experts.94.down_proj",
935
+ "model.layers.80.mlp.experts.95.down_proj",
936
+ "model.layers.80.mlp.experts.96.down_proj",
937
+ "model.layers.80.mlp.experts.97.down_proj",
938
+ "model.layers.80.mlp.experts.98.down_proj",
939
+ "model.layers.80.mlp.experts.99.down_proj"
940
+ ],
941
+ "kv_cache_scheme": null,
942
+ "quant_method": "compressed-tensors",
943
+ "quantization_status": "compressed",
944
+ "sparsity_config": {},
945
+ "transform_config": {},
946
+ "version": "0.13.0"
947
+ },
948
+ "rms_norm_eps": 1e-06,
949
+ "rope_interleave": true,
950
+ "rope_scaling": null,
951
+ "rope_theta": 6000000,
952
+ "rotary_dim": 64,
953
+ "routed_scaling_factor": 2.5,
954
+ "router_dtype": "fp32",
955
+ "score_function": "sigmoid",
956
+ "scoring_func": "sigmoid",
957
+ "seq_aux": true,
958
+ "tie_word_embeddings": false,
959
+ "topk_group": 4,
960
+ "topk_method": "noaux_tc",
961
+ "torch_dtype": "bfloat16",
962
+ "transformers_version": "4.45.0",
963
+ "use_bias": false,
964
+ "use_cache": true,
965
+ "use_qk_norm": true,
966
+ "use_qkv_bias": false,
967
+ "v_head_dim": 128,
968
+ "vocab_size": 157184
969
+ }
configuration_bailing_moe_v2_5.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Bailing MoE V2 model configuration"""
2
+
3
+ from transformers.configuration_utils import PretrainedConfig
4
+
5
+
6
+ class BailingMoeV2_5Config(PretrainedConfig):
7
+
8
+ def __init__(
9
+ self,
10
+ vocab_size=157184,
11
+ hidden_size=2048,
12
+ intermediate_size=5120,
13
+ num_hidden_layers=20,
14
+ num_attention_heads=16,
15
+ num_key_value_heads=4,
16
+ hidden_act="silu",
17
+ use_qkv_bias=False, # bailing only
18
+ use_bias=False, # bailing only
19
+ rms_norm_eps=1e-06,
20
+ tie_word_embeddings=False, # PretrainedConfig key, here change default value.
21
+ embedding_dropout=0.0,
22
+ attention_dropout=0.0,
23
+ output_dropout=0.0,
24
+ initializer_range=0.02,
25
+ max_position_embeddings=32768,
26
+ rope_theta=600000.0,
27
+ use_cache=True,
28
+ max_window_layers=20,
29
+ rope_scaling=None,
30
+ pad_token_id=156892,
31
+ eos_token_id=156892,
32
+ num_experts=256,
33
+ num_shared_experts=1,
34
+ num_experts_per_tok=8,
35
+ n_group=8,
36
+ topk_group=4,
37
+ moe_intermediate_size=512,
38
+ first_k_dense_replace=1,
39
+ head_dim=128,
40
+ output_router_logits=False,
41
+ use_qk_norm=True,
42
+ num_nextn_predict_layers=0,
43
+ mtp_loss_scaling_factor=0,
44
+ moe_router_enable_expert_bias=True,
45
+ routed_scaling_factor=1.0,
46
+ layer_group_size=5,
47
+ group_norm_size=4,
48
+ linear_silu=False,
49
+ kv_lora_rank=512,
50
+ q_lora_rank=None,
51
+ qk_rope_head_dim=64,
52
+ v_head_dim=128,
53
+ qk_nope_head_dim=128,
54
+ rope_interleave=True,
55
+ partial_rotary_factor=0.5,
56
+ score_function="sigmoid",
57
+ scoring_func="sigmoid",
58
+ seq_aux=True,
59
+ topk_method="noaux_tc",
60
+ router_dtype="fp32",
61
+ **kwargs,
62
+ ):
63
+ self.num_hidden_layers = num_hidden_layers
64
+ self.vocab_size = vocab_size
65
+ self.hidden_size = hidden_size
66
+ self.intermediate_size = intermediate_size
67
+ self.num_attention_heads = num_attention_heads
68
+ self.num_key_value_heads = num_key_value_heads
69
+ self.hidden_act = hidden_act
70
+ self.use_qkv_bias = use_qkv_bias
71
+ self.use_bias = use_bias
72
+ self.rms_norm_eps = rms_norm_eps
73
+ self.embedding_dropout = embedding_dropout
74
+ self.attention_dropout = attention_dropout
75
+ self.output_dropout = output_dropout
76
+ self.num_nextn_predict_layers = num_nextn_predict_layers
77
+ self.mtp_loss_scaling_factor = mtp_loss_scaling_factor
78
+ self.initializer_range = initializer_range
79
+ self.max_position_embeddings = max_position_embeddings
80
+ self.rope_theta = rope_theta
81
+ self.use_cache = use_cache
82
+ self.max_window_layers = max_window_layers
83
+ self.head_dim = head_dim or self.hidden_size // self.num_attention_heads
84
+ self.rope_scaling = rope_scaling
85
+ self.use_qk_norm = use_qk_norm
86
+ self.moe_router_enable_expert_bias = moe_router_enable_expert_bias
87
+ self.routed_scaling_factor = routed_scaling_factor
88
+
89
+ # MoE configs
90
+ self.num_experts = num_experts
91
+ self.num_shared_experts = num_shared_experts
92
+ self.num_experts_per_tok = num_experts_per_tok
93
+ self.n_group = n_group
94
+ self.topk_group = topk_group
95
+ self.moe_intermediate_size = moe_intermediate_size
96
+ self.first_k_dense_replace = first_k_dense_replace
97
+ self.output_router_logits = output_router_logits
98
+
99
+ # Linear configs
100
+ self.layer_group_size = layer_group_size
101
+ self.group_norm_size = group_norm_size
102
+ self.linear_silu = linear_silu
103
+ # mla
104
+ self.kv_lora_rank = kv_lora_rank
105
+ self.q_lora_rank = q_lora_rank
106
+ self.qk_rope_head_dim = qk_rope_head_dim
107
+
108
+ self.score_function = score_function
109
+ self.scoring_func = scoring_func
110
+ self.seq_aux = seq_aux
111
+ self.topk_method = topk_method
112
+ self.v_head_dim = v_head_dim
113
+ self.qk_nope_head_dim = qk_nope_head_dim
114
+ self.qk_head_dim = qk_nope_head_dim + qk_rope_head_dim
115
+ self.rope_interleave = rope_interleave
116
+ self.router_dtype = router_dtype
117
+ self.partial_rotary_factor = partial_rotary_factor
118
+ super().__init__(
119
+ pad_token_id=pad_token_id, eos_token_id=eos_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs
120
+ )
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 156891,
3
+ "eos_token_id": [
4
+ 156892,
5
+ 156895
6
+ ],
7
+ "pad_token_id": 156892
8
+ }
model-00002-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b2ffce56b4932ce40dc737beee9e98d3a161aad1fe6473115eaa2649605d425
3
+ size 3222845688
model-00008-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2830ef5edf3ee2a7db5fc2ed22856f459cc67df48b157252ff74fad30036c05
3
+ size 7782723480
model-00010-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:215e30ea70c2b844f93a5af5c4cc663bdbe038e757265296a5554d635ea826f5
3
+ size 6445691768
model-00011-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e91ab778b8affba76e0f05e666437ea672ab0e1d486a27abc2ea282d25092d5
3
+ size 6445692440
model-00031-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b847374df40c91618afce515e62ac00daf6e8a58bd8eae353f49593f5b6168ce
3
+ size 6445693304
model-00035-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0495e0d4bbe6bc5f3ab8498e9f87d0a94585b81fabcba798900971038c0a4177
3
+ size 6445693208
model-00038-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a91ab29212f4dd9592bbc303ef39db95c2782e679753f2d89d1747c3c0fac0d2
3
+ size 6445693304
model-00041-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5427efe5cb233ed79d90f8b02368f1b496c4f0e3e94db12b5a28bf1772541ce
3
+ size 6445692536
model-00049-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd34f90319e3e78778e1b1501bd2718e220de976d5ba13060324edf3e70911a5
3
+ size 6445692536
model-00052-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:828ad56652e2093a52010fa48fc4b417f04c5966ba67a2da844bb5b90bbf8a5e
3
+ size 6445693304
model-00053-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61e8dd2ad107480f1b2631dde53262efeff3b6022cd3e77d22fabba926c26edf
3
+ size 6445693304
model-00054-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:487932721b53a2e1973f10cbc9733b20d27bcb197b74aea4fd5c298e8d8f9e60
3
+ size 6445693304
model-00058-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1e2703c47d324b45345a2bbc73510725b90d105eff227cf87584baf87701135
3
+ size 6445692536
model-00059-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6a206558d4d0e001122fb7afdf7c65b6a5ff6d38c278bea5e5d7ca5d6498e1c
3
+ size 6445693208
model-00063-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61ef06edf80e9c9711c62320df8f65cbde724d7f8270966cda87106d9b5b644c
3
+ size 6445693304
model-00066-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58dbafc22471f78b01b77879617dc2fa3e8ef289bb311a2432d8b1ff57415b95
3
+ size 6445692536
model-00067-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4d45b1a782b9f9a733f40eb49c0cc70347114044b102452da96bb2cbdf4d6a7
3
+ size 6445693208
model-00068-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:280ee6aef627361feeb7fc59b4647a9539bbd380befcdd69f93c7531c936f22c
3
+ size 6445693304
model-00072-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b375185c4854b03e00d9fdac12cba5988502d3c6973fc43a91f7ade2a17adfd3
3
+ size 7782724328
model-00073-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c59ea9af24107391ffa0d87a7589aa46e759223c511eedeae1a4c0a0b4dc7488
3
+ size 6445692536
model-00074-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78a8668d2fc5ef23acc3bd277a5f47ee8f86afd36b6c428a276c246e4cc734f0
3
+ size 6445692536
model-00076-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5644a685d831fe81c3c9a77f32a494a7610f2719baad3ad7c3f214c1538843a1
3
+ size 6445693304
model-00077-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5104f6eb26236b0bbcdf32e204d815a73e7329b433bc2f1b74c0867510cddeb
3
+ size 6445693304
model-00079-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cb721b4dea9c1fe40a38ce4add7ad77d5f119271a2e34c53e5772057505d98c
3
+ size 6445693304
model-00090-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3041338bb7cfb25352794eb27da485716269f67cc9293f43760567255dbceab6
3
+ size 6445692536
model-00091-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ec0ebcccf2008e1def7c8f7e6b6e98ecba68eb3d49d362f4819e577c33bf591
3
+ size 6445693208
model-00092-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c13937865b3954c144f92266025002a162f928f39e490ace4c479c1383e06c5
3
+ size 6445693304
model-00093-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb169a0f7000ddc085835a5d4cf3e381138324e6375da72f65ff1e5f4da529f5
3
+ size 6445693304
model-00095-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f61c7498cedaa97f620d9732ffd818b34fbdf7bf840deabfb25750cba6c775c
3
+ size 6445693304
model-00096-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee89732f6705c0b2402a6363bc34c427b46115effe204e38f6e4a504398b5e2a
3
+ size 8006611688
model-00097-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99bbc6bc509b11c33f6d158166dc5f13d1bc4e1992de1057b9a1edf5bb215018
3
+ size 6445692536
model-00099-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03c6966c9ad0933c51074eeb31a05ec5e417d59d6b24ea9c4f950b38789d386c
3
+ size 6445693208
model-00121-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37a441c7dc3d3ef95b73525edd957998c51ef9c911d76dfdb27cb983a87f935b
3
+ size 6445692536
model-00126-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdb782548129c92a107813f8222a8b1400a61614311570a532fcb4a4e21631b2
3
+ size 6445693304
model-00127-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ae7a90d157854543aec505c8ca96b406cc5c72dcd482fd1bfd80a22f4568a29
3
+ size 6445693304
model-00129-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a386b85707d36288c90a13fb91a659e423b25f99e41ff5e84d1ad228951a9c81
3
+ size 6445692536
model-00130-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:76cd4536f38f58da9dab657c607e443bb9283cebd982ec5d8f908e55627fbc71
3
+ size 6445692536
model-00137-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e12887d1f40918797418251835a8bf48441d417f4a98ab56890a568dcdbfb5e9
3
+ size 6445692536
model-00139-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed7d75cff96a2b0e9c326fd82643357c6506752c5533e7b942fa35cd300312a2
3
+ size 6445693208
model-00140-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e584fdfea6f7dbf941460d2e21e113b2a9a58ca2fb47e120b4a60940f87ca231
3
+ size 6445693304
model-00142-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3060233f4f4cb5b727d00ae7a5c68dd2863e226d621158c6679f30bc9d11c073
3
+ size 6445693304
model-00143-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0662c93efed7b927ae21db8a4a9259761a1c15972926aef2efe53a8d1034010
3
+ size 6445693304
model-00145-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93a8bbd860f40a663c6214bd066cb240597563e097cbdaadfb9a4ba9964aef2d
3
+ size 6445692536
model-00146-of-00160.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9ef66002e5a4fd9a6d2beb1927e4734c0cc8862b5f22bec5bbfc52cbaaaf6d9
3
+ size 6445692536
modeling_bailing_moe_v2_5.py ADDED
@@ -0,0 +1,1603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2025 Antgroup and The HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
5
+ # and OPT implementations in this library. It has been modified from its
6
+ # original forms to accommodate minor architectural differences compared
7
+ # to GPT-NeoX and OPT used by the Meta AI team that trained the model.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ """PyTorch BailingMoE model."""
21
+
22
+ import math
23
+ import warnings
24
+ from typing import List, Optional, Tuple, Union, Callable
25
+
26
+ import torch
27
+ import torch.nn.functional as F
28
+ from torch import nn
29
+
30
+ from transformers.activations import ACT2FN
31
+ from transformers.cache_utils import Cache, DynamicCache
32
+ from transformers.modeling_attn_mask_utils import (
33
+ AttentionMaskConverter,
34
+ _prepare_4d_attention_mask,
35
+ _prepare_4d_causal_attention_mask,
36
+ _prepare_4d_causal_attention_mask_for_sdpa,
37
+ )
38
+ from transformers.modeling_outputs import MoeModelOutputWithPast
39
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
40
+ from transformers.modeling_utils import PreTrainedModel
41
+ from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS, is_torch_greater_or_equal_than_1_13
42
+ from transformers.utils import (
43
+ add_start_docstrings,
44
+ add_start_docstrings_to_model_forward,
45
+ logging,
46
+ replace_return_docstrings,
47
+ )
48
+ from transformers.utils.import_utils import is_torch_fx_available
49
+ from .configuration_bailing_moe_v2_5 import BailingMoeV2_5Config
50
+ from transformers.generation.utils import GenerationMixin
51
+ from dataclasses import dataclass
52
+ from transformers.utils import ModelOutput
53
+ from transformers import DynamicLayer
54
+ from transformers.processing_utils import Unpack
55
+ from transformers.utils import TransformersKwargs
56
+ from transformers.utils.deprecation import deprecate_kwarg
57
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
58
+
59
+ from fla.ops.simple_gla.fused_recurrent import fused_recurrent_simple_gla
60
+ from fla.ops.simple_gla.chunk import chunk_simple_gla
61
+
62
+
63
+ # This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
64
+ # It means that the function will not be traced through and simply appear as a node in the graph.
65
+ if is_torch_fx_available():
66
+ if not is_torch_greater_or_equal_than_1_13:
67
+ import torch.fx
68
+
69
+ _prepare_4d_causal_attention_mask = torch.fx.wrap(_prepare_4d_causal_attention_mask)
70
+
71
+
72
+ logger = logging.get_logger(__name__)
73
+
74
+ _CONFIG_FOR_DOC = "BailingMoeV2_5Config"
75
+
76
+
77
+ def roll_tensor(tensor, shifts=-1, dims=-1, fill_value=0):
78
+ """Roll the tensor input along the given dimension(s).
79
+ Inserted elements are set to be 0.0.
80
+ """
81
+ rolled_tensor = torch.roll(tensor, shifts=shifts, dims=dims)
82
+ rolled_tensor.select(dims, shifts).fill_(fill_value)
83
+ return rolled_tensor, rolled_tensor.sum()
84
+
85
+
86
+ @dataclass
87
+ class MoEV2_5CausalLMOutputWithPast(ModelOutput):
88
+ """
89
+ Base class for causal language model (or autoregressive) outputs as well as Mixture of Expert's router hidden
90
+ states terms, to train a MoE model.
91
+ Args:
92
+ loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
93
+ Language modeling loss (for next-token prediction).
94
+ logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
95
+ Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
96
+ past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
97
+ It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).
98
+ Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
99
+ `past_key_values` input) to speed up sequential decoding.
100
+ hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
101
+ Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
102
+ one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
103
+ Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
104
+ attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
105
+ Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
106
+ sequence_length)`.
107
+ Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
108
+ heads.
109
+ z_loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided):
110
+ z_loss for the sparse modules.
111
+ aux_loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided):
112
+ aux_loss for the sparse modules.
113
+ router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_logits=True` is passed or when `config.add_router_probs=True`):
114
+ Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`.
115
+ Router logits of the encoder model, useful to compute the auxiliary loss and the z_loss for the sparse
116
+ modules.
117
+ """
118
+
119
+ loss: Optional[torch.FloatTensor] = None
120
+ logits: Optional[torch.FloatTensor] = None
121
+ past_key_values: Optional[Cache] = None
122
+ hidden_states: Optional[tuple[torch.FloatTensor, ...]] = None
123
+ attentions: Optional[tuple[torch.FloatTensor, ...]] = None
124
+ z_loss: Optional[torch.FloatTensor] = None
125
+ aux_loss: Optional[torch.FloatTensor] = None
126
+ router_logits: Optional[tuple[torch.FloatTensor]] = None
127
+ mtp_loss: Optional[torch.FloatTensor] = None
128
+ mtp_logits: Optional[tuple[torch.FloatTensor, ...]] = None
129
+
130
+
131
+ class MoeV2_5ModelOutputWithPast(MoeModelOutputWithPast):
132
+
133
+ def __init__(self, mtp_hidden_states=None, **kwargs):
134
+ super().__init__(**kwargs)
135
+ self.mtp_hidden_states = mtp_hidden_states
136
+
137
+
138
+ def _get_unpad_data(attention_mask):
139
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
140
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
141
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
142
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
143
+ return (
144
+ indices,
145
+ cu_seqlens,
146
+ max_seqlen_in_batch,
147
+ )
148
+
149
+
150
+ def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
151
+ warnings.warn(
152
+ "Calling `transformers.models.BailingMoeV2_5.modeling_BailingMoeV2_5._prepare_4d_attention_mask` is deprecated and will be removed in v4.37. Use `transformers.modeling_attn_mask_utils._prepare_4d_attention_mask"
153
+ )
154
+ return _prepare_4d_attention_mask(mask=mask, dtype=dtype, tgt_len=tgt_len)
155
+
156
+
157
+ def _make_causal_mask(
158
+ input_ids_shape: torch.Size, dtype: torch.dtype, device: torch.device, past_key_values_length: int = 0
159
+ ):
160
+ warnings.warn(
161
+ "Calling `transformers.models.BailingMoeV2_5.modeling_BailingMoeV2_5._make_causal_mask` is deprecated and will be removed in v4.37. Use `transformers.models.BailingMoeV2_5.modeling_BailingMoeV2_5.AttentionMaskConverter._make_causal_mask"
162
+ )
163
+ return AttentionMaskConverter._make_causal_mask(
164
+ input_ids_shape=input_ids_shape, dtype=dtype, device=device, past_key_values_length=past_key_values_length
165
+ )
166
+
167
+
168
+ class BailingMoeV2_5RMSNorm(nn.Module):
169
+ def __init__(self, hidden_size, eps=1e-6):
170
+ """
171
+ BailingMoeV2_5RMSNorm is equivalent to T5LayerNorm
172
+ """
173
+ super().__init__()
174
+ self.weight = nn.Parameter(torch.ones(hidden_size))
175
+ self.variance_epsilon = eps
176
+
177
+ def forward(self, hidden_states):
178
+ input_dtype = hidden_states.dtype
179
+ hidden_states = hidden_states.to(torch.float32)
180
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
181
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
182
+ return self.weight * hidden_states.to(input_dtype)
183
+
184
+
185
+ class BailingMoeV2_5GroupRMSNorm(nn.Module):
186
+ def __init__(self, hidden_size, group_norm_size, eps=1e-6):
187
+ """
188
+ BailingMoeV2_5RMSNorm is equivalent to T5LayerNorm
189
+ """
190
+ super().__init__()
191
+ self.weight = nn.Parameter(torch.ones(hidden_size))
192
+ self.group_norm_size = group_norm_size
193
+ assert hidden_size % group_norm_size == 0, "hidden_size must be divisible by group_norm_size"
194
+ self.variance_epsilon = eps
195
+
196
+ def forward(self, hidden_states):
197
+ input_dtype = hidden_states.dtype
198
+ input_shape = hidden_states.size()
199
+ group_input_shape = input_shape[:-1] + (self.group_norm_size, input_shape[-1] // self.group_norm_size)
200
+ hidden_states = hidden_states.view(group_input_shape)
201
+ hidden_states = hidden_states.to(torch.float32)
202
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
203
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
204
+ return self.weight * hidden_states.to(input_dtype).view(input_shape)
205
+
206
+
207
+ ALL_LAYERNORM_LAYERS.append(BailingMoeV2_5RMSNorm)
208
+
209
+
210
+ class BailingMoeV2_5RotaryEmbedding(nn.Module):
211
+ def __init__(self, config: BailingMoeV2_5Config, device=None):
212
+ super().__init__()
213
+ # BC: "rope_type" was originally "type"
214
+ if hasattr(config, "rope_scaling") and config.rope_scaling is not None:
215
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
216
+ else:
217
+ self.rope_type = "default"
218
+ self.max_seq_len_cached = config.max_position_embeddings
219
+ self.original_max_seq_len = config.max_position_embeddings
220
+
221
+ self.config = config
222
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
223
+
224
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
225
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
226
+ self.original_inv_freq = self.inv_freq
227
+
228
+ @torch.no_grad()
229
+ @dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
230
+ def forward(self, x, position_ids):
231
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
232
+ position_ids_expanded = position_ids[:, None, :].float()
233
+
234
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
235
+ with torch.autocast(device_type=device_type, enabled=False): # Force float32
236
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
237
+ emb = torch.cat((freqs, freqs), dim=-1)
238
+ cos = emb.cos() * self.attention_scaling
239
+ sin = emb.sin() * self.attention_scaling
240
+
241
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
242
+
243
+
244
+ # Copied from transformers.models.llama.modeling_llama.rotate_half
245
+ def rotate_half(x):
246
+ """Rotates half the hidden dims of the input."""
247
+ x1 = x[..., : x.shape[-1] // 2]
248
+ x2 = x[..., x.shape[-1] // 2 :]
249
+ return torch.cat((-x2, x1), dim=-1)
250
+
251
+
252
+ # Copied from transformers.models.llama.modeling_llama.apply_rotary_pos_emb
253
+ def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1):
254
+ """Applies Rotary Position Embedding to the query and key tensors.
255
+ Args:
256
+ q (`torch.Tensor`): The query tensor.
257
+ k (`torch.Tensor`): The key tensor.
258
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
259
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
260
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
261
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
262
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
263
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
264
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
265
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
266
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
267
+ Returns:
268
+ `tuple(torch.Tensor)` comprising the query and key tensors rotated using the Rotary Position Embedding.
269
+ """
270
+ cos = cos.unsqueeze(unsqueeze_dim)
271
+ sin = sin.unsqueeze(unsqueeze_dim)
272
+
273
+ # Keep half or full tensor for later concatenation
274
+ rotary_dim = cos.shape[-1]
275
+ q_rot, q_pass = q[..., :rotary_dim], q[..., rotary_dim:]
276
+ k_rot, k_pass = k[..., :rotary_dim], k[..., rotary_dim:]
277
+
278
+ # Apply rotary embeddings on the first half or full tensor
279
+ q_embed = (q_rot * cos) + (rotate_half(q_rot) * sin)
280
+ k_embed = (k_rot * cos) + (rotate_half(k_rot) * sin)
281
+
282
+ # Concatenate back to full shape
283
+ q_embed = torch.cat([q_embed, q_pass], dim=-1)
284
+ k_embed = torch.cat([k_embed, k_pass], dim=-1)
285
+ return q_embed, k_embed
286
+
287
+
288
+ class BailingMoeV2_5MLP(nn.Module):
289
+ def __init__(self, config: BailingMoeV2_5Config, intermediate_size: int):
290
+ super().__init__()
291
+ self.config = config
292
+ self.hidden_size = config.hidden_size
293
+ self.intermediate_size = intermediate_size
294
+
295
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
296
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
297
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
298
+ self.act_fn = ACT2FN[config.hidden_act]
299
+
300
+ def forward(self, x):
301
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
302
+
303
+
304
+ class BailingMoeV2_5Gate(nn.Module):
305
+ def __init__(self, config):
306
+ super().__init__()
307
+ self.config = config
308
+ self.top_k = config.num_experts_per_tok
309
+ self.num_experts = config.num_experts
310
+
311
+ self.n_group = config.n_group
312
+ self.topk_group = config.topk_group
313
+
314
+ # topk selection algorithm
315
+ self.gating_dim = config.hidden_size
316
+ self.weight = nn.Parameter(torch.empty((self.num_experts, self.gating_dim)))
317
+ self.routed_scaling_factor = config.routed_scaling_factor
318
+
319
+ self.register_buffer("expert_bias", torch.zeros((self.num_experts)))
320
+ self.reset_parameters()
321
+
322
+ def reset_parameters(self) -> None:
323
+ import torch.nn.init as init
324
+
325
+ init.kaiming_uniform_(self.weight, a=math.sqrt(5))
326
+
327
+ def group_limited_topk(
328
+ self,
329
+ scores: torch.Tensor,
330
+ ):
331
+ num_tokens, _ = scores.size()
332
+ # Organize the experts into groups
333
+ group_scores = scores.view(num_tokens, self.n_group, -1).topk(2, dim=-1)[0].sum(dim=-1)
334
+ group_idx = torch.topk(group_scores, k=self.topk_group, dim=-1, sorted=False)[1]
335
+ group_mask = torch.zeros_like(group_scores)
336
+ group_mask.scatter_(1, group_idx, 1)
337
+
338
+ # Mask the experts based on selection groups
339
+ score_mask = (
340
+ group_mask.unsqueeze(-1)
341
+ .expand(num_tokens, self.n_group, self.num_experts // self.n_group)
342
+ .reshape(num_tokens, -1)
343
+ )
344
+
345
+ masked_scores = scores.masked_fill(~score_mask.bool(), float('-inf'))
346
+ probs, top_indices = torch.topk(masked_scores, k=self.top_k, dim=-1)
347
+
348
+ return probs, top_indices
349
+
350
+ def forward(self, hidden_states):
351
+ # compute gating score
352
+ hidden_states = hidden_states.view(-1, hidden_states.shape[-1])
353
+ logits = F.linear(hidden_states.type(torch.float32), self.weight.type(torch.float32))
354
+
355
+ scores = torch.sigmoid(logits.float()).type_as(logits)
356
+
357
+ scores_for_routing = scores + self.expert_bias
358
+ _, topk_idx = self.group_limited_topk(scores_for_routing)
359
+
360
+ scores = torch.gather(scores, dim=1, index=topk_idx).type_as(logits)
361
+
362
+ topk_weight = scores / (scores.sum(dim=-1, keepdim=True) + 1e-20) if self.top_k > 1 else scores
363
+ topk_weight = topk_weight * self.routed_scaling_factor
364
+
365
+ return topk_idx, topk_weight, logits
366
+
367
+
368
+ class BailingMoeV2_5SparseMoeBlock(nn.Module):
369
+ """
370
+ A mixed expert module containing shared experts.
371
+ """
372
+
373
+ def __init__(self, config: BailingMoeV2_5Config):
374
+ super().__init__()
375
+ self.config = config
376
+ self.num_experts_per_tok = config.num_experts_per_tok
377
+ self._setup_experts()
378
+ self.gate = BailingMoeV2_5Gate(config)
379
+ if config.num_shared_experts is not None:
380
+ self.shared_experts = BailingMoeV2_5MLP(
381
+ config=config, intermediate_size=config.moe_intermediate_size * config.num_shared_experts
382
+ )
383
+
384
+ def _setup_experts(self):
385
+ self.experts = nn.ModuleList(
386
+ [
387
+ BailingMoeV2_5MLP(config=self.config, intermediate_size=self.config.moe_intermediate_size)
388
+ for _ in range(self.config.num_experts)
389
+ ]
390
+ )
391
+
392
+ def forward(self, hidden_states):
393
+ identity = hidden_states
394
+ bsz, seq_len, h = hidden_states.shape
395
+ topk_idx, topk_weight, router_logits = self.gate(hidden_states)
396
+ hidden_states = hidden_states.view(-1, hidden_states.shape[-1])
397
+ flat_topk_idx = topk_idx.view(-1)
398
+ if self.training:
399
+ hidden_states = hidden_states.repeat_interleave(self.num_experts_per_tok, dim=0)
400
+ y = torch.empty_like(hidden_states)
401
+ for i, expert in enumerate(self.experts):
402
+ y[flat_topk_idx == i] = expert(hidden_states[flat_topk_idx == i])
403
+ y = (y.view(*topk_weight.shape, -1) * topk_weight.unsqueeze(-1)).sum(dim=1)
404
+ y = y.to(hidden_states.dtype).view(bsz, seq_len, h)
405
+ else:
406
+ y = self.moe_infer(hidden_states, topk_idx, topk_weight).view(bsz, seq_len, h)
407
+ if self.config.num_shared_experts is not None:
408
+ y = y + self.shared_experts(identity)
409
+ return y, (router_logits.view(bsz, seq_len, -1), topk_idx.view(bsz, seq_len, -1))
410
+
411
+ @torch.no_grad()
412
+ def moe_infer(self, x, topk_ids, topk_weight):
413
+ cnts = topk_ids.new_zeros((topk_ids.shape[0], len(self.experts)))
414
+ cnts.scatter_(1, topk_ids, 1)
415
+ tokens_per_expert = cnts.sum(dim=0)
416
+ idxs = topk_ids.view(-1).argsort()
417
+ sorted_tokens = x[idxs // topk_ids.shape[1]]
418
+ tokens_per_expert = tokens_per_expert.cpu().numpy()
419
+ outputs = []
420
+ start_idx = 0
421
+ for i, num_tokens in enumerate(tokens_per_expert):
422
+ end_idx = start_idx + num_tokens
423
+ if num_tokens == 0:
424
+ continue
425
+ expert = self.experts[i]
426
+ tokens_for_this_expert = sorted_tokens[start_idx:end_idx]
427
+ expert_out = expert(tokens_for_this_expert)
428
+ outputs.append(expert_out.to(x.device))
429
+ start_idx = end_idx
430
+
431
+ outs = torch.cat(outputs, dim=0) if len(outputs) else sorted_tokens.new_empty(0)
432
+ new_x = torch.empty_like(outs)
433
+ new_x[idxs] = outs
434
+ final_out = (
435
+ new_x.view(*topk_ids.shape, -1)
436
+ .type(topk_weight.dtype)
437
+ .mul_(topk_weight.unsqueeze(dim=-1))
438
+ .sum(dim=1)
439
+ .type(new_x.dtype)
440
+ )
441
+ return final_out
442
+
443
+
444
+ # Copied from transformers.models.llama.modeling_llama.repeat_kv
445
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int, head_first: bool = True) -> torch.Tensor:
446
+ """
447
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). If head_first is True, the hidden states go from (batch,
448
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
449
+ """
450
+ if n_rep == 1:
451
+ return hidden_states
452
+ if head_first:
453
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
454
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
455
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
456
+ else:
457
+ batch, slen, num_key_value_heads, head_dim = hidden_states.shape
458
+ hidden_states = hidden_states[:, :, :, None, :].expand(batch, slen, num_key_value_heads, n_rep, head_dim)
459
+ return hidden_states.reshape(batch, slen, num_key_value_heads * n_rep, head_dim)
460
+
461
+
462
+ def repeat_kv2(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
463
+ """
464
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
465
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
466
+ """
467
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
468
+ if n_rep == 1:
469
+ return hidden_states
470
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
471
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
472
+
473
+
474
+ def eager_attention_forward(
475
+ module: nn.Module,
476
+ query: torch.Tensor,
477
+ key: torch.Tensor,
478
+ value: torch.Tensor,
479
+ attention_mask: Optional[torch.Tensor],
480
+ scaling: float,
481
+ dropout: float = 0.0,
482
+ **kwargs: Unpack[TransformersKwargs],
483
+ ):
484
+ key_states = repeat_kv2(key, module.num_key_value_groups)
485
+ value_states = repeat_kv2(value, module.num_key_value_groups)
486
+
487
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
488
+ if attention_mask is not None:
489
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
490
+ attn_weights = attn_weights + causal_mask
491
+
492
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
493
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
494
+ attn_output = torch.matmul(attn_weights, value_states)
495
+ attn_output = attn_output.transpose(1, 2).contiguous()
496
+
497
+ return attn_output, attn_weights
498
+
499
+
500
+ def apply_rotary_pos_emb_interleave(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
501
+ r"""
502
+ TODO let's just use the original freqcis computation to not have the view
503
+ transpose + reshape! This is not optimized!
504
+ Applies Rotary Position Embedding to the query and key tensors.
505
+
506
+ Args:
507
+ q (`torch.Tensor`): The query tensor.
508
+ k (`torch.Tensor`): The key tensor.
509
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
510
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
511
+ position_ids (`torch.Tensor`):
512
+ The position indices of the tokens corresponding to the query and key tensors. For example, this can be
513
+ used to pass offsetted position ids when working with a KV-cache.
514
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
515
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
516
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
517
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
518
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
519
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
520
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
521
+ Returns:
522
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
523
+ """
524
+ cos = cos.unsqueeze(unsqueeze_dim)
525
+ sin = sin.unsqueeze(unsqueeze_dim)
526
+
527
+ b, h, s, d = q.shape
528
+ q = q.view(b, h, s, d // 2, 2).transpose(4, 3).reshape(b, h, s, d)
529
+
530
+ b, h, s, d = k.shape
531
+ k = k.view(b, h, s, d // 2, 2).transpose(4, 3).reshape(b, h, s, d)
532
+
533
+ q_embed = (q * cos) + (rotate_half(q) * sin)
534
+ k_embed = (k * cos) + (rotate_half(k) * sin)
535
+ return q_embed, k_embed
536
+
537
+
538
+ class BailingMoeV2_5MLARotaryEmbedding(nn.Module):
539
+ inv_freq: torch.Tensor # fix linting for `register_buffer`
540
+
541
+ def __init__(self, config: BailingMoeV2_5Config, device=None):
542
+ super().__init__()
543
+ # BC: "rope_type" was originally "type"
544
+ if hasattr(config, "rope_scaling") and isinstance(config.rope_scaling, dict):
545
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
546
+ else:
547
+ self.rope_type = "default"
548
+ self.max_seq_len_cached = config.max_position_embeddings
549
+ self.original_max_seq_len = config.max_position_embeddings
550
+
551
+ self.config = config
552
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
553
+
554
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
555
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
556
+ self.original_inv_freq = self.inv_freq
557
+
558
+ @torch.no_grad()
559
+ @dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
560
+ def forward(self, x, position_ids):
561
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
562
+ position_ids_expanded = position_ids[:, None, :].float()
563
+
564
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
565
+ with torch.autocast(device_type=device_type, enabled=False): # Force float32
566
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
567
+ emb = torch.cat((freqs, freqs), dim=-1)
568
+ cos = emb.cos() * self.attention_scaling
569
+ sin = emb.sin() * self.attention_scaling
570
+
571
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
572
+
573
+
574
+ def yarn_get_mscale(scale=1, mscale=1):
575
+ if scale <= 1:
576
+ return 1.0
577
+ return 0.1 * mscale * math.log(scale) + 1.0
578
+
579
+
580
+ class BailingMoeV2_5MultiLatentAttention(nn.Module):
581
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
582
+
583
+ def __init__(self, config: BailingMoeV2_5Config, layer_idx: int):
584
+ super().__init__()
585
+ self.config = config
586
+ self.layer_idx = layer_idx
587
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
588
+ self.attention_dropout = config.attention_dropout
589
+ self.num_heads = config.num_attention_heads
590
+ self.rope_theta = config.rope_theta
591
+ self.q_lora_rank = config.q_lora_rank
592
+ self.qk_rope_head_dim = config.qk_rope_head_dim
593
+ self.kv_lora_rank = config.kv_lora_rank
594
+ self.v_head_dim = config.v_head_dim
595
+ self.qk_nope_head_dim = config.qk_nope_head_dim
596
+ self.qk_head_dim = config.qk_head_dim
597
+
598
+ self.is_causal = True
599
+ if self.q_lora_rank is None:
600
+ self.q_proj = nn.Linear(config.hidden_size, self.num_heads * self.qk_head_dim, bias=False)
601
+ else:
602
+ self.q_a_proj = nn.Linear(config.hidden_size, config.q_lora_rank, bias=config.use_qkv_bias)
603
+ self.q_a_layernorm = BailingMoeV2_5RMSNorm(config.q_lora_rank)
604
+ self.q_b_proj = nn.Linear(config.q_lora_rank, self.num_heads * self.qk_head_dim, bias=False)
605
+
606
+ self.kv_a_proj_with_mqa = nn.Linear(
607
+ config.hidden_size,
608
+ self.kv_lora_rank + self.qk_rope_head_dim,
609
+ bias=config.use_qkv_bias,
610
+ )
611
+ self.kv_a_layernorm = BailingMoeV2_5RMSNorm(self.kv_lora_rank)
612
+ self.kv_b_proj = nn.Linear(
613
+ self.kv_lora_rank,
614
+ self.num_heads * (self.qk_nope_head_dim + self.v_head_dim),
615
+ bias=False,
616
+ )
617
+
618
+ self.dense = nn.Linear(
619
+ self.num_heads * self.v_head_dim,
620
+ config.hidden_size,
621
+ bias=config.use_qkv_bias,
622
+ )
623
+
624
+ self.scaling = self.qk_head_dim ** (-0.5)
625
+ if self.config.rope_scaling is not None:
626
+ mscale_all_dim = self.config.rope_scaling.get("mscale_all_dim", 0)
627
+ scaling_factor = self.config.rope_scaling["factor"]
628
+ if mscale_all_dim:
629
+ mscale = yarn_get_mscale(scaling_factor, mscale_all_dim)
630
+ self.scaling = self.scaling * mscale * mscale
631
+
632
+ @deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
633
+ def forward(
634
+ self,
635
+ hidden_states: torch.Tensor,
636
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
637
+ attention_mask: Optional[torch.Tensor],
638
+ past_key_values: Optional[Cache] = None,
639
+ cache_position: Optional[torch.LongTensor] = None,
640
+ **kwargs: Unpack[FlashAttentionKwargs],
641
+ ) -> tuple[torch.Tensor, Optional[torch.Tensor], Optional[tuple[torch.Tensor]]]:
642
+
643
+ batch_size, seq_length = hidden_states.shape[:-1]
644
+ query_shape = (batch_size, seq_length, -1, self.qk_head_dim)
645
+ key_shape = (batch_size, seq_length, -1, self.qk_nope_head_dim + self.v_head_dim)
646
+
647
+ if self.q_lora_rank is None:
648
+ q_states = self.q_proj(hidden_states)
649
+ else:
650
+ q_states = self.q_b_proj(self.q_a_layernorm(self.q_a_proj(hidden_states)))
651
+ q_states = q_states.view(query_shape).transpose(1, 2)
652
+ q_pass, q_rot = torch.split(q_states, [self.qk_nope_head_dim, self.qk_rope_head_dim], dim=-1)
653
+
654
+ compressed_kv = self.kv_a_proj_with_mqa(hidden_states)
655
+ k_pass, k_rot = torch.split(compressed_kv, [self.kv_lora_rank, self.qk_rope_head_dim], dim=-1)
656
+
657
+ k_pass = self.kv_b_proj(self.kv_a_layernorm(k_pass)).view(key_shape).transpose(1, 2)
658
+ k_pass, value_states = torch.split(k_pass, [self.qk_nope_head_dim, self.v_head_dim], dim=-1)
659
+
660
+ k_rot = k_rot.view(batch_size, 1, seq_length, self.qk_rope_head_dim)
661
+
662
+ cos, sin = position_embeddings # tptest
663
+ if self.config.rope_interleave: # support using interleaved weights for efficiency
664
+ q_rot, k_rot = apply_rotary_pos_emb_interleave(q_rot, k_rot, cos, sin)
665
+ else:
666
+ x = 1 / 0
667
+ q_rot, k_rot = apply_rotary_pos_emb(q_rot, k_rot, cos, sin)
668
+ k_rot = k_rot.expand(*k_pass.shape[:-1], -1)
669
+
670
+ query_states = torch.cat((q_pass, q_rot), dim=-1)
671
+ key_states = torch.cat((k_pass, k_rot), dim=-1)
672
+
673
+ if past_key_values is not None:
674
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
675
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
676
+ key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx, cache_kwargs)
677
+
678
+ if self.config._attn_implementation == "flash_attention_2" and self.qk_head_dim != self.v_head_dim:
679
+ value_states = F.pad(value_states, [0, self.qk_head_dim - self.v_head_dim])
680
+
681
+ attention_interface: Callable = eager_attention_forward
682
+
683
+ attn_output, attn_weights = attention_interface(
684
+ self,
685
+ query_states,
686
+ key_states,
687
+ value_states,
688
+ attention_mask,
689
+ dropout=0.0 if not self.training else self.attention_dropout,
690
+ scaling=self.scaling,
691
+ **kwargs,
692
+ )
693
+
694
+ if self.config._attn_implementation == "flash_attention_2" and self.qk_head_dim != self.v_head_dim:
695
+ attn_output = attn_output[:, :, :, : self.v_head_dim]
696
+
697
+ attn_output = attn_output.reshape(batch_size, seq_length, -1).contiguous()
698
+ attn_output = self.dense(attn_output)
699
+ return attn_output, attn_weights, past_key_values
700
+
701
+
702
+ class BailingMoeV2_5LinearAttention(nn.Module):
703
+ """
704
+ BailingMoeAttention implements a linear attention mechanism based on Lightning Attention-2
705
+ (https://arxiv.org/abs/2401.04658) with efficient computation using flash-linear-attention operators.
706
+
707
+ The implementation leverages optimized kernels from the flash-linear-attention library
708
+ (https://github.com/fla-org/flash-linear-attention) for maximum performance.
709
+ """
710
+
711
+ def __init__(self, config: BailingMoeV2_5Config, layer_idx: Optional[int] = None):
712
+ super().__init__()
713
+ self.config = config
714
+ self.layer_idx = layer_idx
715
+ if layer_idx is None:
716
+ logger.warning_once(
717
+ f"Instantiating {self.__class__.__name__} without passing `layer_idx` is not recommended and will "
718
+ "to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` "
719
+ "when creating this class."
720
+ )
721
+ self.hidden_size = config.hidden_size
722
+ self.num_heads = config.num_attention_heads
723
+ self.head_dim = config.head_dim or self.hidden_size // self.num_heads
724
+ self.num_key_value_heads = config.num_attention_heads
725
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
726
+ partial_rotary_factor = config.partial_rotary_factor if hasattr(config, "partial_rotary_factor") else 1.0
727
+ self.rope_dim = int(self.head_dim * partial_rotary_factor)
728
+
729
+ self.use_qk_norm = getattr(config, "use_qk_norm", False)
730
+ self.rms_norm_eps = getattr(config, "rms_norm_eps", 1e-5)
731
+ self.mode = 'chunk'
732
+
733
+ self.query_key_value = nn.Linear(
734
+ self.hidden_size,
735
+ (self.num_heads + 2 * self.num_key_value_heads) * self.head_dim,
736
+ bias=config.use_qkv_bias,
737
+ )
738
+
739
+ if self.config.use_qk_norm:
740
+ self.query_layernorm = BailingMoeV2_5RMSNorm(self.head_dim, eps=config.rms_norm_eps)
741
+ self.key_layernorm = BailingMoeV2_5RMSNorm(self.head_dim, eps=config.rms_norm_eps)
742
+
743
+ self.rotary_emb = BailingMoeV2_5RotaryEmbedding(config=config)
744
+
745
+ self.dense = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=config.use_bias)
746
+
747
+ self.g_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=False)
748
+ self.g_norm = BailingMoeV2_5GroupRMSNorm(
749
+ self.num_heads * self.head_dim, group_norm_size=config.group_norm_size, eps=self.rms_norm_eps
750
+ )
751
+ slope = -BailingMoeV2_5LinearAttention.build_slope_tensor(self.num_heads) * (
752
+ 1 - (self.layer_idx - 1) / (self.config.num_hidden_layers - 1) + 1e-5
753
+ )
754
+ self.register_buffer('slope', slope, persistent=False)
755
+
756
+ self.lightning_attn_ops = {'chunk': chunk_simple_gla, 'fused_recurrent': fused_recurrent_simple_gla}
757
+
758
+ @staticmethod
759
+ def build_slope_tensor(n_attention_heads: int):
760
+ """
761
+ Build a tensor of slopes for Lightning Attention-2 as described in the paper:
762
+ "Lightning Attention-2: A Free Lunch for Handling Unlimited Sequence Lengths in Large Language Models"
763
+ (https://arxiv.org/abs/2401.04658)
764
+
765
+ This function computes the slope values that control the decay rate of attention scores
766
+ based on the number of attention heads. The slopes are designed to have specific
767
+ mathematical properties that work optimally when the number of heads is a power of 2.
768
+
769
+ For non-power-of-2 head counts, a workaround is implemented to maintain similar properties.
770
+
771
+ Args:
772
+ n_attention_heads (int): Number of attention heads in the model
773
+
774
+ Returns:
775
+ torch.Tensor: A tensor of shape [n_attention_heads] containing the computed slopes
776
+
777
+ Note:
778
+ Code copied from: https://github.com/OpenNLPLab/lightning-attention/blob/d15c38529bbd5c2c82b44ddda3cac885825aa873/lightning_attn/utils/utils.py#L6
779
+ """
780
+
781
+ def get_slopes(n):
782
+ def get_slopes_power_of_2(n):
783
+ start = 2 ** (-(2 ** -(math.log2(n) - 3)))
784
+ ratio = start
785
+ return [start * ratio**i for i in range(n)]
786
+
787
+ if math.log2(n).is_integer():
788
+ return get_slopes_power_of_2(
789
+ n
790
+ ) # In the paper, we only train models that have 2^a heads for some a. This function has
791
+ else: # some good properties that only occur when the input is a power of 2. To maintain that even
792
+ closest_power_of_2 = 2 ** math.floor(
793
+ math.log2(n)
794
+ ) # when the number of heads is not a power of 2, we use this workaround.
795
+ return (
796
+ get_slopes_power_of_2(closest_power_of_2)
797
+ + get_slopes(2 * closest_power_of_2)[0::2][: n - closest_power_of_2]
798
+ )
799
+
800
+ slopes = torch.tensor(get_slopes(n_attention_heads), dtype=torch.float)
801
+ return slopes
802
+
803
+ def forward(
804
+ self,
805
+ hidden_states: torch.Tensor,
806
+ attention_mask: Optional[torch.Tensor] = None,
807
+ position_ids: Optional[torch.LongTensor] = None,
808
+ past_key_value: Optional[Cache] = None,
809
+ output_attentions: bool = False,
810
+ use_cache: bool = False,
811
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
812
+ **kwargs,
813
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
814
+ if attention_mask is not None:
815
+ assert len(attention_mask.shape) == 2, (
816
+ "Expected attention_mask as a 0-1 matrix with shape [batch_size, seq_len] "
817
+ "for padding purposes (0 indicating padding). "
818
+ "Arbitrary attention masks of shape [batch_size, seq_len, seq_len] are not allowed."
819
+ )
820
+
821
+ # launching the triton kernel for just one token will actually be slower
822
+ mode = 'fused_recurrent' if hidden_states.shape[1] <= 64 else self.mode
823
+
824
+ # Currently output_attentions can only be False, returning attention weights is not supported
825
+ assert (
826
+ not output_attentions
827
+ ), "output_attentions can only be False, returning attention weights is not supported"
828
+
829
+ bsz, q_len, _ = hidden_states.size()
830
+ device = hidden_states.device
831
+
832
+ qkv = self.query_key_value(hidden_states)
833
+ qkv = qkv.view(bsz, q_len, self.num_heads + 2 * self.num_key_value_heads, self.head_dim)
834
+ query_states, key_states, value_states = qkv.split(
835
+ [self.num_heads, self.num_key_value_heads, self.num_key_value_heads], dim=-2
836
+ )
837
+ if self.config.use_qk_norm:
838
+ query_states = self.query_layernorm(query_states)
839
+ key_states = self.key_layernorm(key_states)
840
+
841
+ cos, sin = position_embeddings
842
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, unsqueeze_dim=2)
843
+
844
+ if self.num_key_value_groups > 1:
845
+ # [bsz, q_len, n_kv_heads, head_dim] -> [bsz, q_len, n_heads, head_dim]
846
+ key_states = repeat_kv(key_states, self.num_key_value_groups, head_first=False)
847
+ value_states = repeat_kv(value_states, self.num_key_value_groups, head_first=False)
848
+
849
+ recurrent_state = None
850
+ if past_key_value is not None and isinstance(past_key_value, Cache):
851
+ # ensure the cache list is long enough
852
+ while len(past_key_value.layers) <= self.layer_idx:
853
+ past_key_value.layers.append(DynamicLayer())
854
+
855
+ if past_key_value.layers[self.layer_idx].keys is not None:
856
+ recurrent_state = past_key_value.layers[self.layer_idx].keys
857
+ # ensure recurrent_state is on the same device as hidden_states
858
+ if recurrent_state.device != hidden_states.device:
859
+ recurrent_state = recurrent_state.to(device).contiguous()
860
+
861
+ if recurrent_state is None:
862
+ # dealing with left-padding
863
+ if attention_mask is not None and use_cache:
864
+ value_states = value_states.mul_(attention_mask[:, -q_len:, None, None])
865
+
866
+ o, recurrent_state = self.lightning_attn_ops[mode](
867
+ q=query_states,
868
+ k=key_states,
869
+ v=value_states,
870
+ g=self.slope[None, None, :].expand(bsz, q_len, self.num_heads),
871
+ initial_state=recurrent_state,
872
+ output_final_state=use_cache,
873
+ )
874
+
875
+ o = o.reshape(bsz, q_len, -1)
876
+ o = self.g_norm(o)
877
+ g_proj = self.g_proj(hidden_states)
878
+ o = o * torch.sigmoid_(g_proj)
879
+ o = self.dense(o)
880
+
881
+ if use_cache and past_key_value is not None and isinstance(past_key_value, Cache):
882
+ target_device = None
883
+ for cache in past_key_value.layers:
884
+ if cache.keys is not None:
885
+ target_device = cache.keys.device
886
+ break
887
+ if target_device is None:
888
+ target_device = recurrent_state.device
889
+
890
+ # move to target device
891
+ if recurrent_state.device != target_device:
892
+ recurrent_state = recurrent_state.to(target_device)
893
+
894
+ past_key_value.layers[self.layer_idx].keys = recurrent_state
895
+
896
+ return o, None, past_key_value
897
+
898
+
899
+ class BailingMoeV2_5MTPLayer(nn.Module):
900
+ def __init__(self, config: BailingMoeV2_5Config, layer_idx: int):
901
+ super().__init__()
902
+ self.layer_idx = layer_idx
903
+ self.input_layernorm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
904
+ self.enorm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
905
+
906
+ self.eh_proj = nn.Linear(config.hidden_size * 2, config.hidden_size, bias=False)
907
+ self.post_attention_layernorm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
908
+ self.attention = BailingMoeV2_5MultiLatentAttention(config=config, layer_idx=layer_idx)
909
+ self.mlp = BailingMoeV2_5SparseMoeBlock(config)
910
+
911
+ self.hnorm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
912
+ self.final_layernorm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
913
+
914
+ def forward(
915
+ self,
916
+ input_embeds,
917
+ hidden_states: torch.Tensor,
918
+ attention_mask: Optional[torch.Tensor] = None,
919
+ position_ids: Optional[torch.LongTensor] = None,
920
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
921
+ output_attentions: Optional[bool] = False,
922
+ output_router_logits: Optional[bool] = False,
923
+ use_cache: Optional[bool] = False,
924
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
925
+ **kwargs,
926
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
927
+ input_embeds = self.enorm(input_embeds)
928
+ hidden_states = self.hnorm(hidden_states)
929
+ hidden_states = self.eh_proj(torch.cat([input_embeds, hidden_states], dim=-1))
930
+ residual = hidden_states
931
+
932
+ hidden_states = self.input_layernorm(hidden_states)
933
+
934
+ # Self Attention
935
+ hidden_states, self_attn_weights, present_key_value = self.attention(
936
+ hidden_states=hidden_states,
937
+ attention_mask=attention_mask,
938
+ position_ids=position_ids,
939
+ past_key_value=past_key_value,
940
+ output_attentions=output_attentions,
941
+ position_embeddings=position_embeddings,
942
+ use_cache=use_cache,
943
+ )
944
+ hidden_states = residual + hidden_states
945
+
946
+ # Fully Connected
947
+ residual = hidden_states
948
+ hidden_states = self.post_attention_layernorm(hidden_states)
949
+ hidden_states = self.mlp(hidden_states)
950
+ if isinstance(hidden_states, tuple):
951
+ hidden_states, router_logits = hidden_states
952
+ else:
953
+ router_logits = None
954
+ hidden_states = residual + hidden_states.to(residual.device)
955
+ hidden_states = self.final_layernorm(hidden_states)
956
+
957
+ outputs = (hidden_states,)
958
+
959
+ if output_attentions:
960
+ outputs += (self_attn_weights,)
961
+
962
+ if use_cache:
963
+ outputs += (present_key_value,)
964
+
965
+ if output_router_logits:
966
+ outputs += (router_logits,)
967
+
968
+ return outputs
969
+
970
+
971
+ class BailingMoeV2_5DecoderLayer(nn.Module):
972
+ def __init__(self, config: BailingMoeV2_5Config, layer_idx: int):
973
+ super().__init__()
974
+ self.hidden_size = config.hidden_size
975
+ self.layer_idx = layer_idx
976
+ self.attention_layer_type = (
977
+ "attention"
978
+ if (layer_idx + 1) % config.layer_group_size == 0
979
+ or layer_idx >= config.num_hidden_layers // config.layer_group_size * config.layer_group_size
980
+ else "linear_attention"
981
+ )
982
+
983
+ if self.attention_layer_type == "attention":
984
+ self.attention = BailingMoeV2_5MultiLatentAttention(config=config, layer_idx=layer_idx)
985
+ else:
986
+ self.attention = BailingMoeV2_5LinearAttention(config=config, layer_idx=layer_idx)
987
+
988
+ self.mlp = (
989
+ BailingMoeV2_5SparseMoeBlock(config)
990
+ if (config.num_experts is not None and layer_idx >= config.first_k_dense_replace)
991
+ else BailingMoeV2_5MLP(config=config, intermediate_size=config.intermediate_size)
992
+ )
993
+ self.input_layernorm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
994
+ self.post_attention_layernorm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
995
+
996
+ def forward(
997
+ self,
998
+ hidden_states: torch.Tensor,
999
+ attention_mask: Optional[torch.Tensor] = None,
1000
+ position_ids: Optional[torch.LongTensor] = None,
1001
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
1002
+ cache_position: Optional[torch.LongTensor] = None,
1003
+ output_attentions: Optional[bool] = False,
1004
+ output_router_logits: Optional[bool] = False,
1005
+ use_cache: Optional[bool] = False,
1006
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
1007
+ position_embeddings_mla: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
1008
+ **kwargs,
1009
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
1010
+ """
1011
+ Args:
1012
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
1013
+ attention_mask (`torch.FloatTensor`, *optional*):
1014
+ attention mask of size `(batch_size, sequence_length)` if flash attention is used or `(batch_size, 1,
1015
+ query_sequence_length, key_sequence_length)` if default attention is used.
1016
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1017
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
1018
+ config.n_positions - 1]`.
1019
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*):
1020
+ cached past key and value projection states
1021
+ output_attentions (`bool`, *optional*):
1022
+ Whether to return the attentions tensors of all attention layers. See `attentions` under
1023
+ returned tensors for more detail.
1024
+ output_router_logits (`bool`, *optional*):
1025
+ Whether or not to return the logits of all the routers. They are useful for computing the router loss,
1026
+ and should not be returned during inference.
1027
+ use_cache (`bool`, *optional*):
1028
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
1029
+ (see `past_key_values`).
1030
+ """
1031
+ residual = hidden_states
1032
+
1033
+ hidden_states = self.input_layernorm(hidden_states)
1034
+
1035
+ # Self Attention
1036
+ if self.attention_layer_type == "attention":
1037
+ hidden_states, self_attn_weights, present_key_value = self.attention(
1038
+ hidden_states=hidden_states,
1039
+ attention_mask=attention_mask,
1040
+ position_ids=position_ids,
1041
+ past_key_values=past_key_value,
1042
+ use_cache=use_cache,
1043
+ cache_position=cache_position, #
1044
+ position_embeddings=position_embeddings_mla, #
1045
+ **kwargs,
1046
+ )
1047
+ else:
1048
+ batch_size, seq_len = hidden_states.shape[0], hidden_states.shape[1]
1049
+ device = hidden_states.device
1050
+
1051
+ if attention_mask is None:
1052
+ # if attention_mask is None, create a full mask
1053
+ attention_mask = torch.ones((batch_size, seq_len), dtype=torch.int32, device=device)
1054
+ elif attention_mask.dim() == 4 and attention_mask.shape[1] == 1:
1055
+ attention_mask = attention_mask[:, 0, -1, :].to(torch.int32)
1056
+ attention_mask = (attention_mask > -1e4).to(torch.int32)
1057
+ elif attention_mask.dim() == 2:
1058
+ attention_mask = attention_mask.to(torch.int32)
1059
+ else:
1060
+ raise ValueError(f"Unsupported mask dimension: {attention_mask.shape}")
1061
+
1062
+ hidden_states, self_attn_weights, present_key_value = self.attention(
1063
+ hidden_states=hidden_states,
1064
+ attention_mask=attention_mask,
1065
+ past_key_value=past_key_value,
1066
+ position_ids=position_ids,
1067
+ use_cache=use_cache,
1068
+ output_attentions=output_attentions,
1069
+ position_embeddings=position_embeddings,
1070
+ )
1071
+
1072
+ hidden_states = residual + hidden_states
1073
+
1074
+ # Fully Connected
1075
+ residual = hidden_states
1076
+ hidden_states = self.post_attention_layernorm(hidden_states)
1077
+ hidden_states = self.mlp(hidden_states)
1078
+ if isinstance(hidden_states, tuple):
1079
+ hidden_states, router_logits = hidden_states
1080
+ else:
1081
+ router_logits = None
1082
+ hidden_states = residual + hidden_states.to(residual.device)
1083
+
1084
+ outputs = (hidden_states,)
1085
+
1086
+ if output_attentions:
1087
+ outputs += (self_attn_weights,)
1088
+
1089
+ if use_cache:
1090
+ outputs += (present_key_value,)
1091
+
1092
+ if output_router_logits:
1093
+ outputs += (router_logits,)
1094
+
1095
+ return outputs
1096
+
1097
+
1098
+ BAILINGMOEV2_5_START_DOCSTRING = r"""
1099
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
1100
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
1101
+ etc.)
1102
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
1103
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
1104
+ and behavior.
1105
+ Parameters:
1106
+ config ([`BailingMoeV2_5Config`]):
1107
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
1108
+ load the weights associated with the model, only the configuration. Check out the
1109
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
1110
+ """
1111
+
1112
+
1113
+ @add_start_docstrings(
1114
+ "The bare BailingMoeV2_5 Model outputting raw hidden-states without any specific head on top.",
1115
+ BAILINGMOEV2_5_START_DOCSTRING,
1116
+ )
1117
+ class BailingMoeV2_5PreTrainedModel(PreTrainedModel):
1118
+ config_class = BailingMoeV2_5Config
1119
+ base_model_prefix = "model"
1120
+ supports_gradient_checkpointing = True
1121
+ _no_split_modules = ["BailingMoeV2_5DecoderLayer"]
1122
+ _skip_keys_device_placement = "past_key_values"
1123
+ _supports_flash_attn_2 = True
1124
+ _supports_sdpa = True
1125
+ _supports_cache_class = True
1126
+
1127
+ def _init_weights(self, module):
1128
+ std = self.config.initializer_range
1129
+ if isinstance(module, nn.Linear):
1130
+ module.weight.data.normal_(mean=0.0, std=std)
1131
+ if module.bias is not None:
1132
+ module.bias.data.zero_()
1133
+ elif isinstance(module, nn.Embedding):
1134
+ module.weight.data.normal_(mean=0.0, std=std)
1135
+ if module.padding_idx is not None:
1136
+ module.weight.data[module.padding_idx].zero_()
1137
+
1138
+
1139
+ BAILINGMOEV2_5_INPUTS_DOCSTRING = r"""
1140
+ Args:
1141
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
1142
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
1143
+ it.
1144
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
1145
+ [`PreTrainedTokenizer.__call__`] for details.
1146
+ [What are input IDs?](../glossary#input-ids)
1147
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
1148
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
1149
+ - 1 for tokens that are **not masked**,
1150
+ - 0 for tokens that are **masked**.
1151
+ [What are attention masks?](../glossary#attention-mask)
1152
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
1153
+ [`PreTrainedTokenizer.__call__`] for details.
1154
+ If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
1155
+ `past_key_values`).
1156
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
1157
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
1158
+ information on the default strategy.
1159
+ - 1 indicates the head is **not masked**,
1160
+ - 0 indicates the head is **masked**.
1161
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1162
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
1163
+ config.n_positions - 1]`.
1164
+ [What are position IDs?](../glossary#position-ids)
1165
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
1166
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
1167
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
1168
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
1169
+ Two formats are allowed:
1170
+ - a [`~cache_utils.Cache`] instance;
1171
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
1172
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
1173
+ cache format.
1174
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
1175
+ legacy cache format will be returned.
1176
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
1177
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
1178
+ of shape `(batch_size, sequence_length)`.
1179
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
1180
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
1181
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
1182
+ model's internal embedding lookup matrix.
1183
+ use_cache (`bool`, *optional*):
1184
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
1185
+ `past_key_values`).
1186
+ output_attentions (`bool`, *optional*):
1187
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
1188
+ tensors for more detail.
1189
+ output_hidden_states (`bool`, *optional*):
1190
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
1191
+ more detail.
1192
+ return_dict (`bool`, *optional*):
1193
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
1194
+ """
1195
+
1196
+
1197
+ @add_start_docstrings(
1198
+ "The bare BailingMoeV2_5 Model outputting raw hidden-states without any specific head on top.",
1199
+ BAILINGMOEV2_5_START_DOCSTRING,
1200
+ )
1201
+ class BailingMoeV2_5Model(BailingMoeV2_5PreTrainedModel):
1202
+ """
1203
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`BailingMoeV2_5DecoderLayer`]
1204
+ Args:
1205
+ config: BailingMoeV2_5Config
1206
+ """
1207
+
1208
+ def __init__(self, config: BailingMoeV2_5Config):
1209
+ super().__init__(config)
1210
+ self.padding_idx = config.pad_token_id
1211
+ self.vocab_size = config.vocab_size
1212
+ self.num_nextn_predict_layers = config.num_nextn_predict_layers
1213
+
1214
+ self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
1215
+ self.layers = []
1216
+ for layer_idx in range(config.num_hidden_layers + config.num_nextn_predict_layers):
1217
+ layer_cls = BailingMoeV2_5DecoderLayer if layer_idx < config.num_hidden_layers else BailingMoeV2_5MTPLayer
1218
+ self.layers.append(layer_cls(config, layer_idx))
1219
+
1220
+ self.layers = nn.ModuleList(self.layers)
1221
+
1222
+ self._use_sdpa = config._attn_implementation == "sdpa"
1223
+ self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
1224
+ self.norm = BailingMoeV2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
1225
+ self.rotary_emb = BailingMoeV2_5RotaryEmbedding(config=config)
1226
+ self.rotary_emb_mla = BailingMoeV2_5MLARotaryEmbedding(config=config)
1227
+ self.gradient_checkpointing = False
1228
+ # Initialize weights and apply final processing
1229
+ self.post_init()
1230
+
1231
+ def get_input_embeddings(self):
1232
+ return self.word_embeddings
1233
+
1234
+ def set_input_embeddings(self, value):
1235
+ self.word_embeddings = value
1236
+
1237
+ @add_start_docstrings_to_model_forward(BAILINGMOEV2_5_INPUTS_DOCSTRING)
1238
+ def forward(
1239
+ self,
1240
+ input_ids: torch.LongTensor = None,
1241
+ attention_mask: Optional[torch.Tensor] = None,
1242
+ position_ids: Optional[torch.LongTensor] = None,
1243
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1244
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1245
+ cache_position: Optional[torch.LongTensor] = None,
1246
+ use_cache: Optional[bool] = None,
1247
+ output_attentions: Optional[bool] = None,
1248
+ output_hidden_states: Optional[bool] = None,
1249
+ output_router_logits: Optional[bool] = None,
1250
+ return_dict: Optional[bool] = None,
1251
+ **kwargs,
1252
+ ) -> Union[Tuple, MoeV2_5ModelOutputWithPast]:
1253
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1254
+ output_hidden_states = (
1255
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1256
+ )
1257
+ output_router_logits = (
1258
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
1259
+ )
1260
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
1261
+
1262
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1263
+
1264
+ # retrieve input_ids and inputs_embeds
1265
+ if input_ids is not None and inputs_embeds is not None:
1266
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
1267
+ elif input_ids is not None:
1268
+ batch_size, seq_length = input_ids.shape[:2]
1269
+ elif inputs_embeds is not None:
1270
+ batch_size, seq_length = inputs_embeds.shape[:2]
1271
+ else:
1272
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
1273
+
1274
+ if self.gradient_checkpointing and self.training:
1275
+ if use_cache:
1276
+ logger.warning_once(
1277
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`transformers."
1278
+ )
1279
+ use_cache = False
1280
+
1281
+ if use_cache and past_key_values is None:
1282
+ past_key_values = DynamicCache()
1283
+
1284
+ if inputs_embeds is None:
1285
+ inputs_embeds = self.word_embeddings(input_ids)
1286
+
1287
+ if cache_position is None:
1288
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
1289
+ cache_position: torch.Tensor = torch.arange(
1290
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
1291
+ )
1292
+
1293
+ if position_ids is None:
1294
+ position_ids = cache_position.unsqueeze(0)
1295
+
1296
+ softmax_attention_layer_id = self.config.layer_group_size - 1
1297
+ past_seen_tokens = (
1298
+ past_key_values.get_seq_length(layer_idx=softmax_attention_layer_id) if past_key_values is not None else 0
1299
+ )
1300
+
1301
+ if position_ids is None:
1302
+ position_ids = torch.arange(
1303
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
1304
+ )
1305
+ position_ids = position_ids.unsqueeze(0)
1306
+
1307
+ if self._use_flash_attention_2:
1308
+ # 2d mask is passed through the layers
1309
+ attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
1310
+ elif self._use_sdpa and not output_attentions:
1311
+ # output_attentions=True can not be supported when using SDPA, and we fall back on
1312
+ # the manual implementation that requires a 4D causal mask in all cases.
1313
+ attention_mask = _prepare_4d_causal_attention_mask_for_sdpa(
1314
+ attention_mask,
1315
+ (batch_size, seq_length),
1316
+ inputs_embeds,
1317
+ past_seen_tokens,
1318
+ )
1319
+ else:
1320
+ # 4d mask is passed through the layers
1321
+ attention_mask = _prepare_4d_causal_attention_mask(
1322
+ attention_mask, (batch_size, seq_length), inputs_embeds, past_seen_tokens
1323
+ )
1324
+
1325
+ # embed positions
1326
+ hidden_states = inputs_embeds
1327
+
1328
+ # create position embeddings to be shared across the decoder layers
1329
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
1330
+ position_embeddings_mla = self.rotary_emb_mla(hidden_states, position_ids)
1331
+
1332
+ # decoder layers
1333
+ all_hidden_states = () if output_hidden_states else None
1334
+ all_self_attns = () if output_attentions else None
1335
+ all_router_logits = () if output_router_logits else None
1336
+ next_decoder_cache = None
1337
+ layers = self.layers[: -self.num_nextn_predict_layers] if self.num_nextn_predict_layers > 0 else self.layers
1338
+ mtp_layers = self.layers[-self.num_nextn_predict_layers :] if self.num_nextn_predict_layers > 0 else None
1339
+
1340
+ # tptest miss causal_mask = create_causal_mask(
1341
+
1342
+ for decoder_layer in layers:
1343
+ if output_hidden_states:
1344
+ all_hidden_states += (hidden_states,)
1345
+
1346
+ if self.gradient_checkpointing and self.training:
1347
+ layer_outputs = self._gradient_checkpointing_func(
1348
+ decoder_layer.__call__,
1349
+ hidden_states,
1350
+ attention_mask,
1351
+ position_ids,
1352
+ past_key_values,
1353
+ cache_position,
1354
+ output_attentions,
1355
+ output_router_logits,
1356
+ use_cache,
1357
+ position_embeddings,
1358
+ position_embeddings_mla,
1359
+ )
1360
+ else:
1361
+ layer_outputs = decoder_layer(
1362
+ hidden_states,
1363
+ attention_mask=attention_mask,
1364
+ position_ids=position_ids,
1365
+ past_key_value=past_key_values,
1366
+ cache_position=cache_position,
1367
+ output_attentions=output_attentions,
1368
+ output_router_logits=output_router_logits,
1369
+ use_cache=use_cache,
1370
+ position_embeddings=position_embeddings,
1371
+ position_embeddings_mla=position_embeddings_mla,
1372
+ )
1373
+ hidden_states = layer_outputs[0]
1374
+
1375
+ if use_cache:
1376
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
1377
+
1378
+ if output_attentions:
1379
+ all_self_attns += (layer_outputs[1],)
1380
+
1381
+ if output_router_logits and layer_outputs[-1] is not None:
1382
+ all_router_logits += (layer_outputs[-1],)
1383
+
1384
+ hidden_states = self.norm(hidden_states)
1385
+ main_hidden_states = hidden_states
1386
+
1387
+ # add hidden states from the last decoder layer
1388
+ if output_hidden_states:
1389
+ all_hidden_states += (main_hidden_states,)
1390
+
1391
+ mtp_hidden_states = None
1392
+
1393
+ if mtp_layers:
1394
+ for decoder_layer in mtp_layers:
1395
+ input_ids, _ = roll_tensor(input_ids, shifts=-1, dims=-1)
1396
+ inputs_embeds = self.word_embeddings(input_ids)
1397
+
1398
+ if self.gradient_checkpointing and self.training:
1399
+ layer_outputs = self._gradient_checkpointing_func(
1400
+ decoder_layer.__call__,
1401
+ inputs_embeds,
1402
+ hidden_states,
1403
+ attention_mask,
1404
+ position_ids,
1405
+ past_key_values,
1406
+ output_attentions,
1407
+ output_router_logits,
1408
+ use_cache,
1409
+ position_embeddings,
1410
+ )
1411
+ else:
1412
+ layer_outputs = decoder_layer(
1413
+ inputs_embeds,
1414
+ hidden_states,
1415
+ attention_mask=attention_mask,
1416
+ position_ids=position_ids,
1417
+ past_key_value=past_key_values,
1418
+ output_attentions=output_attentions,
1419
+ output_router_logits=output_router_logits,
1420
+ use_cache=use_cache,
1421
+ position_embeddings=position_embeddings,
1422
+ )
1423
+ if mtp_hidden_states is None:
1424
+ mtp_hidden_states = []
1425
+ hidden_states = layer_outputs[0]
1426
+ mtp_hidden_states.append(hidden_states)
1427
+
1428
+ if output_hidden_states:
1429
+ all_hidden_states += (hidden_states,)
1430
+
1431
+ if use_cache:
1432
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
1433
+
1434
+ if output_attentions:
1435
+ all_self_attns += (layer_outputs[1],)
1436
+
1437
+ if output_router_logits and layer_outputs[-1] is not None:
1438
+ all_router_logits += (layer_outputs[-1],)
1439
+
1440
+ next_cache = None
1441
+ if use_cache:
1442
+ next_cache = next_decoder_cache
1443
+ if not return_dict:
1444
+ return tuple(
1445
+ v
1446
+ for v in [main_hidden_states, next_cache, all_hidden_states, all_self_attns, all_router_logits]
1447
+ if v is not None
1448
+ )
1449
+ return MoeV2_5ModelOutputWithPast(
1450
+ last_hidden_state=main_hidden_states,
1451
+ past_key_values=next_cache,
1452
+ hidden_states=all_hidden_states,
1453
+ mtp_hidden_states=mtp_hidden_states,
1454
+ attentions=all_self_attns,
1455
+ router_logits=all_router_logits,
1456
+ )
1457
+
1458
+
1459
+ class BailingMoeV2_5ForCausalLM(BailingMoeV2_5PreTrainedModel, GenerationMixin):
1460
+ _tied_weights_keys = ["lm_head.weight"]
1461
+
1462
+ def __init__(self, config: BailingMoeV2_5Config):
1463
+ super().__init__(config)
1464
+ self.model = BailingMoeV2_5Model(config)
1465
+ self.vocab_size = config.vocab_size
1466
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
1467
+ self.num_nextn_predict_layers = config.num_nextn_predict_layers
1468
+ self.mtp_loss_scaling_factor = config.mtp_loss_scaling_factor
1469
+
1470
+ # Initialize weights and apply final processing
1471
+ self.post_init()
1472
+
1473
+ def get_input_embeddings(self):
1474
+ return self.model.word_embeddings
1475
+
1476
+ def set_input_embeddings(self, value):
1477
+ self.model.word_embeddings = value
1478
+
1479
+ def get_output_embeddings(self):
1480
+ return self.lm_head
1481
+
1482
+ def set_output_embeddings(self, new_embeddings):
1483
+ self.lm_head = new_embeddings
1484
+
1485
+ def set_decoder(self, decoder):
1486
+ self.model = decoder
1487
+
1488
+ def get_decoder(self):
1489
+ return self.model
1490
+
1491
+ @add_start_docstrings_to_model_forward(BAILINGMOEV2_5_INPUTS_DOCSTRING)
1492
+ @replace_return_docstrings(output_type=MoEV2_5CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1493
+ def forward(
1494
+ self,
1495
+ input_ids: torch.LongTensor = None,
1496
+ attention_mask: Optional[torch.Tensor] = None,
1497
+ position_ids: Optional[torch.LongTensor] = None,
1498
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1499
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1500
+ labels: Optional[torch.LongTensor] = None,
1501
+ use_cache: Optional[bool] = None,
1502
+ output_attentions: Optional[bool] = None,
1503
+ output_hidden_states: Optional[bool] = None,
1504
+ output_router_logits: Optional[bool] = None,
1505
+ return_dict: Optional[bool] = None,
1506
+ **kwargs,
1507
+ ) -> Union[Tuple, MoEV2_5CausalLMOutputWithPast]:
1508
+ r"""
1509
+ Args:
1510
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1511
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1512
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1513
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1514
+ Returns:
1515
+ Example:
1516
+ ```python
1517
+ >>> from transformers import AutoTokenizer
1518
+ >>> model = BailingMoeV2_5ForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
1519
+ >>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
1520
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
1521
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1522
+ >>> # Generate
1523
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1524
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1525
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
1526
+ ```"""
1527
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1528
+ output_hidden_states = (
1529
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1530
+ )
1531
+ output_router_logits = (
1532
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
1533
+ )
1534
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1535
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1536
+ outputs = self.model(
1537
+ input_ids=input_ids,
1538
+ attention_mask=attention_mask,
1539
+ position_ids=position_ids,
1540
+ past_key_values=past_key_values,
1541
+ inputs_embeds=inputs_embeds,
1542
+ use_cache=use_cache,
1543
+ output_attentions=output_attentions,
1544
+ output_hidden_states=output_hidden_states,
1545
+ output_router_logits=output_router_logits,
1546
+ return_dict=return_dict,
1547
+ **kwargs,
1548
+ )
1549
+
1550
+ loss = None
1551
+ all_mtp_loss = None
1552
+ aux_loss = None
1553
+ hidden_states = outputs[0]
1554
+ logits = self.lm_head(hidden_states)
1555
+ logits = logits.float()
1556
+
1557
+ if labels is not None:
1558
+ loss = self.loss_function(logits, labels, self.config.vocab_size, **kwargs)
1559
+
1560
+ all_mtp_logits = None
1561
+ if self.num_nextn_predict_layers > 0:
1562
+ mtp_hidden_states = outputs.mtp_hidden_states
1563
+ shift_labels_mtp = None
1564
+ for i in range(self.num_nextn_predict_layers):
1565
+ mtp_hidden_states = mtp_hidden_states[i]
1566
+ mtp_logits = self.lm_head(mtp_hidden_states).float()
1567
+ if all_mtp_logits is None:
1568
+ all_mtp_logits = []
1569
+ all_mtp_logits.append(mtp_logits)
1570
+ if labels is not None:
1571
+ if shift_labels_mtp is None:
1572
+ shift_labels_mtp = labels.clone()
1573
+ shift_labels_mtp, _ = roll_tensor(shift_labels_mtp, shifts=-1, dims=-1, fill_value=-100)
1574
+ mtp_logits_ = mtp_logits.view(-1, self.config.vocab_size)
1575
+ mtp_loss = self.loss_function(
1576
+ mtp_logits_, shift_labels_mtp.to(mtp_logits_.device).view(-1), self.config.vocab_size, **kwargs
1577
+ )
1578
+ if loss is not None:
1579
+ loss += self.mtp_loss_scaling_factor * mtp_loss
1580
+ else:
1581
+ loss = self.mtp_loss_scaling_factor * mtp_loss
1582
+
1583
+ if all_mtp_loss is None:
1584
+ all_mtp_loss = []
1585
+ all_mtp_loss.append(mtp_loss)
1586
+
1587
+ if not return_dict:
1588
+ output = (logits,) + outputs[1:]
1589
+ if output_router_logits:
1590
+ output = (aux_loss,) + output
1591
+ return (loss,) + output if loss is not None else output
1592
+
1593
+ return MoEV2_5CausalLMOutputWithPast(
1594
+ loss=loss,
1595
+ mtp_loss=all_mtp_loss,
1596
+ aux_loss=aux_loss,
1597
+ logits=logits,
1598
+ mtp_logits=all_mtp_logits,
1599
+ past_key_values=outputs.past_key_values,
1600
+ hidden_states=outputs.hidden_states,
1601
+ attentions=outputs.attentions,
1602
+ router_logits=outputs.router_logits,
1603
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|startoftext|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "[CLS]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "<|role_end|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "pad_token": {
24
+ "content": "<|endoftext|>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,2114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "156891": {
6
+ "content": "<|startoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "156892": {
14
+ "content": "<|endoftext|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "156893": {
22
+ "content": "[CLS]",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "156894": {
30
+ "content": "[gMASK]",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "156895": {
38
+ "content": "<|role_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "156896": {
46
+ "content": "<tool_call>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": false
52
+ },
53
+ "156897": {
54
+ "content": "</tool_call>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": false
60
+ },
61
+ "156898": {
62
+ "content": "<tool_response>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": false
68
+ },
69
+ "156899": {
70
+ "content": "</tool_response>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": false
76
+ },
77
+ "156900": {
78
+ "content": "<|fim_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "156901": {
86
+ "content": "<|fim_hole|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "156902": {
94
+ "content": "<|fim_end|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "156903": {
102
+ "content": "<think>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": false
108
+ },
109
+ "156904": {
110
+ "content": "</think>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": false
116
+ },
117
+ "156905": {
118
+ "content": "<|reserved_token_10|>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": true
124
+ },
125
+ "156906": {
126
+ "content": "<|reserved_token_11|>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": true
132
+ },
133
+ "156907": {
134
+ "content": "<|reserved_token_12|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": true
140
+ },
141
+ "156908": {
142
+ "content": "<|reserved_token_13|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": true
148
+ },
149
+ "156909": {
150
+ "content": "<|reserved_token_14|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": true
156
+ },
157
+ "156910": {
158
+ "content": "<|reserved_token_15|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": true
164
+ },
165
+ "156911": {
166
+ "content": "<|reserved_token_16|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": true
172
+ },
173
+ "156912": {
174
+ "content": "<|reserved_token_17|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": true
180
+ },
181
+ "156913": {
182
+ "content": "<|reserved_token_18|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
+ },
189
+ "156914": {
190
+ "content": "<|reserved_token_19|>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": true
196
+ },
197
+ "156915": {
198
+ "content": "<|reserved_token_20|>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": true
204
+ },
205
+ "156916": {
206
+ "content": "<|reserved_token_21|>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": true
212
+ },
213
+ "156917": {
214
+ "content": "<|reserved_token_22|>",
215
+ "lstrip": false,
216
+ "normalized": false,
217
+ "rstrip": false,
218
+ "single_word": false,
219
+ "special": true
220
+ },
221
+ "156918": {
222
+ "content": "<|reserved_token_23|>",
223
+ "lstrip": false,
224
+ "normalized": false,
225
+ "rstrip": false,
226
+ "single_word": false,
227
+ "special": true
228
+ },
229
+ "156919": {
230
+ "content": "<|reserved_token_24|>",
231
+ "lstrip": false,
232
+ "normalized": false,
233
+ "rstrip": false,
234
+ "single_word": false,
235
+ "special": true
236
+ },
237
+ "156920": {
238
+ "content": "<|reserved_token_25|>",
239
+ "lstrip": false,
240
+ "normalized": false,
241
+ "rstrip": false,
242
+ "single_word": false,
243
+ "special": true
244
+ },
245
+ "156921": {
246
+ "content": "<|reserved_token_26|>",
247
+ "lstrip": false,
248
+ "normalized": false,
249
+ "rstrip": false,
250
+ "single_word": false,
251
+ "special": true
252
+ },
253
+ "156922": {
254
+ "content": "<|reserved_token_27|>",
255
+ "lstrip": false,
256
+ "normalized": false,
257
+ "rstrip": false,
258
+ "single_word": false,
259
+ "special": true
260
+ },
261
+ "156923": {
262
+ "content": "<|reserved_token_28|>",
263
+ "lstrip": false,
264
+ "normalized": false,
265
+ "rstrip": false,
266
+ "single_word": false,
267
+ "special": true
268
+ },
269
+ "156924": {
270
+ "content": "<|reserved_token_29|>",
271
+ "lstrip": false,
272
+ "normalized": false,
273
+ "rstrip": false,
274
+ "single_word": false,
275
+ "special": true
276
+ },
277
+ "156925": {
278
+ "content": "<|reserved_token_30|>",
279
+ "lstrip": false,
280
+ "normalized": false,
281
+ "rstrip": false,
282
+ "single_word": false,
283
+ "special": true
284
+ },
285
+ "156926": {
286
+ "content": "<|reserved_token_31|>",
287
+ "lstrip": false,
288
+ "normalized": false,
289
+ "rstrip": false,
290
+ "single_word": false,
291
+ "special": true
292
+ },
293
+ "156927": {
294
+ "content": "<|reserved_token_32|>",
295
+ "lstrip": false,
296
+ "normalized": false,
297
+ "rstrip": false,
298
+ "single_word": false,
299
+ "special": true
300
+ },
301
+ "156928": {
302
+ "content": "<|reserved_token_33|>",
303
+ "lstrip": false,
304
+ "normalized": false,
305
+ "rstrip": false,
306
+ "single_word": false,
307
+ "special": true
308
+ },
309
+ "156929": {
310
+ "content": "<|reserved_token_34|>",
311
+ "lstrip": false,
312
+ "normalized": false,
313
+ "rstrip": false,
314
+ "single_word": false,
315
+ "special": true
316
+ },
317
+ "156930": {
318
+ "content": "<|reserved_token_35|>",
319
+ "lstrip": false,
320
+ "normalized": false,
321
+ "rstrip": false,
322
+ "single_word": false,
323
+ "special": true
324
+ },
325
+ "156931": {
326
+ "content": "<|reserved_token_36|>",
327
+ "lstrip": false,
328
+ "normalized": false,
329
+ "rstrip": false,
330
+ "single_word": false,
331
+ "special": true
332
+ },
333
+ "156932": {
334
+ "content": "<|reserved_token_37|>",
335
+ "lstrip": false,
336
+ "normalized": false,
337
+ "rstrip": false,
338
+ "single_word": false,
339
+ "special": true
340
+ },
341
+ "156933": {
342
+ "content": "<|reserved_token_38|>",
343
+ "lstrip": false,
344
+ "normalized": false,
345
+ "rstrip": false,
346
+ "single_word": false,
347
+ "special": true
348
+ },
349
+ "156934": {
350
+ "content": "<|reserved_token_39|>",
351
+ "lstrip": false,
352
+ "normalized": false,
353
+ "rstrip": false,
354
+ "single_word": false,
355
+ "special": true
356
+ },
357
+ "156935": {
358
+ "content": "<|reserved_token_40|>",
359
+ "lstrip": false,
360
+ "normalized": false,
361
+ "rstrip": false,
362
+ "single_word": false,
363
+ "special": true
364
+ },
365
+ "156936": {
366
+ "content": "<|reserved_token_41|>",
367
+ "lstrip": false,
368
+ "normalized": false,
369
+ "rstrip": false,
370
+ "single_word": false,
371
+ "special": true
372
+ },
373
+ "156937": {
374
+ "content": "<|reserved_token_42|>",
375
+ "lstrip": false,
376
+ "normalized": false,
377
+ "rstrip": false,
378
+ "single_word": false,
379
+ "special": true
380
+ },
381
+ "156938": {
382
+ "content": "<|reserved_token_43|>",
383
+ "lstrip": false,
384
+ "normalized": false,
385
+ "rstrip": false,
386
+ "single_word": false,
387
+ "special": true
388
+ },
389
+ "156939": {
390
+ "content": "<|reserved_token_44|>",
391
+ "lstrip": false,
392
+ "normalized": false,
393
+ "rstrip": false,
394
+ "single_word": false,
395
+ "special": true
396
+ },
397
+ "156940": {
398
+ "content": "<|reserved_token_45|>",
399
+ "lstrip": false,
400
+ "normalized": false,
401
+ "rstrip": false,
402
+ "single_word": false,
403
+ "special": true
404
+ },
405
+ "156941": {
406
+ "content": "<|reserved_token_46|>",
407
+ "lstrip": false,
408
+ "normalized": false,
409
+ "rstrip": false,
410
+ "single_word": false,
411
+ "special": true
412
+ },
413
+ "156942": {
414
+ "content": "<|reserved_token_47|>",
415
+ "lstrip": false,
416
+ "normalized": false,
417
+ "rstrip": false,
418
+ "single_word": false,
419
+ "special": true
420
+ },
421
+ "156943": {
422
+ "content": "<|reserved_token_48|>",
423
+ "lstrip": false,
424
+ "normalized": false,
425
+ "rstrip": false,
426
+ "single_word": false,
427
+ "special": true
428
+ },
429
+ "156944": {
430
+ "content": "<|reserved_token_49|>",
431
+ "lstrip": false,
432
+ "normalized": false,
433
+ "rstrip": false,
434
+ "single_word": false,
435
+ "special": true
436
+ },
437
+ "156945": {
438
+ "content": "<|reserved_token_50|>",
439
+ "lstrip": false,
440
+ "normalized": false,
441
+ "rstrip": false,
442
+ "single_word": false,
443
+ "special": true
444
+ },
445
+ "156946": {
446
+ "content": "<|reserved_token_51|>",
447
+ "lstrip": false,
448
+ "normalized": false,
449
+ "rstrip": false,
450
+ "single_word": false,
451
+ "special": true
452
+ },
453
+ "156947": {
454
+ "content": "<|reserved_token_52|>",
455
+ "lstrip": false,
456
+ "normalized": false,
457
+ "rstrip": false,
458
+ "single_word": false,
459
+ "special": true
460
+ },
461
+ "156948": {
462
+ "content": "<|reserved_token_53|>",
463
+ "lstrip": false,
464
+ "normalized": false,
465
+ "rstrip": false,
466
+ "single_word": false,
467
+ "special": true
468
+ },
469
+ "156949": {
470
+ "content": "<|reserved_token_54|>",
471
+ "lstrip": false,
472
+ "normalized": false,
473
+ "rstrip": false,
474
+ "single_word": false,
475
+ "special": true
476
+ },
477
+ "156950": {
478
+ "content": "<|reserved_token_55|>",
479
+ "lstrip": false,
480
+ "normalized": false,
481
+ "rstrip": false,
482
+ "single_word": false,
483
+ "special": true
484
+ },
485
+ "156951": {
486
+ "content": "<|reserved_token_56|>",
487
+ "lstrip": false,
488
+ "normalized": false,
489
+ "rstrip": false,
490
+ "single_word": false,
491
+ "special": true
492
+ },
493
+ "156952": {
494
+ "content": "<|reserved_token_57|>",
495
+ "lstrip": false,
496
+ "normalized": false,
497
+ "rstrip": false,
498
+ "single_word": false,
499
+ "special": true
500
+ },
501
+ "156953": {
502
+ "content": "<|reserved_token_58|>",
503
+ "lstrip": false,
504
+ "normalized": false,
505
+ "rstrip": false,
506
+ "single_word": false,
507
+ "special": true
508
+ },
509
+ "156954": {
510
+ "content": "<|reserved_token_59|>",
511
+ "lstrip": false,
512
+ "normalized": false,
513
+ "rstrip": false,
514
+ "single_word": false,
515
+ "special": true
516
+ },
517
+ "156955": {
518
+ "content": "<|reserved_token_60|>",
519
+ "lstrip": false,
520
+ "normalized": false,
521
+ "rstrip": false,
522
+ "single_word": false,
523
+ "special": true
524
+ },
525
+ "156956": {
526
+ "content": "<|reserved_token_61|>",
527
+ "lstrip": false,
528
+ "normalized": false,
529
+ "rstrip": false,
530
+ "single_word": false,
531
+ "special": true
532
+ },
533
+ "156957": {
534
+ "content": "<|reserved_token_62|>",
535
+ "lstrip": false,
536
+ "normalized": false,
537
+ "rstrip": false,
538
+ "single_word": false,
539
+ "special": true
540
+ },
541
+ "156958": {
542
+ "content": "<|reserved_token_63|>",
543
+ "lstrip": false,
544
+ "normalized": false,
545
+ "rstrip": false,
546
+ "single_word": false,
547
+ "special": true
548
+ },
549
+ "156959": {
550
+ "content": "<|reserved_token_64|>",
551
+ "lstrip": false,
552
+ "normalized": false,
553
+ "rstrip": false,
554
+ "single_word": false,
555
+ "special": true
556
+ },
557
+ "156960": {
558
+ "content": "<|reserved_token_65|>",
559
+ "lstrip": false,
560
+ "normalized": false,
561
+ "rstrip": false,
562
+ "single_word": false,
563
+ "special": true
564
+ },
565
+ "156961": {
566
+ "content": "<|reserved_token_66|>",
567
+ "lstrip": false,
568
+ "normalized": false,
569
+ "rstrip": false,
570
+ "single_word": false,
571
+ "special": true
572
+ },
573
+ "156962": {
574
+ "content": "<|reserved_token_67|>",
575
+ "lstrip": false,
576
+ "normalized": false,
577
+ "rstrip": false,
578
+ "single_word": false,
579
+ "special": true
580
+ },
581
+ "156963": {
582
+ "content": "<|reserved_token_68|>",
583
+ "lstrip": false,
584
+ "normalized": false,
585
+ "rstrip": false,
586
+ "single_word": false,
587
+ "special": true
588
+ },
589
+ "156964": {
590
+ "content": "<|reserved_token_69|>",
591
+ "lstrip": false,
592
+ "normalized": false,
593
+ "rstrip": false,
594
+ "single_word": false,
595
+ "special": true
596
+ },
597
+ "156965": {
598
+ "content": "<|reserved_token_70|>",
599
+ "lstrip": false,
600
+ "normalized": false,
601
+ "rstrip": false,
602
+ "single_word": false,
603
+ "special": true
604
+ },
605
+ "156966": {
606
+ "content": "<|reserved_token_71|>",
607
+ "lstrip": false,
608
+ "normalized": false,
609
+ "rstrip": false,
610
+ "single_word": false,
611
+ "special": true
612
+ },
613
+ "156967": {
614
+ "content": "<|reserved_token_72|>",
615
+ "lstrip": false,
616
+ "normalized": false,
617
+ "rstrip": false,
618
+ "single_word": false,
619
+ "special": true
620
+ },
621
+ "156968": {
622
+ "content": "<|reserved_token_73|>",
623
+ "lstrip": false,
624
+ "normalized": false,
625
+ "rstrip": false,
626
+ "single_word": false,
627
+ "special": true
628
+ },
629
+ "156969": {
630
+ "content": "<|reserved_token_74|>",
631
+ "lstrip": false,
632
+ "normalized": false,
633
+ "rstrip": false,
634
+ "single_word": false,
635
+ "special": true
636
+ },
637
+ "156970": {
638
+ "content": "<|reserved_token_75|>",
639
+ "lstrip": false,
640
+ "normalized": false,
641
+ "rstrip": false,
642
+ "single_word": false,
643
+ "special": true
644
+ },
645
+ "156971": {
646
+ "content": "<|reserved_token_76|>",
647
+ "lstrip": false,
648
+ "normalized": false,
649
+ "rstrip": false,
650
+ "single_word": false,
651
+ "special": true
652
+ },
653
+ "156972": {
654
+ "content": "<|reserved_token_77|>",
655
+ "lstrip": false,
656
+ "normalized": false,
657
+ "rstrip": false,
658
+ "single_word": false,
659
+ "special": true
660
+ },
661
+ "156973": {
662
+ "content": "<|reserved_token_78|>",
663
+ "lstrip": false,
664
+ "normalized": false,
665
+ "rstrip": false,
666
+ "single_word": false,
667
+ "special": true
668
+ },
669
+ "156974": {
670
+ "content": "<|reserved_token_79|>",
671
+ "lstrip": false,
672
+ "normalized": false,
673
+ "rstrip": false,
674
+ "single_word": false,
675
+ "special": true
676
+ },
677
+ "156975": {
678
+ "content": "<|reserved_token_80|>",
679
+ "lstrip": false,
680
+ "normalized": false,
681
+ "rstrip": false,
682
+ "single_word": false,
683
+ "special": true
684
+ },
685
+ "156976": {
686
+ "content": "<|reserved_token_81|>",
687
+ "lstrip": false,
688
+ "normalized": false,
689
+ "rstrip": false,
690
+ "single_word": false,
691
+ "special": true
692
+ },
693
+ "156977": {
694
+ "content": "<|reserved_token_82|>",
695
+ "lstrip": false,
696
+ "normalized": false,
697
+ "rstrip": false,
698
+ "single_word": false,
699
+ "special": true
700
+ },
701
+ "156978": {
702
+ "content": "<|reserved_token_83|>",
703
+ "lstrip": false,
704
+ "normalized": false,
705
+ "rstrip": false,
706
+ "single_word": false,
707
+ "special": true
708
+ },
709
+ "156979": {
710
+ "content": "<|reserved_token_84|>",
711
+ "lstrip": false,
712
+ "normalized": false,
713
+ "rstrip": false,
714
+ "single_word": false,
715
+ "special": true
716
+ },
717
+ "156980": {
718
+ "content": "<|reserved_token_85|>",
719
+ "lstrip": false,
720
+ "normalized": false,
721
+ "rstrip": false,
722
+ "single_word": false,
723
+ "special": true
724
+ },
725
+ "156981": {
726
+ "content": "<|reserved_token_86|>",
727
+ "lstrip": false,
728
+ "normalized": false,
729
+ "rstrip": false,
730
+ "single_word": false,
731
+ "special": true
732
+ },
733
+ "156982": {
734
+ "content": "<|reserved_token_87|>",
735
+ "lstrip": false,
736
+ "normalized": false,
737
+ "rstrip": false,
738
+ "single_word": false,
739
+ "special": true
740
+ },
741
+ "156983": {
742
+ "content": "<|reserved_token_88|>",
743
+ "lstrip": false,
744
+ "normalized": false,
745
+ "rstrip": false,
746
+ "single_word": false,
747
+ "special": true
748
+ },
749
+ "156984": {
750
+ "content": "<|reserved_token_89|>",
751
+ "lstrip": false,
752
+ "normalized": false,
753
+ "rstrip": false,
754
+ "single_word": false,
755
+ "special": true
756
+ },
757
+ "156985": {
758
+ "content": "<|reserved_token_90|>",
759
+ "lstrip": false,
760
+ "normalized": false,
761
+ "rstrip": false,
762
+ "single_word": false,
763
+ "special": true
764
+ },
765
+ "156986": {
766
+ "content": "<|reserved_token_91|>",
767
+ "lstrip": false,
768
+ "normalized": false,
769
+ "rstrip": false,
770
+ "single_word": false,
771
+ "special": true
772
+ },
773
+ "156987": {
774
+ "content": "<|reserved_token_92|>",
775
+ "lstrip": false,
776
+ "normalized": false,
777
+ "rstrip": false,
778
+ "single_word": false,
779
+ "special": true
780
+ },
781
+ "156988": {
782
+ "content": "<|reserved_token_93|>",
783
+ "lstrip": false,
784
+ "normalized": false,
785
+ "rstrip": false,
786
+ "single_word": false,
787
+ "special": true
788
+ },
789
+ "156989": {
790
+ "content": "<|reserved_token_94|>",
791
+ "lstrip": false,
792
+ "normalized": false,
793
+ "rstrip": false,
794
+ "single_word": false,
795
+ "special": true
796
+ },
797
+ "156990": {
798
+ "content": "<|reserved_token_95|>",
799
+ "lstrip": false,
800
+ "normalized": false,
801
+ "rstrip": false,
802
+ "single_word": false,
803
+ "special": true
804
+ },
805
+ "156991": {
806
+ "content": "<|reserved_token_96|>",
807
+ "lstrip": false,
808
+ "normalized": false,
809
+ "rstrip": false,
810
+ "single_word": false,
811
+ "special": true
812
+ },
813
+ "156992": {
814
+ "content": "<|reserved_token_97|>",
815
+ "lstrip": false,
816
+ "normalized": false,
817
+ "rstrip": false,
818
+ "single_word": false,
819
+ "special": true
820
+ },
821
+ "156993": {
822
+ "content": "<|reserved_token_98|>",
823
+ "lstrip": false,
824
+ "normalized": false,
825
+ "rstrip": false,
826
+ "single_word": false,
827
+ "special": true
828
+ },
829
+ "156994": {
830
+ "content": "<|reserved_token_99|>",
831
+ "lstrip": false,
832
+ "normalized": false,
833
+ "rstrip": false,
834
+ "single_word": false,
835
+ "special": true
836
+ },
837
+ "156995": {
838
+ "content": "<|reserved_token_100|>",
839
+ "lstrip": false,
840
+ "normalized": false,
841
+ "rstrip": false,
842
+ "single_word": false,
843
+ "special": true
844
+ },
845
+ "156996": {
846
+ "content": "<|reserved_token_101|>",
847
+ "lstrip": false,
848
+ "normalized": false,
849
+ "rstrip": false,
850
+ "single_word": false,
851
+ "special": true
852
+ },
853
+ "156997": {
854
+ "content": "<|reserved_token_102|>",
855
+ "lstrip": false,
856
+ "normalized": false,
857
+ "rstrip": false,
858
+ "single_word": false,
859
+ "special": true
860
+ },
861
+ "156998": {
862
+ "content": "<|reserved_token_103|>",
863
+ "lstrip": false,
864
+ "normalized": false,
865
+ "rstrip": false,
866
+ "single_word": false,
867
+ "special": true
868
+ },
869
+ "156999": {
870
+ "content": "<|reserved_token_104|>",
871
+ "lstrip": false,
872
+ "normalized": false,
873
+ "rstrip": false,
874
+ "single_word": false,
875
+ "special": true
876
+ },
877
+ "157000": {
878
+ "content": "<|reserved_token_105|>",
879
+ "lstrip": false,
880
+ "normalized": false,
881
+ "rstrip": false,
882
+ "single_word": false,
883
+ "special": true
884
+ },
885
+ "157001": {
886
+ "content": "<|reserved_token_106|>",
887
+ "lstrip": false,
888
+ "normalized": false,
889
+ "rstrip": false,
890
+ "single_word": false,
891
+ "special": true
892
+ },
893
+ "157002": {
894
+ "content": "<|reserved_token_107|>",
895
+ "lstrip": false,
896
+ "normalized": false,
897
+ "rstrip": false,
898
+ "single_word": false,
899
+ "special": true
900
+ },
901
+ "157003": {
902
+ "content": "<|reserved_token_108|>",
903
+ "lstrip": false,
904
+ "normalized": false,
905
+ "rstrip": false,
906
+ "single_word": false,
907
+ "special": true
908
+ },
909
+ "157004": {
910
+ "content": "<|reserved_token_109|>",
911
+ "lstrip": false,
912
+ "normalized": false,
913
+ "rstrip": false,
914
+ "single_word": false,
915
+ "special": true
916
+ },
917
+ "157005": {
918
+ "content": "<|reserved_token_110|>",
919
+ "lstrip": false,
920
+ "normalized": false,
921
+ "rstrip": false,
922
+ "single_word": false,
923
+ "special": true
924
+ },
925
+ "157006": {
926
+ "content": "<|reserved_token_111|>",
927
+ "lstrip": false,
928
+ "normalized": false,
929
+ "rstrip": false,
930
+ "single_word": false,
931
+ "special": true
932
+ },
933
+ "157007": {
934
+ "content": "<|reserved_token_112|>",
935
+ "lstrip": false,
936
+ "normalized": false,
937
+ "rstrip": false,
938
+ "single_word": false,
939
+ "special": true
940
+ },
941
+ "157008": {
942
+ "content": "<|reserved_token_113|>",
943
+ "lstrip": false,
944
+ "normalized": false,
945
+ "rstrip": false,
946
+ "single_word": false,
947
+ "special": true
948
+ },
949
+ "157009": {
950
+ "content": "<|reserved_token_114|>",
951
+ "lstrip": false,
952
+ "normalized": false,
953
+ "rstrip": false,
954
+ "single_word": false,
955
+ "special": true
956
+ },
957
+ "157010": {
958
+ "content": "<|reserved_token_115|>",
959
+ "lstrip": false,
960
+ "normalized": false,
961
+ "rstrip": false,
962
+ "single_word": false,
963
+ "special": true
964
+ },
965
+ "157011": {
966
+ "content": "<|reserved_token_116|>",
967
+ "lstrip": false,
968
+ "normalized": false,
969
+ "rstrip": false,
970
+ "single_word": false,
971
+ "special": true
972
+ },
973
+ "157012": {
974
+ "content": "<|reserved_token_117|>",
975
+ "lstrip": false,
976
+ "normalized": false,
977
+ "rstrip": false,
978
+ "single_word": false,
979
+ "special": true
980
+ },
981
+ "157013": {
982
+ "content": "<|reserved_token_118|>",
983
+ "lstrip": false,
984
+ "normalized": false,
985
+ "rstrip": false,
986
+ "single_word": false,
987
+ "special": true
988
+ },
989
+ "157014": {
990
+ "content": "<|reserved_token_119|>",
991
+ "lstrip": false,
992
+ "normalized": false,
993
+ "rstrip": false,
994
+ "single_word": false,
995
+ "special": true
996
+ },
997
+ "157015": {
998
+ "content": "<|reserved_token_120|>",
999
+ "lstrip": false,
1000
+ "normalized": false,
1001
+ "rstrip": false,
1002
+ "single_word": false,
1003
+ "special": true
1004
+ },
1005
+ "157016": {
1006
+ "content": "<|reserved_token_121|>",
1007
+ "lstrip": false,
1008
+ "normalized": false,
1009
+ "rstrip": false,
1010
+ "single_word": false,
1011
+ "special": true
1012
+ },
1013
+ "157017": {
1014
+ "content": "<|reserved_token_122|>",
1015
+ "lstrip": false,
1016
+ "normalized": false,
1017
+ "rstrip": false,
1018
+ "single_word": false,
1019
+ "special": true
1020
+ },
1021
+ "157018": {
1022
+ "content": "<|reserved_token_123|>",
1023
+ "lstrip": false,
1024
+ "normalized": false,
1025
+ "rstrip": false,
1026
+ "single_word": false,
1027
+ "special": true
1028
+ },
1029
+ "157019": {
1030
+ "content": "<|reserved_token_124|>",
1031
+ "lstrip": false,
1032
+ "normalized": false,
1033
+ "rstrip": false,
1034
+ "single_word": false,
1035
+ "special": true
1036
+ },
1037
+ "157020": {
1038
+ "content": "<|reserved_token_125|>",
1039
+ "lstrip": false,
1040
+ "normalized": false,
1041
+ "rstrip": false,
1042
+ "single_word": false,
1043
+ "special": true
1044
+ },
1045
+ "157021": {
1046
+ "content": "<|reserved_token_126|>",
1047
+ "lstrip": false,
1048
+ "normalized": false,
1049
+ "rstrip": false,
1050
+ "single_word": false,
1051
+ "special": true
1052
+ },
1053
+ "157022": {
1054
+ "content": "<|reserved_token_127|>",
1055
+ "lstrip": false,
1056
+ "normalized": false,
1057
+ "rstrip": false,
1058
+ "single_word": false,
1059
+ "special": true
1060
+ },
1061
+ "157023": {
1062
+ "content": "<|reserved_token_128|>",
1063
+ "lstrip": false,
1064
+ "normalized": false,
1065
+ "rstrip": false,
1066
+ "single_word": false,
1067
+ "special": true
1068
+ },
1069
+ "157024": {
1070
+ "content": "<|reserved_token_129|>",
1071
+ "lstrip": false,
1072
+ "normalized": false,
1073
+ "rstrip": false,
1074
+ "single_word": false,
1075
+ "special": true
1076
+ },
1077
+ "157025": {
1078
+ "content": "<|reserved_token_130|>",
1079
+ "lstrip": false,
1080
+ "normalized": false,
1081
+ "rstrip": false,
1082
+ "single_word": false,
1083
+ "special": true
1084
+ },
1085
+ "157026": {
1086
+ "content": "<|reserved_token_131|>",
1087
+ "lstrip": false,
1088
+ "normalized": false,
1089
+ "rstrip": false,
1090
+ "single_word": false,
1091
+ "special": true
1092
+ },
1093
+ "157027": {
1094
+ "content": "<|reserved_token_132|>",
1095
+ "lstrip": false,
1096
+ "normalized": false,
1097
+ "rstrip": false,
1098
+ "single_word": false,
1099
+ "special": true
1100
+ },
1101
+ "157028": {
1102
+ "content": "<|reserved_token_133|>",
1103
+ "lstrip": false,
1104
+ "normalized": false,
1105
+ "rstrip": false,
1106
+ "single_word": false,
1107
+ "special": true
1108
+ },
1109
+ "157029": {
1110
+ "content": "<|reserved_token_134|>",
1111
+ "lstrip": false,
1112
+ "normalized": false,
1113
+ "rstrip": false,
1114
+ "single_word": false,
1115
+ "special": true
1116
+ },
1117
+ "157030": {
1118
+ "content": "<|reserved_token_135|>",
1119
+ "lstrip": false,
1120
+ "normalized": false,
1121
+ "rstrip": false,
1122
+ "single_word": false,
1123
+ "special": true
1124
+ },
1125
+ "157031": {
1126
+ "content": "<|reserved_token_136|>",
1127
+ "lstrip": false,
1128
+ "normalized": false,
1129
+ "rstrip": false,
1130
+ "single_word": false,
1131
+ "special": true
1132
+ },
1133
+ "157032": {
1134
+ "content": "<|reserved_token_137|>",
1135
+ "lstrip": false,
1136
+ "normalized": false,
1137
+ "rstrip": false,
1138
+ "single_word": false,
1139
+ "special": true
1140
+ },
1141
+ "157033": {
1142
+ "content": "<|reserved_token_138|>",
1143
+ "lstrip": false,
1144
+ "normalized": false,
1145
+ "rstrip": false,
1146
+ "single_word": false,
1147
+ "special": true
1148
+ },
1149
+ "157034": {
1150
+ "content": "<|reserved_token_139|>",
1151
+ "lstrip": false,
1152
+ "normalized": false,
1153
+ "rstrip": false,
1154
+ "single_word": false,
1155
+ "special": true
1156
+ },
1157
+ "157035": {
1158
+ "content": "<|reserved_token_140|>",
1159
+ "lstrip": false,
1160
+ "normalized": false,
1161
+ "rstrip": false,
1162
+ "single_word": false,
1163
+ "special": true
1164
+ },
1165
+ "157036": {
1166
+ "content": "<|reserved_token_141|>",
1167
+ "lstrip": false,
1168
+ "normalized": false,
1169
+ "rstrip": false,
1170
+ "single_word": false,
1171
+ "special": true
1172
+ },
1173
+ "157037": {
1174
+ "content": "<|reserved_token_142|>",
1175
+ "lstrip": false,
1176
+ "normalized": false,
1177
+ "rstrip": false,
1178
+ "single_word": false,
1179
+ "special": true
1180
+ },
1181
+ "157038": {
1182
+ "content": "<|reserved_token_143|>",
1183
+ "lstrip": false,
1184
+ "normalized": false,
1185
+ "rstrip": false,
1186
+ "single_word": false,
1187
+ "special": true
1188
+ },
1189
+ "157039": {
1190
+ "content": "<|reserved_token_144|>",
1191
+ "lstrip": false,
1192
+ "normalized": false,
1193
+ "rstrip": false,
1194
+ "single_word": false,
1195
+ "special": true
1196
+ },
1197
+ "157040": {
1198
+ "content": "<|reserved_token_145|>",
1199
+ "lstrip": false,
1200
+ "normalized": false,
1201
+ "rstrip": false,
1202
+ "single_word": false,
1203
+ "special": true
1204
+ },
1205
+ "157041": {
1206
+ "content": "<|reserved_token_146|>",
1207
+ "lstrip": false,
1208
+ "normalized": false,
1209
+ "rstrip": false,
1210
+ "single_word": false,
1211
+ "special": true
1212
+ },
1213
+ "157042": {
1214
+ "content": "<|reserved_token_147|>",
1215
+ "lstrip": false,
1216
+ "normalized": false,
1217
+ "rstrip": false,
1218
+ "single_word": false,
1219
+ "special": true
1220
+ },
1221
+ "157043": {
1222
+ "content": "<|reserved_token_148|>",
1223
+ "lstrip": false,
1224
+ "normalized": false,
1225
+ "rstrip": false,
1226
+ "single_word": false,
1227
+ "special": true
1228
+ },
1229
+ "157044": {
1230
+ "content": "<|reserved_token_149|>",
1231
+ "lstrip": false,
1232
+ "normalized": false,
1233
+ "rstrip": false,
1234
+ "single_word": false,
1235
+ "special": true
1236
+ },
1237
+ "157045": {
1238
+ "content": "<|reserved_token_150|>",
1239
+ "lstrip": false,
1240
+ "normalized": false,
1241
+ "rstrip": false,
1242
+ "single_word": false,
1243
+ "special": true
1244
+ },
1245
+ "157046": {
1246
+ "content": "<|reserved_token_151|>",
1247
+ "lstrip": false,
1248
+ "normalized": false,
1249
+ "rstrip": false,
1250
+ "single_word": false,
1251
+ "special": true
1252
+ },
1253
+ "157047": {
1254
+ "content": "<|reserved_token_152|>",
1255
+ "lstrip": false,
1256
+ "normalized": false,
1257
+ "rstrip": false,
1258
+ "single_word": false,
1259
+ "special": true
1260
+ },
1261
+ "157048": {
1262
+ "content": "<|reserved_token_153|>",
1263
+ "lstrip": false,
1264
+ "normalized": false,
1265
+ "rstrip": false,
1266
+ "single_word": false,
1267
+ "special": true
1268
+ },
1269
+ "157049": {
1270
+ "content": "<|reserved_token_154|>",
1271
+ "lstrip": false,
1272
+ "normalized": false,
1273
+ "rstrip": false,
1274
+ "single_word": false,
1275
+ "special": true
1276
+ },
1277
+ "157050": {
1278
+ "content": "<|reserved_token_155|>",
1279
+ "lstrip": false,
1280
+ "normalized": false,
1281
+ "rstrip": false,
1282
+ "single_word": false,
1283
+ "special": true
1284
+ },
1285
+ "157051": {
1286
+ "content": "<|reserved_token_156|>",
1287
+ "lstrip": false,
1288
+ "normalized": false,
1289
+ "rstrip": false,
1290
+ "single_word": false,
1291
+ "special": true
1292
+ },
1293
+ "157052": {
1294
+ "content": "<|reserved_token_157|>",
1295
+ "lstrip": false,
1296
+ "normalized": false,
1297
+ "rstrip": false,
1298
+ "single_word": false,
1299
+ "special": true
1300
+ },
1301
+ "157053": {
1302
+ "content": "<|reserved_token_158|>",
1303
+ "lstrip": false,
1304
+ "normalized": false,
1305
+ "rstrip": false,
1306
+ "single_word": false,
1307
+ "special": true
1308
+ },
1309
+ "157054": {
1310
+ "content": "<|reserved_token_159|>",
1311
+ "lstrip": false,
1312
+ "normalized": false,
1313
+ "rstrip": false,
1314
+ "single_word": false,
1315
+ "special": true
1316
+ },
1317
+ "157055": {
1318
+ "content": "<|reserved_token_160|>",
1319
+ "lstrip": false,
1320
+ "normalized": false,
1321
+ "rstrip": false,
1322
+ "single_word": false,
1323
+ "special": true
1324
+ },
1325
+ "157056": {
1326
+ "content": "<|reserved_token_161|>",
1327
+ "lstrip": false,
1328
+ "normalized": false,
1329
+ "rstrip": false,
1330
+ "single_word": false,
1331
+ "special": true
1332
+ },
1333
+ "157057": {
1334
+ "content": "<|reserved_token_162|>",
1335
+ "lstrip": false,
1336
+ "normalized": false,
1337
+ "rstrip": false,
1338
+ "single_word": false,
1339
+ "special": true
1340
+ },
1341
+ "157058": {
1342
+ "content": "<|reserved_token_163|>",
1343
+ "lstrip": false,
1344
+ "normalized": false,
1345
+ "rstrip": false,
1346
+ "single_word": false,
1347
+ "special": true
1348
+ },
1349
+ "157059": {
1350
+ "content": "<|reserved_token_164|>",
1351
+ "lstrip": false,
1352
+ "normalized": false,
1353
+ "rstrip": false,
1354
+ "single_word": false,
1355
+ "special": true
1356
+ },
1357
+ "157060": {
1358
+ "content": "<|reserved_token_165|>",
1359
+ "lstrip": false,
1360
+ "normalized": false,
1361
+ "rstrip": false,
1362
+ "single_word": false,
1363
+ "special": true
1364
+ },
1365
+ "157061": {
1366
+ "content": "<|reserved_token_166|>",
1367
+ "lstrip": false,
1368
+ "normalized": false,
1369
+ "rstrip": false,
1370
+ "single_word": false,
1371
+ "special": true
1372
+ },
1373
+ "157062": {
1374
+ "content": "<|reserved_token_167|>",
1375
+ "lstrip": false,
1376
+ "normalized": false,
1377
+ "rstrip": false,
1378
+ "single_word": false,
1379
+ "special": true
1380
+ },
1381
+ "157063": {
1382
+ "content": "<|reserved_token_168|>",
1383
+ "lstrip": false,
1384
+ "normalized": false,
1385
+ "rstrip": false,
1386
+ "single_word": false,
1387
+ "special": true
1388
+ },
1389
+ "157064": {
1390
+ "content": "<|reserved_token_169|>",
1391
+ "lstrip": false,
1392
+ "normalized": false,
1393
+ "rstrip": false,
1394
+ "single_word": false,
1395
+ "special": true
1396
+ },
1397
+ "157065": {
1398
+ "content": "<|reserved_token_170|>",
1399
+ "lstrip": false,
1400
+ "normalized": false,
1401
+ "rstrip": false,
1402
+ "single_word": false,
1403
+ "special": true
1404
+ },
1405
+ "157066": {
1406
+ "content": "<|reserved_token_171|>",
1407
+ "lstrip": false,
1408
+ "normalized": false,
1409
+ "rstrip": false,
1410
+ "single_word": false,
1411
+ "special": true
1412
+ },
1413
+ "157067": {
1414
+ "content": "<|reserved_token_172|>",
1415
+ "lstrip": false,
1416
+ "normalized": false,
1417
+ "rstrip": false,
1418
+ "single_word": false,
1419
+ "special": true
1420
+ },
1421
+ "157068": {
1422
+ "content": "<|reserved_token_173|>",
1423
+ "lstrip": false,
1424
+ "normalized": false,
1425
+ "rstrip": false,
1426
+ "single_word": false,
1427
+ "special": true
1428
+ },
1429
+ "157069": {
1430
+ "content": "<|reserved_token_174|>",
1431
+ "lstrip": false,
1432
+ "normalized": false,
1433
+ "rstrip": false,
1434
+ "single_word": false,
1435
+ "special": true
1436
+ },
1437
+ "157070": {
1438
+ "content": "<|reserved_token_175|>",
1439
+ "lstrip": false,
1440
+ "normalized": false,
1441
+ "rstrip": false,
1442
+ "single_word": false,
1443
+ "special": true
1444
+ },
1445
+ "157071": {
1446
+ "content": "<|reserved_token_176|>",
1447
+ "lstrip": false,
1448
+ "normalized": false,
1449
+ "rstrip": false,
1450
+ "single_word": false,
1451
+ "special": true
1452
+ },
1453
+ "157072": {
1454
+ "content": "<|reserved_token_177|>",
1455
+ "lstrip": false,
1456
+ "normalized": false,
1457
+ "rstrip": false,
1458
+ "single_word": false,
1459
+ "special": true
1460
+ },
1461
+ "157073": {
1462
+ "content": "<|reserved_token_178|>",
1463
+ "lstrip": false,
1464
+ "normalized": false,
1465
+ "rstrip": false,
1466
+ "single_word": false,
1467
+ "special": true
1468
+ },
1469
+ "157074": {
1470
+ "content": "<|reserved_token_179|>",
1471
+ "lstrip": false,
1472
+ "normalized": false,
1473
+ "rstrip": false,
1474
+ "single_word": false,
1475
+ "special": true
1476
+ },
1477
+ "157075": {
1478
+ "content": "<|reserved_token_180|>",
1479
+ "lstrip": false,
1480
+ "normalized": false,
1481
+ "rstrip": false,
1482
+ "single_word": false,
1483
+ "special": true
1484
+ },
1485
+ "157076": {
1486
+ "content": "<|reserved_token_181|>",
1487
+ "lstrip": false,
1488
+ "normalized": false,
1489
+ "rstrip": false,
1490
+ "single_word": false,
1491
+ "special": true
1492
+ },
1493
+ "157077": {
1494
+ "content": "<|reserved_token_182|>",
1495
+ "lstrip": false,
1496
+ "normalized": false,
1497
+ "rstrip": false,
1498
+ "single_word": false,
1499
+ "special": true
1500
+ },
1501
+ "157078": {
1502
+ "content": "<|reserved_token_183|>",
1503
+ "lstrip": false,
1504
+ "normalized": false,
1505
+ "rstrip": false,
1506
+ "single_word": false,
1507
+ "special": true
1508
+ },
1509
+ "157079": {
1510
+ "content": "<|reserved_token_184|>",
1511
+ "lstrip": false,
1512
+ "normalized": false,
1513
+ "rstrip": false,
1514
+ "single_word": false,
1515
+ "special": true
1516
+ },
1517
+ "157080": {
1518
+ "content": "<|reserved_token_185|>",
1519
+ "lstrip": false,
1520
+ "normalized": false,
1521
+ "rstrip": false,
1522
+ "single_word": false,
1523
+ "special": true
1524
+ },
1525
+ "157081": {
1526
+ "content": "<|reserved_token_186|>",
1527
+ "lstrip": false,
1528
+ "normalized": false,
1529
+ "rstrip": false,
1530
+ "single_word": false,
1531
+ "special": true
1532
+ },
1533
+ "157082": {
1534
+ "content": "<|reserved_token_187|>",
1535
+ "lstrip": false,
1536
+ "normalized": false,
1537
+ "rstrip": false,
1538
+ "single_word": false,
1539
+ "special": true
1540
+ },
1541
+ "157083": {
1542
+ "content": "<|reserved_token_188|>",
1543
+ "lstrip": false,
1544
+ "normalized": false,
1545
+ "rstrip": false,
1546
+ "single_word": false,
1547
+ "special": true
1548
+ },
1549
+ "157084": {
1550
+ "content": "<|reserved_token_189|>",
1551
+ "lstrip": false,
1552
+ "normalized": false,
1553
+ "rstrip": false,
1554
+ "single_word": false,
1555
+ "special": true
1556
+ },
1557
+ "157085": {
1558
+ "content": "<|reserved_token_190|>",
1559
+ "lstrip": false,
1560
+ "normalized": false,
1561
+ "rstrip": false,
1562
+ "single_word": false,
1563
+ "special": true
1564
+ },
1565
+ "157086": {
1566
+ "content": "<|reserved_token_191|>",
1567
+ "lstrip": false,
1568
+ "normalized": false,
1569
+ "rstrip": false,
1570
+ "single_word": false,
1571
+ "special": true
1572
+ },
1573
+ "157087": {
1574
+ "content": "<|reserved_token_192|>",
1575
+ "lstrip": false,
1576
+ "normalized": false,
1577
+ "rstrip": false,
1578
+ "single_word": false,
1579
+ "special": true
1580
+ },
1581
+ "157088": {
1582
+ "content": "<|reserved_token_193|>",
1583
+ "lstrip": false,
1584
+ "normalized": false,
1585
+ "rstrip": false,
1586
+ "single_word": false,
1587
+ "special": true
1588
+ },
1589
+ "157089": {
1590
+ "content": "<|reserved_token_194|>",
1591
+ "lstrip": false,
1592
+ "normalized": false,
1593
+ "rstrip": false,
1594
+ "single_word": false,
1595
+ "special": true
1596
+ },
1597
+ "157090": {
1598
+ "content": "<|reserved_token_195|>",
1599
+ "lstrip": false,
1600
+ "normalized": false,
1601
+ "rstrip": false,
1602
+ "single_word": false,
1603
+ "special": true
1604
+ },
1605
+ "157091": {
1606
+ "content": "<|reserved_token_196|>",
1607
+ "lstrip": false,
1608
+ "normalized": false,
1609
+ "rstrip": false,
1610
+ "single_word": false,
1611
+ "special": true
1612
+ },
1613
+ "157092": {
1614
+ "content": "<|reserved_token_197|>",
1615
+ "lstrip": false,
1616
+ "normalized": false,
1617
+ "rstrip": false,
1618
+ "single_word": false,
1619
+ "special": true
1620
+ },
1621
+ "157093": {
1622
+ "content": "<|reserved_token_198|>",
1623
+ "lstrip": false,
1624
+ "normalized": false,
1625
+ "rstrip": false,
1626
+ "single_word": false,
1627
+ "special": true
1628
+ },
1629
+ "157094": {
1630
+ "content": "<|reserved_token_199|>",
1631
+ "lstrip": false,
1632
+ "normalized": false,
1633
+ "rstrip": false,
1634
+ "single_word": false,
1635
+ "special": true
1636
+ },
1637
+ "157095": {
1638
+ "content": "<|reserved_token_200|>",
1639
+ "lstrip": false,
1640
+ "normalized": false,
1641
+ "rstrip": false,
1642
+ "single_word": false,
1643
+ "special": true
1644
+ },
1645
+ "157096": {
1646
+ "content": "<|reserved_token_201|>",
1647
+ "lstrip": false,
1648
+ "normalized": false,
1649
+ "rstrip": false,
1650
+ "single_word": false,
1651
+ "special": true
1652
+ },
1653
+ "157097": {
1654
+ "content": "<|reserved_token_202|>",
1655
+ "lstrip": false,
1656
+ "normalized": false,
1657
+ "rstrip": false,
1658
+ "single_word": false,
1659
+ "special": true
1660
+ },
1661
+ "157098": {
1662
+ "content": "<|reserved_token_203|>",
1663
+ "lstrip": false,
1664
+ "normalized": false,
1665
+ "rstrip": false,
1666
+ "single_word": false,
1667
+ "special": true
1668
+ },
1669
+ "157099": {
1670
+ "content": "<|reserved_token_204|>",
1671
+ "lstrip": false,
1672
+ "normalized": false,
1673
+ "rstrip": false,
1674
+ "single_word": false,
1675
+ "special": true
1676
+ },
1677
+ "157100": {
1678
+ "content": "<|reserved_token_205|>",
1679
+ "lstrip": false,
1680
+ "normalized": false,
1681
+ "rstrip": false,
1682
+ "single_word": false,
1683
+ "special": true
1684
+ },
1685
+ "157101": {
1686
+ "content": "<|reserved_token_206|>",
1687
+ "lstrip": false,
1688
+ "normalized": false,
1689
+ "rstrip": false,
1690
+ "single_word": false,
1691
+ "special": true
1692
+ },
1693
+ "157102": {
1694
+ "content": "<|reserved_token_207|>",
1695
+ "lstrip": false,
1696
+ "normalized": false,
1697
+ "rstrip": false,
1698
+ "single_word": false,
1699
+ "special": true
1700
+ },
1701
+ "157103": {
1702
+ "content": "<|reserved_token_208|>",
1703
+ "lstrip": false,
1704
+ "normalized": false,
1705
+ "rstrip": false,
1706
+ "single_word": false,
1707
+ "special": true
1708
+ },
1709
+ "157104": {
1710
+ "content": "<|reserved_token_209|>",
1711
+ "lstrip": false,
1712
+ "normalized": false,
1713
+ "rstrip": false,
1714
+ "single_word": false,
1715
+ "special": true
1716
+ },
1717
+ "157105": {
1718
+ "content": "<|reserved_token_210|>",
1719
+ "lstrip": false,
1720
+ "normalized": false,
1721
+ "rstrip": false,
1722
+ "single_word": false,
1723
+ "special": true
1724
+ },
1725
+ "157106": {
1726
+ "content": "<|reserved_token_211|>",
1727
+ "lstrip": false,
1728
+ "normalized": false,
1729
+ "rstrip": false,
1730
+ "single_word": false,
1731
+ "special": true
1732
+ },
1733
+ "157107": {
1734
+ "content": "<|reserved_token_212|>",
1735
+ "lstrip": false,
1736
+ "normalized": false,
1737
+ "rstrip": false,
1738
+ "single_word": false,
1739
+ "special": true
1740
+ },
1741
+ "157108": {
1742
+ "content": "<|reserved_token_213|>",
1743
+ "lstrip": false,
1744
+ "normalized": false,
1745
+ "rstrip": false,
1746
+ "single_word": false,
1747
+ "special": true
1748
+ },
1749
+ "157109": {
1750
+ "content": "<|reserved_token_214|>",
1751
+ "lstrip": false,
1752
+ "normalized": false,
1753
+ "rstrip": false,
1754
+ "single_word": false,
1755
+ "special": true
1756
+ },
1757
+ "157110": {
1758
+ "content": "<|reserved_token_215|>",
1759
+ "lstrip": false,
1760
+ "normalized": false,
1761
+ "rstrip": false,
1762
+ "single_word": false,
1763
+ "special": true
1764
+ },
1765
+ "157111": {
1766
+ "content": "<|reserved_token_216|>",
1767
+ "lstrip": false,
1768
+ "normalized": false,
1769
+ "rstrip": false,
1770
+ "single_word": false,
1771
+ "special": true
1772
+ },
1773
+ "157112": {
1774
+ "content": "<|reserved_token_217|>",
1775
+ "lstrip": false,
1776
+ "normalized": false,
1777
+ "rstrip": false,
1778
+ "single_word": false,
1779
+ "special": true
1780
+ },
1781
+ "157113": {
1782
+ "content": "<|reserved_token_218|>",
1783
+ "lstrip": false,
1784
+ "normalized": false,
1785
+ "rstrip": false,
1786
+ "single_word": false,
1787
+ "special": true
1788
+ },
1789
+ "157114": {
1790
+ "content": "<|reserved_token_219|>",
1791
+ "lstrip": false,
1792
+ "normalized": false,
1793
+ "rstrip": false,
1794
+ "single_word": false,
1795
+ "special": true
1796
+ },
1797
+ "157115": {
1798
+ "content": "<|reserved_token_220|>",
1799
+ "lstrip": false,
1800
+ "normalized": false,
1801
+ "rstrip": false,
1802
+ "single_word": false,
1803
+ "special": true
1804
+ },
1805
+ "157116": {
1806
+ "content": "<|reserved_token_221|>",
1807
+ "lstrip": false,
1808
+ "normalized": false,
1809
+ "rstrip": false,
1810
+ "single_word": false,
1811
+ "special": true
1812
+ },
1813
+ "157117": {
1814
+ "content": "<|reserved_token_222|>",
1815
+ "lstrip": false,
1816
+ "normalized": false,
1817
+ "rstrip": false,
1818
+ "single_word": false,
1819
+ "special": true
1820
+ },
1821
+ "157118": {
1822
+ "content": "<|reserved_token_223|>",
1823
+ "lstrip": false,
1824
+ "normalized": false,
1825
+ "rstrip": false,
1826
+ "single_word": false,
1827
+ "special": true
1828
+ },
1829
+ "157119": {
1830
+ "content": "<|reserved_token_224|>",
1831
+ "lstrip": false,
1832
+ "normalized": false,
1833
+ "rstrip": false,
1834
+ "single_word": false,
1835
+ "special": true
1836
+ },
1837
+ "157120": {
1838
+ "content": "<|reserved_token_225|>",
1839
+ "lstrip": false,
1840
+ "normalized": false,
1841
+ "rstrip": false,
1842
+ "single_word": false,
1843
+ "special": true
1844
+ },
1845
+ "157121": {
1846
+ "content": "<|reserved_token_226|>",
1847
+ "lstrip": false,
1848
+ "normalized": false,
1849
+ "rstrip": false,
1850
+ "single_word": false,
1851
+ "special": true
1852
+ },
1853
+ "157122": {
1854
+ "content": "<|reserved_token_227|>",
1855
+ "lstrip": false,
1856
+ "normalized": false,
1857
+ "rstrip": false,
1858
+ "single_word": false,
1859
+ "special": true
1860
+ },
1861
+ "157123": {
1862
+ "content": "<|reserved_token_228|>",
1863
+ "lstrip": false,
1864
+ "normalized": false,
1865
+ "rstrip": false,
1866
+ "single_word": false,
1867
+ "special": true
1868
+ },
1869
+ "157124": {
1870
+ "content": "<|reserved_token_229|>",
1871
+ "lstrip": false,
1872
+ "normalized": false,
1873
+ "rstrip": false,
1874
+ "single_word": false,
1875
+ "special": true
1876
+ },
1877
+ "157125": {
1878
+ "content": "<|reserved_token_230|>",
1879
+ "lstrip": false,
1880
+ "normalized": false,
1881
+ "rstrip": false,
1882
+ "single_word": false,
1883
+ "special": true
1884
+ },
1885
+ "157126": {
1886
+ "content": "<|reserved_token_231|>",
1887
+ "lstrip": false,
1888
+ "normalized": false,
1889
+ "rstrip": false,
1890
+ "single_word": false,
1891
+ "special": true
1892
+ },
1893
+ "157127": {
1894
+ "content": "<|reserved_token_232|>",
1895
+ "lstrip": false,
1896
+ "normalized": false,
1897
+ "rstrip": false,
1898
+ "single_word": false,
1899
+ "special": true
1900
+ },
1901
+ "157128": {
1902
+ "content": "<|reserved_token_233|>",
1903
+ "lstrip": false,
1904
+ "normalized": false,
1905
+ "rstrip": false,
1906
+ "single_word": false,
1907
+ "special": true
1908
+ },
1909
+ "157129": {
1910
+ "content": "<|reserved_token_234|>",
1911
+ "lstrip": false,
1912
+ "normalized": false,
1913
+ "rstrip": false,
1914
+ "single_word": false,
1915
+ "special": true
1916
+ },
1917
+ "157130": {
1918
+ "content": "<|reserved_token_235|>",
1919
+ "lstrip": false,
1920
+ "normalized": false,
1921
+ "rstrip": false,
1922
+ "single_word": false,
1923
+ "special": true
1924
+ },
1925
+ "157131": {
1926
+ "content": "<|reserved_token_236|>",
1927
+ "lstrip": false,
1928
+ "normalized": false,
1929
+ "rstrip": false,
1930
+ "single_word": false,
1931
+ "special": true
1932
+ },
1933
+ "157132": {
1934
+ "content": "<|reserved_token_237|>",
1935
+ "lstrip": false,
1936
+ "normalized": false,
1937
+ "rstrip": false,
1938
+ "single_word": false,
1939
+ "special": true
1940
+ },
1941
+ "157133": {
1942
+ "content": "<|reserved_token_238|>",
1943
+ "lstrip": false,
1944
+ "normalized": false,
1945
+ "rstrip": false,
1946
+ "single_word": false,
1947
+ "special": true
1948
+ },
1949
+ "157134": {
1950
+ "content": "<|reserved_token_239|>",
1951
+ "lstrip": false,
1952
+ "normalized": false,
1953
+ "rstrip": false,
1954
+ "single_word": false,
1955
+ "special": true
1956
+ },
1957
+ "157135": {
1958
+ "content": "<|reserved_token_240|>",
1959
+ "lstrip": false,
1960
+ "normalized": false,
1961
+ "rstrip": false,
1962
+ "single_word": false,
1963
+ "special": true
1964
+ },
1965
+ "157136": {
1966
+ "content": "<|reserved_token_241|>",
1967
+ "lstrip": false,
1968
+ "normalized": false,
1969
+ "rstrip": false,
1970
+ "single_word": false,
1971
+ "special": true
1972
+ },
1973
+ "157137": {
1974
+ "content": "<|reserved_token_242|>",
1975
+ "lstrip": false,
1976
+ "normalized": false,
1977
+ "rstrip": false,
1978
+ "single_word": false,
1979
+ "special": true
1980
+ },
1981
+ "157138": {
1982
+ "content": "<|reserved_token_243|>",
1983
+ "lstrip": false,
1984
+ "normalized": false,
1985
+ "rstrip": false,
1986
+ "single_word": false,
1987
+ "special": true
1988
+ },
1989
+ "157139": {
1990
+ "content": "<|reserved_token_244|>",
1991
+ "lstrip": false,
1992
+ "normalized": false,
1993
+ "rstrip": false,
1994
+ "single_word": false,
1995
+ "special": true
1996
+ },
1997
+ "157140": {
1998
+ "content": "<|reserved_token_245|>",
1999
+ "lstrip": false,
2000
+ "normalized": false,
2001
+ "rstrip": false,
2002
+ "single_word": false,
2003
+ "special": true
2004
+ },
2005
+ "157141": {
2006
+ "content": "<|reserved_token_246|>",
2007
+ "lstrip": false,
2008
+ "normalized": false,
2009
+ "rstrip": false,
2010
+ "single_word": false,
2011
+ "special": true
2012
+ },
2013
+ "157142": {
2014
+ "content": "<|reserved_token_247|>",
2015
+ "lstrip": false,
2016
+ "normalized": false,
2017
+ "rstrip": false,
2018
+ "single_word": false,
2019
+ "special": true
2020
+ },
2021
+ "157143": {
2022
+ "content": "<|reserved_token_248|>",
2023
+ "lstrip": false,
2024
+ "normalized": false,
2025
+ "rstrip": false,
2026
+ "single_word": false,
2027
+ "special": true
2028
+ },
2029
+ "157144": {
2030
+ "content": "<|reserved_token_249|>",
2031
+ "lstrip": false,
2032
+ "normalized": false,
2033
+ "rstrip": false,
2034
+ "single_word": false,
2035
+ "special": true
2036
+ },
2037
+ "157145": {
2038
+ "content": "<|reserved_token_250|>",
2039
+ "lstrip": false,
2040
+ "normalized": false,
2041
+ "rstrip": false,
2042
+ "single_word": false,
2043
+ "special": true
2044
+ },
2045
+ "157146": {
2046
+ "content": "<|reserved_token_251|>",
2047
+ "lstrip": false,
2048
+ "normalized": false,
2049
+ "rstrip": false,
2050
+ "single_word": false,
2051
+ "special": true
2052
+ },
2053
+ "157147": {
2054
+ "content": "<|reserved_token_252|>",
2055
+ "lstrip": false,
2056
+ "normalized": false,
2057
+ "rstrip": false,
2058
+ "single_word": false,
2059
+ "special": true
2060
+ },
2061
+ "157148": {
2062
+ "content": "<|reserved_token_253|>",
2063
+ "lstrip": false,
2064
+ "normalized": false,
2065
+ "rstrip": false,
2066
+ "single_word": false,
2067
+ "special": true
2068
+ },
2069
+ "157149": {
2070
+ "content": "<|reserved_token_254|>",
2071
+ "lstrip": false,
2072
+ "normalized": false,
2073
+ "rstrip": false,
2074
+ "single_word": false,
2075
+ "special": true
2076
+ },
2077
+ "157150": {
2078
+ "content": "<|reserved_token_255|>",
2079
+ "lstrip": false,
2080
+ "normalized": false,
2081
+ "rstrip": false,
2082
+ "single_word": false,
2083
+ "special": true
2084
+ },
2085
+ "157151": {
2086
+ "content": "<role>",
2087
+ "lstrip": false,
2088
+ "normalized": false,
2089
+ "rstrip": false,
2090
+ "single_word": false,
2091
+ "special": true
2092
+ },
2093
+ "157152": {
2094
+ "content": "</role>",
2095
+ "lstrip": false,
2096
+ "normalized": false,
2097
+ "rstrip": false,
2098
+ "single_word": false,
2099
+ "special": true
2100
+ }
2101
+ },
2102
+ "bos_token": "<|startoftext|>",
2103
+ "chat_template": "{% set thinking_option = 'off' %}\n{{- '<role>SYSTEM</role>' }}\n{%- if tools %}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call>\\n\" }}\n {{- 'detailed thinking ' + thinking_option + '<|role_end|>' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {%- if 'detailed thinking on' in messages[0].content or 'detailed thinking off' in messages[0].content %}\n {{- messages[0].content + '<|role_end|>' }}\n {%- else %}\n {{- messages[0].content + '\\n' }}\n {{- 'detailed thinking ' + thinking_option + '<|role_end|>' }}\n {%- endif %}\n {% else %}\n {{- 'detailed thinking ' + thinking_option + '<|role_end|>' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if message.role == \"user\" %}\n {{- '<role>HUMAN</role>' + message.content + '<|role_end|>' }}\n {%- elif message.role == \"system\" and not loop.first %}\n {{- '<role>SYSTEM</role>' + message.content + '<|role_end|>' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if reasoning_content %}\n {{- '<role>ASSISTANT</role>' + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<role>ASSISTANT</role>' + content }}\n {%- endif %}\n {%- else %}\n {{- '<role>ASSISTANT</role>' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|role_end|>' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<role>OBSERVATION</role>' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|role_end|>' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<role>ASSISTANT</role>' }}\n{%- endif %}",
2104
+ "clean_up_tokenization_spaces": false,
2105
+ "cls_token": "[CLS]",
2106
+ "eos_token": "<|role_end|>",
2107
+ "fast_tokenizer": true,
2108
+ "gmask_token": "[gMASK]",
2109
+ "merges_file": null,
2110
+ "model_max_length": 1000000000000000019884624838656,
2111
+ "pad_token": "<|endoftext|>",
2112
+ "tokenizer_class": "PreTrainedTokenizerFast",
2113
+ "trust_remote_code": true
2114
+ }