Add files using upload-large-folder tool
Browse files- LTA_openwebtext_dualt/docs/lta_samples/metrics_20260517/train8_ode_decode_support_len256_cpu_uniform_now/allcorrupt/summary.json +3197 -0
- LTA_openwebtext_dualt/logs/selfcond_4gpu/lta_owt_gpt2cached_len1024_1gpu_rollout_return_base_diag_20260514_002906.log +103 -0
- LTA_openwebtext_dualt/logs/selfcond_4gpu/lta_owt_gpt2cached_len1024_selfcond_p05_autocastfix_smoke4gpu_20260514_005005.log +104 -0
- LTA_openwebtext_dualt/logs/selfcond_4gpu/lta_owt_gpt2cached_len1024_selfcond_p05_rollout1_autocastfix_c1024_ddit768x12_muon_ema_gbs512_4gpu_50k_20260514_005426.log +0 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/.lock +0 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/CACHEDIR.TAG +1 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/__init__.py +45 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/cli.py +128 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/core.py +605 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/intranges.py +55 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/__init__.py +27 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/configuration_laguna.py +168 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/modeling_laguna.py +759 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/modular_laguna.py +455 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/siglip/__init__.py +31 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/siglip/configuration_siglip.py +153 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/siglip/processing_siglip.py +28 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_015000.pt +3 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_023000.pt +3 -0
- LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_143000.pt +3 -0
LTA_openwebtext_dualt/docs/lta_samples/metrics_20260517/train8_ode_decode_support_len256_cpu_uniform_now/allcorrupt/summary.json
ADDED
|
@@ -0,0 +1,3197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checkpoint": "runs/train8_n256_compactv969_3l_bs512_hard_ce_allcorrupt/latest.pt",
|
| 3 |
+
"data_dir": "/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len256_train8_compact_overfit",
|
| 4 |
+
"max_len": 256,
|
| 5 |
+
"n_samples": 64,
|
| 6 |
+
"steps": 128,
|
| 7 |
+
"seed": 20314773,
|
| 8 |
+
"time_schedule": "uniform",
|
| 9 |
+
"time_logit_mean": -1.5,
|
| 10 |
+
"time_logit_std": 0.8,
|
| 11 |
+
"model_t_mode": "post",
|
| 12 |
+
"final_token_acc_mean": 0.33282470703125,
|
| 13 |
+
"final_token_acc_min": 0.0234375,
|
| 14 |
+
"final_token_acc_max": 0.6484375,
|
| 15 |
+
"final_exact_count": 0,
|
| 16 |
+
"final_best_ref_counts": [
|
| 17 |
+
7,
|
| 18 |
+
9,
|
| 19 |
+
5,
|
| 20 |
+
14,
|
| 21 |
+
3,
|
| 22 |
+
9,
|
| 23 |
+
10,
|
| 24 |
+
7
|
| 25 |
+
],
|
| 26 |
+
"lock_stats": {
|
| 27 |
+
"final_token_acc_mean": 0.33282470703125,
|
| 28 |
+
"final_exact_count": 0,
|
| 29 |
+
"final_best_ref": [
|
| 30 |
+
7,
|
| 31 |
+
7,
|
| 32 |
+
6,
|
| 33 |
+
5,
|
| 34 |
+
0,
|
| 35 |
+
2,
|
| 36 |
+
3,
|
| 37 |
+
6,
|
| 38 |
+
0,
|
| 39 |
+
1,
|
| 40 |
+
4,
|
| 41 |
+
1,
|
| 42 |
+
2,
|
| 43 |
+
7,
|
| 44 |
+
3,
|
| 45 |
+
7,
|
| 46 |
+
5,
|
| 47 |
+
3,
|
| 48 |
+
1,
|
| 49 |
+
7,
|
| 50 |
+
6,
|
| 51 |
+
1,
|
| 52 |
+
5,
|
| 53 |
+
0,
|
| 54 |
+
5,
|
| 55 |
+
1,
|
| 56 |
+
6,
|
| 57 |
+
5,
|
| 58 |
+
2,
|
| 59 |
+
1,
|
| 60 |
+
3,
|
| 61 |
+
3,
|
| 62 |
+
1,
|
| 63 |
+
3,
|
| 64 |
+
6,
|
| 65 |
+
3,
|
| 66 |
+
5,
|
| 67 |
+
0,
|
| 68 |
+
3,
|
| 69 |
+
2,
|
| 70 |
+
1,
|
| 71 |
+
3,
|
| 72 |
+
3,
|
| 73 |
+
5,
|
| 74 |
+
7,
|
| 75 |
+
6,
|
| 76 |
+
4,
|
| 77 |
+
6,
|
| 78 |
+
5,
|
| 79 |
+
0,
|
| 80 |
+
3,
|
| 81 |
+
3,
|
| 82 |
+
3,
|
| 83 |
+
6,
|
| 84 |
+
7,
|
| 85 |
+
3,
|
| 86 |
+
0,
|
| 87 |
+
6,
|
| 88 |
+
5,
|
| 89 |
+
6,
|
| 90 |
+
0,
|
| 91 |
+
4,
|
| 92 |
+
1,
|
| 93 |
+
2
|
| 94 |
+
],
|
| 95 |
+
"wrong_count_per_sample": [
|
| 96 |
+
196,
|
| 97 |
+
196,
|
| 98 |
+
115,
|
| 99 |
+
95,
|
| 100 |
+
233,
|
| 101 |
+
246,
|
| 102 |
+
121,
|
| 103 |
+
115,
|
| 104 |
+
193,
|
| 105 |
+
250,
|
| 106 |
+
246,
|
| 107 |
+
165,
|
| 108 |
+
224,
|
| 109 |
+
184,
|
| 110 |
+
239,
|
| 111 |
+
181,
|
| 112 |
+
95,
|
| 113 |
+
162,
|
| 114 |
+
183,
|
| 115 |
+
183,
|
| 116 |
+
149,
|
| 117 |
+
176,
|
| 118 |
+
101,
|
| 119 |
+
164,
|
| 120 |
+
122,
|
| 121 |
+
185,
|
| 122 |
+
115,
|
| 123 |
+
107,
|
| 124 |
+
246,
|
| 125 |
+
241,
|
| 126 |
+
172,
|
| 127 |
+
127,
|
| 128 |
+
239,
|
| 129 |
+
195,
|
| 130 |
+
113,
|
| 131 |
+
125,
|
| 132 |
+
90,
|
| 133 |
+
167,
|
| 134 |
+
206,
|
| 135 |
+
205,
|
| 136 |
+
184,
|
| 137 |
+
184,
|
| 138 |
+
110,
|
| 139 |
+
91,
|
| 140 |
+
207,
|
| 141 |
+
114,
|
| 142 |
+
236,
|
| 143 |
+
112,
|
| 144 |
+
137,
|
| 145 |
+
245,
|
| 146 |
+
106,
|
| 147 |
+
104,
|
| 148 |
+
141,
|
| 149 |
+
150,
|
| 150 |
+
173,
|
| 151 |
+
240,
|
| 152 |
+
237,
|
| 153 |
+
112,
|
| 154 |
+
91,
|
| 155 |
+
247,
|
| 156 |
+
160,
|
| 157 |
+
240,
|
| 158 |
+
200,
|
| 159 |
+
243
|
| 160 |
+
],
|
| 161 |
+
"wrong_state_lock_step": {
|
| 162 |
+
"n": 10931,
|
| 163 |
+
"min": 0.0,
|
| 164 |
+
"p25": 79.0,
|
| 165 |
+
"median": 118.0,
|
| 166 |
+
"p75": 127.0,
|
| 167 |
+
"max": 128.0,
|
| 168 |
+
"mean": 103.36181502149849
|
| 169 |
+
},
|
| 170 |
+
"wrong_endpoint_first_emit_step": {
|
| 171 |
+
"n": 10931,
|
| 172 |
+
"min": 1.0,
|
| 173 |
+
"p25": 18.5,
|
| 174 |
+
"median": 99.0,
|
| 175 |
+
"p75": 124.0,
|
| 176 |
+
"max": 128.0,
|
| 177 |
+
"mean": 77.59893879791419
|
| 178 |
+
},
|
| 179 |
+
"num_steps": 128
|
| 180 |
+
},
|
| 181 |
+
"snapshots": {
|
| 182 |
+
"1": {
|
| 183 |
+
"state_top_tokens": [
|
| 184 |
+
{
|
| 185 |
+
"id": 615,
|
| 186 |
+
"old_text": " remained",
|
| 187 |
+
"count": 35,
|
| 188 |
+
"mass": 0.00213623046875
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"id": 236,
|
| 192 |
+
"old_text": " New",
|
| 193 |
+
"count": 32,
|
| 194 |
+
"mass": 0.001953125
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"id": 359,
|
| 198 |
+
"old_text": " York",
|
| 199 |
+
"count": 31,
|
| 200 |
+
"mass": 0.00189208984375
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"id": 390,
|
| 204 |
+
"old_text": " Ge",
|
| 205 |
+
"count": 31,
|
| 206 |
+
"mass": 0.00189208984375
|
| 207 |
+
},
|
| 208 |
+
{
|
| 209 |
+
"id": 491,
|
| 210 |
+
"old_text": " etc",
|
| 211 |
+
"count": 29,
|
| 212 |
+
"mass": 0.00177001953125
|
| 213 |
+
}
|
| 214 |
+
],
|
| 215 |
+
"endpoint_top_tokens": [
|
| 216 |
+
{
|
| 217 |
+
"id": 3,
|
| 218 |
+
"old_text": ",",
|
| 219 |
+
"count": 1341,
|
| 220 |
+
"mass": 0.08184814453125
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"id": 34,
|
| 224 |
+
"old_text": "\\n",
|
| 225 |
+
"count": 884,
|
| 226 |
+
"mass": 0.053955078125
|
| 227 |
+
},
|
| 228 |
+
{
|
| 229 |
+
"id": 5,
|
| 230 |
+
"old_text": ".",
|
| 231 |
+
"count": 881,
|
| 232 |
+
"mass": 0.05377197265625
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"id": 40,
|
| 236 |
+
"old_text": " the",
|
| 237 |
+
"count": 648,
|
| 238 |
+
"mass": 0.03955078125
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"id": 52,
|
| 242 |
+
"old_text": " to",
|
| 243 |
+
"count": 405,
|
| 244 |
+
"mass": 0.02471923828125
|
| 245 |
+
}
|
| 246 |
+
],
|
| 247 |
+
"state_best_acc": [
|
| 248 |
+
0.00390625,
|
| 249 |
+
0.00390625,
|
| 250 |
+
0.00390625,
|
| 251 |
+
0.00390625,
|
| 252 |
+
0.00390625,
|
| 253 |
+
0.0078125,
|
| 254 |
+
0.00390625,
|
| 255 |
+
0.00390625,
|
| 256 |
+
0.00390625,
|
| 257 |
+
0.00390625,
|
| 258 |
+
0.00390625,
|
| 259 |
+
0.00390625,
|
| 260 |
+
0.00390625,
|
| 261 |
+
0.0078125,
|
| 262 |
+
0.00390625,
|
| 263 |
+
0.00390625,
|
| 264 |
+
0.00390625,
|
| 265 |
+
0.0078125,
|
| 266 |
+
0.00390625,
|
| 267 |
+
0.0,
|
| 268 |
+
0.0,
|
| 269 |
+
0.00390625,
|
| 270 |
+
0.00390625,
|
| 271 |
+
0.00390625,
|
| 272 |
+
0.00390625,
|
| 273 |
+
0.01171875,
|
| 274 |
+
0.0078125,
|
| 275 |
+
0.00390625,
|
| 276 |
+
0.00390625,
|
| 277 |
+
0.0078125,
|
| 278 |
+
0.00390625,
|
| 279 |
+
0.00390625,
|
| 280 |
+
0.00390625,
|
| 281 |
+
0.00390625,
|
| 282 |
+
0.00390625,
|
| 283 |
+
0.0078125,
|
| 284 |
+
0.00390625,
|
| 285 |
+
0.00390625,
|
| 286 |
+
0.00390625,
|
| 287 |
+
0.00390625,
|
| 288 |
+
0.0,
|
| 289 |
+
0.00390625,
|
| 290 |
+
0.0078125,
|
| 291 |
+
0.00390625,
|
| 292 |
+
0.00390625,
|
| 293 |
+
0.0,
|
| 294 |
+
0.0,
|
| 295 |
+
0.00390625,
|
| 296 |
+
0.00390625,
|
| 297 |
+
0.0078125,
|
| 298 |
+
0.00390625,
|
| 299 |
+
0.0,
|
| 300 |
+
0.0078125,
|
| 301 |
+
0.00390625,
|
| 302 |
+
0.00390625,
|
| 303 |
+
0.00390625,
|
| 304 |
+
0.00390625,
|
| 305 |
+
0.00390625,
|
| 306 |
+
0.0078125,
|
| 307 |
+
0.0,
|
| 308 |
+
0.00390625,
|
| 309 |
+
0.0078125,
|
| 310 |
+
0.00390625,
|
| 311 |
+
0.00390625
|
| 312 |
+
],
|
| 313 |
+
"endpoint_best_acc": [
|
| 314 |
+
0.07421875,
|
| 315 |
+
0.13671875,
|
| 316 |
+
0.31640625,
|
| 317 |
+
0.46484375,
|
| 318 |
+
0.265625,
|
| 319 |
+
0.1796875,
|
| 320 |
+
0.63671875,
|
| 321 |
+
0.58984375,
|
| 322 |
+
0.51953125,
|
| 323 |
+
0.37890625,
|
| 324 |
+
0.3984375,
|
| 325 |
+
0.1640625,
|
| 326 |
+
0.26171875,
|
| 327 |
+
0.078125,
|
| 328 |
+
0.171875,
|
| 329 |
+
0.234375,
|
| 330 |
+
0.26953125,
|
| 331 |
+
0.359375,
|
| 332 |
+
0.45703125,
|
| 333 |
+
0.140625,
|
| 334 |
+
0.19921875,
|
| 335 |
+
0.22265625,
|
| 336 |
+
0.27734375,
|
| 337 |
+
0.22265625,
|
| 338 |
+
0.125,
|
| 339 |
+
0.3671875,
|
| 340 |
+
0.46875,
|
| 341 |
+
0.4140625,
|
| 342 |
+
0.43359375,
|
| 343 |
+
0.203125,
|
| 344 |
+
0.28515625,
|
| 345 |
+
0.2265625,
|
| 346 |
+
0.16015625,
|
| 347 |
+
0.265625,
|
| 348 |
+
0.61328125,
|
| 349 |
+
0.6328125,
|
| 350 |
+
0.36328125,
|
| 351 |
+
0.41796875,
|
| 352 |
+
0.1640625,
|
| 353 |
+
0.15234375,
|
| 354 |
+
0.5078125,
|
| 355 |
+
0.109375,
|
| 356 |
+
0.07421875,
|
| 357 |
+
0.62890625,
|
| 358 |
+
0.36328125,
|
| 359 |
+
0.44140625,
|
| 360 |
+
0.1875,
|
| 361 |
+
0.453125,
|
| 362 |
+
0.0859375,
|
| 363 |
+
0.09375,
|
| 364 |
+
0.26953125,
|
| 365 |
+
0.24609375,
|
| 366 |
+
0.14453125,
|
| 367 |
+
0.16015625,
|
| 368 |
+
0.390625,
|
| 369 |
+
0.2890625,
|
| 370 |
+
0.109375,
|
| 371 |
+
0.4296875,
|
| 372 |
+
0.37890625,
|
| 373 |
+
0.26171875,
|
| 374 |
+
0.23828125,
|
| 375 |
+
0.26171875,
|
| 376 |
+
0.28125,
|
| 377 |
+
0.33984375
|
| 378 |
+
],
|
| 379 |
+
"state_best_ref": [
|
| 380 |
+
1,
|
| 381 |
+
2,
|
| 382 |
+
5,
|
| 383 |
+
5,
|
| 384 |
+
0,
|
| 385 |
+
7,
|
| 386 |
+
3,
|
| 387 |
+
7,
|
| 388 |
+
2,
|
| 389 |
+
1,
|
| 390 |
+
1,
|
| 391 |
+
0,
|
| 392 |
+
1,
|
| 393 |
+
7,
|
| 394 |
+
0,
|
| 395 |
+
3,
|
| 396 |
+
3,
|
| 397 |
+
3,
|
| 398 |
+
3,
|
| 399 |
+
0,
|
| 400 |
+
0,
|
| 401 |
+
1,
|
| 402 |
+
0,
|
| 403 |
+
6,
|
| 404 |
+
3,
|
| 405 |
+
1,
|
| 406 |
+
5,
|
| 407 |
+
4,
|
| 408 |
+
4,
|
| 409 |
+
0,
|
| 410 |
+
3,
|
| 411 |
+
1,
|
| 412 |
+
6,
|
| 413 |
+
1,
|
| 414 |
+
0,
|
| 415 |
+
3,
|
| 416 |
+
3,
|
| 417 |
+
0,
|
| 418 |
+
3,
|
| 419 |
+
2,
|
| 420 |
+
0,
|
| 421 |
+
2,
|
| 422 |
+
3,
|
| 423 |
+
0,
|
| 424 |
+
1,
|
| 425 |
+
0,
|
| 426 |
+
0,
|
| 427 |
+
1,
|
| 428 |
+
3,
|
| 429 |
+
3,
|
| 430 |
+
6,
|
| 431 |
+
0,
|
| 432 |
+
1,
|
| 433 |
+
7,
|
| 434 |
+
0,
|
| 435 |
+
7,
|
| 436 |
+
0,
|
| 437 |
+
2,
|
| 438 |
+
1,
|
| 439 |
+
0,
|
| 440 |
+
5,
|
| 441 |
+
6,
|
| 442 |
+
2,
|
| 443 |
+
1
|
| 444 |
+
],
|
| 445 |
+
"endpoint_best_ref": [
|
| 446 |
+
7,
|
| 447 |
+
7,
|
| 448 |
+
6,
|
| 449 |
+
5,
|
| 450 |
+
6,
|
| 451 |
+
0,
|
| 452 |
+
3,
|
| 453 |
+
6,
|
| 454 |
+
0,
|
| 455 |
+
5,
|
| 456 |
+
4,
|
| 457 |
+
1,
|
| 458 |
+
5,
|
| 459 |
+
6,
|
| 460 |
+
6,
|
| 461 |
+
7,
|
| 462 |
+
5,
|
| 463 |
+
6,
|
| 464 |
+
1,
|
| 465 |
+
1,
|
| 466 |
+
6,
|
| 467 |
+
1,
|
| 468 |
+
5,
|
| 469 |
+
1,
|
| 470 |
+
4,
|
| 471 |
+
1,
|
| 472 |
+
6,
|
| 473 |
+
5,
|
| 474 |
+
4,
|
| 475 |
+
7,
|
| 476 |
+
3,
|
| 477 |
+
3,
|
| 478 |
+
2,
|
| 479 |
+
1,
|
| 480 |
+
6,
|
| 481 |
+
3,
|
| 482 |
+
5,
|
| 483 |
+
0,
|
| 484 |
+
6,
|
| 485 |
+
2,
|
| 486 |
+
1,
|
| 487 |
+
4,
|
| 488 |
+
2,
|
| 489 |
+
5,
|
| 490 |
+
6,
|
| 491 |
+
6,
|
| 492 |
+
4,
|
| 493 |
+
6,
|
| 494 |
+
3,
|
| 495 |
+
4,
|
| 496 |
+
6,
|
| 497 |
+
0,
|
| 498 |
+
4,
|
| 499 |
+
6,
|
| 500 |
+
7,
|
| 501 |
+
2,
|
| 502 |
+
7,
|
| 503 |
+
6,
|
| 504 |
+
5,
|
| 505 |
+
2,
|
| 506 |
+
3,
|
| 507 |
+
4,
|
| 508 |
+
5,
|
| 509 |
+
4
|
| 510 |
+
]
|
| 511 |
+
},
|
| 512 |
+
"2": {
|
| 513 |
+
"state_top_tokens": [
|
| 514 |
+
{
|
| 515 |
+
"id": 615,
|
| 516 |
+
"old_text": " remained",
|
| 517 |
+
"count": 35,
|
| 518 |
+
"mass": 0.00213623046875
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"id": 236,
|
| 522 |
+
"old_text": " New",
|
| 523 |
+
"count": 32,
|
| 524 |
+
"mass": 0.001953125
|
| 525 |
+
},
|
| 526 |
+
{
|
| 527 |
+
"id": 359,
|
| 528 |
+
"old_text": " York",
|
| 529 |
+
"count": 31,
|
| 530 |
+
"mass": 0.00189208984375
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"id": 390,
|
| 534 |
+
"old_text": " Ge",
|
| 535 |
+
"count": 31,
|
| 536 |
+
"mass": 0.00189208984375
|
| 537 |
+
},
|
| 538 |
+
{
|
| 539 |
+
"id": 491,
|
| 540 |
+
"old_text": " etc",
|
| 541 |
+
"count": 29,
|
| 542 |
+
"mass": 0.00177001953125
|
| 543 |
+
}
|
| 544 |
+
],
|
| 545 |
+
"endpoint_top_tokens": [
|
| 546 |
+
{
|
| 547 |
+
"id": 3,
|
| 548 |
+
"old_text": ",",
|
| 549 |
+
"count": 1303,
|
| 550 |
+
"mass": 0.07952880859375
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"id": 5,
|
| 554 |
+
"old_text": ".",
|
| 555 |
+
"count": 865,
|
| 556 |
+
"mass": 0.05279541015625
|
| 557 |
+
},
|
| 558 |
+
{
|
| 559 |
+
"id": 34,
|
| 560 |
+
"old_text": "\\n",
|
| 561 |
+
"count": 848,
|
| 562 |
+
"mass": 0.0517578125
|
| 563 |
+
},
|
| 564 |
+
{
|
| 565 |
+
"id": 40,
|
| 566 |
+
"old_text": " the",
|
| 567 |
+
"count": 637,
|
| 568 |
+
"mass": 0.03887939453125
|
| 569 |
+
},
|
| 570 |
+
{
|
| 571 |
+
"id": 52,
|
| 572 |
+
"old_text": " to",
|
| 573 |
+
"count": 418,
|
| 574 |
+
"mass": 0.0255126953125
|
| 575 |
+
}
|
| 576 |
+
],
|
| 577 |
+
"state_best_acc": [
|
| 578 |
+
0.00390625,
|
| 579 |
+
0.00390625,
|
| 580 |
+
0.00390625,
|
| 581 |
+
0.00390625,
|
| 582 |
+
0.00390625,
|
| 583 |
+
0.0078125,
|
| 584 |
+
0.00390625,
|
| 585 |
+
0.00390625,
|
| 586 |
+
0.00390625,
|
| 587 |
+
0.00390625,
|
| 588 |
+
0.00390625,
|
| 589 |
+
0.00390625,
|
| 590 |
+
0.00390625,
|
| 591 |
+
0.0078125,
|
| 592 |
+
0.00390625,
|
| 593 |
+
0.00390625,
|
| 594 |
+
0.00390625,
|
| 595 |
+
0.0078125,
|
| 596 |
+
0.00390625,
|
| 597 |
+
0.0,
|
| 598 |
+
0.0,
|
| 599 |
+
0.00390625,
|
| 600 |
+
0.00390625,
|
| 601 |
+
0.00390625,
|
| 602 |
+
0.00390625,
|
| 603 |
+
0.01171875,
|
| 604 |
+
0.0078125,
|
| 605 |
+
0.00390625,
|
| 606 |
+
0.00390625,
|
| 607 |
+
0.0078125,
|
| 608 |
+
0.00390625,
|
| 609 |
+
0.00390625,
|
| 610 |
+
0.00390625,
|
| 611 |
+
0.00390625,
|
| 612 |
+
0.00390625,
|
| 613 |
+
0.0078125,
|
| 614 |
+
0.00390625,
|
| 615 |
+
0.00390625,
|
| 616 |
+
0.00390625,
|
| 617 |
+
0.00390625,
|
| 618 |
+
0.0,
|
| 619 |
+
0.00390625,
|
| 620 |
+
0.0078125,
|
| 621 |
+
0.00390625,
|
| 622 |
+
0.00390625,
|
| 623 |
+
0.0,
|
| 624 |
+
0.0,
|
| 625 |
+
0.00390625,
|
| 626 |
+
0.00390625,
|
| 627 |
+
0.0078125,
|
| 628 |
+
0.00390625,
|
| 629 |
+
0.0,
|
| 630 |
+
0.0078125,
|
| 631 |
+
0.00390625,
|
| 632 |
+
0.00390625,
|
| 633 |
+
0.00390625,
|
| 634 |
+
0.00390625,
|
| 635 |
+
0.00390625,
|
| 636 |
+
0.0078125,
|
| 637 |
+
0.0,
|
| 638 |
+
0.00390625,
|
| 639 |
+
0.0078125,
|
| 640 |
+
0.00390625,
|
| 641 |
+
0.00390625
|
| 642 |
+
],
|
| 643 |
+
"endpoint_best_acc": [
|
| 644 |
+
0.1015625,
|
| 645 |
+
0.203125,
|
| 646 |
+
0.3984375,
|
| 647 |
+
0.51953125,
|
| 648 |
+
0.3203125,
|
| 649 |
+
0.1171875,
|
| 650 |
+
0.640625,
|
| 651 |
+
0.62109375,
|
| 652 |
+
0.52734375,
|
| 653 |
+
0.375,
|
| 654 |
+
0.41796875,
|
| 655 |
+
0.21875,
|
| 656 |
+
0.203125,
|
| 657 |
+
0.1015625,
|
| 658 |
+
0.15234375,
|
| 659 |
+
0.21484375,
|
| 660 |
+
0.30859375,
|
| 661 |
+
0.3671875,
|
| 662 |
+
0.484375,
|
| 663 |
+
0.1640625,
|
| 664 |
+
0.1953125,
|
| 665 |
+
0.25,
|
| 666 |
+
0.29296875,
|
| 667 |
+
0.17578125,
|
| 668 |
+
0.15234375,
|
| 669 |
+
0.41796875,
|
| 670 |
+
0.53515625,
|
| 671 |
+
0.41796875,
|
| 672 |
+
0.4453125,
|
| 673 |
+
0.203125,
|
| 674 |
+
0.31640625,
|
| 675 |
+
0.2421875,
|
| 676 |
+
0.15625,
|
| 677 |
+
0.29296875,
|
| 678 |
+
0.640625,
|
| 679 |
+
0.6328125,
|
| 680 |
+
0.38671875,
|
| 681 |
+
0.48828125,
|
| 682 |
+
0.1328125,
|
| 683 |
+
0.1875,
|
| 684 |
+
0.5234375,
|
| 685 |
+
0.09375,
|
| 686 |
+
0.07421875,
|
| 687 |
+
0.65234375,
|
| 688 |
+
0.3515625,
|
| 689 |
+
0.51953125,
|
| 690 |
+
0.265625,
|
| 691 |
+
0.4921875,
|
| 692 |
+
0.078125,
|
| 693 |
+
0.125,
|
| 694 |
+
0.3359375,
|
| 695 |
+
0.2109375,
|
| 696 |
+
0.12890625,
|
| 697 |
+
0.171875,
|
| 698 |
+
0.42578125,
|
| 699 |
+
0.28125,
|
| 700 |
+
0.11328125,
|
| 701 |
+
0.453125,
|
| 702 |
+
0.4375,
|
| 703 |
+
0.24609375,
|
| 704 |
+
0.2578125,
|
| 705 |
+
0.31640625,
|
| 706 |
+
0.265625,
|
| 707 |
+
0.42578125
|
| 708 |
+
],
|
| 709 |
+
"state_best_ref": [
|
| 710 |
+
1,
|
| 711 |
+
2,
|
| 712 |
+
5,
|
| 713 |
+
5,
|
| 714 |
+
0,
|
| 715 |
+
7,
|
| 716 |
+
3,
|
| 717 |
+
7,
|
| 718 |
+
2,
|
| 719 |
+
1,
|
| 720 |
+
1,
|
| 721 |
+
0,
|
| 722 |
+
1,
|
| 723 |
+
7,
|
| 724 |
+
0,
|
| 725 |
+
3,
|
| 726 |
+
3,
|
| 727 |
+
3,
|
| 728 |
+
3,
|
| 729 |
+
0,
|
| 730 |
+
0,
|
| 731 |
+
1,
|
| 732 |
+
0,
|
| 733 |
+
6,
|
| 734 |
+
3,
|
| 735 |
+
1,
|
| 736 |
+
5,
|
| 737 |
+
4,
|
| 738 |
+
4,
|
| 739 |
+
0,
|
| 740 |
+
3,
|
| 741 |
+
1,
|
| 742 |
+
6,
|
| 743 |
+
1,
|
| 744 |
+
0,
|
| 745 |
+
3,
|
| 746 |
+
3,
|
| 747 |
+
0,
|
| 748 |
+
3,
|
| 749 |
+
2,
|
| 750 |
+
0,
|
| 751 |
+
2,
|
| 752 |
+
3,
|
| 753 |
+
0,
|
| 754 |
+
1,
|
| 755 |
+
0,
|
| 756 |
+
0,
|
| 757 |
+
1,
|
| 758 |
+
3,
|
| 759 |
+
3,
|
| 760 |
+
6,
|
| 761 |
+
0,
|
| 762 |
+
1,
|
| 763 |
+
7,
|
| 764 |
+
0,
|
| 765 |
+
7,
|
| 766 |
+
0,
|
| 767 |
+
2,
|
| 768 |
+
1,
|
| 769 |
+
0,
|
| 770 |
+
5,
|
| 771 |
+
6,
|
| 772 |
+
2,
|
| 773 |
+
1
|
| 774 |
+
],
|
| 775 |
+
"endpoint_best_ref": [
|
| 776 |
+
7,
|
| 777 |
+
7,
|
| 778 |
+
6,
|
| 779 |
+
5,
|
| 780 |
+
6,
|
| 781 |
+
0,
|
| 782 |
+
3,
|
| 783 |
+
6,
|
| 784 |
+
0,
|
| 785 |
+
5,
|
| 786 |
+
4,
|
| 787 |
+
1,
|
| 788 |
+
5,
|
| 789 |
+
4,
|
| 790 |
+
6,
|
| 791 |
+
7,
|
| 792 |
+
5,
|
| 793 |
+
6,
|
| 794 |
+
1,
|
| 795 |
+
1,
|
| 796 |
+
6,
|
| 797 |
+
1,
|
| 798 |
+
5,
|
| 799 |
+
1,
|
| 800 |
+
4,
|
| 801 |
+
1,
|
| 802 |
+
6,
|
| 803 |
+
5,
|
| 804 |
+
4,
|
| 805 |
+
7,
|
| 806 |
+
3,
|
| 807 |
+
3,
|
| 808 |
+
2,
|
| 809 |
+
1,
|
| 810 |
+
6,
|
| 811 |
+
3,
|
| 812 |
+
5,
|
| 813 |
+
0,
|
| 814 |
+
6,
|
| 815 |
+
2,
|
| 816 |
+
1,
|
| 817 |
+
6,
|
| 818 |
+
2,
|
| 819 |
+
5,
|
| 820 |
+
6,
|
| 821 |
+
6,
|
| 822 |
+
4,
|
| 823 |
+
6,
|
| 824 |
+
3,
|
| 825 |
+
0,
|
| 826 |
+
6,
|
| 827 |
+
0,
|
| 828 |
+
4,
|
| 829 |
+
6,
|
| 830 |
+
7,
|
| 831 |
+
2,
|
| 832 |
+
7,
|
| 833 |
+
6,
|
| 834 |
+
5,
|
| 835 |
+
2,
|
| 836 |
+
3,
|
| 837 |
+
4,
|
| 838 |
+
5,
|
| 839 |
+
4
|
| 840 |
+
]
|
| 841 |
+
},
|
| 842 |
+
"4": {
|
| 843 |
+
"state_top_tokens": [
|
| 844 |
+
{
|
| 845 |
+
"id": 615,
|
| 846 |
+
"old_text": " remained",
|
| 847 |
+
"count": 35,
|
| 848 |
+
"mass": 0.00213623046875
|
| 849 |
+
},
|
| 850 |
+
{
|
| 851 |
+
"id": 236,
|
| 852 |
+
"old_text": " New",
|
| 853 |
+
"count": 32,
|
| 854 |
+
"mass": 0.001953125
|
| 855 |
+
},
|
| 856 |
+
{
|
| 857 |
+
"id": 359,
|
| 858 |
+
"old_text": " York",
|
| 859 |
+
"count": 31,
|
| 860 |
+
"mass": 0.00189208984375
|
| 861 |
+
},
|
| 862 |
+
{
|
| 863 |
+
"id": 390,
|
| 864 |
+
"old_text": " Ge",
|
| 865 |
+
"count": 31,
|
| 866 |
+
"mass": 0.00189208984375
|
| 867 |
+
},
|
| 868 |
+
{
|
| 869 |
+
"id": 491,
|
| 870 |
+
"old_text": " etc",
|
| 871 |
+
"count": 29,
|
| 872 |
+
"mass": 0.00177001953125
|
| 873 |
+
}
|
| 874 |
+
],
|
| 875 |
+
"endpoint_top_tokens": [
|
| 876 |
+
{
|
| 877 |
+
"id": 3,
|
| 878 |
+
"old_text": ",",
|
| 879 |
+
"count": 1208,
|
| 880 |
+
"mass": 0.07373046875
|
| 881 |
+
},
|
| 882 |
+
{
|
| 883 |
+
"id": 5,
|
| 884 |
+
"old_text": ".",
|
| 885 |
+
"count": 855,
|
| 886 |
+
"mass": 0.05218505859375
|
| 887 |
+
},
|
| 888 |
+
{
|
| 889 |
+
"id": 34,
|
| 890 |
+
"old_text": "\\n",
|
| 891 |
+
"count": 782,
|
| 892 |
+
"mass": 0.0477294921875
|
| 893 |
+
},
|
| 894 |
+
{
|
| 895 |
+
"id": 40,
|
| 896 |
+
"old_text": " the",
|
| 897 |
+
"count": 646,
|
| 898 |
+
"mass": 0.0394287109375
|
| 899 |
+
},
|
| 900 |
+
{
|
| 901 |
+
"id": 52,
|
| 902 |
+
"old_text": " to",
|
| 903 |
+
"count": 381,
|
| 904 |
+
"mass": 0.02325439453125
|
| 905 |
+
}
|
| 906 |
+
],
|
| 907 |
+
"state_best_acc": [
|
| 908 |
+
0.00390625,
|
| 909 |
+
0.00390625,
|
| 910 |
+
0.00390625,
|
| 911 |
+
0.00390625,
|
| 912 |
+
0.00390625,
|
| 913 |
+
0.0078125,
|
| 914 |
+
0.00390625,
|
| 915 |
+
0.00390625,
|
| 916 |
+
0.00390625,
|
| 917 |
+
0.00390625,
|
| 918 |
+
0.00390625,
|
| 919 |
+
0.00390625,
|
| 920 |
+
0.00390625,
|
| 921 |
+
0.0078125,
|
| 922 |
+
0.00390625,
|
| 923 |
+
0.00390625,
|
| 924 |
+
0.00390625,
|
| 925 |
+
0.0078125,
|
| 926 |
+
0.00390625,
|
| 927 |
+
0.0,
|
| 928 |
+
0.0,
|
| 929 |
+
0.00390625,
|
| 930 |
+
0.00390625,
|
| 931 |
+
0.00390625,
|
| 932 |
+
0.00390625,
|
| 933 |
+
0.01171875,
|
| 934 |
+
0.0078125,
|
| 935 |
+
0.00390625,
|
| 936 |
+
0.00390625,
|
| 937 |
+
0.0078125,
|
| 938 |
+
0.00390625,
|
| 939 |
+
0.00390625,
|
| 940 |
+
0.00390625,
|
| 941 |
+
0.00390625,
|
| 942 |
+
0.00390625,
|
| 943 |
+
0.0078125,
|
| 944 |
+
0.00390625,
|
| 945 |
+
0.00390625,
|
| 946 |
+
0.00390625,
|
| 947 |
+
0.00390625,
|
| 948 |
+
0.0,
|
| 949 |
+
0.00390625,
|
| 950 |
+
0.0078125,
|
| 951 |
+
0.00390625,
|
| 952 |
+
0.00390625,
|
| 953 |
+
0.0,
|
| 954 |
+
0.0,
|
| 955 |
+
0.00390625,
|
| 956 |
+
0.00390625,
|
| 957 |
+
0.0078125,
|
| 958 |
+
0.00390625,
|
| 959 |
+
0.0,
|
| 960 |
+
0.0078125,
|
| 961 |
+
0.00390625,
|
| 962 |
+
0.00390625,
|
| 963 |
+
0.00390625,
|
| 964 |
+
0.00390625,
|
| 965 |
+
0.00390625,
|
| 966 |
+
0.0078125,
|
| 967 |
+
0.0,
|
| 968 |
+
0.00390625,
|
| 969 |
+
0.0078125,
|
| 970 |
+
0.00390625,
|
| 971 |
+
0.00390625
|
| 972 |
+
],
|
| 973 |
+
"endpoint_best_acc": [
|
| 974 |
+
0.1484375,
|
| 975 |
+
0.3046875,
|
| 976 |
+
0.5078125,
|
| 977 |
+
0.5859375,
|
| 978 |
+
0.234375,
|
| 979 |
+
0.18359375,
|
| 980 |
+
0.66015625,
|
| 981 |
+
0.67578125,
|
| 982 |
+
0.5234375,
|
| 983 |
+
0.33203125,
|
| 984 |
+
0.45703125,
|
| 985 |
+
0.328125,
|
| 986 |
+
0.11328125,
|
| 987 |
+
0.1015625,
|
| 988 |
+
0.1015625,
|
| 989 |
+
0.23046875,
|
| 990 |
+
0.40234375,
|
| 991 |
+
0.39453125,
|
| 992 |
+
0.52734375,
|
| 993 |
+
0.16015625,
|
| 994 |
+
0.21875,
|
| 995 |
+
0.328125,
|
| 996 |
+
0.35546875,
|
| 997 |
+
0.28515625,
|
| 998 |
+
0.1796875,
|
| 999 |
+
0.5625,
|
| 1000 |
+
0.63671875,
|
| 1001 |
+
0.453125,
|
| 1002 |
+
0.5,
|
| 1003 |
+
0.2265625,
|
| 1004 |
+
0.359375,
|
| 1005 |
+
0.2890625,
|
| 1006 |
+
0.1640625,
|
| 1007 |
+
0.30859375,
|
| 1008 |
+
0.66015625,
|
| 1009 |
+
0.66015625,
|
| 1010 |
+
0.484375,
|
| 1011 |
+
0.5859375,
|
| 1012 |
+
0.13671875,
|
| 1013 |
+
0.27734375,
|
| 1014 |
+
0.58984375,
|
| 1015 |
+
0.1484375,
|
| 1016 |
+
0.07421875,
|
| 1017 |
+
0.69140625,
|
| 1018 |
+
0.296875,
|
| 1019 |
+
0.6015625,
|
| 1020 |
+
0.45703125,
|
| 1021 |
+
0.5,
|
| 1022 |
+
0.12890625,
|
| 1023 |
+
0.1875,
|
| 1024 |
+
0.37890625,
|
| 1025 |
+
0.26171875,
|
| 1026 |
+
0.13671875,
|
| 1027 |
+
0.20703125,
|
| 1028 |
+
0.484375,
|
| 1029 |
+
0.24609375,
|
| 1030 |
+
0.1640625,
|
| 1031 |
+
0.49609375,
|
| 1032 |
+
0.5390625,
|
| 1033 |
+
0.1875,
|
| 1034 |
+
0.23046875,
|
| 1035 |
+
0.3984375,
|
| 1036 |
+
0.203125,
|
| 1037 |
+
0.53125
|
| 1038 |
+
],
|
| 1039 |
+
"state_best_ref": [
|
| 1040 |
+
1,
|
| 1041 |
+
2,
|
| 1042 |
+
5,
|
| 1043 |
+
5,
|
| 1044 |
+
0,
|
| 1045 |
+
7,
|
| 1046 |
+
3,
|
| 1047 |
+
7,
|
| 1048 |
+
2,
|
| 1049 |
+
1,
|
| 1050 |
+
1,
|
| 1051 |
+
0,
|
| 1052 |
+
1,
|
| 1053 |
+
7,
|
| 1054 |
+
0,
|
| 1055 |
+
3,
|
| 1056 |
+
3,
|
| 1057 |
+
3,
|
| 1058 |
+
3,
|
| 1059 |
+
0,
|
| 1060 |
+
0,
|
| 1061 |
+
1,
|
| 1062 |
+
0,
|
| 1063 |
+
6,
|
| 1064 |
+
3,
|
| 1065 |
+
1,
|
| 1066 |
+
5,
|
| 1067 |
+
4,
|
| 1068 |
+
4,
|
| 1069 |
+
0,
|
| 1070 |
+
3,
|
| 1071 |
+
1,
|
| 1072 |
+
6,
|
| 1073 |
+
1,
|
| 1074 |
+
0,
|
| 1075 |
+
3,
|
| 1076 |
+
3,
|
| 1077 |
+
0,
|
| 1078 |
+
3,
|
| 1079 |
+
2,
|
| 1080 |
+
0,
|
| 1081 |
+
2,
|
| 1082 |
+
3,
|
| 1083 |
+
0,
|
| 1084 |
+
1,
|
| 1085 |
+
0,
|
| 1086 |
+
0,
|
| 1087 |
+
1,
|
| 1088 |
+
3,
|
| 1089 |
+
3,
|
| 1090 |
+
6,
|
| 1091 |
+
0,
|
| 1092 |
+
1,
|
| 1093 |
+
7,
|
| 1094 |
+
0,
|
| 1095 |
+
7,
|
| 1096 |
+
0,
|
| 1097 |
+
2,
|
| 1098 |
+
1,
|
| 1099 |
+
0,
|
| 1100 |
+
5,
|
| 1101 |
+
2,
|
| 1102 |
+
2,
|
| 1103 |
+
1
|
| 1104 |
+
],
|
| 1105 |
+
"endpoint_best_ref": [
|
| 1106 |
+
7,
|
| 1107 |
+
7,
|
| 1108 |
+
6,
|
| 1109 |
+
5,
|
| 1110 |
+
0,
|
| 1111 |
+
2,
|
| 1112 |
+
3,
|
| 1113 |
+
6,
|
| 1114 |
+
0,
|
| 1115 |
+
5,
|
| 1116 |
+
4,
|
| 1117 |
+
1,
|
| 1118 |
+
0,
|
| 1119 |
+
7,
|
| 1120 |
+
2,
|
| 1121 |
+
6,
|
| 1122 |
+
5,
|
| 1123 |
+
6,
|
| 1124 |
+
1,
|
| 1125 |
+
7,
|
| 1126 |
+
6,
|
| 1127 |
+
1,
|
| 1128 |
+
5,
|
| 1129 |
+
0,
|
| 1130 |
+
4,
|
| 1131 |
+
1,
|
| 1132 |
+
6,
|
| 1133 |
+
5,
|
| 1134 |
+
4,
|
| 1135 |
+
0,
|
| 1136 |
+
3,
|
| 1137 |
+
3,
|
| 1138 |
+
2,
|
| 1139 |
+
1,
|
| 1140 |
+
6,
|
| 1141 |
+
3,
|
| 1142 |
+
5,
|
| 1143 |
+
0,
|
| 1144 |
+
7,
|
| 1145 |
+
2,
|
| 1146 |
+
1,
|
| 1147 |
+
6,
|
| 1148 |
+
4,
|
| 1149 |
+
5,
|
| 1150 |
+
6,
|
| 1151 |
+
6,
|
| 1152 |
+
4,
|
| 1153 |
+
6,
|
| 1154 |
+
5,
|
| 1155 |
+
0,
|
| 1156 |
+
6,
|
| 1157 |
+
6,
|
| 1158 |
+
4,
|
| 1159 |
+
6,
|
| 1160 |
+
7,
|
| 1161 |
+
2,
|
| 1162 |
+
7,
|
| 1163 |
+
6,
|
| 1164 |
+
5,
|
| 1165 |
+
2,
|
| 1166 |
+
3,
|
| 1167 |
+
4,
|
| 1168 |
+
1,
|
| 1169 |
+
4
|
| 1170 |
+
]
|
| 1171 |
+
},
|
| 1172 |
+
"8": {
|
| 1173 |
+
"state_top_tokens": [
|
| 1174 |
+
{
|
| 1175 |
+
"id": 615,
|
| 1176 |
+
"old_text": " remained",
|
| 1177 |
+
"count": 35,
|
| 1178 |
+
"mass": 0.00213623046875
|
| 1179 |
+
},
|
| 1180 |
+
{
|
| 1181 |
+
"id": 236,
|
| 1182 |
+
"old_text": " New",
|
| 1183 |
+
"count": 32,
|
| 1184 |
+
"mass": 0.001953125
|
| 1185 |
+
},
|
| 1186 |
+
{
|
| 1187 |
+
"id": 359,
|
| 1188 |
+
"old_text": " York",
|
| 1189 |
+
"count": 31,
|
| 1190 |
+
"mass": 0.00189208984375
|
| 1191 |
+
},
|
| 1192 |
+
{
|
| 1193 |
+
"id": 390,
|
| 1194 |
+
"old_text": " Ge",
|
| 1195 |
+
"count": 31,
|
| 1196 |
+
"mass": 0.00189208984375
|
| 1197 |
+
},
|
| 1198 |
+
{
|
| 1199 |
+
"id": 491,
|
| 1200 |
+
"old_text": " etc",
|
| 1201 |
+
"count": 29,
|
| 1202 |
+
"mass": 0.00177001953125
|
| 1203 |
+
}
|
| 1204 |
+
],
|
| 1205 |
+
"endpoint_top_tokens": [
|
| 1206 |
+
{
|
| 1207 |
+
"id": 3,
|
| 1208 |
+
"old_text": ",",
|
| 1209 |
+
"count": 948,
|
| 1210 |
+
"mass": 0.057861328125
|
| 1211 |
+
},
|
| 1212 |
+
{
|
| 1213 |
+
"id": 5,
|
| 1214 |
+
"old_text": ".",
|
| 1215 |
+
"count": 682,
|
| 1216 |
+
"mass": 0.0416259765625
|
| 1217 |
+
},
|
| 1218 |
+
{
|
| 1219 |
+
"id": 40,
|
| 1220 |
+
"old_text": " the",
|
| 1221 |
+
"count": 607,
|
| 1222 |
+
"mass": 0.03704833984375
|
| 1223 |
+
},
|
| 1224 |
+
{
|
| 1225 |
+
"id": 34,
|
| 1226 |
+
"old_text": "\\n",
|
| 1227 |
+
"count": 593,
|
| 1228 |
+
"mass": 0.03619384765625
|
| 1229 |
+
},
|
| 1230 |
+
{
|
| 1231 |
+
"id": 52,
|
| 1232 |
+
"old_text": " to",
|
| 1233 |
+
"count": 296,
|
| 1234 |
+
"mass": 0.01806640625
|
| 1235 |
+
}
|
| 1236 |
+
],
|
| 1237 |
+
"state_best_acc": [
|
| 1238 |
+
0.00390625,
|
| 1239 |
+
0.00390625,
|
| 1240 |
+
0.00390625,
|
| 1241 |
+
0.00390625,
|
| 1242 |
+
0.00390625,
|
| 1243 |
+
0.0078125,
|
| 1244 |
+
0.00390625,
|
| 1245 |
+
0.00390625,
|
| 1246 |
+
0.00390625,
|
| 1247 |
+
0.00390625,
|
| 1248 |
+
0.00390625,
|
| 1249 |
+
0.00390625,
|
| 1250 |
+
0.00390625,
|
| 1251 |
+
0.0078125,
|
| 1252 |
+
0.00390625,
|
| 1253 |
+
0.00390625,
|
| 1254 |
+
0.00390625,
|
| 1255 |
+
0.0078125,
|
| 1256 |
+
0.00390625,
|
| 1257 |
+
0.0,
|
| 1258 |
+
0.0,
|
| 1259 |
+
0.00390625,
|
| 1260 |
+
0.00390625,
|
| 1261 |
+
0.00390625,
|
| 1262 |
+
0.00390625,
|
| 1263 |
+
0.01171875,
|
| 1264 |
+
0.0078125,
|
| 1265 |
+
0.00390625,
|
| 1266 |
+
0.00390625,
|
| 1267 |
+
0.0078125,
|
| 1268 |
+
0.00390625,
|
| 1269 |
+
0.00390625,
|
| 1270 |
+
0.00390625,
|
| 1271 |
+
0.00390625,
|
| 1272 |
+
0.00390625,
|
| 1273 |
+
0.0078125,
|
| 1274 |
+
0.00390625,
|
| 1275 |
+
0.00390625,
|
| 1276 |
+
0.00390625,
|
| 1277 |
+
0.00390625,
|
| 1278 |
+
0.0,
|
| 1279 |
+
0.00390625,
|
| 1280 |
+
0.0078125,
|
| 1281 |
+
0.00390625,
|
| 1282 |
+
0.00390625,
|
| 1283 |
+
0.0,
|
| 1284 |
+
0.0,
|
| 1285 |
+
0.00390625,
|
| 1286 |
+
0.00390625,
|
| 1287 |
+
0.0078125,
|
| 1288 |
+
0.00390625,
|
| 1289 |
+
0.0,
|
| 1290 |
+
0.0078125,
|
| 1291 |
+
0.00390625,
|
| 1292 |
+
0.00390625,
|
| 1293 |
+
0.00390625,
|
| 1294 |
+
0.00390625,
|
| 1295 |
+
0.00390625,
|
| 1296 |
+
0.0078125,
|
| 1297 |
+
0.0,
|
| 1298 |
+
0.00390625,
|
| 1299 |
+
0.0078125,
|
| 1300 |
+
0.00390625,
|
| 1301 |
+
0.00390625
|
| 1302 |
+
],
|
| 1303 |
+
"endpoint_best_acc": [
|
| 1304 |
+
0.38671875,
|
| 1305 |
+
0.39453125,
|
| 1306 |
+
0.69921875,
|
| 1307 |
+
0.62890625,
|
| 1308 |
+
0.6015625,
|
| 1309 |
+
0.328125,
|
| 1310 |
+
0.68359375,
|
| 1311 |
+
0.7265625,
|
| 1312 |
+
0.6171875,
|
| 1313 |
+
0.23828125,
|
| 1314 |
+
0.609375,
|
| 1315 |
+
0.50390625,
|
| 1316 |
+
0.14453125,
|
| 1317 |
+
0.23828125,
|
| 1318 |
+
0.078125,
|
| 1319 |
+
0.49609375,
|
| 1320 |
+
0.54296875,
|
| 1321 |
+
0.41015625,
|
| 1322 |
+
0.625,
|
| 1323 |
+
0.5,
|
| 1324 |
+
0.28125,
|
| 1325 |
+
0.6171875,
|
| 1326 |
+
0.41796875,
|
| 1327 |
+
0.51171875,
|
| 1328 |
+
0.05078125,
|
| 1329 |
+
0.76171875,
|
| 1330 |
+
0.7265625,
|
| 1331 |
+
0.48046875,
|
| 1332 |
+
0.50390625,
|
| 1333 |
+
0.5,
|
| 1334 |
+
0.296875,
|
| 1335 |
+
0.58203125,
|
| 1336 |
+
0.109375,
|
| 1337 |
+
0.12890625,
|
| 1338 |
+
0.62890625,
|
| 1339 |
+
0.69921875,
|
| 1340 |
+
0.7109375,
|
| 1341 |
+
0.5859375,
|
| 1342 |
+
0.140625,
|
| 1343 |
+
0.54296875,
|
| 1344 |
+
0.75390625,
|
| 1345 |
+
0.15234375,
|
| 1346 |
+
0.1953125,
|
| 1347 |
+
0.734375,
|
| 1348 |
+
0.45703125,
|
| 1349 |
+
0.6796875,
|
| 1350 |
+
0.71875,
|
| 1351 |
+
0.59765625,
|
| 1352 |
+
0.25390625,
|
| 1353 |
+
0.2109375,
|
| 1354 |
+
0.3515625,
|
| 1355 |
+
0.3125,
|
| 1356 |
+
0.09375,
|
| 1357 |
+
0.359375,
|
| 1358 |
+
0.56640625,
|
| 1359 |
+
0.125,
|
| 1360 |
+
0.23828125,
|
| 1361 |
+
0.62109375,
|
| 1362 |
+
0.69921875,
|
| 1363 |
+
0.05859375,
|
| 1364 |
+
0.578125,
|
| 1365 |
+
0.58984375,
|
| 1366 |
+
0.5,
|
| 1367 |
+
0.703125
|
| 1368 |
+
],
|
| 1369 |
+
"state_best_ref": [
|
| 1370 |
+
1,
|
| 1371 |
+
2,
|
| 1372 |
+
5,
|
| 1373 |
+
5,
|
| 1374 |
+
0,
|
| 1375 |
+
7,
|
| 1376 |
+
3,
|
| 1377 |
+
7,
|
| 1378 |
+
2,
|
| 1379 |
+
1,
|
| 1380 |
+
1,
|
| 1381 |
+
0,
|
| 1382 |
+
1,
|
| 1383 |
+
7,
|
| 1384 |
+
0,
|
| 1385 |
+
3,
|
| 1386 |
+
3,
|
| 1387 |
+
3,
|
| 1388 |
+
3,
|
| 1389 |
+
0,
|
| 1390 |
+
0,
|
| 1391 |
+
1,
|
| 1392 |
+
0,
|
| 1393 |
+
6,
|
| 1394 |
+
3,
|
| 1395 |
+
1,
|
| 1396 |
+
5,
|
| 1397 |
+
4,
|
| 1398 |
+
4,
|
| 1399 |
+
0,
|
| 1400 |
+
3,
|
| 1401 |
+
1,
|
| 1402 |
+
6,
|
| 1403 |
+
1,
|
| 1404 |
+
0,
|
| 1405 |
+
3,
|
| 1406 |
+
3,
|
| 1407 |
+
0,
|
| 1408 |
+
3,
|
| 1409 |
+
2,
|
| 1410 |
+
0,
|
| 1411 |
+
2,
|
| 1412 |
+
3,
|
| 1413 |
+
0,
|
| 1414 |
+
1,
|
| 1415 |
+
0,
|
| 1416 |
+
0,
|
| 1417 |
+
1,
|
| 1418 |
+
3,
|
| 1419 |
+
3,
|
| 1420 |
+
6,
|
| 1421 |
+
0,
|
| 1422 |
+
1,
|
| 1423 |
+
7,
|
| 1424 |
+
0,
|
| 1425 |
+
7,
|
| 1426 |
+
0,
|
| 1427 |
+
2,
|
| 1428 |
+
1,
|
| 1429 |
+
0,
|
| 1430 |
+
5,
|
| 1431 |
+
2,
|
| 1432 |
+
2,
|
| 1433 |
+
1
|
| 1434 |
+
],
|
| 1435 |
+
"endpoint_best_ref": [
|
| 1436 |
+
7,
|
| 1437 |
+
7,
|
| 1438 |
+
6,
|
| 1439 |
+
5,
|
| 1440 |
+
0,
|
| 1441 |
+
4,
|
| 1442 |
+
3,
|
| 1443 |
+
6,
|
| 1444 |
+
0,
|
| 1445 |
+
5,
|
| 1446 |
+
4,
|
| 1447 |
+
1,
|
| 1448 |
+
2,
|
| 1449 |
+
7,
|
| 1450 |
+
2,
|
| 1451 |
+
7,
|
| 1452 |
+
5,
|
| 1453 |
+
6,
|
| 1454 |
+
1,
|
| 1455 |
+
7,
|
| 1456 |
+
6,
|
| 1457 |
+
1,
|
| 1458 |
+
5,
|
| 1459 |
+
0,
|
| 1460 |
+
4,
|
| 1461 |
+
1,
|
| 1462 |
+
6,
|
| 1463 |
+
5,
|
| 1464 |
+
4,
|
| 1465 |
+
0,
|
| 1466 |
+
3,
|
| 1467 |
+
3,
|
| 1468 |
+
0,
|
| 1469 |
+
1,
|
| 1470 |
+
6,
|
| 1471 |
+
3,
|
| 1472 |
+
5,
|
| 1473 |
+
0,
|
| 1474 |
+
7,
|
| 1475 |
+
2,
|
| 1476 |
+
1,
|
| 1477 |
+
3,
|
| 1478 |
+
5,
|
| 1479 |
+
5,
|
| 1480 |
+
7,
|
| 1481 |
+
6,
|
| 1482 |
+
4,
|
| 1483 |
+
6,
|
| 1484 |
+
5,
|
| 1485 |
+
0,
|
| 1486 |
+
6,
|
| 1487 |
+
6,
|
| 1488 |
+
3,
|
| 1489 |
+
6,
|
| 1490 |
+
7,
|
| 1491 |
+
2,
|
| 1492 |
+
7,
|
| 1493 |
+
6,
|
| 1494 |
+
5,
|
| 1495 |
+
2,
|
| 1496 |
+
0,
|
| 1497 |
+
4,
|
| 1498 |
+
1,
|
| 1499 |
+
4
|
| 1500 |
+
]
|
| 1501 |
+
},
|
| 1502 |
+
"16": {
|
| 1503 |
+
"state_top_tokens": [
|
| 1504 |
+
{
|
| 1505 |
+
"id": 615,
|
| 1506 |
+
"old_text": " remained",
|
| 1507 |
+
"count": 35,
|
| 1508 |
+
"mass": 0.00213623046875
|
| 1509 |
+
},
|
| 1510 |
+
{
|
| 1511 |
+
"id": 236,
|
| 1512 |
+
"old_text": " New",
|
| 1513 |
+
"count": 32,
|
| 1514 |
+
"mass": 0.001953125
|
| 1515 |
+
},
|
| 1516 |
+
{
|
| 1517 |
+
"id": 359,
|
| 1518 |
+
"old_text": " York",
|
| 1519 |
+
"count": 31,
|
| 1520 |
+
"mass": 0.00189208984375
|
| 1521 |
+
},
|
| 1522 |
+
{
|
| 1523 |
+
"id": 390,
|
| 1524 |
+
"old_text": " Ge",
|
| 1525 |
+
"count": 31,
|
| 1526 |
+
"mass": 0.00189208984375
|
| 1527 |
+
},
|
| 1528 |
+
{
|
| 1529 |
+
"id": 491,
|
| 1530 |
+
"old_text": " etc",
|
| 1531 |
+
"count": 29,
|
| 1532 |
+
"mass": 0.00177001953125
|
| 1533 |
+
}
|
| 1534 |
+
],
|
| 1535 |
+
"endpoint_top_tokens": [
|
| 1536 |
+
{
|
| 1537 |
+
"id": 3,
|
| 1538 |
+
"old_text": ",",
|
| 1539 |
+
"count": 673,
|
| 1540 |
+
"mass": 0.04107666015625
|
| 1541 |
+
},
|
| 1542 |
+
{
|
| 1543 |
+
"id": 40,
|
| 1544 |
+
"old_text": " the",
|
| 1545 |
+
"count": 523,
|
| 1546 |
+
"mass": 0.03192138671875
|
| 1547 |
+
},
|
| 1548 |
+
{
|
| 1549 |
+
"id": 5,
|
| 1550 |
+
"old_text": ".",
|
| 1551 |
+
"count": 500,
|
| 1552 |
+
"mass": 0.030517578125
|
| 1553 |
+
},
|
| 1554 |
+
{
|
| 1555 |
+
"id": 34,
|
| 1556 |
+
"old_text": "\\n",
|
| 1557 |
+
"count": 442,
|
| 1558 |
+
"mass": 0.0269775390625
|
| 1559 |
+
},
|
| 1560 |
+
{
|
| 1561 |
+
"id": 113,
|
| 1562 |
+
"old_text": "�",
|
| 1563 |
+
"count": 254,
|
| 1564 |
+
"mass": 0.0155029296875
|
| 1565 |
+
}
|
| 1566 |
+
],
|
| 1567 |
+
"state_best_acc": [
|
| 1568 |
+
0.00390625,
|
| 1569 |
+
0.00390625,
|
| 1570 |
+
0.00390625,
|
| 1571 |
+
0.00390625,
|
| 1572 |
+
0.00390625,
|
| 1573 |
+
0.0078125,
|
| 1574 |
+
0.00390625,
|
| 1575 |
+
0.00390625,
|
| 1576 |
+
0.00390625,
|
| 1577 |
+
0.00390625,
|
| 1578 |
+
0.00390625,
|
| 1579 |
+
0.00390625,
|
| 1580 |
+
0.00390625,
|
| 1581 |
+
0.0078125,
|
| 1582 |
+
0.00390625,
|
| 1583 |
+
0.00390625,
|
| 1584 |
+
0.00390625,
|
| 1585 |
+
0.0078125,
|
| 1586 |
+
0.00390625,
|
| 1587 |
+
0.0,
|
| 1588 |
+
0.0,
|
| 1589 |
+
0.00390625,
|
| 1590 |
+
0.00390625,
|
| 1591 |
+
0.00390625,
|
| 1592 |
+
0.00390625,
|
| 1593 |
+
0.01171875,
|
| 1594 |
+
0.0078125,
|
| 1595 |
+
0.00390625,
|
| 1596 |
+
0.00390625,
|
| 1597 |
+
0.0078125,
|
| 1598 |
+
0.00390625,
|
| 1599 |
+
0.00390625,
|
| 1600 |
+
0.00390625,
|
| 1601 |
+
0.00390625,
|
| 1602 |
+
0.00390625,
|
| 1603 |
+
0.0078125,
|
| 1604 |
+
0.00390625,
|
| 1605 |
+
0.00390625,
|
| 1606 |
+
0.00390625,
|
| 1607 |
+
0.00390625,
|
| 1608 |
+
0.0,
|
| 1609 |
+
0.00390625,
|
| 1610 |
+
0.01171875,
|
| 1611 |
+
0.00390625,
|
| 1612 |
+
0.00390625,
|
| 1613 |
+
0.0,
|
| 1614 |
+
0.00390625,
|
| 1615 |
+
0.00390625,
|
| 1616 |
+
0.00390625,
|
| 1617 |
+
0.0078125,
|
| 1618 |
+
0.00390625,
|
| 1619 |
+
0.0,
|
| 1620 |
+
0.0078125,
|
| 1621 |
+
0.00390625,
|
| 1622 |
+
0.00390625,
|
| 1623 |
+
0.00390625,
|
| 1624 |
+
0.00390625,
|
| 1625 |
+
0.00390625,
|
| 1626 |
+
0.0078125,
|
| 1627 |
+
0.0,
|
| 1628 |
+
0.00390625,
|
| 1629 |
+
0.0078125,
|
| 1630 |
+
0.00390625,
|
| 1631 |
+
0.00390625
|
| 1632 |
+
],
|
| 1633 |
+
"endpoint_best_acc": [
|
| 1634 |
+
0.5234375,
|
| 1635 |
+
0.25390625,
|
| 1636 |
+
0.8046875,
|
| 1637 |
+
0.546875,
|
| 1638 |
+
0.62109375,
|
| 1639 |
+
0.60546875,
|
| 1640 |
+
0.66015625,
|
| 1641 |
+
0.74609375,
|
| 1642 |
+
0.60546875,
|
| 1643 |
+
0.0703125,
|
| 1644 |
+
0.75,
|
| 1645 |
+
0.72265625,
|
| 1646 |
+
0.296875,
|
| 1647 |
+
0.46484375,
|
| 1648 |
+
0.0703125,
|
| 1649 |
+
0.71484375,
|
| 1650 |
+
0.50390625,
|
| 1651 |
+
0.31640625,
|
| 1652 |
+
0.68359375,
|
| 1653 |
+
0.71875,
|
| 1654 |
+
0.41015625,
|
| 1655 |
+
0.79296875,
|
| 1656 |
+
0.46875,
|
| 1657 |
+
0.6875,
|
| 1658 |
+
0.0703125,
|
| 1659 |
+
0.76171875,
|
| 1660 |
+
0.7734375,
|
| 1661 |
+
0.40234375,
|
| 1662 |
+
0.54296875,
|
| 1663 |
+
0.51953125,
|
| 1664 |
+
0.34765625,
|
| 1665 |
+
0.75390625,
|
| 1666 |
+
0.48046875,
|
| 1667 |
+
0.09765625,
|
| 1668 |
+
0.50390625,
|
| 1669 |
+
0.6953125,
|
| 1670 |
+
0.76171875,
|
| 1671 |
+
0.671875,
|
| 1672 |
+
0.1171875,
|
| 1673 |
+
0.609375,
|
| 1674 |
+
0.765625,
|
| 1675 |
+
0.21875,
|
| 1676 |
+
0.60546875,
|
| 1677 |
+
0.70703125,
|
| 1678 |
+
0.18359375,
|
| 1679 |
+
0.67578125,
|
| 1680 |
+
0.73828125,
|
| 1681 |
+
0.6875,
|
| 1682 |
+
0.14453125,
|
| 1683 |
+
0.15234375,
|
| 1684 |
+
0.2578125,
|
| 1685 |
+
0.3125,
|
| 1686 |
+
0.234375,
|
| 1687 |
+
0.40625,
|
| 1688 |
+
0.62890625,
|
| 1689 |
+
0.1015625,
|
| 1690 |
+
0.359375,
|
| 1691 |
+
0.8046875,
|
| 1692 |
+
0.59375,
|
| 1693 |
+
0.015625,
|
| 1694 |
+
0.65625,
|
| 1695 |
+
0.703125,
|
| 1696 |
+
0.69140625,
|
| 1697 |
+
0.7578125
|
| 1698 |
+
],
|
| 1699 |
+
"state_best_ref": [
|
| 1700 |
+
1,
|
| 1701 |
+
2,
|
| 1702 |
+
5,
|
| 1703 |
+
5,
|
| 1704 |
+
0,
|
| 1705 |
+
7,
|
| 1706 |
+
3,
|
| 1707 |
+
6,
|
| 1708 |
+
2,
|
| 1709 |
+
1,
|
| 1710 |
+
1,
|
| 1711 |
+
0,
|
| 1712 |
+
1,
|
| 1713 |
+
7,
|
| 1714 |
+
0,
|
| 1715 |
+
3,
|
| 1716 |
+
3,
|
| 1717 |
+
3,
|
| 1718 |
+
3,
|
| 1719 |
+
0,
|
| 1720 |
+
0,
|
| 1721 |
+
1,
|
| 1722 |
+
0,
|
| 1723 |
+
6,
|
| 1724 |
+
3,
|
| 1725 |
+
1,
|
| 1726 |
+
5,
|
| 1727 |
+
4,
|
| 1728 |
+
4,
|
| 1729 |
+
0,
|
| 1730 |
+
3,
|
| 1731 |
+
1,
|
| 1732 |
+
6,
|
| 1733 |
+
1,
|
| 1734 |
+
0,
|
| 1735 |
+
3,
|
| 1736 |
+
3,
|
| 1737 |
+
0,
|
| 1738 |
+
3,
|
| 1739 |
+
2,
|
| 1740 |
+
0,
|
| 1741 |
+
2,
|
| 1742 |
+
3,
|
| 1743 |
+
0,
|
| 1744 |
+
1,
|
| 1745 |
+
0,
|
| 1746 |
+
4,
|
| 1747 |
+
1,
|
| 1748 |
+
3,
|
| 1749 |
+
3,
|
| 1750 |
+
6,
|
| 1751 |
+
0,
|
| 1752 |
+
1,
|
| 1753 |
+
7,
|
| 1754 |
+
0,
|
| 1755 |
+
7,
|
| 1756 |
+
0,
|
| 1757 |
+
2,
|
| 1758 |
+
1,
|
| 1759 |
+
0,
|
| 1760 |
+
5,
|
| 1761 |
+
2,
|
| 1762 |
+
2,
|
| 1763 |
+
1
|
| 1764 |
+
],
|
| 1765 |
+
"endpoint_best_ref": [
|
| 1766 |
+
7,
|
| 1767 |
+
7,
|
| 1768 |
+
6,
|
| 1769 |
+
5,
|
| 1770 |
+
0,
|
| 1771 |
+
4,
|
| 1772 |
+
3,
|
| 1773 |
+
6,
|
| 1774 |
+
0,
|
| 1775 |
+
1,
|
| 1776 |
+
4,
|
| 1777 |
+
1,
|
| 1778 |
+
2,
|
| 1779 |
+
7,
|
| 1780 |
+
3,
|
| 1781 |
+
7,
|
| 1782 |
+
5,
|
| 1783 |
+
3,
|
| 1784 |
+
1,
|
| 1785 |
+
7,
|
| 1786 |
+
6,
|
| 1787 |
+
1,
|
| 1788 |
+
5,
|
| 1789 |
+
0,
|
| 1790 |
+
5,
|
| 1791 |
+
1,
|
| 1792 |
+
6,
|
| 1793 |
+
5,
|
| 1794 |
+
4,
|
| 1795 |
+
0,
|
| 1796 |
+
3,
|
| 1797 |
+
3,
|
| 1798 |
+
0,
|
| 1799 |
+
3,
|
| 1800 |
+
6,
|
| 1801 |
+
3,
|
| 1802 |
+
5,
|
| 1803 |
+
0,
|
| 1804 |
+
3,
|
| 1805 |
+
2,
|
| 1806 |
+
1,
|
| 1807 |
+
3,
|
| 1808 |
+
3,
|
| 1809 |
+
5,
|
| 1810 |
+
7,
|
| 1811 |
+
6,
|
| 1812 |
+
4,
|
| 1813 |
+
6,
|
| 1814 |
+
5,
|
| 1815 |
+
0,
|
| 1816 |
+
3,
|
| 1817 |
+
3,
|
| 1818 |
+
3,
|
| 1819 |
+
6,
|
| 1820 |
+
7,
|
| 1821 |
+
7,
|
| 1822 |
+
7,
|
| 1823 |
+
6,
|
| 1824 |
+
5,
|
| 1825 |
+
6,
|
| 1826 |
+
0,
|
| 1827 |
+
4,
|
| 1828 |
+
1,
|
| 1829 |
+
4
|
| 1830 |
+
]
|
| 1831 |
+
},
|
| 1832 |
+
"32": {
|
| 1833 |
+
"state_top_tokens": [
|
| 1834 |
+
{
|
| 1835 |
+
"id": 615,
|
| 1836 |
+
"old_text": " remained",
|
| 1837 |
+
"count": 35,
|
| 1838 |
+
"mass": 0.00213623046875
|
| 1839 |
+
},
|
| 1840 |
+
{
|
| 1841 |
+
"id": 3,
|
| 1842 |
+
"old_text": ",",
|
| 1843 |
+
"count": 35,
|
| 1844 |
+
"mass": 0.00213623046875
|
| 1845 |
+
},
|
| 1846 |
+
{
|
| 1847 |
+
"id": 236,
|
| 1848 |
+
"old_text": " New",
|
| 1849 |
+
"count": 32,
|
| 1850 |
+
"mass": 0.001953125
|
| 1851 |
+
},
|
| 1852 |
+
{
|
| 1853 |
+
"id": 390,
|
| 1854 |
+
"old_text": " Ge",
|
| 1855 |
+
"count": 31,
|
| 1856 |
+
"mass": 0.00189208984375
|
| 1857 |
+
},
|
| 1858 |
+
{
|
| 1859 |
+
"id": 359,
|
| 1860 |
+
"old_text": " York",
|
| 1861 |
+
"count": 30,
|
| 1862 |
+
"mass": 0.0018310546875
|
| 1863 |
+
}
|
| 1864 |
+
],
|
| 1865 |
+
"endpoint_top_tokens": [
|
| 1866 |
+
{
|
| 1867 |
+
"id": 3,
|
| 1868 |
+
"old_text": ",",
|
| 1869 |
+
"count": 847,
|
| 1870 |
+
"mass": 0.05169677734375
|
| 1871 |
+
},
|
| 1872 |
+
{
|
| 1873 |
+
"id": 40,
|
| 1874 |
+
"old_text": " the",
|
| 1875 |
+
"count": 591,
|
| 1876 |
+
"mass": 0.03607177734375
|
| 1877 |
+
},
|
| 1878 |
+
{
|
| 1879 |
+
"id": 5,
|
| 1880 |
+
"old_text": ".",
|
| 1881 |
+
"count": 552,
|
| 1882 |
+
"mass": 0.03369140625
|
| 1883 |
+
},
|
| 1884 |
+
{
|
| 1885 |
+
"id": 34,
|
| 1886 |
+
"old_text": "\\n",
|
| 1887 |
+
"count": 519,
|
| 1888 |
+
"mass": 0.03167724609375
|
| 1889 |
+
},
|
| 1890 |
+
{
|
| 1891 |
+
"id": 113,
|
| 1892 |
+
"old_text": "�",
|
| 1893 |
+
"count": 277,
|
| 1894 |
+
"mass": 0.01690673828125
|
| 1895 |
+
}
|
| 1896 |
+
],
|
| 1897 |
+
"state_best_acc": [
|
| 1898 |
+
0.00390625,
|
| 1899 |
+
0.00390625,
|
| 1900 |
+
0.01171875,
|
| 1901 |
+
0.015625,
|
| 1902 |
+
0.015625,
|
| 1903 |
+
0.0078125,
|
| 1904 |
+
0.015625,
|
| 1905 |
+
0.02734375,
|
| 1906 |
+
0.00390625,
|
| 1907 |
+
0.01171875,
|
| 1908 |
+
0.00390625,
|
| 1909 |
+
0.01171875,
|
| 1910 |
+
0.00390625,
|
| 1911 |
+
0.01953125,
|
| 1912 |
+
0.00390625,
|
| 1913 |
+
0.00390625,
|
| 1914 |
+
0.00390625,
|
| 1915 |
+
0.0078125,
|
| 1916 |
+
0.00390625,
|
| 1917 |
+
0.0078125,
|
| 1918 |
+
0.00390625,
|
| 1919 |
+
0.03125,
|
| 1920 |
+
0.00390625,
|
| 1921 |
+
0.01171875,
|
| 1922 |
+
0.00390625,
|
| 1923 |
+
0.01953125,
|
| 1924 |
+
0.0234375,
|
| 1925 |
+
0.0078125,
|
| 1926 |
+
0.03515625,
|
| 1927 |
+
0.0078125,
|
| 1928 |
+
0.01171875,
|
| 1929 |
+
0.0078125,
|
| 1930 |
+
0.00390625,
|
| 1931 |
+
0.00390625,
|
| 1932 |
+
0.015625,
|
| 1933 |
+
0.01953125,
|
| 1934 |
+
0.0234375,
|
| 1935 |
+
0.0234375,
|
| 1936 |
+
0.00390625,
|
| 1937 |
+
0.01953125,
|
| 1938 |
+
0.03125,
|
| 1939 |
+
0.00390625,
|
| 1940 |
+
0.01953125,
|
| 1941 |
+
0.01953125,
|
| 1942 |
+
0.00390625,
|
| 1943 |
+
0.015625,
|
| 1944 |
+
0.01953125,
|
| 1945 |
+
0.0078125,
|
| 1946 |
+
0.00390625,
|
| 1947 |
+
0.0078125,
|
| 1948 |
+
0.00390625,
|
| 1949 |
+
0.00390625,
|
| 1950 |
+
0.0078125,
|
| 1951 |
+
0.00390625,
|
| 1952 |
+
0.0078125,
|
| 1953 |
+
0.00390625,
|
| 1954 |
+
0.00390625,
|
| 1955 |
+
0.00390625,
|
| 1956 |
+
0.02734375,
|
| 1957 |
+
0.0,
|
| 1958 |
+
0.01171875,
|
| 1959 |
+
0.015625,
|
| 1960 |
+
0.00390625,
|
| 1961 |
+
0.01953125
|
| 1962 |
+
],
|
| 1963 |
+
"endpoint_best_acc": [
|
| 1964 |
+
0.6171875,
|
| 1965 |
+
0.421875,
|
| 1966 |
+
0.81640625,
|
| 1967 |
+
0.56640625,
|
| 1968 |
+
0.62890625,
|
| 1969 |
+
0.578125,
|
| 1970 |
+
0.7421875,
|
| 1971 |
+
0.76953125,
|
| 1972 |
+
0.47265625,
|
| 1973 |
+
0.046875,
|
| 1974 |
+
0.7421875,
|
| 1975 |
+
0.75390625,
|
| 1976 |
+
0.3359375,
|
| 1977 |
+
0.6875,
|
| 1978 |
+
0.0703125,
|
| 1979 |
+
0.7265625,
|
| 1980 |
+
0.546875,
|
| 1981 |
+
0.39453125,
|
| 1982 |
+
0.796875,
|
| 1983 |
+
0.73046875,
|
| 1984 |
+
0.41015625,
|
| 1985 |
+
0.74609375,
|
| 1986 |
+
0.46875,
|
| 1987 |
+
0.703125,
|
| 1988 |
+
0.12890625,
|
| 1989 |
+
0.7890625,
|
| 1990 |
+
0.796875,
|
| 1991 |
+
0.421875,
|
| 1992 |
+
0.73828125,
|
| 1993 |
+
0.5234375,
|
| 1994 |
+
0.4140625,
|
| 1995 |
+
0.75390625,
|
| 1996 |
+
0.48828125,
|
| 1997 |
+
0.18359375,
|
| 1998 |
+
0.58203125,
|
| 1999 |
+
0.68359375,
|
| 2000 |
+
0.765625,
|
| 2001 |
+
0.55078125,
|
| 2002 |
+
0.16015625,
|
| 2003 |
+
0.62109375,
|
| 2004 |
+
0.76171875,
|
| 2005 |
+
0.25390625,
|
| 2006 |
+
0.72265625,
|
| 2007 |
+
0.7265625,
|
| 2008 |
+
0.25390625,
|
| 2009 |
+
0.7265625,
|
| 2010 |
+
0.76171875,
|
| 2011 |
+
0.78515625,
|
| 2012 |
+
0.203125,
|
| 2013 |
+
0.0703125,
|
| 2014 |
+
0.51171875,
|
| 2015 |
+
0.51171875,
|
| 2016 |
+
0.4921875,
|
| 2017 |
+
0.33203125,
|
| 2018 |
+
0.71875,
|
| 2019 |
+
0.05859375,
|
| 2020 |
+
0.3671875,
|
| 2021 |
+
0.765625,
|
| 2022 |
+
0.6640625,
|
| 2023 |
+
0.015625,
|
| 2024 |
+
0.68359375,
|
| 2025 |
+
0.7734375,
|
| 2026 |
+
0.6875,
|
| 2027 |
+
0.73828125
|
| 2028 |
+
],
|
| 2029 |
+
"state_best_ref": [
|
| 2030 |
+
1,
|
| 2031 |
+
2,
|
| 2032 |
+
6,
|
| 2033 |
+
5,
|
| 2034 |
+
0,
|
| 2035 |
+
7,
|
| 2036 |
+
3,
|
| 2037 |
+
6,
|
| 2038 |
+
0,
|
| 2039 |
+
3,
|
| 2040 |
+
1,
|
| 2041 |
+
1,
|
| 2042 |
+
0,
|
| 2043 |
+
7,
|
| 2044 |
+
0,
|
| 2045 |
+
3,
|
| 2046 |
+
3,
|
| 2047 |
+
3,
|
| 2048 |
+
1,
|
| 2049 |
+
7,
|
| 2050 |
+
6,
|
| 2051 |
+
1,
|
| 2052 |
+
0,
|
| 2053 |
+
0,
|
| 2054 |
+
3,
|
| 2055 |
+
1,
|
| 2056 |
+
6,
|
| 2057 |
+
5,
|
| 2058 |
+
4,
|
| 2059 |
+
0,
|
| 2060 |
+
3,
|
| 2061 |
+
3,
|
| 2062 |
+
6,
|
| 2063 |
+
1,
|
| 2064 |
+
6,
|
| 2065 |
+
3,
|
| 2066 |
+
5,
|
| 2067 |
+
0,
|
| 2068 |
+
3,
|
| 2069 |
+
2,
|
| 2070 |
+
1,
|
| 2071 |
+
2,
|
| 2072 |
+
3,
|
| 2073 |
+
5,
|
| 2074 |
+
1,
|
| 2075 |
+
6,
|
| 2076 |
+
4,
|
| 2077 |
+
6,
|
| 2078 |
+
3,
|
| 2079 |
+
3,
|
| 2080 |
+
3,
|
| 2081 |
+
2,
|
| 2082 |
+
1,
|
| 2083 |
+
6,
|
| 2084 |
+
7,
|
| 2085 |
+
7,
|
| 2086 |
+
0,
|
| 2087 |
+
2,
|
| 2088 |
+
5,
|
| 2089 |
+
0,
|
| 2090 |
+
0,
|
| 2091 |
+
4,
|
| 2092 |
+
1,
|
| 2093 |
+
4
|
| 2094 |
+
],
|
| 2095 |
+
"endpoint_best_ref": [
|
| 2096 |
+
7,
|
| 2097 |
+
7,
|
| 2098 |
+
6,
|
| 2099 |
+
5,
|
| 2100 |
+
0,
|
| 2101 |
+
4,
|
| 2102 |
+
3,
|
| 2103 |
+
6,
|
| 2104 |
+
0,
|
| 2105 |
+
1,
|
| 2106 |
+
4,
|
| 2107 |
+
1,
|
| 2108 |
+
2,
|
| 2109 |
+
7,
|
| 2110 |
+
3,
|
| 2111 |
+
7,
|
| 2112 |
+
5,
|
| 2113 |
+
3,
|
| 2114 |
+
1,
|
| 2115 |
+
7,
|
| 2116 |
+
6,
|
| 2117 |
+
1,
|
| 2118 |
+
5,
|
| 2119 |
+
0,
|
| 2120 |
+
5,
|
| 2121 |
+
1,
|
| 2122 |
+
6,
|
| 2123 |
+
5,
|
| 2124 |
+
4,
|
| 2125 |
+
0,
|
| 2126 |
+
3,
|
| 2127 |
+
3,
|
| 2128 |
+
0,
|
| 2129 |
+
3,
|
| 2130 |
+
6,
|
| 2131 |
+
3,
|
| 2132 |
+
5,
|
| 2133 |
+
0,
|
| 2134 |
+
3,
|
| 2135 |
+
2,
|
| 2136 |
+
1,
|
| 2137 |
+
3,
|
| 2138 |
+
3,
|
| 2139 |
+
5,
|
| 2140 |
+
7,
|
| 2141 |
+
6,
|
| 2142 |
+
4,
|
| 2143 |
+
6,
|
| 2144 |
+
5,
|
| 2145 |
+
4,
|
| 2146 |
+
3,
|
| 2147 |
+
3,
|
| 2148 |
+
3,
|
| 2149 |
+
6,
|
| 2150 |
+
7,
|
| 2151 |
+
3,
|
| 2152 |
+
0,
|
| 2153 |
+
6,
|
| 2154 |
+
5,
|
| 2155 |
+
6,
|
| 2156 |
+
0,
|
| 2157 |
+
4,
|
| 2158 |
+
1,
|
| 2159 |
+
4
|
| 2160 |
+
]
|
| 2161 |
+
},
|
| 2162 |
+
"64": {
|
| 2163 |
+
"state_top_tokens": [
|
| 2164 |
+
{
|
| 2165 |
+
"id": 3,
|
| 2166 |
+
"old_text": ",",
|
| 2167 |
+
"count": 638,
|
| 2168 |
+
"mass": 0.0389404296875
|
| 2169 |
+
},
|
| 2170 |
+
{
|
| 2171 |
+
"id": 34,
|
| 2172 |
+
"old_text": "\\n",
|
| 2173 |
+
"count": 441,
|
| 2174 |
+
"mass": 0.02691650390625
|
| 2175 |
+
},
|
| 2176 |
+
{
|
| 2177 |
+
"id": 40,
|
| 2178 |
+
"old_text": " the",
|
| 2179 |
+
"count": 423,
|
| 2180 |
+
"mass": 0.02581787109375
|
| 2181 |
+
},
|
| 2182 |
+
{
|
| 2183 |
+
"id": 5,
|
| 2184 |
+
"old_text": ".",
|
| 2185 |
+
"count": 414,
|
| 2186 |
+
"mass": 0.0252685546875
|
| 2187 |
+
},
|
| 2188 |
+
{
|
| 2189 |
+
"id": 38,
|
| 2190 |
+
"old_text": " a",
|
| 2191 |
+
"count": 214,
|
| 2192 |
+
"mass": 0.0130615234375
|
| 2193 |
+
}
|
| 2194 |
+
],
|
| 2195 |
+
"endpoint_top_tokens": [
|
| 2196 |
+
{
|
| 2197 |
+
"id": 3,
|
| 2198 |
+
"old_text": ",",
|
| 2199 |
+
"count": 982,
|
| 2200 |
+
"mass": 0.0599365234375
|
| 2201 |
+
},
|
| 2202 |
+
{
|
| 2203 |
+
"id": 34,
|
| 2204 |
+
"old_text": "\\n",
|
| 2205 |
+
"count": 669,
|
| 2206 |
+
"mass": 0.04083251953125
|
| 2207 |
+
},
|
| 2208 |
+
{
|
| 2209 |
+
"id": 40,
|
| 2210 |
+
"old_text": " the",
|
| 2211 |
+
"count": 667,
|
| 2212 |
+
"mass": 0.04071044921875
|
| 2213 |
+
},
|
| 2214 |
+
{
|
| 2215 |
+
"id": 5,
|
| 2216 |
+
"old_text": ".",
|
| 2217 |
+
"count": 663,
|
| 2218 |
+
"mass": 0.04046630859375
|
| 2219 |
+
},
|
| 2220 |
+
{
|
| 2221 |
+
"id": 38,
|
| 2222 |
+
"old_text": " a",
|
| 2223 |
+
"count": 328,
|
| 2224 |
+
"mass": 0.02001953125
|
| 2225 |
+
}
|
| 2226 |
+
],
|
| 2227 |
+
"state_best_acc": [
|
| 2228 |
+
0.50390625,
|
| 2229 |
+
0.33203125,
|
| 2230 |
+
0.67578125,
|
| 2231 |
+
0.484375,
|
| 2232 |
+
0.4296875,
|
| 2233 |
+
0.3828125,
|
| 2234 |
+
0.6171875,
|
| 2235 |
+
0.66015625,
|
| 2236 |
+
0.27734375,
|
| 2237 |
+
0.0234375,
|
| 2238 |
+
0.59375,
|
| 2239 |
+
0.58984375,
|
| 2240 |
+
0.22265625,
|
| 2241 |
+
0.47265625,
|
| 2242 |
+
0.04296875,
|
| 2243 |
+
0.578125,
|
| 2244 |
+
0.48046875,
|
| 2245 |
+
0.31640625,
|
| 2246 |
+
0.58203125,
|
| 2247 |
+
0.57421875,
|
| 2248 |
+
0.3203125,
|
| 2249 |
+
0.6015625,
|
| 2250 |
+
0.42578125,
|
| 2251 |
+
0.4765625,
|
| 2252 |
+
0.1171875,
|
| 2253 |
+
0.64453125,
|
| 2254 |
+
0.6484375,
|
| 2255 |
+
0.39453125,
|
| 2256 |
+
0.53125,
|
| 2257 |
+
0.2734375,
|
| 2258 |
+
0.296875,
|
| 2259 |
+
0.62109375,
|
| 2260 |
+
0.17578125,
|
| 2261 |
+
0.13671875,
|
| 2262 |
+
0.50390625,
|
| 2263 |
+
0.609375,
|
| 2264 |
+
0.625,
|
| 2265 |
+
0.38671875,
|
| 2266 |
+
0.109375,
|
| 2267 |
+
0.48046875,
|
| 2268 |
+
0.6484375,
|
| 2269 |
+
0.19921875,
|
| 2270 |
+
0.578125,
|
| 2271 |
+
0.62109375,
|
| 2272 |
+
0.18359375,
|
| 2273 |
+
0.5546875,
|
| 2274 |
+
0.625,
|
| 2275 |
+
0.6328125,
|
| 2276 |
+
0.16015625,
|
| 2277 |
+
0.03515625,
|
| 2278 |
+
0.43359375,
|
| 2279 |
+
0.4140625,
|
| 2280 |
+
0.359375,
|
| 2281 |
+
0.26953125,
|
| 2282 |
+
0.6015625,
|
| 2283 |
+
0.046875,
|
| 2284 |
+
0.09765625,
|
| 2285 |
+
0.61328125,
|
| 2286 |
+
0.55859375,
|
| 2287 |
+
0.015625,
|
| 2288 |
+
0.5234375,
|
| 2289 |
+
0.62890625,
|
| 2290 |
+
0.5,
|
| 2291 |
+
0.6015625
|
| 2292 |
+
],
|
| 2293 |
+
"endpoint_best_acc": [
|
| 2294 |
+
0.62890625,
|
| 2295 |
+
0.4921875,
|
| 2296 |
+
0.78125,
|
| 2297 |
+
0.58203125,
|
| 2298 |
+
0.41796875,
|
| 2299 |
+
0.39453125,
|
| 2300 |
+
0.69921875,
|
| 2301 |
+
0.7734375,
|
| 2302 |
+
0.28125,
|
| 2303 |
+
0.02734375,
|
| 2304 |
+
0.6796875,
|
| 2305 |
+
0.6953125,
|
| 2306 |
+
0.29296875,
|
| 2307 |
+
0.59765625,
|
| 2308 |
+
0.08984375,
|
| 2309 |
+
0.671875,
|
| 2310 |
+
0.58984375,
|
| 2311 |
+
0.43359375,
|
| 2312 |
+
0.703125,
|
| 2313 |
+
0.68359375,
|
| 2314 |
+
0.5390625,
|
| 2315 |
+
0.67578125,
|
| 2316 |
+
0.5703125,
|
| 2317 |
+
0.49609375,
|
| 2318 |
+
0.28515625,
|
| 2319 |
+
0.74609375,
|
| 2320 |
+
0.7890625,
|
| 2321 |
+
0.55078125,
|
| 2322 |
+
0.58984375,
|
| 2323 |
+
0.296875,
|
| 2324 |
+
0.37109375,
|
| 2325 |
+
0.69140625,
|
| 2326 |
+
0.234375,
|
| 2327 |
+
0.25,
|
| 2328 |
+
0.72265625,
|
| 2329 |
+
0.70703125,
|
| 2330 |
+
0.75,
|
| 2331 |
+
0.38671875,
|
| 2332 |
+
0.22265625,
|
| 2333 |
+
0.5703125,
|
| 2334 |
+
0.72265625,
|
| 2335 |
+
0.3125,
|
| 2336 |
+
0.6875,
|
| 2337 |
+
0.7265625,
|
| 2338 |
+
0.28515625,
|
| 2339 |
+
0.72265625,
|
| 2340 |
+
0.6953125,
|
| 2341 |
+
0.76171875,
|
| 2342 |
+
0.35546875,
|
| 2343 |
+
0.09375,
|
| 2344 |
+
0.66015625,
|
| 2345 |
+
0.65625,
|
| 2346 |
+
0.57421875,
|
| 2347 |
+
0.4375,
|
| 2348 |
+
0.6953125,
|
| 2349 |
+
0.07421875,
|
| 2350 |
+
0.13671875,
|
| 2351 |
+
0.7421875,
|
| 2352 |
+
0.66796875,
|
| 2353 |
+
0.0234375,
|
| 2354 |
+
0.54296875,
|
| 2355 |
+
0.703125,
|
| 2356 |
+
0.625,
|
| 2357 |
+
0.6953125
|
| 2358 |
+
],
|
| 2359 |
+
"state_best_ref": [
|
| 2360 |
+
7,
|
| 2361 |
+
7,
|
| 2362 |
+
6,
|
| 2363 |
+
5,
|
| 2364 |
+
0,
|
| 2365 |
+
4,
|
| 2366 |
+
3,
|
| 2367 |
+
6,
|
| 2368 |
+
0,
|
| 2369 |
+
1,
|
| 2370 |
+
4,
|
| 2371 |
+
1,
|
| 2372 |
+
2,
|
| 2373 |
+
7,
|
| 2374 |
+
3,
|
| 2375 |
+
7,
|
| 2376 |
+
5,
|
| 2377 |
+
3,
|
| 2378 |
+
1,
|
| 2379 |
+
7,
|
| 2380 |
+
6,
|
| 2381 |
+
1,
|
| 2382 |
+
5,
|
| 2383 |
+
0,
|
| 2384 |
+
5,
|
| 2385 |
+
1,
|
| 2386 |
+
6,
|
| 2387 |
+
5,
|
| 2388 |
+
4,
|
| 2389 |
+
0,
|
| 2390 |
+
3,
|
| 2391 |
+
3,
|
| 2392 |
+
0,
|
| 2393 |
+
3,
|
| 2394 |
+
6,
|
| 2395 |
+
3,
|
| 2396 |
+
5,
|
| 2397 |
+
0,
|
| 2398 |
+
3,
|
| 2399 |
+
2,
|
| 2400 |
+
1,
|
| 2401 |
+
3,
|
| 2402 |
+
3,
|
| 2403 |
+
5,
|
| 2404 |
+
7,
|
| 2405 |
+
6,
|
| 2406 |
+
4,
|
| 2407 |
+
6,
|
| 2408 |
+
5,
|
| 2409 |
+
4,
|
| 2410 |
+
3,
|
| 2411 |
+
3,
|
| 2412 |
+
3,
|
| 2413 |
+
6,
|
| 2414 |
+
7,
|
| 2415 |
+
3,
|
| 2416 |
+
0,
|
| 2417 |
+
6,
|
| 2418 |
+
5,
|
| 2419 |
+
6,
|
| 2420 |
+
0,
|
| 2421 |
+
4,
|
| 2422 |
+
1,
|
| 2423 |
+
4
|
| 2424 |
+
],
|
| 2425 |
+
"endpoint_best_ref": [
|
| 2426 |
+
7,
|
| 2427 |
+
7,
|
| 2428 |
+
6,
|
| 2429 |
+
5,
|
| 2430 |
+
0,
|
| 2431 |
+
4,
|
| 2432 |
+
3,
|
| 2433 |
+
6,
|
| 2434 |
+
0,
|
| 2435 |
+
0,
|
| 2436 |
+
4,
|
| 2437 |
+
1,
|
| 2438 |
+
2,
|
| 2439 |
+
7,
|
| 2440 |
+
3,
|
| 2441 |
+
7,
|
| 2442 |
+
5,
|
| 2443 |
+
3,
|
| 2444 |
+
1,
|
| 2445 |
+
7,
|
| 2446 |
+
6,
|
| 2447 |
+
1,
|
| 2448 |
+
5,
|
| 2449 |
+
0,
|
| 2450 |
+
5,
|
| 2451 |
+
1,
|
| 2452 |
+
6,
|
| 2453 |
+
5,
|
| 2454 |
+
4,
|
| 2455 |
+
0,
|
| 2456 |
+
3,
|
| 2457 |
+
3,
|
| 2458 |
+
0,
|
| 2459 |
+
3,
|
| 2460 |
+
6,
|
| 2461 |
+
3,
|
| 2462 |
+
5,
|
| 2463 |
+
0,
|
| 2464 |
+
3,
|
| 2465 |
+
2,
|
| 2466 |
+
1,
|
| 2467 |
+
3,
|
| 2468 |
+
3,
|
| 2469 |
+
5,
|
| 2470 |
+
7,
|
| 2471 |
+
6,
|
| 2472 |
+
4,
|
| 2473 |
+
6,
|
| 2474 |
+
5,
|
| 2475 |
+
4,
|
| 2476 |
+
3,
|
| 2477 |
+
3,
|
| 2478 |
+
3,
|
| 2479 |
+
6,
|
| 2480 |
+
7,
|
| 2481 |
+
3,
|
| 2482 |
+
0,
|
| 2483 |
+
6,
|
| 2484 |
+
5,
|
| 2485 |
+
6,
|
| 2486 |
+
0,
|
| 2487 |
+
4,
|
| 2488 |
+
1,
|
| 2489 |
+
4
|
| 2490 |
+
]
|
| 2491 |
+
},
|
| 2492 |
+
"96": {
|
| 2493 |
+
"state_top_tokens": [
|
| 2494 |
+
{
|
| 2495 |
+
"id": 3,
|
| 2496 |
+
"old_text": ",",
|
| 2497 |
+
"count": 1003,
|
| 2498 |
+
"mass": 0.06121826171875
|
| 2499 |
+
},
|
| 2500 |
+
{
|
| 2501 |
+
"id": 34,
|
| 2502 |
+
"old_text": "\\n",
|
| 2503 |
+
"count": 773,
|
| 2504 |
+
"mass": 0.04718017578125
|
| 2505 |
+
},
|
| 2506 |
+
{
|
| 2507 |
+
"id": 5,
|
| 2508 |
+
"old_text": ".",
|
| 2509 |
+
"count": 693,
|
| 2510 |
+
"mass": 0.04229736328125
|
| 2511 |
+
},
|
| 2512 |
+
{
|
| 2513 |
+
"id": 40,
|
| 2514 |
+
"old_text": " the",
|
| 2515 |
+
"count": 691,
|
| 2516 |
+
"mass": 0.04217529296875
|
| 2517 |
+
},
|
| 2518 |
+
{
|
| 2519 |
+
"id": 38,
|
| 2520 |
+
"old_text": " a",
|
| 2521 |
+
"count": 352,
|
| 2522 |
+
"mass": 0.021484375
|
| 2523 |
+
}
|
| 2524 |
+
],
|
| 2525 |
+
"endpoint_top_tokens": [
|
| 2526 |
+
{
|
| 2527 |
+
"id": 3,
|
| 2528 |
+
"old_text": ",",
|
| 2529 |
+
"count": 1058,
|
| 2530 |
+
"mass": 0.0645751953125
|
| 2531 |
+
},
|
| 2532 |
+
{
|
| 2533 |
+
"id": 34,
|
| 2534 |
+
"old_text": "\\n",
|
| 2535 |
+
"count": 932,
|
| 2536 |
+
"mass": 0.056884765625
|
| 2537 |
+
},
|
| 2538 |
+
{
|
| 2539 |
+
"id": 40,
|
| 2540 |
+
"old_text": " the",
|
| 2541 |
+
"count": 723,
|
| 2542 |
+
"mass": 0.04412841796875
|
| 2543 |
+
},
|
| 2544 |
+
{
|
| 2545 |
+
"id": 5,
|
| 2546 |
+
"old_text": ".",
|
| 2547 |
+
"count": 684,
|
| 2548 |
+
"mass": 0.041748046875
|
| 2549 |
+
},
|
| 2550 |
+
{
|
| 2551 |
+
"id": 38,
|
| 2552 |
+
"old_text": " a",
|
| 2553 |
+
"count": 379,
|
| 2554 |
+
"mass": 0.02313232421875
|
| 2555 |
+
}
|
| 2556 |
+
],
|
| 2557 |
+
"state_best_acc": [
|
| 2558 |
+
0.61328125,
|
| 2559 |
+
0.46875,
|
| 2560 |
+
0.77734375,
|
| 2561 |
+
0.59375,
|
| 2562 |
+
0.41015625,
|
| 2563 |
+
0.3125,
|
| 2564 |
+
0.6875,
|
| 2565 |
+
0.76171875,
|
| 2566 |
+
0.32421875,
|
| 2567 |
+
0.04296875,
|
| 2568 |
+
0.62109375,
|
| 2569 |
+
0.68359375,
|
| 2570 |
+
0.26953125,
|
| 2571 |
+
0.578125,
|
| 2572 |
+
0.0859375,
|
| 2573 |
+
0.6640625,
|
| 2574 |
+
0.59765625,
|
| 2575 |
+
0.41796875,
|
| 2576 |
+
0.61328125,
|
| 2577 |
+
0.67578125,
|
| 2578 |
+
0.5390625,
|
| 2579 |
+
0.59765625,
|
| 2580 |
+
0.59375,
|
| 2581 |
+
0.46875,
|
| 2582 |
+
0.3046875,
|
| 2583 |
+
0.73046875,
|
| 2584 |
+
0.7734375,
|
| 2585 |
+
0.55078125,
|
| 2586 |
+
0.5234375,
|
| 2587 |
+
0.29296875,
|
| 2588 |
+
0.359375,
|
| 2589 |
+
0.66015625,
|
| 2590 |
+
0.2265625,
|
| 2591 |
+
0.2421875,
|
| 2592 |
+
0.70703125,
|
| 2593 |
+
0.69140625,
|
| 2594 |
+
0.7421875,
|
| 2595 |
+
0.41015625,
|
| 2596 |
+
0.2265625,
|
| 2597 |
+
0.484375,
|
| 2598 |
+
0.64453125,
|
| 2599 |
+
0.30859375,
|
| 2600 |
+
0.69140625,
|
| 2601 |
+
0.72265625,
|
| 2602 |
+
0.28515625,
|
| 2603 |
+
0.70703125,
|
| 2604 |
+
0.66796875,
|
| 2605 |
+
0.734375,
|
| 2606 |
+
0.3828125,
|
| 2607 |
+
0.08203125,
|
| 2608 |
+
0.66796875,
|
| 2609 |
+
0.6640625,
|
| 2610 |
+
0.5625,
|
| 2611 |
+
0.4296875,
|
| 2612 |
+
0.68359375,
|
| 2613 |
+
0.06640625,
|
| 2614 |
+
0.11328125,
|
| 2615 |
+
0.7265625,
|
| 2616 |
+
0.69140625,
|
| 2617 |
+
0.02734375,
|
| 2618 |
+
0.50390625,
|
| 2619 |
+
0.640625,
|
| 2620 |
+
0.60546875,
|
| 2621 |
+
0.671875
|
| 2622 |
+
],
|
| 2623 |
+
"endpoint_best_acc": [
|
| 2624 |
+
0.59375,
|
| 2625 |
+
0.4453125,
|
| 2626 |
+
0.68359375,
|
| 2627 |
+
0.6015625,
|
| 2628 |
+
0.35546875,
|
| 2629 |
+
0.12890625,
|
| 2630 |
+
0.65234375,
|
| 2631 |
+
0.6640625,
|
| 2632 |
+
0.30078125,
|
| 2633 |
+
0.03515625,
|
| 2634 |
+
0.43359375,
|
| 2635 |
+
0.5703125,
|
| 2636 |
+
0.21484375,
|
| 2637 |
+
0.5390625,
|
| 2638 |
+
0.06640625,
|
| 2639 |
+
0.62109375,
|
| 2640 |
+
0.578125,
|
| 2641 |
+
0.41796875,
|
| 2642 |
+
0.35546875,
|
| 2643 |
+
0.61328125,
|
| 2644 |
+
0.5078125,
|
| 2645 |
+
0.45703125,
|
| 2646 |
+
0.61328125,
|
| 2647 |
+
0.40625,
|
| 2648 |
+
0.33984375,
|
| 2649 |
+
0.61328125,
|
| 2650 |
+
0.69921875,
|
| 2651 |
+
0.5703125,
|
| 2652 |
+
0.390625,
|
| 2653 |
+
0.24609375,
|
| 2654 |
+
0.34765625,
|
| 2655 |
+
0.63671875,
|
| 2656 |
+
0.15625,
|
| 2657 |
+
0.2578125,
|
| 2658 |
+
0.6484375,
|
| 2659 |
+
0.65234375,
|
| 2660 |
+
0.71875,
|
| 2661 |
+
0.359375,
|
| 2662 |
+
0.22265625,
|
| 2663 |
+
0.34375,
|
| 2664 |
+
0.390625,
|
| 2665 |
+
0.3125,
|
| 2666 |
+
0.67578125,
|
| 2667 |
+
0.69140625,
|
| 2668 |
+
0.30859375,
|
| 2669 |
+
0.609375,
|
| 2670 |
+
0.48046875,
|
| 2671 |
+
0.6875,
|
| 2672 |
+
0.421875,
|
| 2673 |
+
0.078125,
|
| 2674 |
+
0.65234375,
|
| 2675 |
+
0.66796875,
|
| 2676 |
+
0.56640625,
|
| 2677 |
+
0.45703125,
|
| 2678 |
+
0.64453125,
|
| 2679 |
+
0.0703125,
|
| 2680 |
+
0.06640625,
|
| 2681 |
+
0.65625,
|
| 2682 |
+
0.6796875,
|
| 2683 |
+
0.03125,
|
| 2684 |
+
0.4296875,
|
| 2685 |
+
0.48046875,
|
| 2686 |
+
0.5546875,
|
| 2687 |
+
0.51171875
|
| 2688 |
+
],
|
| 2689 |
+
"state_best_ref": [
|
| 2690 |
+
7,
|
| 2691 |
+
7,
|
| 2692 |
+
6,
|
| 2693 |
+
5,
|
| 2694 |
+
0,
|
| 2695 |
+
4,
|
| 2696 |
+
3,
|
| 2697 |
+
6,
|
| 2698 |
+
0,
|
| 2699 |
+
2,
|
| 2700 |
+
4,
|
| 2701 |
+
1,
|
| 2702 |
+
2,
|
| 2703 |
+
7,
|
| 2704 |
+
3,
|
| 2705 |
+
7,
|
| 2706 |
+
5,
|
| 2707 |
+
3,
|
| 2708 |
+
1,
|
| 2709 |
+
7,
|
| 2710 |
+
6,
|
| 2711 |
+
1,
|
| 2712 |
+
5,
|
| 2713 |
+
0,
|
| 2714 |
+
5,
|
| 2715 |
+
1,
|
| 2716 |
+
6,
|
| 2717 |
+
5,
|
| 2718 |
+
4,
|
| 2719 |
+
0,
|
| 2720 |
+
3,
|
| 2721 |
+
3,
|
| 2722 |
+
0,
|
| 2723 |
+
3,
|
| 2724 |
+
6,
|
| 2725 |
+
3,
|
| 2726 |
+
5,
|
| 2727 |
+
0,
|
| 2728 |
+
3,
|
| 2729 |
+
2,
|
| 2730 |
+
1,
|
| 2731 |
+
3,
|
| 2732 |
+
3,
|
| 2733 |
+
5,
|
| 2734 |
+
7,
|
| 2735 |
+
6,
|
| 2736 |
+
4,
|
| 2737 |
+
6,
|
| 2738 |
+
5,
|
| 2739 |
+
4,
|
| 2740 |
+
3,
|
| 2741 |
+
3,
|
| 2742 |
+
3,
|
| 2743 |
+
6,
|
| 2744 |
+
7,
|
| 2745 |
+
3,
|
| 2746 |
+
0,
|
| 2747 |
+
6,
|
| 2748 |
+
5,
|
| 2749 |
+
6,
|
| 2750 |
+
0,
|
| 2751 |
+
4,
|
| 2752 |
+
1,
|
| 2753 |
+
4
|
| 2754 |
+
],
|
| 2755 |
+
"endpoint_best_ref": [
|
| 2756 |
+
7,
|
| 2757 |
+
7,
|
| 2758 |
+
6,
|
| 2759 |
+
5,
|
| 2760 |
+
0,
|
| 2761 |
+
4,
|
| 2762 |
+
3,
|
| 2763 |
+
6,
|
| 2764 |
+
0,
|
| 2765 |
+
2,
|
| 2766 |
+
4,
|
| 2767 |
+
1,
|
| 2768 |
+
2,
|
| 2769 |
+
7,
|
| 2770 |
+
3,
|
| 2771 |
+
7,
|
| 2772 |
+
5,
|
| 2773 |
+
3,
|
| 2774 |
+
1,
|
| 2775 |
+
7,
|
| 2776 |
+
6,
|
| 2777 |
+
1,
|
| 2778 |
+
5,
|
| 2779 |
+
0,
|
| 2780 |
+
5,
|
| 2781 |
+
1,
|
| 2782 |
+
6,
|
| 2783 |
+
5,
|
| 2784 |
+
4,
|
| 2785 |
+
0,
|
| 2786 |
+
3,
|
| 2787 |
+
3,
|
| 2788 |
+
0,
|
| 2789 |
+
3,
|
| 2790 |
+
6,
|
| 2791 |
+
3,
|
| 2792 |
+
5,
|
| 2793 |
+
0,
|
| 2794 |
+
3,
|
| 2795 |
+
2,
|
| 2796 |
+
1,
|
| 2797 |
+
3,
|
| 2798 |
+
3,
|
| 2799 |
+
5,
|
| 2800 |
+
7,
|
| 2801 |
+
6,
|
| 2802 |
+
4,
|
| 2803 |
+
6,
|
| 2804 |
+
5,
|
| 2805 |
+
4,
|
| 2806 |
+
3,
|
| 2807 |
+
3,
|
| 2808 |
+
3,
|
| 2809 |
+
6,
|
| 2810 |
+
7,
|
| 2811 |
+
3,
|
| 2812 |
+
0,
|
| 2813 |
+
6,
|
| 2814 |
+
5,
|
| 2815 |
+
6,
|
| 2816 |
+
0,
|
| 2817 |
+
4,
|
| 2818 |
+
1,
|
| 2819 |
+
4
|
| 2820 |
+
]
|
| 2821 |
+
},
|
| 2822 |
+
"128": {
|
| 2823 |
+
"state_top_tokens": [
|
| 2824 |
+
{
|
| 2825 |
+
"id": 34,
|
| 2826 |
+
"old_text": "\\n",
|
| 2827 |
+
"count": 1230,
|
| 2828 |
+
"mass": 0.0750732421875
|
| 2829 |
+
},
|
| 2830 |
+
{
|
| 2831 |
+
"id": 3,
|
| 2832 |
+
"old_text": ",",
|
| 2833 |
+
"count": 1132,
|
| 2834 |
+
"mass": 0.069091796875
|
| 2835 |
+
},
|
| 2836 |
+
{
|
| 2837 |
+
"id": 40,
|
| 2838 |
+
"old_text": " the",
|
| 2839 |
+
"count": 840,
|
| 2840 |
+
"mass": 0.05126953125
|
| 2841 |
+
},
|
| 2842 |
+
{
|
| 2843 |
+
"id": 5,
|
| 2844 |
+
"old_text": ".",
|
| 2845 |
+
"count": 710,
|
| 2846 |
+
"mass": 0.0433349609375
|
| 2847 |
+
},
|
| 2848 |
+
{
|
| 2849 |
+
"id": 38,
|
| 2850 |
+
"old_text": " a",
|
| 2851 |
+
"count": 543,
|
| 2852 |
+
"mass": 0.03314208984375
|
| 2853 |
+
}
|
| 2854 |
+
],
|
| 2855 |
+
"endpoint_top_tokens": [
|
| 2856 |
+
{
|
| 2857 |
+
"id": 34,
|
| 2858 |
+
"old_text": "\\n",
|
| 2859 |
+
"count": 1230,
|
| 2860 |
+
"mass": 0.0750732421875
|
| 2861 |
+
},
|
| 2862 |
+
{
|
| 2863 |
+
"id": 3,
|
| 2864 |
+
"old_text": ",",
|
| 2865 |
+
"count": 1132,
|
| 2866 |
+
"mass": 0.069091796875
|
| 2867 |
+
},
|
| 2868 |
+
{
|
| 2869 |
+
"id": 40,
|
| 2870 |
+
"old_text": " the",
|
| 2871 |
+
"count": 840,
|
| 2872 |
+
"mass": 0.05126953125
|
| 2873 |
+
},
|
| 2874 |
+
{
|
| 2875 |
+
"id": 5,
|
| 2876 |
+
"old_text": ".",
|
| 2877 |
+
"count": 710,
|
| 2878 |
+
"mass": 0.0433349609375
|
| 2879 |
+
},
|
| 2880 |
+
{
|
| 2881 |
+
"id": 38,
|
| 2882 |
+
"old_text": " a",
|
| 2883 |
+
"count": 543,
|
| 2884 |
+
"mass": 0.03314208984375
|
| 2885 |
+
}
|
| 2886 |
+
],
|
| 2887 |
+
"state_best_acc": [
|
| 2888 |
+
0.234375,
|
| 2889 |
+
0.234375,
|
| 2890 |
+
0.55078125,
|
| 2891 |
+
0.62890625,
|
| 2892 |
+
0.08984375,
|
| 2893 |
+
0.0390625,
|
| 2894 |
+
0.52734375,
|
| 2895 |
+
0.55078125,
|
| 2896 |
+
0.24609375,
|
| 2897 |
+
0.0234375,
|
| 2898 |
+
0.0390625,
|
| 2899 |
+
0.35546875,
|
| 2900 |
+
0.125,
|
| 2901 |
+
0.28125,
|
| 2902 |
+
0.06640625,
|
| 2903 |
+
0.29296875,
|
| 2904 |
+
0.62890625,
|
| 2905 |
+
0.3671875,
|
| 2906 |
+
0.28515625,
|
| 2907 |
+
0.28515625,
|
| 2908 |
+
0.41796875,
|
| 2909 |
+
0.3125,
|
| 2910 |
+
0.60546875,
|
| 2911 |
+
0.359375,
|
| 2912 |
+
0.5234375,
|
| 2913 |
+
0.27734375,
|
| 2914 |
+
0.55078125,
|
| 2915 |
+
0.58203125,
|
| 2916 |
+
0.0390625,
|
| 2917 |
+
0.05859375,
|
| 2918 |
+
0.328125,
|
| 2919 |
+
0.50390625,
|
| 2920 |
+
0.06640625,
|
| 2921 |
+
0.23828125,
|
| 2922 |
+
0.55859375,
|
| 2923 |
+
0.51171875,
|
| 2924 |
+
0.6484375,
|
| 2925 |
+
0.34765625,
|
| 2926 |
+
0.1953125,
|
| 2927 |
+
0.19921875,
|
| 2928 |
+
0.28125,
|
| 2929 |
+
0.28125,
|
| 2930 |
+
0.5703125,
|
| 2931 |
+
0.64453125,
|
| 2932 |
+
0.19140625,
|
| 2933 |
+
0.5546875,
|
| 2934 |
+
0.078125,
|
| 2935 |
+
0.5625,
|
| 2936 |
+
0.46484375,
|
| 2937 |
+
0.04296875,
|
| 2938 |
+
0.5859375,
|
| 2939 |
+
0.59375,
|
| 2940 |
+
0.44921875,
|
| 2941 |
+
0.4140625,
|
| 2942 |
+
0.32421875,
|
| 2943 |
+
0.0625,
|
| 2944 |
+
0.07421875,
|
| 2945 |
+
0.5625,
|
| 2946 |
+
0.64453125,
|
| 2947 |
+
0.03515625,
|
| 2948 |
+
0.375,
|
| 2949 |
+
0.0625,
|
| 2950 |
+
0.21875,
|
| 2951 |
+
0.05078125
|
| 2952 |
+
],
|
| 2953 |
+
"endpoint_best_acc": [
|
| 2954 |
+
0.234375,
|
| 2955 |
+
0.234375,
|
| 2956 |
+
0.55078125,
|
| 2957 |
+
0.62890625,
|
| 2958 |
+
0.08984375,
|
| 2959 |
+
0.0390625,
|
| 2960 |
+
0.52734375,
|
| 2961 |
+
0.55078125,
|
| 2962 |
+
0.24609375,
|
| 2963 |
+
0.0234375,
|
| 2964 |
+
0.0390625,
|
| 2965 |
+
0.35546875,
|
| 2966 |
+
0.125,
|
| 2967 |
+
0.28125,
|
| 2968 |
+
0.06640625,
|
| 2969 |
+
0.29296875,
|
| 2970 |
+
0.62890625,
|
| 2971 |
+
0.3671875,
|
| 2972 |
+
0.28515625,
|
| 2973 |
+
0.28515625,
|
| 2974 |
+
0.41796875,
|
| 2975 |
+
0.3125,
|
| 2976 |
+
0.60546875,
|
| 2977 |
+
0.359375,
|
| 2978 |
+
0.5234375,
|
| 2979 |
+
0.27734375,
|
| 2980 |
+
0.55078125,
|
| 2981 |
+
0.58203125,
|
| 2982 |
+
0.0390625,
|
| 2983 |
+
0.05859375,
|
| 2984 |
+
0.328125,
|
| 2985 |
+
0.50390625,
|
| 2986 |
+
0.06640625,
|
| 2987 |
+
0.23828125,
|
| 2988 |
+
0.55859375,
|
| 2989 |
+
0.51171875,
|
| 2990 |
+
0.6484375,
|
| 2991 |
+
0.34765625,
|
| 2992 |
+
0.1953125,
|
| 2993 |
+
0.19921875,
|
| 2994 |
+
0.28125,
|
| 2995 |
+
0.28125,
|
| 2996 |
+
0.5703125,
|
| 2997 |
+
0.64453125,
|
| 2998 |
+
0.19140625,
|
| 2999 |
+
0.5546875,
|
| 3000 |
+
0.078125,
|
| 3001 |
+
0.5625,
|
| 3002 |
+
0.46484375,
|
| 3003 |
+
0.04296875,
|
| 3004 |
+
0.5859375,
|
| 3005 |
+
0.59375,
|
| 3006 |
+
0.44921875,
|
| 3007 |
+
0.4140625,
|
| 3008 |
+
0.32421875,
|
| 3009 |
+
0.0625,
|
| 3010 |
+
0.07421875,
|
| 3011 |
+
0.5625,
|
| 3012 |
+
0.64453125,
|
| 3013 |
+
0.03515625,
|
| 3014 |
+
0.375,
|
| 3015 |
+
0.0625,
|
| 3016 |
+
0.21875,
|
| 3017 |
+
0.05078125
|
| 3018 |
+
],
|
| 3019 |
+
"state_best_ref": [
|
| 3020 |
+
7,
|
| 3021 |
+
7,
|
| 3022 |
+
6,
|
| 3023 |
+
5,
|
| 3024 |
+
0,
|
| 3025 |
+
2,
|
| 3026 |
+
3,
|
| 3027 |
+
6,
|
| 3028 |
+
0,
|
| 3029 |
+
1,
|
| 3030 |
+
4,
|
| 3031 |
+
1,
|
| 3032 |
+
2,
|
| 3033 |
+
7,
|
| 3034 |
+
3,
|
| 3035 |
+
7,
|
| 3036 |
+
5,
|
| 3037 |
+
3,
|
| 3038 |
+
1,
|
| 3039 |
+
7,
|
| 3040 |
+
6,
|
| 3041 |
+
1,
|
| 3042 |
+
5,
|
| 3043 |
+
0,
|
| 3044 |
+
5,
|
| 3045 |
+
1,
|
| 3046 |
+
6,
|
| 3047 |
+
5,
|
| 3048 |
+
2,
|
| 3049 |
+
1,
|
| 3050 |
+
3,
|
| 3051 |
+
3,
|
| 3052 |
+
1,
|
| 3053 |
+
3,
|
| 3054 |
+
6,
|
| 3055 |
+
3,
|
| 3056 |
+
5,
|
| 3057 |
+
0,
|
| 3058 |
+
3,
|
| 3059 |
+
2,
|
| 3060 |
+
1,
|
| 3061 |
+
3,
|
| 3062 |
+
3,
|
| 3063 |
+
5,
|
| 3064 |
+
7,
|
| 3065 |
+
6,
|
| 3066 |
+
4,
|
| 3067 |
+
6,
|
| 3068 |
+
5,
|
| 3069 |
+
0,
|
| 3070 |
+
3,
|
| 3071 |
+
3,
|
| 3072 |
+
3,
|
| 3073 |
+
6,
|
| 3074 |
+
7,
|
| 3075 |
+
3,
|
| 3076 |
+
0,
|
| 3077 |
+
6,
|
| 3078 |
+
5,
|
| 3079 |
+
6,
|
| 3080 |
+
0,
|
| 3081 |
+
4,
|
| 3082 |
+
1,
|
| 3083 |
+
2
|
| 3084 |
+
],
|
| 3085 |
+
"endpoint_best_ref": [
|
| 3086 |
+
7,
|
| 3087 |
+
7,
|
| 3088 |
+
6,
|
| 3089 |
+
5,
|
| 3090 |
+
0,
|
| 3091 |
+
2,
|
| 3092 |
+
3,
|
| 3093 |
+
6,
|
| 3094 |
+
0,
|
| 3095 |
+
1,
|
| 3096 |
+
4,
|
| 3097 |
+
1,
|
| 3098 |
+
2,
|
| 3099 |
+
7,
|
| 3100 |
+
3,
|
| 3101 |
+
7,
|
| 3102 |
+
5,
|
| 3103 |
+
3,
|
| 3104 |
+
1,
|
| 3105 |
+
7,
|
| 3106 |
+
6,
|
| 3107 |
+
1,
|
| 3108 |
+
5,
|
| 3109 |
+
0,
|
| 3110 |
+
5,
|
| 3111 |
+
1,
|
| 3112 |
+
6,
|
| 3113 |
+
5,
|
| 3114 |
+
2,
|
| 3115 |
+
1,
|
| 3116 |
+
3,
|
| 3117 |
+
3,
|
| 3118 |
+
1,
|
| 3119 |
+
3,
|
| 3120 |
+
6,
|
| 3121 |
+
3,
|
| 3122 |
+
5,
|
| 3123 |
+
0,
|
| 3124 |
+
3,
|
| 3125 |
+
2,
|
| 3126 |
+
1,
|
| 3127 |
+
3,
|
| 3128 |
+
3,
|
| 3129 |
+
5,
|
| 3130 |
+
7,
|
| 3131 |
+
6,
|
| 3132 |
+
4,
|
| 3133 |
+
6,
|
| 3134 |
+
5,
|
| 3135 |
+
0,
|
| 3136 |
+
3,
|
| 3137 |
+
3,
|
| 3138 |
+
3,
|
| 3139 |
+
6,
|
| 3140 |
+
7,
|
| 3141 |
+
3,
|
| 3142 |
+
0,
|
| 3143 |
+
6,
|
| 3144 |
+
5,
|
| 3145 |
+
6,
|
| 3146 |
+
0,
|
| 3147 |
+
4,
|
| 3148 |
+
1,
|
| 3149 |
+
2
|
| 3150 |
+
]
|
| 3151 |
+
}
|
| 3152 |
+
},
|
| 3153 |
+
"last_step": {
|
| 3154 |
+
"step": 128,
|
| 3155 |
+
"progress": 0.9921875,
|
| 3156 |
+
"next_progress": 1.0,
|
| 3157 |
+
"dt": 0.0078125,
|
| 3158 |
+
"gamma": 1.0,
|
| 3159 |
+
"temperature": 1.0,
|
| 3160 |
+
"endpoint_alpha": 1.0,
|
| 3161 |
+
"state_acc_before_mean": 0.34881591796875,
|
| 3162 |
+
"state_acc_after_mean": 0.33282470703125,
|
| 3163 |
+
"endpoint_acc_mean": 0.33282470703125,
|
| 3164 |
+
"state_exact_after": 0,
|
| 3165 |
+
"endpoint_exact": 0,
|
| 3166 |
+
"state_pgold_best_mean": 0.33046483993530273,
|
| 3167 |
+
"endpoint_pgold_best_mean": 0.3132457137107849,
|
| 3168 |
+
"state_entropy_mean": 0.6723271012306213,
|
| 3169 |
+
"endpoint_entropy_mean": 0.672324538230896,
|
| 3170 |
+
"state_maxprob_mean": 0.7957823872566223,
|
| 3171 |
+
"endpoint_maxprob_mean": 0.7957860827445984,
|
| 3172 |
+
"oracle_clean_acc_mean": 0.603515625,
|
| 3173 |
+
"oracle_clean_pgold_mean": 0.5734644532203674,
|
| 3174 |
+
"state_best_ref_mode": 3,
|
| 3175 |
+
"endpoint_best_ref_mode": 3,
|
| 3176 |
+
"state_best_ref_counts": [
|
| 3177 |
+
7,
|
| 3178 |
+
9,
|
| 3179 |
+
5,
|
| 3180 |
+
14,
|
| 3181 |
+
3,
|
| 3182 |
+
9,
|
| 3183 |
+
10,
|
| 3184 |
+
7
|
| 3185 |
+
],
|
| 3186 |
+
"endpoint_best_ref_counts": [
|
| 3187 |
+
7,
|
| 3188 |
+
9,
|
| 3189 |
+
5,
|
| 3190 |
+
14,
|
| 3191 |
+
3,
|
| 3192 |
+
9,
|
| 3193 |
+
10,
|
| 3194 |
+
7
|
| 3195 |
+
]
|
| 3196 |
+
}
|
| 3197 |
+
}
|
LTA_openwebtext_dualt/logs/selfcond_4gpu/lta_owt_gpt2cached_len1024_1gpu_rollout_return_base_diag_20260514_002906.log
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"device": "cuda:0",
|
| 3 |
+
"rank": 0,
|
| 4 |
+
"world_size": 1,
|
| 5 |
+
"samples": "owt_cached_chunks:8734897",
|
| 6 |
+
"vocab_size": 50257,
|
| 7 |
+
"tokenizer_vocab_size": 50257,
|
| 8 |
+
"save_dir": "runs/lta_owt_gpt2cached_len1024_1gpu_rollout_return_base_diag_20260514_002906",
|
| 9 |
+
"batch_size": 32,
|
| 10 |
+
"grad_accum": 1,
|
| 11 |
+
"effective_batch_size": 32,
|
| 12 |
+
"global_batch_size": 32,
|
| 13 |
+
"lr_schedule": "constant_warmup",
|
| 14 |
+
"optimizer": "muon",
|
| 15 |
+
"warmup_steps": 2000,
|
| 16 |
+
"min_lr": 0.0,
|
| 17 |
+
"weight_decay": 0.0,
|
| 18 |
+
"adamw_param_groups": "nanogpt",
|
| 19 |
+
"adam_beta1": 0.9,
|
| 20 |
+
"adam_beta2": 0.95,
|
| 21 |
+
"adam_eps": 1e-08,
|
| 22 |
+
"muon_momentum": 0.95,
|
| 23 |
+
"muon_ns_steps": 5,
|
| 24 |
+
"muon_update_scale": 1.0,
|
| 25 |
+
"ema_decay": 0.0,
|
| 26 |
+
"ema_start_step": 0,
|
| 27 |
+
"model_type": "ddit",
|
| 28 |
+
"dual_t": true,
|
| 29 |
+
"corrupt_t_mode": "same",
|
| 30 |
+
"corrupt_min_t": 0.0,
|
| 31 |
+
"corrupt_max_t": 1.0,
|
| 32 |
+
"prefix_block_prob": 0.0,
|
| 33 |
+
"prefix_block_len": 128,
|
| 34 |
+
"mask_ratio_floor_schedule": "none",
|
| 35 |
+
"dirichlet_endpoint_mode": "categorical_dual_t",
|
| 36 |
+
"dirichlet_semantic_t_mode": "same",
|
| 37 |
+
"dirichlet_semantic_t_value": 0.0,
|
| 38 |
+
"dirichlet_semantic_t_curve": "linear",
|
| 39 |
+
"dirichlet_semantic_t_power": 1.0,
|
| 40 |
+
"endpoint_sequence_random_prob_alpha": 0.0,
|
| 41 |
+
"categorical_wrong_from_full_vocab": true,
|
| 42 |
+
"categorical_wrong_from_batch_valid_tokens": false,
|
| 43 |
+
"mask_mixture_original_prob": 0.0,
|
| 44 |
+
"mask_mixture_lowk_prob": 0.0,
|
| 45 |
+
"mask_mixture_lowcorrupt_prob": 0.0,
|
| 46 |
+
"mask_mixture_block_prob": 0.0,
|
| 47 |
+
"mask_mixture_all_prob": 0.0,
|
| 48 |
+
"mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
|
| 49 |
+
"mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
|
| 50 |
+
"mask_mixture_block_tokens": "64,128",
|
| 51 |
+
"simplex_bridge_sampler": "dirichlet",
|
| 52 |
+
"logistic_normal_sigma_min": 0.18,
|
| 53 |
+
"logistic_normal_sigma_max": 2.2,
|
| 54 |
+
"logistic_normal_tau_min": 0.65,
|
| 55 |
+
"logistic_normal_tau_max": 1.15,
|
| 56 |
+
"torch_compile": false,
|
| 57 |
+
"compile_mode": "max-autotune",
|
| 58 |
+
"state_format": "prob",
|
| 59 |
+
"target_loss": "hard_ce",
|
| 60 |
+
"meanflow_weight": 0.0,
|
| 61 |
+
"rollout_train_prob": 0.5,
|
| 62 |
+
"rollout_train_steps": 1,
|
| 63 |
+
"rollout_train_infer_steps": 64,
|
| 64 |
+
"rollout_train_temp": 1.45,
|
| 65 |
+
"rollout_train_max_gamma": 1.0,
|
| 66 |
+
"rollout_train_corrupt_only": true,
|
| 67 |
+
"rollout_train_samplewise": true,
|
| 68 |
+
"rollout_train_compute_always": false,
|
| 69 |
+
"bridge_noise_init": "logistic_normal",
|
| 70 |
+
"noise_sigma": -1.0,
|
| 71 |
+
"allow_tf32": true,
|
| 72 |
+
"activation_checkpointing": false,
|
| 73 |
+
"activation_checkpoint_interval": 1,
|
| 74 |
+
"activation_checkpoint_scope": "block",
|
| 75 |
+
"ddp_static_graph": false,
|
| 76 |
+
"ddp_gradient_as_bucket_view": true,
|
| 77 |
+
"blocking_data_transfer": false,
|
| 78 |
+
"dataloader_prefetch_factor": 4,
|
| 79 |
+
"full_train_stats": false,
|
| 80 |
+
"record_pad_truncate": false,
|
| 81 |
+
"record_add_eos": false,
|
| 82 |
+
"record_add_special_tokens": false,
|
| 83 |
+
"record_pad_token": "pad",
|
| 84 |
+
"record_shuffle_buffer": 10000,
|
| 85 |
+
"wrap": true,
|
| 86 |
+
"wrap_mode": "stream",
|
| 87 |
+
"wrap_record_buffer_size": 200,
|
| 88 |
+
"owt_cached_chunks": true,
|
| 89 |
+
"owt_chunk_cache_dir": "/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len1024_train_minus_100k",
|
| 90 |
+
"owt_chunk_cache_rebuild": false,
|
| 91 |
+
"owt_chunk_cache_write_batch": 4096,
|
| 92 |
+
"owt_exact_repeat_per_chunk": 0,
|
| 93 |
+
"online_chunk_shuffle": false,
|
| 94 |
+
"online_chunk_shuffle_buffer": 10000,
|
| 95 |
+
"openwebtext_split": "train_minus_100k",
|
| 96 |
+
"detokenizer": "auto",
|
| 97 |
+
"resolved_detokenizer": null,
|
| 98 |
+
"num_workers": 4,
|
| 99 |
+
"latest_every": 0,
|
| 100 |
+
"resume_path": ""
|
| 101 |
+
}
|
| 102 |
+
step=20 micro_steps=20 elapsed=20.2s lr=2.100000e-05 loss=10.8125 loss_recon=10.8125 loss_meanflow=0.0000 mean_model_t=0.4886 mean_corrupt_t=0.4886 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.5078 acc_all=0.0005 acc_corrupt=0.0003 corrupt_frac=0.4716 loss_all=10.8125 loss_corrupt=10.8125 acc_corrupt_t_0p0_0p2=0.0037 corrupt_frac_t_0p0_0p2=0.0353 acc_corrupt_t_0p2_0p4=0.0000 corrupt_frac_t_0p2_0p4=0.3025 acc_corrupt_t_0p4_0p6=0.0000 corrupt_frac_t_0p4_0p6=0.1542 acc_corrupt_t_0p6_0p8=0.0004 corrupt_frac_t_0p6_0p8=0.3077 acc_corrupt_t_0p8_1p0=0.0000 corrupt_frac_t_0p8_1p0=0.2003 wrong_frac=0.4271 init_acc_corrupt=0.5455 init_gold_top10=0.5717 init_gold_top100=0.5815 rollout_applied_pos_frac=0.5593 init_acc_rollout_applied=0.5406 init_acc_rollout_kept=0.5517 logit_acc_rollout_applied=0.0000 logit_acc_rollout_kept=0.0006
|
| 103 |
+
step=40 micro_steps=40 elapsed=22.1s lr=4.100000e-05 loss=10.8125 loss_recon=10.8125 loss_meanflow=0.0000 mean_model_t=0.5122 mean_corrupt_t=0.5122 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.5016 acc_all=0.0003 acc_corrupt=0.0004 corrupt_frac=0.4598 loss_all=10.8125 loss_corrupt=10.8125 acc_corrupt_t_0p0_0p2=0.0007 corrupt_frac_t_0p0_0p2=0.0958 acc_corrupt_t_0p2_0p4=0.0008 corrupt_frac_t_0p2_0p4=0.2545 acc_corrupt_t_0p4_0p6=0.0005 corrupt_frac_t_0p4_0p6=0.2818 acc_corrupt_t_0p6_0p8=0.0000 corrupt_frac_t_0p6_0p8=0.2028 acc_corrupt_t_0p8_1p0=0.0000 corrupt_frac_t_0p8_1p0=0.1651 wrong_frac=0.4979 init_acc_corrupt=0.4701 init_gold_top10=0.4988 init_gold_top100=0.5169 rollout_applied_pos_frac=0.5595 init_acc_rollout_applied=0.4179 init_acc_rollout_kept=0.5363 logit_acc_rollout_applied=0.0007 logit_acc_rollout_kept=0.0000
|
LTA_openwebtext_dualt/logs/selfcond_4gpu/lta_owt_gpt2cached_len1024_selfcond_p05_autocastfix_smoke4gpu_20260514_005005.log
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
NCCL version 2.25.1+cuda12.8
|
| 2 |
+
{
|
| 3 |
+
"device": "cuda:0",
|
| 4 |
+
"rank": 0,
|
| 5 |
+
"world_size": 4,
|
| 6 |
+
"samples": "owt_cached_chunks:8734897",
|
| 7 |
+
"vocab_size": 50257,
|
| 8 |
+
"tokenizer_vocab_size": 50257,
|
| 9 |
+
"save_dir": "runs/lta_owt_gpt2cached_len1024_selfcond_p05_autocastfix_smoke4gpu_20260514_005005",
|
| 10 |
+
"batch_size": 32,
|
| 11 |
+
"grad_accum": 4,
|
| 12 |
+
"effective_batch_size": 512,
|
| 13 |
+
"global_batch_size": 512,
|
| 14 |
+
"lr_schedule": "constant_warmup",
|
| 15 |
+
"optimizer": "muon",
|
| 16 |
+
"warmup_steps": 2000,
|
| 17 |
+
"min_lr": 0.0,
|
| 18 |
+
"weight_decay": 0.0,
|
| 19 |
+
"adamw_param_groups": "nanogpt",
|
| 20 |
+
"adam_beta1": 0.9,
|
| 21 |
+
"adam_beta2": 0.95,
|
| 22 |
+
"adam_eps": 1e-08,
|
| 23 |
+
"muon_momentum": 0.95,
|
| 24 |
+
"muon_ns_steps": 5,
|
| 25 |
+
"muon_update_scale": 1.0,
|
| 26 |
+
"ema_decay": 0.0,
|
| 27 |
+
"ema_start_step": 0,
|
| 28 |
+
"model_type": "ddit",
|
| 29 |
+
"dual_t": true,
|
| 30 |
+
"corrupt_t_mode": "same",
|
| 31 |
+
"corrupt_min_t": 0.0,
|
| 32 |
+
"corrupt_max_t": 1.0,
|
| 33 |
+
"prefix_block_prob": 0.0,
|
| 34 |
+
"prefix_block_len": 128,
|
| 35 |
+
"mask_ratio_floor_schedule": "none",
|
| 36 |
+
"dirichlet_endpoint_mode": "categorical_dual_t",
|
| 37 |
+
"dirichlet_semantic_t_mode": "same",
|
| 38 |
+
"dirichlet_semantic_t_value": 0.0,
|
| 39 |
+
"dirichlet_semantic_t_curve": "linear",
|
| 40 |
+
"dirichlet_semantic_t_power": 1.0,
|
| 41 |
+
"endpoint_sequence_random_prob_alpha": 0.0,
|
| 42 |
+
"categorical_wrong_from_full_vocab": true,
|
| 43 |
+
"categorical_wrong_from_batch_valid_tokens": false,
|
| 44 |
+
"mask_mixture_original_prob": 0.0,
|
| 45 |
+
"mask_mixture_lowk_prob": 0.0,
|
| 46 |
+
"mask_mixture_lowcorrupt_prob": 0.0,
|
| 47 |
+
"mask_mixture_block_prob": 0.0,
|
| 48 |
+
"mask_mixture_all_prob": 0.0,
|
| 49 |
+
"mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
|
| 50 |
+
"mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
|
| 51 |
+
"mask_mixture_block_tokens": "64,128",
|
| 52 |
+
"simplex_bridge_sampler": "dirichlet",
|
| 53 |
+
"logistic_normal_sigma_min": 0.18,
|
| 54 |
+
"logistic_normal_sigma_max": 2.2,
|
| 55 |
+
"logistic_normal_tau_min": 0.65,
|
| 56 |
+
"logistic_normal_tau_max": 1.15,
|
| 57 |
+
"torch_compile": false,
|
| 58 |
+
"compile_mode": "max-autotune",
|
| 59 |
+
"state_format": "prob",
|
| 60 |
+
"target_loss": "hard_ce",
|
| 61 |
+
"meanflow_weight": 0.0,
|
| 62 |
+
"rollout_train_prob": 0.5,
|
| 63 |
+
"rollout_train_steps": 1,
|
| 64 |
+
"rollout_train_infer_steps": 64,
|
| 65 |
+
"rollout_train_temp": 1.45,
|
| 66 |
+
"rollout_train_max_gamma": 1.0,
|
| 67 |
+
"rollout_train_corrupt_only": true,
|
| 68 |
+
"rollout_train_samplewise": true,
|
| 69 |
+
"rollout_train_compute_always": false,
|
| 70 |
+
"bridge_noise_init": "logistic_normal",
|
| 71 |
+
"noise_sigma": -1.0,
|
| 72 |
+
"allow_tf32": true,
|
| 73 |
+
"activation_checkpointing": false,
|
| 74 |
+
"activation_checkpoint_interval": 1,
|
| 75 |
+
"activation_checkpoint_scope": "block",
|
| 76 |
+
"ddp_static_graph": false,
|
| 77 |
+
"ddp_gradient_as_bucket_view": true,
|
| 78 |
+
"blocking_data_transfer": false,
|
| 79 |
+
"dataloader_prefetch_factor": 4,
|
| 80 |
+
"full_train_stats": false,
|
| 81 |
+
"record_pad_truncate": false,
|
| 82 |
+
"record_add_eos": false,
|
| 83 |
+
"record_add_special_tokens": false,
|
| 84 |
+
"record_pad_token": "pad",
|
| 85 |
+
"record_shuffle_buffer": 10000,
|
| 86 |
+
"wrap": true,
|
| 87 |
+
"wrap_mode": "stream",
|
| 88 |
+
"wrap_record_buffer_size": 200,
|
| 89 |
+
"owt_cached_chunks": true,
|
| 90 |
+
"owt_chunk_cache_dir": "/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len1024_train_minus_100k",
|
| 91 |
+
"owt_chunk_cache_rebuild": false,
|
| 92 |
+
"owt_chunk_cache_write_batch": 4096,
|
| 93 |
+
"owt_exact_repeat_per_chunk": 0,
|
| 94 |
+
"online_chunk_shuffle": false,
|
| 95 |
+
"online_chunk_shuffle_buffer": 10000,
|
| 96 |
+
"openwebtext_split": "train_minus_100k",
|
| 97 |
+
"detokenizer": "auto",
|
| 98 |
+
"resolved_detokenizer": null,
|
| 99 |
+
"num_workers": 4,
|
| 100 |
+
"latest_every": 0,
|
| 101 |
+
"resume_path": ""
|
| 102 |
+
}
|
| 103 |
+
step=20 micro_steps=80 elapsed=85.9s lr=2.100000e-05 loss=10.8125 loss_recon=10.8125 loss_meanflow=0.0000 mean_model_t=0.4997 mean_corrupt_t=0.4997 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.5125 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 out_w_norm=0.0017 out_g_norm=1.0682 acc_all=0.5844 acc_corrupt=0.4340 corrupt_frac=0.5791 loss_all=10.8125 loss_corrupt=10.8125 acc_corrupt_t_0p0_0p2=0.0566 corrupt_frac_t_0p0_0p2=0.2347 acc_corrupt_t_0p2_0p4=0.2340 corrupt_frac_t_0p2_0p4=0.1446 acc_corrupt_t_0p4_0p6=0.4344 corrupt_frac_t_0p4_0p6=0.0960 acc_corrupt_t_0p6_0p8=0.5764 corrupt_frac_t_0p6_0p8=0.0845 acc_corrupt_t_0p8_1p0=0.6734 corrupt_frac_t_0p8_1p0=0.4403 wrong_frac=0.4264 init_acc_corrupt=0.5383 init_gold_top10=0.5672 init_gold_top100=0.6079 rollout_applied_pos_frac=0.5383 init_acc_rollout_applied=0.6241 init_acc_rollout_kept=0.4383 logit_acc_rollout_applied=0.5028 logit_acc_rollout_kept=0.3537
|
| 104 |
+
step=40 micro_steps=160 elapsed=100.6s lr=4.100000e-05 loss=10.8125 loss_recon=10.8125 loss_meanflow=0.0000 mean_model_t=0.4828 mean_corrupt_t=0.4828 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.5297 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 out_w_norm=0.0121 out_g_norm=1.0545 acc_all=0.5412 acc_corrupt=0.3598 corrupt_frac=0.5686 loss_all=10.8125 loss_corrupt=10.8125 acc_corrupt_t_0p0_0p2=0.0256 corrupt_frac_t_0p0_0p2=0.2223 acc_corrupt_t_0p2_0p4=0.2657 corrupt_frac_t_0p2_0p4=0.2560 acc_corrupt_t_0p4_0p6=0.3865 corrupt_frac_t_0p4_0p6=0.1561 acc_corrupt_t_0p6_0p8=0.5197 corrupt_frac_t_0p6_0p8=0.1894 acc_corrupt_t_0p8_1p0=0.7223 corrupt_frac_t_0p8_1p0=0.1763 wrong_frac=0.5301 init_acc_corrupt=0.4423 init_gold_top10=0.4647 init_gold_top100=0.5096 rollout_applied_pos_frac=0.6069 init_acc_rollout_applied=0.4848 init_acc_rollout_kept=0.3766 logit_acc_rollout_applied=0.4024 logit_acc_rollout_kept=0.2940
|
LTA_openwebtext_dualt/logs/selfcond_4gpu/lta_owt_gpt2cached_len1024_selfcond_p05_rollout1_autocastfix_c1024_ddit768x12_muon_ema_gbs512_4gpu_50k_20260514_005426.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/.lock
ADDED
|
File without changes
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/CACHEDIR.TAG
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/__init__.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .core import (
|
| 2 |
+
IDNABidiError,
|
| 3 |
+
IDNAError,
|
| 4 |
+
InvalidCodepoint,
|
| 5 |
+
InvalidCodepointContext,
|
| 6 |
+
alabel,
|
| 7 |
+
check_bidi,
|
| 8 |
+
check_hyphen_ok,
|
| 9 |
+
check_initial_combiner,
|
| 10 |
+
check_label,
|
| 11 |
+
check_nfc,
|
| 12 |
+
decode,
|
| 13 |
+
encode,
|
| 14 |
+
ulabel,
|
| 15 |
+
uts46_remap,
|
| 16 |
+
valid_contextj,
|
| 17 |
+
valid_contexto,
|
| 18 |
+
valid_label_length,
|
| 19 |
+
valid_string_length,
|
| 20 |
+
)
|
| 21 |
+
from .intranges import intranges_contain
|
| 22 |
+
from .package_data import __version__
|
| 23 |
+
|
| 24 |
+
__all__ = [
|
| 25 |
+
"__version__",
|
| 26 |
+
"IDNABidiError",
|
| 27 |
+
"IDNAError",
|
| 28 |
+
"InvalidCodepoint",
|
| 29 |
+
"InvalidCodepointContext",
|
| 30 |
+
"alabel",
|
| 31 |
+
"check_bidi",
|
| 32 |
+
"check_hyphen_ok",
|
| 33 |
+
"check_initial_combiner",
|
| 34 |
+
"check_label",
|
| 35 |
+
"check_nfc",
|
| 36 |
+
"decode",
|
| 37 |
+
"encode",
|
| 38 |
+
"intranges_contain",
|
| 39 |
+
"ulabel",
|
| 40 |
+
"uts46_remap",
|
| 41 |
+
"valid_contextj",
|
| 42 |
+
"valid_contexto",
|
| 43 |
+
"valid_label_length",
|
| 44 |
+
"valid_string_length",
|
| 45 |
+
]
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/cli.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Command-line interface for the :mod:`idna` package.
|
| 2 |
+
|
| 3 |
+
Invoked via ``python -m idna``. See :func:`main` for the entry point.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import sys
|
| 8 |
+
from collections.abc import Iterable
|
| 9 |
+
from itertools import chain
|
| 10 |
+
from typing import IO, Optional
|
| 11 |
+
|
| 12 |
+
from . import IDNAError, decode, encode
|
| 13 |
+
from .core import _alabel_prefix, _unicode_dots_re
|
| 14 |
+
from .package_data import __version__
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _looks_like_alabel(s: str) -> bool:
|
| 18 |
+
"""Return True if any label in ``s`` carries the ``xn--`` ACE prefix."""
|
| 19 |
+
prefix = _alabel_prefix.decode("ascii")
|
| 20 |
+
return any(label.lower().startswith(prefix) for label in _unicode_dots_re.split(s))
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def _build_parser() -> argparse.ArgumentParser:
|
| 24 |
+
parser = argparse.ArgumentParser(
|
| 25 |
+
prog="python -m idna",
|
| 26 |
+
description=(
|
| 27 |
+
"Convert a domain name between its Unicode (U-label) and "
|
| 28 |
+
"ASCII-compatible (A-label) forms. With no mode flag, the "
|
| 29 |
+
"direction is chosen from the first input — if it contains "
|
| 30 |
+
"an xn-- label the stream is decoded, otherwise it is "
|
| 31 |
+
"encoded — and the same mode is applied to every remaining "
|
| 32 |
+
"input. UTS #46 mapping is applied by default; pass "
|
| 33 |
+
"--strict to disable it. When no domains are given on the "
|
| 34 |
+
"command line and stdin is piped, one domain per line is "
|
| 35 |
+
"read from stdin."
|
| 36 |
+
),
|
| 37 |
+
)
|
| 38 |
+
mode = parser.add_mutually_exclusive_group()
|
| 39 |
+
mode.add_argument(
|
| 40 |
+
"-e",
|
| 41 |
+
"--encode",
|
| 42 |
+
dest="mode",
|
| 43 |
+
action="store_const",
|
| 44 |
+
const="encode",
|
| 45 |
+
help="Encode the input to its ASCII A-label form.",
|
| 46 |
+
)
|
| 47 |
+
mode.add_argument(
|
| 48 |
+
"-d",
|
| 49 |
+
"--decode",
|
| 50 |
+
dest="mode",
|
| 51 |
+
action="store_const",
|
| 52 |
+
const="decode",
|
| 53 |
+
help="Decode the input from its ASCII A-label form.",
|
| 54 |
+
)
|
| 55 |
+
parser.add_argument(
|
| 56 |
+
"--strict",
|
| 57 |
+
action="store_true",
|
| 58 |
+
help="Disable the default UTS #46 mapping and apply IDNA 2008 rules verbatim.",
|
| 59 |
+
)
|
| 60 |
+
parser.add_argument(
|
| 61 |
+
"--version",
|
| 62 |
+
action="version",
|
| 63 |
+
version=f"idna {__version__}",
|
| 64 |
+
)
|
| 65 |
+
parser.add_argument(
|
| 66 |
+
"domain",
|
| 67 |
+
nargs="*",
|
| 68 |
+
help="One or more domain names to convert. Omit to read from stdin.",
|
| 69 |
+
)
|
| 70 |
+
return parser
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def _iter_stdin(stream: IO[str]) -> Iterable[str]:
|
| 74 |
+
"""Yield non-empty stripped lines from ``stream``, ignoring blanks."""
|
| 75 |
+
for line in stream:
|
| 76 |
+
stripped = line.strip()
|
| 77 |
+
if stripped:
|
| 78 |
+
yield stripped
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def _convert_one(domain: str, mode: str, uts46: bool) -> bool:
|
| 82 |
+
"""Convert ``domain`` and write the result; return ``False`` on failure."""
|
| 83 |
+
try:
|
| 84 |
+
if mode == "decode":
|
| 85 |
+
print(decode(domain, uts46=uts46))
|
| 86 |
+
else:
|
| 87 |
+
print(encode(domain, uts46=uts46).decode("ascii"))
|
| 88 |
+
except IDNAError as err:
|
| 89 |
+
print(f"idna: {mode} failed for {domain!r}: {err}", file=sys.stderr)
|
| 90 |
+
return False
|
| 91 |
+
return True
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def main(argv: Optional[list[str]] = None) -> int:
|
| 95 |
+
"""Entry point for ``python -m idna``.
|
| 96 |
+
|
| 97 |
+
When more than one domain is supplied (via positional arguments or
|
| 98 |
+
piped stdin) and no mode flag is given, the first input determines
|
| 99 |
+
the direction and that mode is applied uniformly to the rest.
|
| 100 |
+
|
| 101 |
+
:param argv: Argument list excluding the program name. Defaults to
|
| 102 |
+
:data:`sys.argv` when ``None``.
|
| 103 |
+
:returns: ``0`` on success, ``1`` if any conversion fails.
|
| 104 |
+
"""
|
| 105 |
+
parser = _build_parser()
|
| 106 |
+
args = parser.parse_args(argv)
|
| 107 |
+
uts46 = not args.strict
|
| 108 |
+
|
| 109 |
+
if args.domain:
|
| 110 |
+
domains: Iterable[str] = args.domain
|
| 111 |
+
elif not sys.stdin.isatty():
|
| 112 |
+
domains = _iter_stdin(sys.stdin)
|
| 113 |
+
else:
|
| 114 |
+
parser.error("a domain argument is required when stdin is a terminal")
|
| 115 |
+
|
| 116 |
+
iterator = iter(domains)
|
| 117 |
+
first = next(iterator, None)
|
| 118 |
+
if first is None:
|
| 119 |
+
return 0
|
| 120 |
+
|
| 121 |
+
mode = args.mode or ("decode" if _looks_like_alabel(first) else "encode")
|
| 122 |
+
|
| 123 |
+
results = [_convert_one(domain, mode, uts46) for domain in chain([first], iterator)]
|
| 124 |
+
return 0 if all(results) else 1
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
sys.exit(main())
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/core.py
ADDED
|
@@ -0,0 +1,605 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import bisect
|
| 2 |
+
import re
|
| 3 |
+
import unicodedata
|
| 4 |
+
import warnings
|
| 5 |
+
from typing import Optional, Union
|
| 6 |
+
|
| 7 |
+
from . import idnadata
|
| 8 |
+
from .intranges import intranges_contain
|
| 9 |
+
|
| 10 |
+
_virama_combining_class = 9
|
| 11 |
+
_alabel_prefix = b"xn--"
|
| 12 |
+
_unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]")
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# Bidi category sets from RFC 5893, hoisted out of the per-codepoint loop
|
| 16 |
+
_bidi_rtl_first = frozenset({"R", "AL"})
|
| 17 |
+
_bidi_rtl_categories = frozenset({"R", "AL", "AN"})
|
| 18 |
+
_bidi_rtl_allowed = frozenset({"R", "AL", "AN", "EN", "ES", "CS", "ET", "ON", "BN", "NSM"})
|
| 19 |
+
_bidi_rtl_valid_ending = frozenset({"R", "AL", "EN", "AN"})
|
| 20 |
+
_bidi_rtl_numeric = frozenset({"AN", "EN"})
|
| 21 |
+
_bidi_ltr_allowed = frozenset({"L", "EN", "ES", "CS", "ET", "ON", "BN", "NSM"})
|
| 22 |
+
_bidi_ltr_valid_ending = frozenset({"L", "EN"})
|
| 23 |
+
_bidi_joiner_l_or_d = frozenset({ord("L"), ord("D")})
|
| 24 |
+
_bidi_joiner_r_or_d = frozenset({ord("R"), ord("D")})
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class IDNAError(UnicodeError):
|
| 28 |
+
"""Base exception for all IDNA-encoding related problems"""
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class IDNABidiError(IDNAError):
|
| 32 |
+
"""Exception when bidirectional requirements are not satisfied"""
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class InvalidCodepoint(IDNAError):
|
| 36 |
+
"""Exception when a disallowed or unallocated codepoint is used"""
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class InvalidCodepointContext(IDNAError):
|
| 40 |
+
"""Exception when the codepoint is not valid in the context it is used"""
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def _combining_class(cp: int) -> int:
|
| 44 |
+
v = unicodedata.combining(chr(cp))
|
| 45 |
+
if v == 0 and not unicodedata.name(chr(cp)):
|
| 46 |
+
raise ValueError("Unknown character in unicodedata")
|
| 47 |
+
return v
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def _is_script(cp: str, script: str) -> bool:
|
| 51 |
+
return intranges_contain(ord(cp), idnadata.scripts[script])
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def _punycode(s: str) -> bytes:
|
| 55 |
+
return s.encode("punycode")
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def _unot(s: int) -> str:
|
| 59 |
+
return f"U+{s:04X}"
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def valid_label_length(label: Union[bytes, str]) -> bool:
|
| 63 |
+
"""Check that a label does not exceed the maximum permitted length.
|
| 64 |
+
|
| 65 |
+
Per :rfc:`1035` (and :rfc:`5891` §4.2.4) a DNS label must not exceed
|
| 66 |
+
63 octets. The argument may be either a :class:`str` (a U-label, where
|
| 67 |
+
length is measured in characters) or :class:`bytes` (an A-label, where
|
| 68 |
+
length is measured in octets).
|
| 69 |
+
|
| 70 |
+
:param label: The label to check.
|
| 71 |
+
:returns: ``True`` if the label is within the length limit, otherwise
|
| 72 |
+
``False``.
|
| 73 |
+
"""
|
| 74 |
+
return len(label) <= 63
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def valid_string_length(domain: Union[bytes, str], trailing_dot: bool) -> bool:
|
| 78 |
+
"""Check that a full domain name does not exceed the maximum length.
|
| 79 |
+
|
| 80 |
+
Per :rfc:`1035`, a domain name is limited to 253 octets when no trailing
|
| 81 |
+
dot is present, or 254 octets when one is included.
|
| 82 |
+
|
| 83 |
+
:param domain: The full (possibly multi-label) domain name.
|
| 84 |
+
:param trailing_dot: ``True`` if ``domain`` includes a trailing ``.``.
|
| 85 |
+
:returns: ``True`` if the domain is within the length limit, otherwise
|
| 86 |
+
``False``.
|
| 87 |
+
"""
|
| 88 |
+
return len(domain) <= (254 if trailing_dot else 253)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def check_bidi(label: str, check_ltr: bool = False) -> bool:
|
| 92 |
+
"""Validate the Bidi Rule from :rfc:`5893` for a single label.
|
| 93 |
+
|
| 94 |
+
The Bidi Rule constrains how bidirectional characters (Hebrew, Arabic,
|
| 95 |
+
etc.) may appear within a label. By default the check is only applied
|
| 96 |
+
when the label contains at least one right-to-left character (Unicode
|
| 97 |
+
bidirectional categories ``R``, ``AL``, or ``AN``); set ``check_ltr``
|
| 98 |
+
to ``True`` to apply it to LTR-only labels as well.
|
| 99 |
+
|
| 100 |
+
:param label: The label to validate, as a Unicode string.
|
| 101 |
+
:param check_ltr: If ``True``, apply the rules even when the label
|
| 102 |
+
contains no RTL characters.
|
| 103 |
+
:returns: ``True`` if the label satisfies the Bidi Rule.
|
| 104 |
+
:raises IDNABidiError: If any of Bidi Rule conditions 1-6 are violated,
|
| 105 |
+
or if the directional category of a codepoint cannot be determined.
|
| 106 |
+
"""
|
| 107 |
+
# Bidi rules should only be applied if string contains RTL characters
|
| 108 |
+
bidi_label = False
|
| 109 |
+
for idx, cp in enumerate(label, 1):
|
| 110 |
+
direction = unicodedata.bidirectional(cp)
|
| 111 |
+
if direction == "":
|
| 112 |
+
# String likely comes from a newer version of Unicode
|
| 113 |
+
raise IDNABidiError(f"Unknown directionality in label {label!r} at position {idx}")
|
| 114 |
+
if direction in _bidi_rtl_categories:
|
| 115 |
+
bidi_label = True
|
| 116 |
+
if not bidi_label and not check_ltr:
|
| 117 |
+
return True
|
| 118 |
+
|
| 119 |
+
# Bidi rule 1
|
| 120 |
+
direction = unicodedata.bidirectional(label[0])
|
| 121 |
+
if direction in _bidi_rtl_first:
|
| 122 |
+
rtl = True
|
| 123 |
+
elif direction == "L":
|
| 124 |
+
rtl = False
|
| 125 |
+
else:
|
| 126 |
+
raise IDNABidiError(f"First codepoint in label {label!r} must be directionality L, R or AL")
|
| 127 |
+
|
| 128 |
+
valid_ending = False
|
| 129 |
+
number_type: Optional[str] = None
|
| 130 |
+
for idx, cp in enumerate(label, 1):
|
| 131 |
+
direction = unicodedata.bidirectional(cp)
|
| 132 |
+
|
| 133 |
+
if rtl:
|
| 134 |
+
# Bidi rule 2
|
| 135 |
+
if direction not in _bidi_rtl_allowed:
|
| 136 |
+
raise IDNABidiError(f"Invalid direction for codepoint at position {idx} in a right-to-left label")
|
| 137 |
+
# Bidi rule 3
|
| 138 |
+
if direction in _bidi_rtl_valid_ending:
|
| 139 |
+
valid_ending = True
|
| 140 |
+
elif direction != "NSM":
|
| 141 |
+
valid_ending = False
|
| 142 |
+
# Bidi rule 4
|
| 143 |
+
if direction in _bidi_rtl_numeric:
|
| 144 |
+
if not number_type:
|
| 145 |
+
number_type = direction
|
| 146 |
+
elif number_type != direction:
|
| 147 |
+
raise IDNABidiError("Can not mix numeral types in a right-to-left label")
|
| 148 |
+
else:
|
| 149 |
+
# Bidi rule 5
|
| 150 |
+
if direction not in _bidi_ltr_allowed:
|
| 151 |
+
raise IDNABidiError(f"Invalid direction for codepoint at position {idx} in a left-to-right label")
|
| 152 |
+
# Bidi rule 6
|
| 153 |
+
if direction in _bidi_ltr_valid_ending:
|
| 154 |
+
valid_ending = True
|
| 155 |
+
elif direction != "NSM":
|
| 156 |
+
valid_ending = False
|
| 157 |
+
|
| 158 |
+
if not valid_ending:
|
| 159 |
+
raise IDNABidiError("Label ends with illegal codepoint directionality")
|
| 160 |
+
|
| 161 |
+
return True
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def check_initial_combiner(label: str) -> bool:
|
| 165 |
+
"""Reject labels that begin with a combining mark.
|
| 166 |
+
|
| 167 |
+
Per :rfc:`5891` §4.2.3.2 a label must not start with a character of
|
| 168 |
+
Unicode general category ``M`` (Mark).
|
| 169 |
+
|
| 170 |
+
:param label: The label to check.
|
| 171 |
+
:returns: ``True`` if the first character is not a combining mark.
|
| 172 |
+
:raises IDNAError: If the label begins with a combining character.
|
| 173 |
+
"""
|
| 174 |
+
if unicodedata.category(label[0])[0] == "M":
|
| 175 |
+
raise IDNAError("Label begins with an illegal combining character")
|
| 176 |
+
return True
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def check_hyphen_ok(label: str) -> bool:
|
| 180 |
+
"""Validate the hyphen restrictions for a label.
|
| 181 |
+
|
| 182 |
+
Per :rfc:`5891` §4.2.3.1 a label must not start or end with a hyphen
|
| 183 |
+
(``U+002D``), and must not have hyphens in both the third and fourth
|
| 184 |
+
positions (the prefix reserved for A-labels).
|
| 185 |
+
|
| 186 |
+
:param label: The label to check.
|
| 187 |
+
:returns: ``True`` if the hyphen restrictions are satisfied.
|
| 188 |
+
:raises IDNAError: If any of the hyphen restrictions are violated.
|
| 189 |
+
"""
|
| 190 |
+
if label[2:4] == "--":
|
| 191 |
+
raise IDNAError("Label has disallowed hyphens in 3rd and 4th position")
|
| 192 |
+
if label[0] == "-" or label[-1] == "-":
|
| 193 |
+
raise IDNAError("Label must not start or end with a hyphen")
|
| 194 |
+
return True
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def check_nfc(label: str) -> None:
|
| 198 |
+
"""Require that a label is in Unicode Normalization Form C.
|
| 199 |
+
|
| 200 |
+
:param label: The label to check.
|
| 201 |
+
:raises IDNAError: If ``label`` differs from its NFC normalisation.
|
| 202 |
+
"""
|
| 203 |
+
if unicodedata.normalize("NFC", label) != label:
|
| 204 |
+
raise IDNAError("Label must be in Normalization Form C")
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
def valid_contextj(label: str, pos: int) -> bool:
|
| 208 |
+
"""Validate the CONTEXTJ rules from :rfc:`5892` Appendix A.
|
| 209 |
+
|
| 210 |
+
These rules govern the contextual use of the joiner codepoints
|
| 211 |
+
``U+200C`` (ZERO WIDTH NON-JOINER, Appendix A.1) and ``U+200D``
|
| 212 |
+
(ZERO WIDTH JOINER, Appendix A.2) within a label.
|
| 213 |
+
|
| 214 |
+
:param label: The label containing the codepoint.
|
| 215 |
+
:param pos: Index of the joiner codepoint within ``label``.
|
| 216 |
+
:returns: ``True`` if the codepoint at ``pos`` satisfies its CONTEXTJ
|
| 217 |
+
rule, ``False`` otherwise (including when the codepoint at
|
| 218 |
+
``pos`` is not a recognised joiner).
|
| 219 |
+
:raises ValueError: If an adjacent codepoint has no Unicode name when
|
| 220 |
+
determining its combining class.
|
| 221 |
+
"""
|
| 222 |
+
cp_value = ord(label[pos])
|
| 223 |
+
|
| 224 |
+
if cp_value == 0x200C:
|
| 225 |
+
if pos > 0 and _combining_class(ord(label[pos - 1])) == _virama_combining_class:
|
| 226 |
+
return True
|
| 227 |
+
|
| 228 |
+
ok = False
|
| 229 |
+
for i in range(pos - 1, -1, -1):
|
| 230 |
+
joining_type = idnadata.joining_types().get(ord(label[i]))
|
| 231 |
+
if joining_type == ord("T"):
|
| 232 |
+
continue
|
| 233 |
+
if joining_type in _bidi_joiner_l_or_d:
|
| 234 |
+
ok = True
|
| 235 |
+
break
|
| 236 |
+
break
|
| 237 |
+
|
| 238 |
+
if not ok:
|
| 239 |
+
return False
|
| 240 |
+
|
| 241 |
+
ok = False
|
| 242 |
+
for i in range(pos + 1, len(label)):
|
| 243 |
+
joining_type = idnadata.joining_types().get(ord(label[i]))
|
| 244 |
+
if joining_type == ord("T"):
|
| 245 |
+
continue
|
| 246 |
+
if joining_type in _bidi_joiner_r_or_d:
|
| 247 |
+
ok = True
|
| 248 |
+
break
|
| 249 |
+
break
|
| 250 |
+
return ok
|
| 251 |
+
|
| 252 |
+
if cp_value == 0x200D:
|
| 253 |
+
return pos > 0 and _combining_class(ord(label[pos - 1])) == _virama_combining_class
|
| 254 |
+
|
| 255 |
+
return False
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
def valid_contexto(label: str, pos: int, exception: bool = False) -> bool:
|
| 259 |
+
"""Validate the CONTEXTO rules from :rfc:`5892` Appendix A.
|
| 260 |
+
|
| 261 |
+
Covers the contextual rules for codepoints such as MIDDLE DOT
|
| 262 |
+
(``U+00B7``), Greek lower numeral sign, Hebrew punctuation, Katakana
|
| 263 |
+
middle dot, and the Arabic-Indic / Extended Arabic-Indic digit ranges.
|
| 264 |
+
|
| 265 |
+
:param label: The label containing the codepoint.
|
| 266 |
+
:param pos: Index of the codepoint within ``label``.
|
| 267 |
+
:param exception: Reserved for forward compatibility; currently unused.
|
| 268 |
+
:returns: ``True`` if the codepoint at ``pos`` satisfies its CONTEXTO
|
| 269 |
+
rule, ``False`` otherwise (including when the codepoint is not a
|
| 270 |
+
recognised CONTEXTO codepoint).
|
| 271 |
+
"""
|
| 272 |
+
cp_value = ord(label[pos])
|
| 273 |
+
|
| 274 |
+
if cp_value == 0x00B7:
|
| 275 |
+
return 0 < pos < len(label) - 1 and ord(label[pos - 1]) == 0x006C and ord(label[pos + 1]) == 0x006C
|
| 276 |
+
|
| 277 |
+
if cp_value == 0x0375:
|
| 278 |
+
if pos < len(label) - 1 and len(label) > 1:
|
| 279 |
+
return _is_script(label[pos + 1], "Greek")
|
| 280 |
+
return False
|
| 281 |
+
|
| 282 |
+
if cp_value in {0x05F3, 0x05F4}:
|
| 283 |
+
if pos > 0:
|
| 284 |
+
return _is_script(label[pos - 1], "Hebrew")
|
| 285 |
+
return False
|
| 286 |
+
|
| 287 |
+
if cp_value == 0x30FB:
|
| 288 |
+
for cp in label:
|
| 289 |
+
if cp == "\u30fb":
|
| 290 |
+
continue
|
| 291 |
+
if _is_script(cp, "Hiragana") or _is_script(cp, "Katakana") or _is_script(cp, "Han"):
|
| 292 |
+
return True
|
| 293 |
+
return False
|
| 294 |
+
|
| 295 |
+
if 0x660 <= cp_value <= 0x669:
|
| 296 |
+
return not any(0x6F0 <= ord(cp) <= 0x06F9 for cp in label)
|
| 297 |
+
|
| 298 |
+
if 0x6F0 <= cp_value <= 0x6F9:
|
| 299 |
+
return not any(0x660 <= ord(cp) <= 0x0669 for cp in label)
|
| 300 |
+
|
| 301 |
+
return False
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
def check_label(label: Union[str, bytes, bytearray]) -> None:
|
| 305 |
+
"""Run the full set of IDNA 2008 validity checks on a single label.
|
| 306 |
+
|
| 307 |
+
Applies, in order: NFC normalisation (:func:`check_nfc`), hyphen
|
| 308 |
+
restrictions (:func:`check_hyphen_ok`), the no-leading-combiner rule
|
| 309 |
+
(:func:`check_initial_combiner`), per-codepoint validity (PVALID,
|
| 310 |
+
CONTEXTJ, CONTEXTO classes from :rfc:`5892`), and the Bidi Rule
|
| 311 |
+
(:func:`check_bidi`).
|
| 312 |
+
|
| 313 |
+
:param label: The label to validate. ``bytes`` or ``bytearray`` input
|
| 314 |
+
is decoded as UTF-8 first.
|
| 315 |
+
:raises IDNAError: If the label is empty or fails a structural rule.
|
| 316 |
+
:raises InvalidCodepoint: If the label contains a DISALLOWED or
|
| 317 |
+
UNASSIGNED codepoint.
|
| 318 |
+
:raises InvalidCodepointContext: If a CONTEXTJ or CONTEXTO codepoint
|
| 319 |
+
is not valid in its context.
|
| 320 |
+
:raises IDNABidiError: If the Bidi Rule is violated.
|
| 321 |
+
"""
|
| 322 |
+
if isinstance(label, (bytes, bytearray)):
|
| 323 |
+
label = label.decode("utf-8")
|
| 324 |
+
if len(label) == 0:
|
| 325 |
+
raise IDNAError("Empty Label")
|
| 326 |
+
|
| 327 |
+
# Reject on domain length rather than label length so support some UTS 46
|
| 328 |
+
# use cases, still reducing processing of label contextual rules
|
| 329 |
+
if not valid_string_length(label, trailing_dot=True):
|
| 330 |
+
raise IDNAError("Label too long")
|
| 331 |
+
|
| 332 |
+
check_nfc(label)
|
| 333 |
+
check_hyphen_ok(label)
|
| 334 |
+
check_initial_combiner(label)
|
| 335 |
+
|
| 336 |
+
for pos, cp in enumerate(label):
|
| 337 |
+
cp_value = ord(cp)
|
| 338 |
+
if intranges_contain(cp_value, idnadata.codepoint_classes["PVALID"]):
|
| 339 |
+
continue
|
| 340 |
+
if intranges_contain(cp_value, idnadata.codepoint_classes["CONTEXTJ"]):
|
| 341 |
+
try:
|
| 342 |
+
if not valid_contextj(label, pos):
|
| 343 |
+
raise InvalidCodepointContext(f"Joiner {_unot(cp_value)} not allowed at position {pos + 1} in {label!r}")
|
| 344 |
+
except ValueError as err:
|
| 345 |
+
raise IDNAError(
|
| 346 |
+
f"Unknown codepoint adjacent to joiner {_unot(cp_value)} at position {pos + 1} in {label!r}"
|
| 347 |
+
) from err
|
| 348 |
+
elif intranges_contain(cp_value, idnadata.codepoint_classes["CONTEXTO"]):
|
| 349 |
+
if not valid_contexto(label, pos):
|
| 350 |
+
raise InvalidCodepointContext(f"Codepoint {_unot(cp_value)} not allowed at position {pos + 1} in {label!r}")
|
| 351 |
+
else:
|
| 352 |
+
raise InvalidCodepoint(f"Codepoint {_unot(cp_value)} at position {pos + 1} of {label!r} not allowed")
|
| 353 |
+
|
| 354 |
+
check_bidi(label)
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
def alabel(label: str) -> bytes:
|
| 358 |
+
"""Convert a single U-label into its A-label form.
|
| 359 |
+
|
| 360 |
+
The result is the ASCII-Compatible Encoding (ACE) form per :rfc:`5891`
|
| 361 |
+
§4: the label is validated, Punycode-encoded, and prefixed with
|
| 362 |
+
``xn--``. Pure ASCII labels that are already valid IDNA labels are
|
| 363 |
+
returned unchanged (as :class:`bytes`).
|
| 364 |
+
|
| 365 |
+
:param label: The label to convert, as a Unicode string.
|
| 366 |
+
:returns: The A-label as ASCII-encoded :class:`bytes`.
|
| 367 |
+
:raises IDNAError: If the label is invalid or the resulting A-label
|
| 368 |
+
exceeds 63 octets.
|
| 369 |
+
"""
|
| 370 |
+
try:
|
| 371 |
+
label_bytes = label.encode("ascii")
|
| 372 |
+
except UnicodeEncodeError:
|
| 373 |
+
pass
|
| 374 |
+
else:
|
| 375 |
+
ulabel(label_bytes)
|
| 376 |
+
if not valid_label_length(label_bytes):
|
| 377 |
+
raise IDNAError("Label too long")
|
| 378 |
+
return label_bytes
|
| 379 |
+
|
| 380 |
+
check_label(label)
|
| 381 |
+
label_bytes = _alabel_prefix + _punycode(label)
|
| 382 |
+
|
| 383 |
+
if not valid_label_length(label_bytes):
|
| 384 |
+
raise IDNAError("Label too long")
|
| 385 |
+
|
| 386 |
+
return label_bytes
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def ulabel(label: Union[str, bytes, bytearray]) -> str:
|
| 390 |
+
"""Convert a single A-label into its U-label form.
|
| 391 |
+
|
| 392 |
+
Performs the inverse of :func:`alabel`: an ``xn--``-prefixed label is
|
| 393 |
+
Punycode-decoded and validated. Labels that are already Unicode (or
|
| 394 |
+
plain ASCII without the ACE prefix) are validated and returned as a
|
| 395 |
+
Unicode string.
|
| 396 |
+
|
| 397 |
+
:param label: The label to convert. ``bytes`` or ``bytearray`` input
|
| 398 |
+
is treated as ASCII.
|
| 399 |
+
:returns: The U-label as a Unicode string.
|
| 400 |
+
:raises IDNAError: If the label is malformed or fails validation.
|
| 401 |
+
"""
|
| 402 |
+
if not isinstance(label, (bytes, bytearray)):
|
| 403 |
+
try:
|
| 404 |
+
label_bytes = label.encode("ascii")
|
| 405 |
+
except UnicodeEncodeError:
|
| 406 |
+
check_label(label)
|
| 407 |
+
return label
|
| 408 |
+
else:
|
| 409 |
+
label_bytes = bytes(label)
|
| 410 |
+
|
| 411 |
+
label_bytes = label_bytes.lower()
|
| 412 |
+
if label_bytes.startswith(_alabel_prefix):
|
| 413 |
+
label_bytes = label_bytes[len(_alabel_prefix) :]
|
| 414 |
+
if not label_bytes:
|
| 415 |
+
raise IDNAError("Malformed A-label, no Punycode eligible content found")
|
| 416 |
+
if label_bytes.endswith(b"-"):
|
| 417 |
+
raise IDNAError("A-label must not end with a hyphen")
|
| 418 |
+
else:
|
| 419 |
+
check_label(label_bytes)
|
| 420 |
+
return label_bytes.decode("ascii")
|
| 421 |
+
|
| 422 |
+
try:
|
| 423 |
+
label = label_bytes.decode("punycode")
|
| 424 |
+
except UnicodeError as err:
|
| 425 |
+
raise IDNAError("Invalid A-label") from err
|
| 426 |
+
check_label(label)
|
| 427 |
+
return label
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False) -> str:
|
| 431 |
+
"""Apply the UTS #46 character mapping to a domain string.
|
| 432 |
+
|
| 433 |
+
Implements the mapping table from `UTS #46 §4
|
| 434 |
+
<https://www.unicode.org/reports/tr46/>`_: each character is kept,
|
| 435 |
+
replaced, or rejected based on its status (``V``, ``M``, ``D``, ``3``,
|
| 436 |
+
``I``). The result is returned in Normalisation Form C.
|
| 437 |
+
|
| 438 |
+
:param domain: The full domain name to remap.
|
| 439 |
+
:param std3_rules: If ``True``, apply the stricter STD3 ASCII rules
|
| 440 |
+
(status ``3`` codepoints raise instead of being kept or mapped).
|
| 441 |
+
:param transitional: If ``True``, use transitional processing (status
|
| 442 |
+
``D`` codepoints are mapped instead of kept). Transitional
|
| 443 |
+
processing has been removed from UTS #46 and this option is
|
| 444 |
+
retained only for backwards compatibility.
|
| 445 |
+
:returns: The remapped domain, in Normalisation Form C.
|
| 446 |
+
:raises InvalidCodepoint: If the domain contains a disallowed
|
| 447 |
+
codepoint under the chosen rules.
|
| 448 |
+
"""
|
| 449 |
+
from .uts46data import uts46data
|
| 450 |
+
|
| 451 |
+
output = ""
|
| 452 |
+
|
| 453 |
+
for pos, char in enumerate(domain):
|
| 454 |
+
code_point = ord(char)
|
| 455 |
+
uts46row = uts46data[code_point if code_point < 256 else bisect.bisect_left(uts46data, (code_point, "Z")) - 1]
|
| 456 |
+
status = uts46row[1]
|
| 457 |
+
replacement: Optional[str] = None
|
| 458 |
+
if len(uts46row) == 3:
|
| 459 |
+
replacement = uts46row[2] # ty: ignore[index-out-of-bounds]
|
| 460 |
+
|
| 461 |
+
# UTS #46 §4: V is always valid, D is deviation (kept unless transitional),
|
| 462 |
+
# 3 is disallowed-STD3 (kept unmapped if std3_rules is off and no mapping).
|
| 463 |
+
keep_as_is = (
|
| 464 |
+
status == "V" or (status == "D" and not transitional) or (status == "3" and not std3_rules and replacement is None)
|
| 465 |
+
)
|
| 466 |
+
# M is mapped, 3-with-replacement and transitional D fall through to the
|
| 467 |
+
# same replacement output path.
|
| 468 |
+
use_replacement = replacement is not None and (
|
| 469 |
+
status == "M" or (status == "3" and not std3_rules) or (status == "D" and transitional)
|
| 470 |
+
)
|
| 471 |
+
|
| 472 |
+
if keep_as_is:
|
| 473 |
+
output += char
|
| 474 |
+
elif use_replacement:
|
| 475 |
+
assert replacement is not None # narrowed by use_replacement
|
| 476 |
+
output += replacement
|
| 477 |
+
elif status == "I":
|
| 478 |
+
continue
|
| 479 |
+
else:
|
| 480 |
+
raise InvalidCodepoint(f"Codepoint {_unot(code_point)} not allowed at position {pos + 1} in {domain!r}")
|
| 481 |
+
|
| 482 |
+
return unicodedata.normalize("NFC", output)
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
def encode(
|
| 486 |
+
s: Union[str, bytes, bytearray],
|
| 487 |
+
strict: bool = False,
|
| 488 |
+
uts46: bool = False,
|
| 489 |
+
std3_rules: bool = False,
|
| 490 |
+
transitional: bool = False,
|
| 491 |
+
) -> bytes:
|
| 492 |
+
"""Encode a Unicode domain name into its ASCII (A-label) form.
|
| 493 |
+
|
| 494 |
+
Splits the input on label separators (only ``U+002E`` if ``strict`` is
|
| 495 |
+
set; otherwise also IDEOGRAPHIC FULL STOP ``U+3002``, FULLWIDTH FULL
|
| 496 |
+
STOP ``U+FF0E``, and HALFWIDTH IDEOGRAPHIC FULL STOP ``U+FF61``),
|
| 497 |
+
encodes each label with :func:`alabel`, and rejoins them with ``.``.
|
| 498 |
+
Optionally pre-processes the input through :func:`uts46_remap`.
|
| 499 |
+
|
| 500 |
+
:param s: The domain name to encode.
|
| 501 |
+
:param strict: If ``True``, only ``U+002E`` is recognised as a label
|
| 502 |
+
separator.
|
| 503 |
+
:param uts46: If ``True``, apply UTS #46 mapping before encoding.
|
| 504 |
+
:param std3_rules: Forwarded to :func:`uts46_remap` when ``uts46`` is
|
| 505 |
+
``True``.
|
| 506 |
+
:param transitional: Forwarded to :func:`uts46_remap` when ``uts46``
|
| 507 |
+
is ``True``. Deprecated: emits a :class:`DeprecationWarning` and
|
| 508 |
+
will be removed in a future version.
|
| 509 |
+
:returns: The encoded domain as ASCII :class:`bytes`.
|
| 510 |
+
:raises IDNAError: If the domain is empty, contains an invalid label,
|
| 511 |
+
or exceeds the maximum domain length.
|
| 512 |
+
"""
|
| 513 |
+
if transitional:
|
| 514 |
+
warnings.warn(
|
| 515 |
+
"Transitional processing has been removed from UTS #46. "
|
| 516 |
+
"The transitional argument will be removed in a future version.",
|
| 517 |
+
DeprecationWarning,
|
| 518 |
+
stacklevel=2,
|
| 519 |
+
)
|
| 520 |
+
if not isinstance(s, str):
|
| 521 |
+
try:
|
| 522 |
+
s = str(s, "ascii")
|
| 523 |
+
except (UnicodeDecodeError, TypeError) as err:
|
| 524 |
+
raise IDNAError("should pass a unicode string to the function rather than a byte string.") from err
|
| 525 |
+
if uts46:
|
| 526 |
+
s = uts46_remap(s, std3_rules, transitional)
|
| 527 |
+
|
| 528 |
+
# Reject inputs that exceed the maximum DNS domain length up-front
|
| 529 |
+
# to avoid expensive computation on long inputs.
|
| 530 |
+
if not valid_string_length(s, trailing_dot=True):
|
| 531 |
+
raise IDNAError("Domain too long")
|
| 532 |
+
|
| 533 |
+
trailing_dot = False
|
| 534 |
+
result = []
|
| 535 |
+
labels = s.split(".") if strict else _unicode_dots_re.split(s)
|
| 536 |
+
if not labels or labels == [""]:
|
| 537 |
+
raise IDNAError("Empty domain")
|
| 538 |
+
if labels[-1] == "":
|
| 539 |
+
del labels[-1]
|
| 540 |
+
trailing_dot = True
|
| 541 |
+
for label in labels:
|
| 542 |
+
s = alabel(label)
|
| 543 |
+
if s:
|
| 544 |
+
result.append(s)
|
| 545 |
+
else:
|
| 546 |
+
raise IDNAError("Empty label")
|
| 547 |
+
if trailing_dot:
|
| 548 |
+
result.append(b"")
|
| 549 |
+
s = b".".join(result)
|
| 550 |
+
if not valid_string_length(s, trailing_dot):
|
| 551 |
+
raise IDNAError("Domain too long")
|
| 552 |
+
return s
|
| 553 |
+
|
| 554 |
+
|
| 555 |
+
def decode(
|
| 556 |
+
s: Union[str, bytes, bytearray],
|
| 557 |
+
strict: bool = False,
|
| 558 |
+
uts46: bool = False,
|
| 559 |
+
std3_rules: bool = False,
|
| 560 |
+
) -> str:
|
| 561 |
+
"""Decode an A-label-encoded domain name back to Unicode.
|
| 562 |
+
|
| 563 |
+
Splits the input on label separators (see :func:`encode` for the
|
| 564 |
+
rules), decodes each label with :func:`ulabel`, and rejoins them
|
| 565 |
+
with ``.``. Optionally pre-processes the input through
|
| 566 |
+
:func:`uts46_remap`.
|
| 567 |
+
|
| 568 |
+
:param s: The domain name to decode.
|
| 569 |
+
:param strict: If ``True``, only ``U+002E`` is recognised as a label
|
| 570 |
+
separator.
|
| 571 |
+
:param uts46: If ``True``, apply UTS #46 mapping before decoding.
|
| 572 |
+
:param std3_rules: Forwarded to :func:`uts46_remap` when ``uts46`` is
|
| 573 |
+
``True``.
|
| 574 |
+
:returns: The decoded domain as a Unicode string.
|
| 575 |
+
:raises IDNAError: If the input is not valid ASCII, contains an
|
| 576 |
+
invalid label, or is empty.
|
| 577 |
+
"""
|
| 578 |
+
if not isinstance(s, str):
|
| 579 |
+
try:
|
| 580 |
+
s = str(s, "ascii")
|
| 581 |
+
except (UnicodeDecodeError, TypeError) as err:
|
| 582 |
+
raise IDNAError("Invalid ASCII in A-label") from err
|
| 583 |
+
if uts46:
|
| 584 |
+
s = uts46_remap(s, std3_rules, False)
|
| 585 |
+
# Reject inputs that exceed the maximum DNS domain length up-front
|
| 586 |
+
# to avoid expensive computation on long inputs.
|
| 587 |
+
if not valid_string_length(s, trailing_dot=True):
|
| 588 |
+
raise IDNAError("Domain too long")
|
| 589 |
+
trailing_dot = False
|
| 590 |
+
result = []
|
| 591 |
+
labels = s.split(".") if strict else _unicode_dots_re.split(s)
|
| 592 |
+
if not labels or labels == [""]:
|
| 593 |
+
raise IDNAError("Empty domain")
|
| 594 |
+
if not labels[-1]:
|
| 595 |
+
del labels[-1]
|
| 596 |
+
trailing_dot = True
|
| 597 |
+
for label in labels:
|
| 598 |
+
s = ulabel(label)
|
| 599 |
+
if s:
|
| 600 |
+
result.append(s)
|
| 601 |
+
else:
|
| 602 |
+
raise IDNAError("Empty label")
|
| 603 |
+
if trailing_dot:
|
| 604 |
+
result.append("")
|
| 605 |
+
return ".".join(result)
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/idna/intranges.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Given a list of integers, made up of (hopefully) a small number of long runs
|
| 3 |
+
of consecutive integers, compute a representation of the form
|
| 4 |
+
((start1, end1), (start2, end2) ...). Then answer the question "was x present
|
| 5 |
+
in the original list?" in time O(log(# runs)).
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import bisect
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def intranges_from_list(list_: list[int]) -> tuple[int, ...]:
|
| 12 |
+
"""Represent a list of integers as a sequence of ranges:
|
| 13 |
+
((start_0, end_0), (start_1, end_1), ...), such that the original
|
| 14 |
+
integers are exactly those x such that start_i <= x < end_i for some i.
|
| 15 |
+
|
| 16 |
+
Ranges are encoded as single integers (start << 32 | end), not as tuples.
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
sorted_list = sorted(list_)
|
| 20 |
+
ranges = []
|
| 21 |
+
last_write = -1
|
| 22 |
+
for i in range(len(sorted_list)):
|
| 23 |
+
if i + 1 < len(sorted_list) and sorted_list[i] == sorted_list[i + 1] - 1:
|
| 24 |
+
continue
|
| 25 |
+
current_range = sorted_list[last_write + 1 : i + 1]
|
| 26 |
+
ranges.append(_encode_range(current_range[0], current_range[-1] + 1))
|
| 27 |
+
last_write = i
|
| 28 |
+
|
| 29 |
+
return tuple(ranges)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def _encode_range(start: int, end: int) -> int:
|
| 33 |
+
return (start << 32) | end
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def _decode_range(r: int) -> tuple[int, int]:
|
| 37 |
+
return (r >> 32), (r & ((1 << 32) - 1))
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def intranges_contain(int_: int, ranges: tuple[int, ...]) -> bool:
|
| 41 |
+
"""Determine if `int_` falls into one of the ranges in `ranges`."""
|
| 42 |
+
tuple_ = _encode_range(int_, 0)
|
| 43 |
+
pos = bisect.bisect_left(ranges, tuple_)
|
| 44 |
+
# we could be immediately ahead of a tuple (start, end)
|
| 45 |
+
# with start < int_ <= end
|
| 46 |
+
if pos > 0:
|
| 47 |
+
left, right = _decode_range(ranges[pos - 1])
|
| 48 |
+
if left <= int_ < right:
|
| 49 |
+
return True
|
| 50 |
+
# or we could be immediately behind a tuple (int_, end)
|
| 51 |
+
if pos < len(ranges):
|
| 52 |
+
left, _ = _decode_range(ranges[pos])
|
| 53 |
+
if left == int_:
|
| 54 |
+
return True
|
| 55 |
+
return False
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/__init__.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2026 Poolside and the HuggingFace Inc. team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
from typing import TYPE_CHECKING
|
| 15 |
+
|
| 16 |
+
from ...utils import _LazyModule
|
| 17 |
+
from ...utils.import_utils import define_import_structure
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
if TYPE_CHECKING:
|
| 21 |
+
from .configuration_laguna import *
|
| 22 |
+
from .modeling_laguna import *
|
| 23 |
+
else:
|
| 24 |
+
import sys
|
| 25 |
+
|
| 26 |
+
_file = globals()["__file__"]
|
| 27 |
+
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/configuration_laguna.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 2 |
+
# This file was automatically generated from src/transformers/models/laguna/modular_laguna.py.
|
| 3 |
+
# Do NOT edit this file manually as any edits will be overwritten by the generation of
|
| 4 |
+
# the file from the modular. If any change should be done, please apply the change to the
|
| 5 |
+
# modular_laguna.py file directly. One of our CI enforces this.
|
| 6 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 7 |
+
# Copyright 2026 Poolside and the HuggingFace Inc. team. All rights reserved.
|
| 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 |
+
from typing import Any, Literal
|
| 21 |
+
|
| 22 |
+
from huggingface_hub.dataclasses import strict
|
| 23 |
+
|
| 24 |
+
from ...configuration_utils import PreTrainedConfig
|
| 25 |
+
from ...modeling_rope_utils import RopeParameters
|
| 26 |
+
from ...utils import auto_docstring
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
@auto_docstring(checkpoint="poolside/laguna-XS.2")
|
| 30 |
+
@strict
|
| 31 |
+
class LagunaConfig(PreTrainedConfig):
|
| 32 |
+
r"""
|
| 33 |
+
num_attention_heads_per_layer (`list[int]`, *optional*):
|
| 34 |
+
Per-layer override for ``num_attention_heads``. Length must equal ``num_hidden_layers``.
|
| 35 |
+
mlp_layer_types (`list[str]`, *optional*):
|
| 36 |
+
Per-layer MLP type — ``"dense"`` or ``"sparse"``. Length must equal
|
| 37 |
+
``num_hidden_layers``. Defaults to first layer dense, rest sparse.
|
| 38 |
+
moe_routed_scaling_factor (`float`, *optional*, defaults to 1.0):
|
| 39 |
+
Scalar applied to routed-expert output before combining with the shared-expert output.
|
| 40 |
+
moe_apply_router_weight_on_input (`bool`, *optional*, defaults to `False`):
|
| 41 |
+
Whether to apply router weights to the MoE input rather than the output. Not supported
|
| 42 |
+
in transformers yet; ``True`` will raise a ``NotImplementedError`` for now.
|
| 43 |
+
moe_router_logit_softcapping (`float`, *optional*, defaults to 0.0):
|
| 44 |
+
Scaling factor when applying tanh softcapping on the logits of the MoE router logits.
|
| 45 |
+
|
| 46 |
+
Example:
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
>>> from transformers import LagunaModel, LagunaConfig
|
| 50 |
+
|
| 51 |
+
>>> configuration = LagunaConfig()
|
| 52 |
+
>>> model = LagunaModel(configuration)
|
| 53 |
+
>>> configuration = model.config
|
| 54 |
+
```
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
model_type = "laguna"
|
| 58 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 59 |
+
base_model_tp_plan = {
|
| 60 |
+
"layers.*.self_attn.q_proj": "colwise",
|
| 61 |
+
"layers.*.self_attn.k_proj": "colwise",
|
| 62 |
+
"layers.*.self_attn.v_proj": "colwise",
|
| 63 |
+
"layers.*.self_attn.g_proj": "colwise",
|
| 64 |
+
"layers.*.self_attn.o_proj": "rowwise",
|
| 65 |
+
"layers.*.self_attn.q_norm": "replicated_with_grad_allreduce",
|
| 66 |
+
"layers.*.self_attn.k_norm": "replicated_with_grad_allreduce",
|
| 67 |
+
"layers.*.mlp.gate_proj": "colwise",
|
| 68 |
+
"layers.*.mlp.up_proj": "colwise",
|
| 69 |
+
"layers.*.mlp.down_proj": "rowwise",
|
| 70 |
+
"layers.*.mlp.experts.gate_up_proj": "packed_colwise",
|
| 71 |
+
"layers.*.mlp.experts.down_proj": "rowwise",
|
| 72 |
+
"layers.*.mlp.experts": "moe_tp_experts",
|
| 73 |
+
"layers.*.mlp.shared_experts.gate_proj": "colwise",
|
| 74 |
+
"layers.*.mlp.shared_experts.up_proj": "colwise",
|
| 75 |
+
"layers.*.mlp.shared_experts.down_proj": "rowwise",
|
| 76 |
+
}
|
| 77 |
+
base_model_pp_plan = {
|
| 78 |
+
"embed_tokens": (["input_ids"], ["inputs_embeds"]),
|
| 79 |
+
"layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
|
| 80 |
+
"norm": (["hidden_states"], ["hidden_states"]),
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
vocab_size: int = 100352
|
| 84 |
+
hidden_size: int = 2048
|
| 85 |
+
intermediate_size: int = 8192
|
| 86 |
+
num_hidden_layers: int = 40
|
| 87 |
+
num_attention_heads: int = 48
|
| 88 |
+
num_key_value_heads: int = 8
|
| 89 |
+
hidden_act: str = "silu"
|
| 90 |
+
max_position_embeddings: int = 131072
|
| 91 |
+
initializer_range: float = 0.02
|
| 92 |
+
rms_norm_eps: float = 1e-6
|
| 93 |
+
use_cache: bool = True
|
| 94 |
+
tie_word_embeddings: bool = False
|
| 95 |
+
rope_parameters: RopeParameters | dict | None = None
|
| 96 |
+
sliding_window: int = 512
|
| 97 |
+
attention_dropout: float | int = 0.0
|
| 98 |
+
moe_intermediate_size: int = 512
|
| 99 |
+
shared_expert_intermediate_size: int = 512
|
| 100 |
+
num_experts_per_tok: int = 8
|
| 101 |
+
num_experts: int = 256
|
| 102 |
+
output_router_logits: bool = False
|
| 103 |
+
router_aux_loss_coef: float = 0.001
|
| 104 |
+
layer_types: list[str] | None = None
|
| 105 |
+
pad_token_id: int | None = None
|
| 106 |
+
bos_token_id: int | None = None
|
| 107 |
+
eos_token_id: int | list[int] | None = None
|
| 108 |
+
|
| 109 |
+
# Laguna-specific attention
|
| 110 |
+
head_dim: int = 128
|
| 111 |
+
attention_bias: bool = False
|
| 112 |
+
num_attention_heads_per_layer: list[int] | None = None
|
| 113 |
+
# Laguna-specific MoE
|
| 114 |
+
mlp_layer_types: list[str] | None = None
|
| 115 |
+
moe_routed_scaling_factor: float = 1.0
|
| 116 |
+
moe_apply_router_weight_on_input: bool = False
|
| 117 |
+
moe_router_logit_softcapping: float = 0.0
|
| 118 |
+
|
| 119 |
+
def __post_init__(self, **kwargs):
|
| 120 |
+
if self.layer_types is None:
|
| 121 |
+
self.layer_types = ["full_attention"] * self.num_hidden_layers
|
| 122 |
+
if self.mlp_layer_types is None:
|
| 123 |
+
self.mlp_layer_types = ["dense"] + ["sparse"] * (self.num_hidden_layers - 1)
|
| 124 |
+
if self.num_attention_heads_per_layer is None:
|
| 125 |
+
self.num_attention_heads_per_layer = [self.num_attention_heads] * self.num_hidden_layers
|
| 126 |
+
|
| 127 |
+
default_rope_params: dict[Literal["full_attention", "sliding_attention"], dict[str, Any]] = {
|
| 128 |
+
"full_attention": {"rope_type": "default", "rope_theta": 500000.0, "partial_rotary_factor": 0.5},
|
| 129 |
+
"sliding_attention": {"rope_type": "default", "rope_theta": 10000.0, "partial_rotary_factor": 1.0},
|
| 130 |
+
}
|
| 131 |
+
if self.rope_parameters is None:
|
| 132 |
+
self.rope_parameters = default_rope_params
|
| 133 |
+
|
| 134 |
+
# rope_parameters is keyed by layer type; tell the validator those keys are intentional.
|
| 135 |
+
super().__post_init__(**kwargs, ignore_keys_at_rope_validation={"sliding_attention", "full_attention"})
|
| 136 |
+
|
| 137 |
+
def convert_rope_params_to_dict(self, **kwargs):
|
| 138 |
+
# No need to handle BC for new models, because they have no old-format `rope_scaling`
|
| 139 |
+
return kwargs
|
| 140 |
+
|
| 141 |
+
def validate_architecture(self):
|
| 142 |
+
"""Part of ``@strict``-powered validation."""
|
| 143 |
+
if self.moe_apply_router_weight_on_input:
|
| 144 |
+
raise NotImplementedError(
|
| 145 |
+
"moe_apply_router_weight_on_input=True is not yet supported in the "
|
| 146 |
+
"transformers implementation of Laguna."
|
| 147 |
+
)
|
| 148 |
+
if (
|
| 149 |
+
self.num_attention_heads_per_layer is not None
|
| 150 |
+
and len(self.num_attention_heads_per_layer) != self.num_hidden_layers
|
| 151 |
+
):
|
| 152 |
+
raise ValueError(
|
| 153 |
+
f"num_attention_heads_per_layer length ({len(self.num_attention_heads_per_layer)}) "
|
| 154 |
+
f"must equal num_hidden_layers ({self.num_hidden_layers})."
|
| 155 |
+
)
|
| 156 |
+
if len(self.layer_types) != self.num_hidden_layers:
|
| 157 |
+
raise ValueError(
|
| 158 |
+
f"layer_types length ({len(self.layer_types)}) "
|
| 159 |
+
f"must equal num_hidden_layers ({self.num_hidden_layers})."
|
| 160 |
+
)
|
| 161 |
+
if len(self.mlp_layer_types) != self.num_hidden_layers:
|
| 162 |
+
raise ValueError(
|
| 163 |
+
f"mlp_layer_types length ({len(self.mlp_layer_types)}) "
|
| 164 |
+
f"must equal num_hidden_layers ({self.num_hidden_layers})."
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
__all__ = ["LagunaConfig"]
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/modeling_laguna.py
ADDED
|
@@ -0,0 +1,759 @@
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 2 |
+
# This file was automatically generated from src/transformers/models/laguna/modular_laguna.py.
|
| 3 |
+
# Do NOT edit this file manually as any edits will be overwritten by the generation of
|
| 4 |
+
# the file from the modular. If any change should be done, please apply the change to the
|
| 5 |
+
# modular_laguna.py file directly. One of our CI enforces this.
|
| 6 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 7 |
+
# Copyright 2026 Poolside and the HuggingFace Inc. team. All rights reserved.
|
| 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 |
+
|
| 21 |
+
from collections.abc import Callable
|
| 22 |
+
from typing import Optional
|
| 23 |
+
|
| 24 |
+
import torch
|
| 25 |
+
import torch.nn.functional as F
|
| 26 |
+
from torch import nn
|
| 27 |
+
|
| 28 |
+
from ... import initialization as init
|
| 29 |
+
from ...activations import ACT2FN
|
| 30 |
+
from ...cache_utils import Cache, DynamicCache
|
| 31 |
+
from ...generation import GenerationMixin
|
| 32 |
+
from ...integrations import use_experts_implementation, use_kernel_forward_from_hub, use_kernelized_func
|
| 33 |
+
from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask
|
| 34 |
+
from ...modeling_flash_attention_utils import FlashAttentionKwargs
|
| 35 |
+
from ...modeling_layers import GradientCheckpointingLayer
|
| 36 |
+
from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
|
| 37 |
+
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
| 38 |
+
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 39 |
+
from ...processing_utils import Unpack
|
| 40 |
+
from ...utils import auto_docstring, can_return_tuple
|
| 41 |
+
from ...utils.generic import TransformersKwargs, maybe_autocast, merge_with_config_defaults
|
| 42 |
+
from ...utils.output_capturing import OutputRecorder, capture_outputs
|
| 43 |
+
from .configuration_laguna import LagunaConfig
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@use_kernel_forward_from_hub("RMSNorm")
|
| 47 |
+
class LagunaRMSNorm(nn.Module):
|
| 48 |
+
def __init__(self, hidden_size, eps: float = 1e-6) -> None:
|
| 49 |
+
"""
|
| 50 |
+
LagunaRMSNorm is equivalent to T5LayerNorm
|
| 51 |
+
"""
|
| 52 |
+
super().__init__()
|
| 53 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
| 54 |
+
self.variance_epsilon = eps
|
| 55 |
+
|
| 56 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 57 |
+
input_dtype = hidden_states.dtype
|
| 58 |
+
hidden_states = hidden_states.to(torch.float32)
|
| 59 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
| 60 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
| 61 |
+
return self.weight * hidden_states.to(input_dtype)
|
| 62 |
+
|
| 63 |
+
def extra_repr(self):
|
| 64 |
+
return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
class LagunaRotaryEmbedding(nn.Module):
|
| 68 |
+
inv_freq: torch.Tensor # fix linting for `register_buffer`
|
| 69 |
+
|
| 70 |
+
def __init__(self, config: LagunaConfig):
|
| 71 |
+
super().__init__()
|
| 72 |
+
self.max_seq_len_cached = config.max_position_embeddings
|
| 73 |
+
self.original_max_seq_len = config.max_position_embeddings
|
| 74 |
+
self.config = config
|
| 75 |
+
self.layer_types = list(set(config.layer_types))
|
| 76 |
+
self.rope_type = {}
|
| 77 |
+
for layer_type in self.layer_types:
|
| 78 |
+
rope_params = self.config.rope_parameters[layer_type]
|
| 79 |
+
if rope_params is None:
|
| 80 |
+
continue
|
| 81 |
+
|
| 82 |
+
self.rope_type[layer_type] = rope_params["rope_type"]
|
| 83 |
+
rope_init_fn: Callable = self.compute_default_rope_parameters
|
| 84 |
+
if self.rope_type[layer_type] != "default":
|
| 85 |
+
rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type[layer_type]]
|
| 86 |
+
curr_inv_freq, curr_attention_scaling = rope_init_fn(self.config, layer_type=layer_type)
|
| 87 |
+
self.register_buffer(f"{layer_type}_inv_freq", curr_inv_freq, persistent=False)
|
| 88 |
+
self.register_buffer(f"{layer_type}_original_inv_freq", curr_inv_freq.clone(), persistent=False)
|
| 89 |
+
setattr(self, f"{layer_type}_attention_scaling", curr_attention_scaling)
|
| 90 |
+
|
| 91 |
+
@staticmethod
|
| 92 |
+
def compute_default_rope_parameters(
|
| 93 |
+
config: LagunaConfig | None = None,
|
| 94 |
+
device: Optional["torch.device"] = None,
|
| 95 |
+
seq_len: int | None = None,
|
| 96 |
+
layer_type: str | None = None,
|
| 97 |
+
) -> tuple["torch.Tensor", float]:
|
| 98 |
+
"""
|
| 99 |
+
Computes the inverse frequencies according to the original RoPE implementation
|
| 100 |
+
Args:
|
| 101 |
+
config ([`~transformers.PreTrainedConfig`]):
|
| 102 |
+
The model configuration.
|
| 103 |
+
device (`torch.device`):
|
| 104 |
+
The device to use for initialization of the inverse frequencies.
|
| 105 |
+
seq_len (`int`, *optional*):
|
| 106 |
+
The current sequence length. Unused for this type of RoPE.
|
| 107 |
+
layer_type (`str`, *optional*):
|
| 108 |
+
The current layer type if the model has different RoPE parameters per type.
|
| 109 |
+
Should not be used unless `config.layer_types is not None`
|
| 110 |
+
Returns:
|
| 111 |
+
Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the
|
| 112 |
+
post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE).
|
| 113 |
+
"""
|
| 114 |
+
base = config.rope_parameters[layer_type]["rope_theta"]
|
| 115 |
+
# key difference to gemma3: partial rope
|
| 116 |
+
partial_rotary_factor = config.rope_parameters[layer_type].get("partial_rotary_factor", 1.0)
|
| 117 |
+
head_dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads
|
| 118 |
+
dim = int(head_dim * partial_rotary_factor)
|
| 119 |
+
|
| 120 |
+
attention_factor = 1.0 # Unused in this type of RoPE
|
| 121 |
+
|
| 122 |
+
# Compute the inverse frequencies
|
| 123 |
+
inv_freq = 1.0 / (
|
| 124 |
+
base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)
|
| 125 |
+
)
|
| 126 |
+
return inv_freq, attention_factor
|
| 127 |
+
|
| 128 |
+
@torch.no_grad()
|
| 129 |
+
@dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
|
| 130 |
+
def forward(self, x, position_ids, layer_type=None):
|
| 131 |
+
inv_freq = getattr(self, f"{layer_type}_inv_freq")
|
| 132 |
+
attention_scaling = getattr(self, f"{layer_type}_attention_scaling")
|
| 133 |
+
|
| 134 |
+
inv_freq_expanded = inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
|
| 135 |
+
position_ids_expanded = position_ids[:, None, :].float()
|
| 136 |
+
|
| 137 |
+
device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
|
| 138 |
+
with maybe_autocast(device_type=device_type, enabled=False): # Force float32
|
| 139 |
+
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
|
| 140 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 141 |
+
cos = emb.cos() * attention_scaling
|
| 142 |
+
sin = emb.sin() * attention_scaling
|
| 143 |
+
|
| 144 |
+
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
class LagunaMLP(nn.Module):
|
| 148 |
+
def __init__(self, config, intermediate_size=None):
|
| 149 |
+
super().__init__()
|
| 150 |
+
self.config = config
|
| 151 |
+
self.hidden_size = config.hidden_size
|
| 152 |
+
self.intermediate_size = config.intermediate_size if intermediate_size is None else intermediate_size
|
| 153 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 154 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 155 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
|
| 156 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 157 |
+
|
| 158 |
+
def forward(self, x):
|
| 159 |
+
down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
| 160 |
+
return down_proj
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
class LagunaTopKRouter(nn.Module):
|
| 164 |
+
def __init__(self, config):
|
| 165 |
+
super().__init__()
|
| 166 |
+
self.top_k = config.num_experts_per_tok
|
| 167 |
+
self.num_experts = config.num_experts
|
| 168 |
+
self.hidden_dim = config.hidden_size
|
| 169 |
+
self.weight = nn.Parameter(torch.zeros(self.num_experts, self.hidden_dim))
|
| 170 |
+
self.e_score_correction_bias = nn.Parameter(torch.zeros(config.num_experts), requires_grad=False)
|
| 171 |
+
self.router_logit_softcapping = config.moe_router_logit_softcapping
|
| 172 |
+
|
| 173 |
+
def forward(
|
| 174 |
+
self,
|
| 175 |
+
hidden_states: torch.Tensor,
|
| 176 |
+
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 177 |
+
hidden_states = hidden_states.reshape(-1, self.hidden_dim)
|
| 178 |
+
router_logits = F.linear(hidden_states, self.weight).float()
|
| 179 |
+
# Optional logits softcapping
|
| 180 |
+
if self.router_logit_softcapping > 0.0:
|
| 181 |
+
router_logits = torch.tanh(router_logits / self.router_logit_softcapping) * self.router_logit_softcapping
|
| 182 |
+
# Sigmoid instead of softmax normalization
|
| 183 |
+
routing_scores = torch.sigmoid(router_logits)
|
| 184 |
+
|
| 185 |
+
scores_for_selection = routing_scores + self.e_score_correction_bias.to(routing_scores.dtype)
|
| 186 |
+
_, selected_experts = torch.topk(scores_for_selection, self.top_k, dim=-1)
|
| 187 |
+
routing_weights = routing_scores.gather(-1, selected_experts)
|
| 188 |
+
routing_weights = routing_weights / routing_weights.sum(dim=-1, keepdim=True)
|
| 189 |
+
routing_weights = routing_weights.to(hidden_states.dtype)
|
| 190 |
+
|
| 191 |
+
return router_logits, routing_weights, selected_experts
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
@use_experts_implementation
|
| 195 |
+
class LagunaExperts(nn.Module):
|
| 196 |
+
"""Collection of expert weights stored as 3D tensors."""
|
| 197 |
+
|
| 198 |
+
def __init__(self, config):
|
| 199 |
+
super().__init__()
|
| 200 |
+
self.num_experts = config.num_experts
|
| 201 |
+
self.hidden_dim = config.hidden_size
|
| 202 |
+
self.intermediate_dim = config.moe_intermediate_size
|
| 203 |
+
self.gate_up_proj = nn.Parameter(torch.empty(self.num_experts, 2 * self.intermediate_dim, self.hidden_dim))
|
| 204 |
+
self.down_proj = nn.Parameter(torch.empty(self.num_experts, self.hidden_dim, self.intermediate_dim))
|
| 205 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 206 |
+
|
| 207 |
+
def forward(
|
| 208 |
+
self,
|
| 209 |
+
hidden_states: torch.Tensor,
|
| 210 |
+
top_k_index: torch.Tensor,
|
| 211 |
+
top_k_weights: torch.Tensor,
|
| 212 |
+
) -> torch.Tensor:
|
| 213 |
+
final_hidden_states = torch.zeros_like(hidden_states)
|
| 214 |
+
with torch.no_grad():
|
| 215 |
+
expert_mask = torch.nn.functional.one_hot(top_k_index, num_classes=self.num_experts)
|
| 216 |
+
expert_mask = expert_mask.permute(2, 1, 0)
|
| 217 |
+
expert_hit = torch.greater(expert_mask.sum(dim=(-1, -2)), 0).nonzero()
|
| 218 |
+
|
| 219 |
+
for expert_idx in expert_hit:
|
| 220 |
+
expert_idx = expert_idx[0]
|
| 221 |
+
if expert_idx == self.num_experts:
|
| 222 |
+
continue
|
| 223 |
+
top_k_pos, token_idx = torch.where(expert_mask[expert_idx])
|
| 224 |
+
current_state = hidden_states[token_idx]
|
| 225 |
+
gate, up = nn.functional.linear(current_state, self.gate_up_proj[expert_idx]).chunk(2, dim=-1)
|
| 226 |
+
current_hidden_states = self.act_fn(gate) * up
|
| 227 |
+
current_hidden_states = nn.functional.linear(current_hidden_states, self.down_proj[expert_idx])
|
| 228 |
+
current_hidden_states = current_hidden_states * top_k_weights[token_idx, top_k_pos, None]
|
| 229 |
+
final_hidden_states.index_add_(0, token_idx, current_hidden_states.to(final_hidden_states.dtype))
|
| 230 |
+
|
| 231 |
+
return final_hidden_states
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
class LagunaSparseMoeBlock(nn.Module):
|
| 235 |
+
def __init__(self, config: LagunaConfig):
|
| 236 |
+
super().__init__()
|
| 237 |
+
self.experts = LagunaExperts(config)
|
| 238 |
+
self.gate = LagunaTopKRouter(config)
|
| 239 |
+
self.shared_experts = LagunaMLP(config, intermediate_size=config.shared_expert_intermediate_size)
|
| 240 |
+
self.routed_scaling_factor = config.moe_routed_scaling_factor
|
| 241 |
+
|
| 242 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 243 |
+
batch_size, sequence_length, hidden_dim = hidden_states.shape
|
| 244 |
+
hidden_states = hidden_states.view(-1, hidden_dim)
|
| 245 |
+
shared_output = self.shared_experts(hidden_states)
|
| 246 |
+
|
| 247 |
+
_, routing_weights, selected_experts = self.gate(hidden_states)
|
| 248 |
+
hidden_states = self.experts(hidden_states, selected_experts, routing_weights)
|
| 249 |
+
# Additional scaling
|
| 250 |
+
hidden_states = hidden_states * self.routed_scaling_factor
|
| 251 |
+
hidden_states = hidden_states + shared_output
|
| 252 |
+
|
| 253 |
+
hidden_states = hidden_states.reshape(batch_size, sequence_length, hidden_dim)
|
| 254 |
+
return hidden_states
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
def rotate_half(x):
|
| 258 |
+
"""Rotates half the hidden dims of the input."""
|
| 259 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 260 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 261 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
# Adapted from transformers.models.glm.modular_glm.apply_rotary_pos_emb
|
| 265 |
+
def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1):
|
| 266 |
+
"""Applies Rotary Position Embedding to the query and key tensors.
|
| 267 |
+
|
| 268 |
+
Removes the interleaving of cos and sin from GLM
|
| 269 |
+
|
| 270 |
+
Args:
|
| 271 |
+
q (`torch.Tensor`): The query tensor.
|
| 272 |
+
k (`torch.Tensor`): The key tensor.
|
| 273 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
| 274 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
| 275 |
+
unsqueeze_dim (`int`, *optional*, defaults to 1):
|
| 276 |
+
The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
|
| 277 |
+
sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
|
| 278 |
+
that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
|
| 279 |
+
k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
|
| 280 |
+
cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
|
| 281 |
+
the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
|
| 282 |
+
Returns:
|
| 283 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
| 284 |
+
"""
|
| 285 |
+
cos = cos.unsqueeze(unsqueeze_dim)
|
| 286 |
+
sin = sin.unsqueeze(unsqueeze_dim)
|
| 287 |
+
|
| 288 |
+
# Keep half or full tensor for later concatenation
|
| 289 |
+
rotary_dim = cos.shape[-1]
|
| 290 |
+
q_rot, q_pass = q[..., :rotary_dim], q[..., rotary_dim:]
|
| 291 |
+
k_rot, k_pass = k[..., :rotary_dim], k[..., rotary_dim:]
|
| 292 |
+
|
| 293 |
+
# Apply rotary embeddings on the first half or full tensor
|
| 294 |
+
q_embed = (q_rot * cos) + (rotate_half(q_rot) * sin)
|
| 295 |
+
k_embed = (k_rot * cos) + (rotate_half(k_rot) * sin)
|
| 296 |
+
|
| 297 |
+
# Concatenate back to full shape
|
| 298 |
+
q_embed = torch.cat([q_embed, q_pass], dim=-1)
|
| 299 |
+
k_embed = torch.cat([k_embed, k_pass], dim=-1)
|
| 300 |
+
return q_embed, k_embed
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
| 304 |
+
"""
|
| 305 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
| 306 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
| 307 |
+
"""
|
| 308 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
| 309 |
+
if n_rep == 1:
|
| 310 |
+
return hidden_states
|
| 311 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
| 312 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
def eager_attention_forward(
|
| 316 |
+
module: nn.Module,
|
| 317 |
+
query: torch.Tensor,
|
| 318 |
+
key: torch.Tensor,
|
| 319 |
+
value: torch.Tensor,
|
| 320 |
+
attention_mask: torch.Tensor | None,
|
| 321 |
+
scaling: float,
|
| 322 |
+
dropout: float = 0.0,
|
| 323 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 324 |
+
):
|
| 325 |
+
key_states = repeat_kv(key, module.num_key_value_groups)
|
| 326 |
+
value_states = repeat_kv(value, module.num_key_value_groups)
|
| 327 |
+
|
| 328 |
+
attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
|
| 329 |
+
if attention_mask is not None:
|
| 330 |
+
attn_weights = attn_weights + attention_mask
|
| 331 |
+
|
| 332 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
|
| 333 |
+
attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
|
| 334 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 335 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 336 |
+
|
| 337 |
+
return attn_output, attn_weights
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
@use_kernelized_func(apply_rotary_pos_emb)
|
| 341 |
+
class LagunaAttention(nn.Module):
|
| 342 |
+
"""Afmoe-style SWA/GQA attention with Laguna-specific gating and per-layer head count."""
|
| 343 |
+
|
| 344 |
+
def __init__(self, config: LagunaConfig, layer_idx: int, num_heads: int):
|
| 345 |
+
super().__init__()
|
| 346 |
+
# Number of heads is controlled via `config.num_attention_heads_per_layer`
|
| 347 |
+
self.num_heads = num_heads
|
| 348 |
+
self.config = config
|
| 349 |
+
self.layer_idx = layer_idx
|
| 350 |
+
self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
|
| 351 |
+
self.num_key_value_groups = self.num_heads // config.num_key_value_heads
|
| 352 |
+
self.scaling = self.head_dim**-0.5
|
| 353 |
+
self.attention_dropout = config.attention_dropout
|
| 354 |
+
self.is_causal = True
|
| 355 |
+
|
| 356 |
+
self.q_proj = nn.Linear(config.hidden_size, self.num_heads * self.head_dim, bias=config.attention_bias)
|
| 357 |
+
self.k_proj = nn.Linear(
|
| 358 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 359 |
+
)
|
| 360 |
+
self.v_proj = nn.Linear(
|
| 361 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 362 |
+
)
|
| 363 |
+
self.o_proj = nn.Linear(self.num_heads * self.head_dim, config.hidden_size, bias=config.attention_bias)
|
| 364 |
+
# Parent LlamaAttention already sets: layer_idx, num_heads, num_key_value_heads, num_key_value_groups, head_dim
|
| 365 |
+
# We only add Laguna-specific attributes
|
| 366 |
+
self.is_local_attention = config.layer_types[layer_idx] == "sliding_attention"
|
| 367 |
+
self.sliding_window = config.sliding_window if self.is_local_attention else None
|
| 368 |
+
|
| 369 |
+
self.q_norm = LagunaRMSNorm(self.head_dim, eps=config.rms_norm_eps)
|
| 370 |
+
self.k_norm = LagunaRMSNorm(self.head_dim, eps=config.rms_norm_eps)
|
| 371 |
+
self.g_proj = nn.Linear(config.hidden_size, self.num_heads, bias=False)
|
| 372 |
+
|
| 373 |
+
def forward(
|
| 374 |
+
self,
|
| 375 |
+
hidden_states: torch.Tensor,
|
| 376 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor],
|
| 377 |
+
attention_mask: torch.Tensor | None,
|
| 378 |
+
past_key_values: Cache | None = None,
|
| 379 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 380 |
+
) -> tuple[torch.Tensor, torch.Tensor | None]:
|
| 381 |
+
input_shape = hidden_states.shape[:-1]
|
| 382 |
+
hidden_shape = (*input_shape, -1, self.head_dim)
|
| 383 |
+
|
| 384 |
+
query_states = self.q_proj(hidden_states).view(hidden_shape)
|
| 385 |
+
key_states = self.k_proj(hidden_states).view(hidden_shape)
|
| 386 |
+
value_states = self.v_proj(hidden_states).view(hidden_shape)
|
| 387 |
+
|
| 388 |
+
query_states = self.q_norm(query_states).transpose(1, 2)
|
| 389 |
+
key_states = self.k_norm(key_states).transpose(1, 2)
|
| 390 |
+
value_states = value_states.transpose(1, 2)
|
| 391 |
+
|
| 392 |
+
cos, sin = position_embeddings
|
| 393 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
|
| 394 |
+
|
| 395 |
+
if past_key_values is not None:
|
| 396 |
+
key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx)
|
| 397 |
+
|
| 398 |
+
attention_interface: Callable = ALL_ATTENTION_FUNCTIONS.get_interface(
|
| 399 |
+
self.config._attn_implementation, eager_attention_forward
|
| 400 |
+
)
|
| 401 |
+
attn_output, attn_weights = attention_interface(
|
| 402 |
+
self,
|
| 403 |
+
query_states,
|
| 404 |
+
key_states,
|
| 405 |
+
value_states,
|
| 406 |
+
attention_mask,
|
| 407 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 408 |
+
scaling=self.scaling,
|
| 409 |
+
sliding_window=self.sliding_window,
|
| 410 |
+
**kwargs,
|
| 411 |
+
)
|
| 412 |
+
|
| 413 |
+
attn_output = attn_output.reshape(*input_shape, -1).contiguous()
|
| 414 |
+
|
| 415 |
+
gate = F.softplus(self.g_proj(hidden_states).float()).to(attn_output.dtype)
|
| 416 |
+
attn_output = (attn_output.view(*input_shape, -1, self.head_dim) * gate.unsqueeze(-1)).view(*input_shape, -1)
|
| 417 |
+
|
| 418 |
+
attn_output = self.o_proj(attn_output)
|
| 419 |
+
return attn_output, attn_weights
|
| 420 |
+
|
| 421 |
+
|
| 422 |
+
class LagunaDecoderLayer(GradientCheckpointingLayer):
|
| 423 |
+
def __init__(self, config: LagunaConfig, layer_idx: int):
|
| 424 |
+
super().__init__()
|
| 425 |
+
self.hidden_size = config.hidden_size
|
| 426 |
+
self.self_attn = LagunaAttention(config, layer_idx, config.num_attention_heads_per_layer[layer_idx])
|
| 427 |
+
if config.mlp_layer_types[layer_idx] == "sparse":
|
| 428 |
+
self.mlp = LagunaSparseMoeBlock(config)
|
| 429 |
+
else:
|
| 430 |
+
self.mlp = LagunaMLP(config, intermediate_size=config.intermediate_size)
|
| 431 |
+
self.input_layernorm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 432 |
+
self.post_attention_layernorm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 433 |
+
|
| 434 |
+
def forward(
|
| 435 |
+
self,
|
| 436 |
+
hidden_states: torch.Tensor,
|
| 437 |
+
attention_mask: torch.Tensor | None = None,
|
| 438 |
+
position_ids: torch.LongTensor | None = None,
|
| 439 |
+
past_key_values: Cache | None = None,
|
| 440 |
+
use_cache: bool | None = False,
|
| 441 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
|
| 442 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 443 |
+
) -> torch.Tensor:
|
| 444 |
+
residual = hidden_states
|
| 445 |
+
hidden_states = self.input_layernorm(hidden_states)
|
| 446 |
+
# Self Attention
|
| 447 |
+
hidden_states, _ = self.self_attn(
|
| 448 |
+
hidden_states=hidden_states,
|
| 449 |
+
attention_mask=attention_mask,
|
| 450 |
+
position_ids=position_ids,
|
| 451 |
+
past_key_values=past_key_values,
|
| 452 |
+
use_cache=use_cache,
|
| 453 |
+
position_embeddings=position_embeddings,
|
| 454 |
+
**kwargs,
|
| 455 |
+
)
|
| 456 |
+
hidden_states = residual + hidden_states
|
| 457 |
+
|
| 458 |
+
# Fully Connected
|
| 459 |
+
residual = hidden_states
|
| 460 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
| 461 |
+
hidden_states = self.mlp(hidden_states)
|
| 462 |
+
hidden_states = residual + hidden_states
|
| 463 |
+
return hidden_states
|
| 464 |
+
|
| 465 |
+
|
| 466 |
+
@auto_docstring
|
| 467 |
+
class LagunaPreTrainedModel(PreTrainedModel):
|
| 468 |
+
config: LagunaConfig
|
| 469 |
+
base_model_prefix = "model"
|
| 470 |
+
supports_gradient_checkpointing = True
|
| 471 |
+
_no_split_modules = ["LagunaDecoderLayer"]
|
| 472 |
+
_skip_keys_device_placement = ["past_key_values"]
|
| 473 |
+
_supports_flash_attn = True
|
| 474 |
+
_supports_sdpa = True
|
| 475 |
+
_supports_flex_attn = True
|
| 476 |
+
|
| 477 |
+
_can_compile_fullgraph = True
|
| 478 |
+
_supports_attention_backend = True
|
| 479 |
+
_can_record_outputs = {
|
| 480 |
+
"router_logits": OutputRecorder(LagunaTopKRouter, index=0),
|
| 481 |
+
"hidden_states": LagunaDecoderLayer,
|
| 482 |
+
"attentions": LagunaAttention,
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
@torch.no_grad()
|
| 486 |
+
def _init_weights(self, module):
|
| 487 |
+
super()._init_weights(module)
|
| 488 |
+
std = self.config.initializer_range
|
| 489 |
+
if isinstance(module, LagunaExperts):
|
| 490 |
+
init.normal_(module.gate_up_proj, mean=0.0, std=std)
|
| 491 |
+
init.normal_(module.down_proj, mean=0.0, std=std)
|
| 492 |
+
elif isinstance(module, LagunaTopKRouter):
|
| 493 |
+
init.normal_(module.weight, mean=0.0, std=std)
|
| 494 |
+
if isinstance(module, LagunaTopKRouter):
|
| 495 |
+
torch.nn.init.zeros_(module.e_score_correction_bias)
|
| 496 |
+
elif isinstance(module, LagunaRotaryEmbedding):
|
| 497 |
+
for layer_type in module.layer_types:
|
| 498 |
+
rope_init_fn = module.compute_default_rope_parameters
|
| 499 |
+
if module.rope_type[layer_type] != "default":
|
| 500 |
+
rope_init_fn = ROPE_INIT_FUNCTIONS[module.rope_type[layer_type]]
|
| 501 |
+
curr_inv_freq, _ = rope_init_fn(module.config, layer_type=layer_type)
|
| 502 |
+
init.copy_(getattr(module, f"{layer_type}_inv_freq"), curr_inv_freq)
|
| 503 |
+
init.copy_(getattr(module, f"{layer_type}_original_inv_freq"), curr_inv_freq)
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
@auto_docstring
|
| 507 |
+
class LagunaModel(LagunaPreTrainedModel):
|
| 508 |
+
def __init__(self, config: LagunaConfig):
|
| 509 |
+
super().__init__(config)
|
| 510 |
+
self.padding_idx = config.pad_token_id
|
| 511 |
+
self.vocab_size = config.vocab_size
|
| 512 |
+
|
| 513 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
| 514 |
+
self.layers = nn.ModuleList(
|
| 515 |
+
[LagunaDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
|
| 516 |
+
)
|
| 517 |
+
self.norm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 518 |
+
self.rotary_emb = LagunaRotaryEmbedding(config=config)
|
| 519 |
+
self.gradient_checkpointing = False
|
| 520 |
+
|
| 521 |
+
# Initialize weights and apply final processing
|
| 522 |
+
self.post_init()
|
| 523 |
+
|
| 524 |
+
@merge_with_config_defaults
|
| 525 |
+
@capture_outputs
|
| 526 |
+
@auto_docstring
|
| 527 |
+
def forward(
|
| 528 |
+
self,
|
| 529 |
+
input_ids: torch.LongTensor | None = None,
|
| 530 |
+
attention_mask: torch.Tensor | None = None,
|
| 531 |
+
position_ids: torch.LongTensor | None = None,
|
| 532 |
+
past_key_values: Cache | None = None,
|
| 533 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 534 |
+
use_cache: bool | None = None,
|
| 535 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 536 |
+
) -> MoeModelOutputWithPast:
|
| 537 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 538 |
+
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
| 539 |
+
|
| 540 |
+
if inputs_embeds is None:
|
| 541 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 542 |
+
|
| 543 |
+
if use_cache and past_key_values is None:
|
| 544 |
+
past_key_values = DynamicCache(config=self.config)
|
| 545 |
+
|
| 546 |
+
if position_ids is None:
|
| 547 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 548 |
+
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device) + past_seen_tokens
|
| 549 |
+
position_ids = position_ids.unsqueeze(0)
|
| 550 |
+
|
| 551 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 552 |
+
mask_kwargs = {
|
| 553 |
+
"config": self.config,
|
| 554 |
+
"inputs_embeds": inputs_embeds,
|
| 555 |
+
"attention_mask": attention_mask,
|
| 556 |
+
"past_key_values": past_key_values,
|
| 557 |
+
"position_ids": position_ids,
|
| 558 |
+
}
|
| 559 |
+
mask_creation_functions = {
|
| 560 |
+
"full_attention": lambda: create_causal_mask(**mask_kwargs),
|
| 561 |
+
"sliding_attention": lambda: create_sliding_window_causal_mask(**mask_kwargs),
|
| 562 |
+
}
|
| 563 |
+
causal_mask_mapping = {}
|
| 564 |
+
for layer_type in set(self.config.layer_types):
|
| 565 |
+
causal_mask_mapping[layer_type] = mask_creation_functions[layer_type]()
|
| 566 |
+
|
| 567 |
+
hidden_states = inputs_embeds
|
| 568 |
+
position_embeddings = {}
|
| 569 |
+
for layer_type in set(self.config.layer_types):
|
| 570 |
+
position_embeddings[layer_type] = self.rotary_emb(hidden_states, position_ids, layer_type)
|
| 571 |
+
|
| 572 |
+
for i, decoder_layer in enumerate(self.layers[: self.config.num_hidden_layers]):
|
| 573 |
+
hidden_states = decoder_layer(
|
| 574 |
+
hidden_states,
|
| 575 |
+
attention_mask=causal_mask_mapping[self.config.layer_types[i]],
|
| 576 |
+
position_embeddings=position_embeddings[self.config.layer_types[i]],
|
| 577 |
+
position_ids=position_ids,
|
| 578 |
+
past_key_values=past_key_values,
|
| 579 |
+
**kwargs,
|
| 580 |
+
)
|
| 581 |
+
|
| 582 |
+
hidden_states = self.norm(hidden_states)
|
| 583 |
+
|
| 584 |
+
return MoeModelOutputWithPast(
|
| 585 |
+
last_hidden_state=hidden_states,
|
| 586 |
+
past_key_values=past_key_values if use_cache else None,
|
| 587 |
+
)
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
def load_balancing_loss_func(
|
| 591 |
+
gate_logits: torch.Tensor | tuple[torch.Tensor] | None,
|
| 592 |
+
num_experts: int | None = None,
|
| 593 |
+
top_k=2,
|
| 594 |
+
attention_mask: torch.Tensor | None = None,
|
| 595 |
+
) -> torch.Tensor | int:
|
| 596 |
+
r"""
|
| 597 |
+
Computes auxiliary load balancing loss as in Switch Transformer - implemented in Pytorch.
|
| 598 |
+
|
| 599 |
+
See Switch Transformer (https://huggingface.co/papers/2101.03961) for more details. This function implements the loss
|
| 600 |
+
function presented in equations (4) - (6) of the paper. It aims at penalizing cases where the routing between
|
| 601 |
+
experts is too unbalanced.
|
| 602 |
+
|
| 603 |
+
Args:
|
| 604 |
+
gate_logits:
|
| 605 |
+
Logits from the `gate`, should be a tuple of model.config.num_hidden_layers tensors of
|
| 606 |
+
shape [batch_size X sequence_length, num_experts].
|
| 607 |
+
num_experts:
|
| 608 |
+
Number of experts
|
| 609 |
+
top_k:
|
| 610 |
+
The number of experts to route per-token, can be also interpreted as the `top-k` routing
|
| 611 |
+
parameter.
|
| 612 |
+
attention_mask (`torch.Tensor`, *optional*):
|
| 613 |
+
The attention_mask used in forward function
|
| 614 |
+
shape [batch_size X sequence_length] if not None.
|
| 615 |
+
|
| 616 |
+
Returns:
|
| 617 |
+
The auxiliary loss.
|
| 618 |
+
"""
|
| 619 |
+
if gate_logits is None or not isinstance(gate_logits, tuple):
|
| 620 |
+
return 0
|
| 621 |
+
|
| 622 |
+
if isinstance(gate_logits, tuple):
|
| 623 |
+
compute_device = gate_logits[0].device
|
| 624 |
+
concatenated_gate_logits = torch.cat([layer_gate.to(compute_device) for layer_gate in gate_logits], dim=0)
|
| 625 |
+
|
| 626 |
+
routing_weights = torch.nn.functional.softmax(concatenated_gate_logits, dim=-1)
|
| 627 |
+
|
| 628 |
+
_, selected_experts = torch.topk(routing_weights, top_k, dim=-1)
|
| 629 |
+
|
| 630 |
+
expert_mask = torch.nn.functional.one_hot(selected_experts, num_experts)
|
| 631 |
+
|
| 632 |
+
if attention_mask is None:
|
| 633 |
+
# Compute the percentage of tokens routed to each experts
|
| 634 |
+
tokens_per_expert = torch.mean(expert_mask.float(), dim=0)
|
| 635 |
+
|
| 636 |
+
# Compute the average probability of routing to these experts
|
| 637 |
+
router_prob_per_expert = torch.mean(routing_weights, dim=0)
|
| 638 |
+
else:
|
| 639 |
+
batch_size, sequence_length = attention_mask.shape
|
| 640 |
+
num_hidden_layers = concatenated_gate_logits.shape[0] // (batch_size * sequence_length)
|
| 641 |
+
|
| 642 |
+
# Compute the mask that masks all padding tokens as 0 with the same shape of expert_mask
|
| 643 |
+
expert_attention_mask = (
|
| 644 |
+
attention_mask[None, :, :, None, None]
|
| 645 |
+
.expand((num_hidden_layers, batch_size, sequence_length, top_k, num_experts))
|
| 646 |
+
.reshape(-1, top_k, num_experts)
|
| 647 |
+
.to(compute_device)
|
| 648 |
+
)
|
| 649 |
+
|
| 650 |
+
# Compute the percentage of tokens routed to each experts
|
| 651 |
+
tokens_per_expert = torch.sum(expert_mask.float() * expert_attention_mask, dim=0) / torch.sum(
|
| 652 |
+
expert_attention_mask, dim=0
|
| 653 |
+
)
|
| 654 |
+
|
| 655 |
+
# Compute the mask that masks all padding tokens as 0 with the same shape of tokens_per_expert
|
| 656 |
+
router_per_expert_attention_mask = (
|
| 657 |
+
attention_mask[None, :, :, None]
|
| 658 |
+
.expand((num_hidden_layers, batch_size, sequence_length, num_experts))
|
| 659 |
+
.reshape(-1, num_experts)
|
| 660 |
+
.to(compute_device)
|
| 661 |
+
)
|
| 662 |
+
|
| 663 |
+
# Compute the average probability of routing to these experts
|
| 664 |
+
router_prob_per_expert = torch.sum(routing_weights * router_per_expert_attention_mask, dim=0) / torch.sum(
|
| 665 |
+
router_per_expert_attention_mask, dim=0
|
| 666 |
+
)
|
| 667 |
+
|
| 668 |
+
overall_loss = torch.sum(tokens_per_expert * router_prob_per_expert.unsqueeze(0))
|
| 669 |
+
return overall_loss * num_experts
|
| 670 |
+
|
| 671 |
+
|
| 672 |
+
@auto_docstring
|
| 673 |
+
class LagunaForCausalLM(LagunaPreTrainedModel, GenerationMixin):
|
| 674 |
+
_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
|
| 675 |
+
_tp_plan = {"lm_head": "colwise_gather_output"}
|
| 676 |
+
_pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
|
| 677 |
+
|
| 678 |
+
def __init__(self, config):
|
| 679 |
+
super().__init__(config)
|
| 680 |
+
self.model = LagunaModel(config)
|
| 681 |
+
self.vocab_size = config.vocab_size
|
| 682 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 683 |
+
self.router_aux_loss_coef = config.router_aux_loss_coef
|
| 684 |
+
self.num_experts = config.num_experts
|
| 685 |
+
self.num_experts_per_tok = config.num_experts_per_tok
|
| 686 |
+
|
| 687 |
+
# Initialize weights and apply final processing
|
| 688 |
+
self.post_init()
|
| 689 |
+
|
| 690 |
+
@can_return_tuple
|
| 691 |
+
@auto_docstring
|
| 692 |
+
def forward(
|
| 693 |
+
self,
|
| 694 |
+
input_ids: torch.LongTensor | None = None,
|
| 695 |
+
attention_mask: torch.Tensor | None = None,
|
| 696 |
+
position_ids: torch.LongTensor | None = None,
|
| 697 |
+
past_key_values: Cache | None = None,
|
| 698 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 699 |
+
labels: torch.LongTensor | None = None,
|
| 700 |
+
use_cache: bool | None = None,
|
| 701 |
+
output_router_logits: bool | None = None,
|
| 702 |
+
logits_to_keep: int | torch.Tensor = 0,
|
| 703 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 704 |
+
) -> MoeCausalLMOutputWithPast:
|
| 705 |
+
r"""
|
| 706 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 707 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
| 708 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
| 709 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
| 710 |
+
"""
|
| 711 |
+
|
| 712 |
+
output_router_logits = (
|
| 713 |
+
output_router_logits if output_router_logits is not None else self.config.output_router_logits
|
| 714 |
+
)
|
| 715 |
+
|
| 716 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
| 717 |
+
outputs: MoeModelOutputWithPast = self.model(
|
| 718 |
+
input_ids=input_ids,
|
| 719 |
+
attention_mask=attention_mask,
|
| 720 |
+
position_ids=position_ids,
|
| 721 |
+
past_key_values=past_key_values,
|
| 722 |
+
inputs_embeds=inputs_embeds,
|
| 723 |
+
use_cache=use_cache,
|
| 724 |
+
output_router_logits=output_router_logits,
|
| 725 |
+
**kwargs,
|
| 726 |
+
)
|
| 727 |
+
|
| 728 |
+
hidden_states = outputs.last_hidden_state
|
| 729 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
| 730 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 731 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
| 732 |
+
|
| 733 |
+
loss = None
|
| 734 |
+
if labels is not None:
|
| 735 |
+
loss = self.loss_function(logits, labels, self.vocab_size, **kwargs)
|
| 736 |
+
|
| 737 |
+
aux_loss = None
|
| 738 |
+
if output_router_logits:
|
| 739 |
+
aux_loss = load_balancing_loss_func(
|
| 740 |
+
outputs.router_logits,
|
| 741 |
+
self.num_experts,
|
| 742 |
+
self.num_experts_per_tok,
|
| 743 |
+
attention_mask,
|
| 744 |
+
)
|
| 745 |
+
if labels is not None:
|
| 746 |
+
loss += self.router_aux_loss_coef * aux_loss.to(loss.device) # make sure to reside in the same device
|
| 747 |
+
|
| 748 |
+
return MoeCausalLMOutputWithPast(
|
| 749 |
+
loss=loss,
|
| 750 |
+
aux_loss=aux_loss,
|
| 751 |
+
logits=logits,
|
| 752 |
+
past_key_values=outputs.past_key_values,
|
| 753 |
+
hidden_states=outputs.hidden_states,
|
| 754 |
+
attentions=outputs.attentions,
|
| 755 |
+
router_logits=outputs.router_logits,
|
| 756 |
+
)
|
| 757 |
+
|
| 758 |
+
|
| 759 |
+
__all__ = ["LagunaForCausalLM", "LagunaModel", "LagunaPreTrainedModel"]
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/laguna/modular_laguna.py
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2026 Poolside and the HuggingFace Inc. team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""PyTorch Laguna model."""
|
| 15 |
+
|
| 16 |
+
from collections.abc import Callable
|
| 17 |
+
from typing import Any, Literal, Optional
|
| 18 |
+
|
| 19 |
+
import torch
|
| 20 |
+
import torch.nn.functional as F
|
| 21 |
+
from huggingface_hub.dataclasses import strict
|
| 22 |
+
from torch import nn
|
| 23 |
+
|
| 24 |
+
from ... import initialization as init
|
| 25 |
+
from ...cache_utils import Cache, DynamicCache
|
| 26 |
+
from ...configuration_utils import PreTrainedConfig
|
| 27 |
+
from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask
|
| 28 |
+
from ...modeling_flash_attention_utils import FlashAttentionKwargs
|
| 29 |
+
from ...modeling_outputs import MoeModelOutputWithPast
|
| 30 |
+
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS
|
| 31 |
+
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS
|
| 32 |
+
from ...processing_utils import Unpack
|
| 33 |
+
from ...utils import auto_docstring, logging
|
| 34 |
+
from ...utils.generic import TransformersKwargs
|
| 35 |
+
from ..afmoe.modeling_afmoe import AfmoeAttention
|
| 36 |
+
from ..gemma3.modeling_gemma3 import Gemma3RotaryEmbedding
|
| 37 |
+
from ..glm4_moe_lite.modeling_glm4_moe_lite import Glm4MoeLiteDecoderLayer
|
| 38 |
+
from ..llama.modeling_llama import LlamaModel, eager_attention_forward
|
| 39 |
+
from ..qwen2_moe.configuration_qwen2_moe import Qwen2MoeConfig
|
| 40 |
+
from ..qwen2_moe.modeling_qwen2_moe import Qwen2MoeForCausalLM, Qwen2MoeMLP, Qwen2MoePreTrainedModel, Qwen2MoeRMSNorm
|
| 41 |
+
from ..qwen3_5_moe.modeling_qwen3_5_moe import Qwen3_5MoeTopKRouter, apply_rotary_pos_emb
|
| 42 |
+
from ..qwen3_moe.modeling_qwen3_moe import Qwen3MoeExperts, Qwen3MoeSparseMoeBlock
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
logger = logging.get_logger(__name__)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
@auto_docstring(checkpoint="poolside/laguna-XS.2")
|
| 49 |
+
@strict
|
| 50 |
+
class LagunaConfig(Qwen2MoeConfig):
|
| 51 |
+
r"""
|
| 52 |
+
num_attention_heads_per_layer (`list[int]`, *optional*):
|
| 53 |
+
Per-layer override for ``num_attention_heads``. Length must equal ``num_hidden_layers``.
|
| 54 |
+
mlp_layer_types (`list[str]`, *optional*):
|
| 55 |
+
Per-layer MLP type — ``"dense"`` or ``"sparse"``. Length must equal
|
| 56 |
+
``num_hidden_layers``. Defaults to first layer dense, rest sparse.
|
| 57 |
+
moe_routed_scaling_factor (`float`, *optional*, defaults to 1.0):
|
| 58 |
+
Scalar applied to routed-expert output before combining with the shared-expert output.
|
| 59 |
+
moe_apply_router_weight_on_input (`bool`, *optional*, defaults to `False`):
|
| 60 |
+
Whether to apply router weights to the MoE input rather than the output. Not supported
|
| 61 |
+
in transformers yet; ``True`` will raise a ``NotImplementedError`` for now.
|
| 62 |
+
moe_router_logit_softcapping (`float`, *optional*, defaults to 0.0):
|
| 63 |
+
Scaling factor when applying tanh softcapping on the logits of the MoE router logits.
|
| 64 |
+
|
| 65 |
+
Example:
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
>>> from transformers import LagunaModel, LagunaConfig
|
| 69 |
+
|
| 70 |
+
>>> configuration = LagunaConfig()
|
| 71 |
+
>>> model = LagunaModel(configuration)
|
| 72 |
+
>>> configuration = model.config
|
| 73 |
+
```
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
+
model_type = "laguna"
|
| 77 |
+
base_model_tp_plan = {
|
| 78 |
+
"layers.*.self_attn.q_proj": "colwise",
|
| 79 |
+
"layers.*.self_attn.k_proj": "colwise",
|
| 80 |
+
"layers.*.self_attn.v_proj": "colwise",
|
| 81 |
+
"layers.*.self_attn.g_proj": "colwise",
|
| 82 |
+
"layers.*.self_attn.o_proj": "rowwise",
|
| 83 |
+
"layers.*.self_attn.q_norm": "replicated_with_grad_allreduce",
|
| 84 |
+
"layers.*.self_attn.k_norm": "replicated_with_grad_allreduce",
|
| 85 |
+
"layers.*.mlp.gate_proj": "colwise",
|
| 86 |
+
"layers.*.mlp.up_proj": "colwise",
|
| 87 |
+
"layers.*.mlp.down_proj": "rowwise",
|
| 88 |
+
"layers.*.mlp.experts.gate_up_proj": "packed_colwise",
|
| 89 |
+
"layers.*.mlp.experts.down_proj": "rowwise",
|
| 90 |
+
"layers.*.mlp.experts": "moe_tp_experts",
|
| 91 |
+
"layers.*.mlp.shared_experts.gate_proj": "colwise",
|
| 92 |
+
"layers.*.mlp.shared_experts.up_proj": "colwise",
|
| 93 |
+
"layers.*.mlp.shared_experts.down_proj": "rowwise",
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
vocab_size: int = 100352
|
| 97 |
+
intermediate_size: int = 8192
|
| 98 |
+
num_hidden_layers: int = 40
|
| 99 |
+
num_attention_heads: int = 48
|
| 100 |
+
num_key_value_heads: int = 8
|
| 101 |
+
max_position_embeddings: int = 131072
|
| 102 |
+
num_experts: int = 256
|
| 103 |
+
num_experts_per_tok: int = 8
|
| 104 |
+
moe_intermediate_size: int = 512
|
| 105 |
+
shared_expert_intermediate_size: int = 512
|
| 106 |
+
sliding_window: int = 512
|
| 107 |
+
|
| 108 |
+
# Laguna-specific attention
|
| 109 |
+
head_dim: int = 128
|
| 110 |
+
attention_bias: bool = False
|
| 111 |
+
num_attention_heads_per_layer: list[int] | None = None
|
| 112 |
+
# Laguna-specific MoE
|
| 113 |
+
mlp_layer_types: list[str] | None = None
|
| 114 |
+
moe_routed_scaling_factor: float = 1.0
|
| 115 |
+
moe_apply_router_weight_on_input: bool = False
|
| 116 |
+
moe_router_logit_softcapping: float = 0.0
|
| 117 |
+
|
| 118 |
+
# Fields declared by Qwen2MoeConfig but not used by Laguna. ``= AttributeError()``
|
| 119 |
+
# tells modular to drop these from the materialized child.
|
| 120 |
+
decoder_sparse_step = AttributeError()
|
| 121 |
+
mlp_only_layers = AttributeError()
|
| 122 |
+
qkv_bias = AttributeError()
|
| 123 |
+
norm_topk_prob = AttributeError()
|
| 124 |
+
use_sliding_window = AttributeError()
|
| 125 |
+
max_window_layers = AttributeError()
|
| 126 |
+
|
| 127 |
+
def __post_init__(self, **kwargs):
|
| 128 |
+
if self.layer_types is None:
|
| 129 |
+
self.layer_types = ["full_attention"] * self.num_hidden_layers
|
| 130 |
+
if self.mlp_layer_types is None:
|
| 131 |
+
self.mlp_layer_types = ["dense"] + ["sparse"] * (self.num_hidden_layers - 1)
|
| 132 |
+
if self.num_attention_heads_per_layer is None:
|
| 133 |
+
self.num_attention_heads_per_layer = [self.num_attention_heads] * self.num_hidden_layers
|
| 134 |
+
|
| 135 |
+
default_rope_params: dict[Literal["full_attention", "sliding_attention"], dict[str, Any]] = {
|
| 136 |
+
"full_attention": {"rope_type": "default", "rope_theta": 500000.0, "partial_rotary_factor": 0.5},
|
| 137 |
+
"sliding_attention": {"rope_type": "default", "rope_theta": 10000.0, "partial_rotary_factor": 1.0},
|
| 138 |
+
}
|
| 139 |
+
if self.rope_parameters is None:
|
| 140 |
+
self.rope_parameters = default_rope_params
|
| 141 |
+
|
| 142 |
+
# rope_parameters is keyed by layer type; tell the validator those keys are intentional.
|
| 143 |
+
PreTrainedConfig.__post_init__(
|
| 144 |
+
self, **kwargs, ignore_keys_at_rope_validation={"sliding_attention", "full_attention"}
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
def convert_rope_params_to_dict(self, **kwargs):
|
| 148 |
+
# No need to handle BC for new models, because they have no old-format `rope_scaling`
|
| 149 |
+
return kwargs
|
| 150 |
+
|
| 151 |
+
def validate_architecture(self):
|
| 152 |
+
"""Part of ``@strict``-powered validation."""
|
| 153 |
+
if self.moe_apply_router_weight_on_input:
|
| 154 |
+
raise NotImplementedError(
|
| 155 |
+
"moe_apply_router_weight_on_input=True is not yet supported in the "
|
| 156 |
+
"transformers implementation of Laguna."
|
| 157 |
+
)
|
| 158 |
+
if (
|
| 159 |
+
self.num_attention_heads_per_layer is not None
|
| 160 |
+
and len(self.num_attention_heads_per_layer) != self.num_hidden_layers
|
| 161 |
+
):
|
| 162 |
+
raise ValueError(
|
| 163 |
+
f"num_attention_heads_per_layer length ({len(self.num_attention_heads_per_layer)}) "
|
| 164 |
+
f"must equal num_hidden_layers ({self.num_hidden_layers})."
|
| 165 |
+
)
|
| 166 |
+
if len(self.layer_types) != self.num_hidden_layers:
|
| 167 |
+
raise ValueError(
|
| 168 |
+
f"layer_types length ({len(self.layer_types)}) "
|
| 169 |
+
f"must equal num_hidden_layers ({self.num_hidden_layers})."
|
| 170 |
+
)
|
| 171 |
+
if len(self.mlp_layer_types) != self.num_hidden_layers:
|
| 172 |
+
raise ValueError(
|
| 173 |
+
f"mlp_layer_types length ({len(self.mlp_layer_types)}) "
|
| 174 |
+
f"must equal num_hidden_layers ({self.num_hidden_layers})."
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
class LagunaRMSNorm(Qwen2MoeRMSNorm):
|
| 179 |
+
pass
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
class LagunaRotaryEmbedding(Gemma3RotaryEmbedding):
|
| 183 |
+
def __init__(self, config: LagunaConfig):
|
| 184 |
+
super().__init__(config)
|
| 185 |
+
|
| 186 |
+
@staticmethod
|
| 187 |
+
def compute_default_rope_parameters(
|
| 188 |
+
config: LagunaConfig | None = None,
|
| 189 |
+
device: Optional["torch.device"] = None,
|
| 190 |
+
seq_len: int | None = None,
|
| 191 |
+
layer_type: str | None = None,
|
| 192 |
+
) -> tuple["torch.Tensor", float]:
|
| 193 |
+
"""
|
| 194 |
+
Computes the inverse frequencies according to the original RoPE implementation
|
| 195 |
+
Args:
|
| 196 |
+
config ([`~transformers.PreTrainedConfig`]):
|
| 197 |
+
The model configuration.
|
| 198 |
+
device (`torch.device`):
|
| 199 |
+
The device to use for initialization of the inverse frequencies.
|
| 200 |
+
seq_len (`int`, *optional*):
|
| 201 |
+
The current sequence length. Unused for this type of RoPE.
|
| 202 |
+
layer_type (`str`, *optional*):
|
| 203 |
+
The current layer type if the model has different RoPE parameters per type.
|
| 204 |
+
Should not be used unless `config.layer_types is not None`
|
| 205 |
+
Returns:
|
| 206 |
+
Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the
|
| 207 |
+
post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE).
|
| 208 |
+
"""
|
| 209 |
+
base = config.rope_parameters[layer_type]["rope_theta"]
|
| 210 |
+
# key difference to gemma3: partial rope
|
| 211 |
+
partial_rotary_factor = config.rope_parameters[layer_type].get("partial_rotary_factor", 1.0)
|
| 212 |
+
head_dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads
|
| 213 |
+
dim = int(head_dim * partial_rotary_factor)
|
| 214 |
+
|
| 215 |
+
attention_factor = 1.0 # Unused in this type of RoPE
|
| 216 |
+
|
| 217 |
+
# Compute the inverse frequencies
|
| 218 |
+
inv_freq = 1.0 / (
|
| 219 |
+
base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)
|
| 220 |
+
)
|
| 221 |
+
return inv_freq, attention_factor
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
class LagunaMLP(Qwen2MoeMLP):
|
| 225 |
+
pass
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
class LagunaTopKRouter(Qwen3_5MoeTopKRouter):
|
| 229 |
+
def __init__(self, config):
|
| 230 |
+
super().__init__()
|
| 231 |
+
self.e_score_correction_bias = nn.Parameter(torch.zeros(config.num_experts), requires_grad=False)
|
| 232 |
+
self.router_logit_softcapping = config.moe_router_logit_softcapping
|
| 233 |
+
|
| 234 |
+
def forward(
|
| 235 |
+
self,
|
| 236 |
+
hidden_states: torch.Tensor,
|
| 237 |
+
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 238 |
+
hidden_states = hidden_states.reshape(-1, self.hidden_dim)
|
| 239 |
+
router_logits = F.linear(hidden_states, self.weight).float()
|
| 240 |
+
# Optional logits softcapping
|
| 241 |
+
if self.router_logit_softcapping > 0.0:
|
| 242 |
+
router_logits = torch.tanh(router_logits / self.router_logit_softcapping) * self.router_logit_softcapping
|
| 243 |
+
# Sigmoid instead of softmax normalization
|
| 244 |
+
routing_scores = torch.sigmoid(router_logits)
|
| 245 |
+
|
| 246 |
+
scores_for_selection = routing_scores + self.e_score_correction_bias.to(routing_scores.dtype)
|
| 247 |
+
_, selected_experts = torch.topk(scores_for_selection, self.top_k, dim=-1)
|
| 248 |
+
routing_weights = routing_scores.gather(-1, selected_experts)
|
| 249 |
+
routing_weights = routing_weights / routing_weights.sum(dim=-1, keepdim=True)
|
| 250 |
+
routing_weights = routing_weights.to(hidden_states.dtype)
|
| 251 |
+
|
| 252 |
+
return router_logits, routing_weights, selected_experts
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
class LagunaExperts(Qwen3MoeExperts):
|
| 256 |
+
pass
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
class LagunaSparseMoeBlock(Qwen3MoeSparseMoeBlock):
|
| 260 |
+
def __init__(self, config: LagunaConfig):
|
| 261 |
+
super().__init__(config)
|
| 262 |
+
self.shared_experts = LagunaMLP(config, intermediate_size=config.shared_expert_intermediate_size)
|
| 263 |
+
self.routed_scaling_factor = config.moe_routed_scaling_factor
|
| 264 |
+
|
| 265 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 266 |
+
batch_size, sequence_length, hidden_dim = hidden_states.shape
|
| 267 |
+
hidden_states = hidden_states.view(-1, hidden_dim)
|
| 268 |
+
shared_output = self.shared_experts(hidden_states)
|
| 269 |
+
|
| 270 |
+
_, routing_weights, selected_experts = self.gate(hidden_states)
|
| 271 |
+
hidden_states = self.experts(hidden_states, selected_experts, routing_weights)
|
| 272 |
+
# Additional scaling
|
| 273 |
+
hidden_states = hidden_states * self.routed_scaling_factor
|
| 274 |
+
hidden_states = hidden_states + shared_output
|
| 275 |
+
|
| 276 |
+
hidden_states = hidden_states.reshape(batch_size, sequence_length, hidden_dim)
|
| 277 |
+
return hidden_states
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
class LagunaAttention(AfmoeAttention):
|
| 281 |
+
"""Afmoe-style SWA/GQA attention with Laguna-specific gating and per-layer head count."""
|
| 282 |
+
|
| 283 |
+
def __init__(self, config: LagunaConfig, layer_idx: int, num_heads: int):
|
| 284 |
+
# Number of heads is controlled via `config.num_attention_heads_per_layer`
|
| 285 |
+
self.num_heads = num_heads
|
| 286 |
+
|
| 287 |
+
super().__init__(config, layer_idx)
|
| 288 |
+
self.num_key_value_groups = self.num_heads // config.num_key_value_heads
|
| 289 |
+
|
| 290 |
+
self.q_proj = nn.Linear(config.hidden_size, self.num_heads * self.head_dim, bias=config.attention_bias)
|
| 291 |
+
self.o_proj = nn.Linear(self.num_heads * self.head_dim, config.hidden_size, bias=config.attention_bias)
|
| 292 |
+
|
| 293 |
+
# Custom per-head gating
|
| 294 |
+
del self.gate_proj
|
| 295 |
+
self.g_proj = nn.Linear(config.hidden_size, self.num_heads, bias=False)
|
| 296 |
+
|
| 297 |
+
def forward(
|
| 298 |
+
self,
|
| 299 |
+
hidden_states: torch.Tensor,
|
| 300 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor],
|
| 301 |
+
attention_mask: torch.Tensor | None,
|
| 302 |
+
past_key_values: Cache | None = None,
|
| 303 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 304 |
+
) -> tuple[torch.Tensor, torch.Tensor | None]:
|
| 305 |
+
input_shape = hidden_states.shape[:-1]
|
| 306 |
+
hidden_shape = (*input_shape, -1, self.head_dim)
|
| 307 |
+
|
| 308 |
+
query_states = self.q_proj(hidden_states).view(hidden_shape)
|
| 309 |
+
key_states = self.k_proj(hidden_states).view(hidden_shape)
|
| 310 |
+
value_states = self.v_proj(hidden_states).view(hidden_shape)
|
| 311 |
+
|
| 312 |
+
query_states = self.q_norm(query_states).transpose(1, 2)
|
| 313 |
+
key_states = self.k_norm(key_states).transpose(1, 2)
|
| 314 |
+
value_states = value_states.transpose(1, 2)
|
| 315 |
+
|
| 316 |
+
cos, sin = position_embeddings
|
| 317 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
|
| 318 |
+
|
| 319 |
+
if past_key_values is not None:
|
| 320 |
+
key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx)
|
| 321 |
+
|
| 322 |
+
attention_interface: Callable = ALL_ATTENTION_FUNCTIONS.get_interface(
|
| 323 |
+
self.config._attn_implementation, eager_attention_forward
|
| 324 |
+
)
|
| 325 |
+
attn_output, attn_weights = attention_interface(
|
| 326 |
+
self,
|
| 327 |
+
query_states,
|
| 328 |
+
key_states,
|
| 329 |
+
value_states,
|
| 330 |
+
attention_mask,
|
| 331 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 332 |
+
scaling=self.scaling,
|
| 333 |
+
sliding_window=self.sliding_window,
|
| 334 |
+
**kwargs,
|
| 335 |
+
)
|
| 336 |
+
|
| 337 |
+
attn_output = attn_output.reshape(*input_shape, -1).contiguous()
|
| 338 |
+
|
| 339 |
+
gate = F.softplus(self.g_proj(hidden_states).float()).to(attn_output.dtype)
|
| 340 |
+
attn_output = (attn_output.view(*input_shape, -1, self.head_dim) * gate.unsqueeze(-1)).view(*input_shape, -1)
|
| 341 |
+
|
| 342 |
+
attn_output = self.o_proj(attn_output)
|
| 343 |
+
return attn_output, attn_weights
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
class LagunaDecoderLayer(Glm4MoeLiteDecoderLayer):
|
| 347 |
+
def __init__(self, config: LagunaConfig, layer_idx: int):
|
| 348 |
+
nn.Module.__init__(self)
|
| 349 |
+
self.hidden_size = config.hidden_size
|
| 350 |
+
self.self_attn = LagunaAttention(config, layer_idx, config.num_attention_heads_per_layer[layer_idx])
|
| 351 |
+
if config.mlp_layer_types[layer_idx] == "sparse":
|
| 352 |
+
self.mlp = LagunaSparseMoeBlock(config)
|
| 353 |
+
else:
|
| 354 |
+
self.mlp = LagunaMLP(config, intermediate_size=config.intermediate_size)
|
| 355 |
+
self.input_layernorm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 356 |
+
self.post_attention_layernorm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
class LagunaPreTrainedModel(Qwen2MoePreTrainedModel):
|
| 360 |
+
@torch.no_grad()
|
| 361 |
+
def _init_weights(self, module):
|
| 362 |
+
super()._init_weights(module)
|
| 363 |
+
if isinstance(module, LagunaTopKRouter):
|
| 364 |
+
torch.nn.init.zeros_(module.e_score_correction_bias)
|
| 365 |
+
elif isinstance(module, LagunaRotaryEmbedding):
|
| 366 |
+
for layer_type in module.layer_types:
|
| 367 |
+
rope_init_fn = module.compute_default_rope_parameters
|
| 368 |
+
if module.rope_type[layer_type] != "default":
|
| 369 |
+
rope_init_fn = ROPE_INIT_FUNCTIONS[module.rope_type[layer_type]]
|
| 370 |
+
curr_inv_freq, _ = rope_init_fn(module.config, layer_type=layer_type)
|
| 371 |
+
init.copy_(getattr(module, f"{layer_type}_inv_freq"), curr_inv_freq)
|
| 372 |
+
init.copy_(getattr(module, f"{layer_type}_original_inv_freq"), curr_inv_freq)
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
class LagunaModel(LlamaModel):
|
| 376 |
+
def forward(
|
| 377 |
+
self,
|
| 378 |
+
input_ids: torch.LongTensor | None = None,
|
| 379 |
+
attention_mask: torch.Tensor | None = None,
|
| 380 |
+
position_ids: torch.LongTensor | None = None,
|
| 381 |
+
past_key_values: Cache | None = None,
|
| 382 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 383 |
+
use_cache: bool | None = None,
|
| 384 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 385 |
+
) -> MoeModelOutputWithPast:
|
| 386 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 387 |
+
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
| 388 |
+
|
| 389 |
+
if inputs_embeds is None:
|
| 390 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 391 |
+
|
| 392 |
+
if use_cache and past_key_values is None:
|
| 393 |
+
past_key_values = DynamicCache(config=self.config)
|
| 394 |
+
|
| 395 |
+
if position_ids is None:
|
| 396 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 397 |
+
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device) + past_seen_tokens
|
| 398 |
+
position_ids = position_ids.unsqueeze(0)
|
| 399 |
+
|
| 400 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 401 |
+
mask_kwargs = {
|
| 402 |
+
"config": self.config,
|
| 403 |
+
"inputs_embeds": inputs_embeds,
|
| 404 |
+
"attention_mask": attention_mask,
|
| 405 |
+
"past_key_values": past_key_values,
|
| 406 |
+
"position_ids": position_ids,
|
| 407 |
+
}
|
| 408 |
+
mask_creation_functions = {
|
| 409 |
+
"full_attention": lambda: create_causal_mask(**mask_kwargs),
|
| 410 |
+
"sliding_attention": lambda: create_sliding_window_causal_mask(**mask_kwargs),
|
| 411 |
+
}
|
| 412 |
+
causal_mask_mapping = {}
|
| 413 |
+
for layer_type in set(self.config.layer_types):
|
| 414 |
+
causal_mask_mapping[layer_type] = mask_creation_functions[layer_type]()
|
| 415 |
+
|
| 416 |
+
hidden_states = inputs_embeds
|
| 417 |
+
position_embeddings = {}
|
| 418 |
+
for layer_type in set(self.config.layer_types):
|
| 419 |
+
position_embeddings[layer_type] = self.rotary_emb(hidden_states, position_ids, layer_type)
|
| 420 |
+
|
| 421 |
+
for i, decoder_layer in enumerate(self.layers[: self.config.num_hidden_layers]):
|
| 422 |
+
hidden_states = decoder_layer(
|
| 423 |
+
hidden_states,
|
| 424 |
+
attention_mask=causal_mask_mapping[self.config.layer_types[i]],
|
| 425 |
+
position_embeddings=position_embeddings[self.config.layer_types[i]],
|
| 426 |
+
position_ids=position_ids,
|
| 427 |
+
past_key_values=past_key_values,
|
| 428 |
+
**kwargs,
|
| 429 |
+
)
|
| 430 |
+
|
| 431 |
+
hidden_states = self.norm(hidden_states)
|
| 432 |
+
|
| 433 |
+
return MoeModelOutputWithPast(
|
| 434 |
+
last_hidden_state=hidden_states,
|
| 435 |
+
past_key_values=past_key_values if use_cache else None,
|
| 436 |
+
)
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
class LagunaForCausalLM(Qwen2MoeForCausalLM):
|
| 440 |
+
def forward(self, **super_kwargs):
|
| 441 |
+
r"""
|
| 442 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 443 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
| 444 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
| 445 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
| 446 |
+
"""
|
| 447 |
+
return super().forward(**super_kwargs)
|
| 448 |
+
|
| 449 |
+
|
| 450 |
+
__all__ = [
|
| 451 |
+
"LagunaConfig",
|
| 452 |
+
"LagunaForCausalLM",
|
| 453 |
+
"LagunaModel",
|
| 454 |
+
"LagunaPreTrainedModel",
|
| 455 |
+
]
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/siglip/__init__.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
from typing import TYPE_CHECKING
|
| 15 |
+
|
| 16 |
+
from ...utils import _LazyModule
|
| 17 |
+
from ...utils.import_utils import define_import_structure
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
if TYPE_CHECKING:
|
| 21 |
+
from .configuration_siglip import *
|
| 22 |
+
from .image_processing_pil_siglip import *
|
| 23 |
+
from .image_processing_siglip import *
|
| 24 |
+
from .modeling_siglip import *
|
| 25 |
+
from .processing_siglip import *
|
| 26 |
+
from .tokenization_siglip import *
|
| 27 |
+
else:
|
| 28 |
+
import sys
|
| 29 |
+
|
| 30 |
+
_file = globals()["__file__"]
|
| 31 |
+
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/siglip/configuration_siglip.py
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Siglip model configuration"""
|
| 15 |
+
|
| 16 |
+
from huggingface_hub.dataclasses import strict
|
| 17 |
+
|
| 18 |
+
from ...configuration_utils import PreTrainedConfig
|
| 19 |
+
from ...utils import auto_docstring, logging
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
logger = logging.get_logger(__name__)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
@auto_docstring(checkpoint="google/siglip-base-patch16-224")
|
| 26 |
+
@strict
|
| 27 |
+
class SiglipTextConfig(PreTrainedConfig):
|
| 28 |
+
r"""
|
| 29 |
+
Example:
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
>>> from transformers import SiglipTextConfig, SiglipTextModel
|
| 33 |
+
|
| 34 |
+
>>> # Initializing a SiglipTextConfig with google/siglip-base-patch16-224 style configuration
|
| 35 |
+
>>> configuration = SiglipTextConfig()
|
| 36 |
+
|
| 37 |
+
>>> # Initializing a SiglipTextModel (with random weights) from the google/siglip-base-patch16-224 style configuration
|
| 38 |
+
>>> model = SiglipTextModel(configuration)
|
| 39 |
+
|
| 40 |
+
>>> # Accessing the model configuration
|
| 41 |
+
>>> configuration = model.config
|
| 42 |
+
```"""
|
| 43 |
+
|
| 44 |
+
model_type = "siglip_text_model"
|
| 45 |
+
base_config_key = "text_config"
|
| 46 |
+
|
| 47 |
+
vocab_size: int = 32000
|
| 48 |
+
hidden_size: int = 768
|
| 49 |
+
intermediate_size: int = 3072
|
| 50 |
+
num_hidden_layers: int = 12
|
| 51 |
+
num_attention_heads: int = 12
|
| 52 |
+
max_position_embeddings: int = 64
|
| 53 |
+
hidden_act: str = "gelu_pytorch_tanh"
|
| 54 |
+
layer_norm_eps: float = 1e-6
|
| 55 |
+
attention_dropout: float | int = 0.0
|
| 56 |
+
# This differs from `CLIPTokenizer`'s default and from openai/siglip
|
| 57 |
+
# See https://github.com/huggingface/transformers/pull/24773#issuecomment-1632287538
|
| 58 |
+
pad_token_id: int | None = 1
|
| 59 |
+
bos_token_id: int | None = 49406
|
| 60 |
+
eos_token_id: int | list[int] | None = 49407
|
| 61 |
+
projection_size: int | None = None
|
| 62 |
+
|
| 63 |
+
def __post_init__(self, **kwargs):
|
| 64 |
+
self.projection_size = self.projection_size if self.projection_size is not None else self.hidden_size
|
| 65 |
+
super().__post_init__(**kwargs)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
@auto_docstring(checkpoint="google/siglip-base-patch16-224")
|
| 69 |
+
@strict
|
| 70 |
+
class SiglipVisionConfig(PreTrainedConfig):
|
| 71 |
+
r"""
|
| 72 |
+
Example:
|
| 73 |
+
|
| 74 |
+
```python
|
| 75 |
+
>>> from transformers import SiglipVisionConfig, SiglipVisionModel
|
| 76 |
+
|
| 77 |
+
>>> # Initializing a SiglipVisionConfig with google/siglip-base-patch16-224 style configuration
|
| 78 |
+
>>> configuration = SiglipVisionConfig()
|
| 79 |
+
|
| 80 |
+
>>> # Initializing a SiglipVisionModel (with random weights) from the google/siglip-base-patch16-224 style configuration
|
| 81 |
+
>>> model = SiglipVisionModel(configuration)
|
| 82 |
+
|
| 83 |
+
>>> # Accessing the model configuration
|
| 84 |
+
>>> configuration = model.config
|
| 85 |
+
```"""
|
| 86 |
+
|
| 87 |
+
model_type = "siglip_vision_model"
|
| 88 |
+
base_config_key = "vision_config"
|
| 89 |
+
|
| 90 |
+
hidden_size: int = 768
|
| 91 |
+
intermediate_size: int = 3072
|
| 92 |
+
num_hidden_layers: int = 12
|
| 93 |
+
num_attention_heads: int = 12
|
| 94 |
+
num_channels: int = 3
|
| 95 |
+
image_size: int | list[int] | tuple[int, int] = 224
|
| 96 |
+
patch_size: int | list[int] | tuple[int, int] = 16
|
| 97 |
+
hidden_act: str = "gelu_pytorch_tanh"
|
| 98 |
+
layer_norm_eps: float = 1e-6
|
| 99 |
+
attention_dropout: float | int = 0.0
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
@auto_docstring(checkpoint="google/siglip-base-patch16-224")
|
| 103 |
+
@strict
|
| 104 |
+
class SiglipConfig(PreTrainedConfig):
|
| 105 |
+
r"""
|
| 106 |
+
Example:
|
| 107 |
+
|
| 108 |
+
```python
|
| 109 |
+
>>> from transformers import SiglipConfig, SiglipModel
|
| 110 |
+
|
| 111 |
+
>>> # Initializing a SiglipConfig with google/siglip-base-patch16-224 style configuration
|
| 112 |
+
>>> configuration = SiglipConfig()
|
| 113 |
+
|
| 114 |
+
>>> # Initializing a SiglipModel (with random weights) from the google/siglip-base-patch16-224 style configuration
|
| 115 |
+
>>> model = SiglipModel(configuration)
|
| 116 |
+
|
| 117 |
+
>>> # Accessing the model configuration
|
| 118 |
+
>>> configuration = model.config
|
| 119 |
+
|
| 120 |
+
>>> # We can also initialize a SiglipConfig from a SiglipTextConfig and a SiglipVisionConfig
|
| 121 |
+
>>> from transformers import SiglipTextConfig, SiglipVisionConfig
|
| 122 |
+
|
| 123 |
+
>>> # Initializing a SiglipText and SiglipVision configuration
|
| 124 |
+
>>> config_text = SiglipTextConfig()
|
| 125 |
+
>>> config_vision = SiglipVisionConfig()
|
| 126 |
+
|
| 127 |
+
>>> config = SiglipConfig(text_config=config_text, vision_config=config_vision)
|
| 128 |
+
```"""
|
| 129 |
+
|
| 130 |
+
model_type = "siglip"
|
| 131 |
+
sub_configs = {"text_config": SiglipTextConfig, "vision_config": SiglipVisionConfig}
|
| 132 |
+
|
| 133 |
+
text_config: dict | PreTrainedConfig | None = None
|
| 134 |
+
vision_config: dict | PreTrainedConfig | None = None
|
| 135 |
+
initializer_factor: float = 1.0
|
| 136 |
+
|
| 137 |
+
def __post_init__(self, **kwargs):
|
| 138 |
+
if self.text_config is None:
|
| 139 |
+
self.text_config = SiglipTextConfig()
|
| 140 |
+
logger.info("`text_config` is `None`. Initializing the `SiglipTextConfig` with default values.")
|
| 141 |
+
elif isinstance(self.text_config, dict):
|
| 142 |
+
self.text_config = SiglipTextConfig(**self.text_config)
|
| 143 |
+
|
| 144 |
+
if self.vision_config is None:
|
| 145 |
+
self.vision_config = SiglipVisionConfig()
|
| 146 |
+
logger.info("`vision_config` is `None`. initializing the `SiglipVisionConfig` with default values.")
|
| 147 |
+
elif isinstance(self.vision_config, dict):
|
| 148 |
+
self.vision_config = SiglipVisionConfig(**self.vision_config)
|
| 149 |
+
|
| 150 |
+
super().__post_init__(**kwargs)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
__all__ = ["SiglipConfig", "SiglipTextConfig", "SiglipVisionConfig"]
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/siglip/processing_siglip.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 The HuggingFace Inc. team.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""
|
| 15 |
+
Image/Text processor class for SigLIP.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
from ...processing_utils import ProcessorMixin
|
| 19 |
+
from ...utils import auto_docstring
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
@auto_docstring
|
| 23 |
+
class SiglipProcessor(ProcessorMixin):
|
| 24 |
+
def __init__(self, image_processor, tokenizer):
|
| 25 |
+
super().__init__(image_processor, tokenizer)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
__all__ = ["SiglipProcessor"]
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_015000.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b567178986137e3893f3982e1fbf2e5213b97102692fa7a551ec536c23beb47d
|
| 3 |
+
size 927700322
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_023000.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f92adceed4d126ef91c5b14243d128d7c913c65be70b81ba879ec25827d7a23
|
| 3 |
+
size 927700322
|
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_143000.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a010d76018fa5f9a1c1ecb0985d97772dc90c95a06548d44ad69765a0adb0d3
|
| 3 |
+
size 927700322
|