Text Generation
Transformers
Safetensors
English
metadiffusion
diffusion
diffusion-lm
ar-to-diffusion
custom_code
Instructions to use CodeSoft/MetaDiffusion-600M-ChatBase with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CodeSoft/MetaDiffusion-600M-ChatBase with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CodeSoft/MetaDiffusion-600M-ChatBase", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("CodeSoft/MetaDiffusion-600M-ChatBase", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CodeSoft/MetaDiffusion-600M-ChatBase with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CodeSoft/MetaDiffusion-600M-ChatBase" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeSoft/MetaDiffusion-600M-ChatBase", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CodeSoft/MetaDiffusion-600M-ChatBase
- SGLang
How to use CodeSoft/MetaDiffusion-600M-ChatBase with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CodeSoft/MetaDiffusion-600M-ChatBase" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeSoft/MetaDiffusion-600M-ChatBase", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "CodeSoft/MetaDiffusion-600M-ChatBase" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeSoft/MetaDiffusion-600M-ChatBase", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CodeSoft/MetaDiffusion-600M-ChatBase with Docker Model Runner:
docker model run hf.co/CodeSoft/MetaDiffusion-600M-ChatBase
Upload 7 files
Browse files- .gitattributes +1 -0
- config.json +1184 -0
- generation_config.json +17 -0
- hf_modeling.py +494 -0
- model.safetensors +3 -0
- tokenizer/chat_template.jinja +4 -0
- tokenizer/tokenizer.json +3 -0
- tokenizer/tokenizer_config.json +26 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
config.json
ADDED
|
@@ -0,0 +1,1184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"hidden_size": 1024,
|
| 3 |
+
"intermediate_size": 3072,
|
| 4 |
+
"num_hidden_layers": 28,
|
| 5 |
+
"num_attention_heads": 16,
|
| 6 |
+
"num_key_value_heads": 8,
|
| 7 |
+
"head_dim": 128,
|
| 8 |
+
"vocab_size": 151677,
|
| 9 |
+
"mask_vocab_size": 151677,
|
| 10 |
+
"mask_token_id": 151669,
|
| 11 |
+
"pad_token_id": 151643,
|
| 12 |
+
"max_position_embeddings": 40960,
|
| 13 |
+
"rope_theta": 1000000.0,
|
| 14 |
+
"rms_norm_eps": 1e-06,
|
| 15 |
+
"hidden_act": "silu",
|
| 16 |
+
"qk_norm": true,
|
| 17 |
+
"timestep_emb_hidden": 1024,
|
| 18 |
+
"tie_word_embeddings": false,
|
| 19 |
+
"mask_ratio_min": 0.0,
|
| 20 |
+
"mask_ratio_max": 1.0,
|
| 21 |
+
"model_type": "metadiffusion",
|
| 22 |
+
"architectures": [
|
| 23 |
+
"MetaDiffusion600MForCausalLM"
|
| 24 |
+
],
|
| 25 |
+
"auto_map": {
|
| 26 |
+
"AutoConfig": "hf_modeling.MetaDiffusion600MConfig",
|
| 27 |
+
"AutoModelForCausalLM": "hf_modeling.MetaDiffusion600MForCausalLM"
|
| 28 |
+
},
|
| 29 |
+
"eos_token_id": [
|
| 30 |
+
151645
|
| 31 |
+
],
|
| 32 |
+
"rainbow_token_ids": [
|
| 33 |
+
151670,
|
| 34 |
+
151671,
|
| 35 |
+
151672,
|
| 36 |
+
151673,
|
| 37 |
+
151674,
|
| 38 |
+
151675,
|
| 39 |
+
151676
|
| 40 |
+
],
|
| 41 |
+
"invalid_utf8_token_ids": [
|
| 42 |
+
94,
|
| 43 |
+
95,
|
| 44 |
+
96,
|
| 45 |
+
97,
|
| 46 |
+
98,
|
| 47 |
+
99,
|
| 48 |
+
100,
|
| 49 |
+
101,
|
| 50 |
+
102,
|
| 51 |
+
103,
|
| 52 |
+
104,
|
| 53 |
+
105,
|
| 54 |
+
106,
|
| 55 |
+
107,
|
| 56 |
+
108,
|
| 57 |
+
109,
|
| 58 |
+
110,
|
| 59 |
+
111,
|
| 60 |
+
112,
|
| 61 |
+
113,
|
| 62 |
+
114,
|
| 63 |
+
115,
|
| 64 |
+
116,
|
| 65 |
+
117,
|
| 66 |
+
118,
|
| 67 |
+
119,
|
| 68 |
+
120,
|
| 69 |
+
121,
|
| 70 |
+
122,
|
| 71 |
+
123,
|
| 72 |
+
124,
|
| 73 |
+
125,
|
| 74 |
+
126,
|
| 75 |
+
127,
|
| 76 |
+
128,
|
| 77 |
+
129,
|
| 78 |
+
130,
|
| 79 |
+
131,
|
| 80 |
+
132,
|
| 81 |
+
133,
|
| 82 |
+
134,
|
| 83 |
+
135,
|
| 84 |
+
136,
|
| 85 |
+
137,
|
| 86 |
+
138,
|
| 87 |
+
139,
|
| 88 |
+
140,
|
| 89 |
+
141,
|
| 90 |
+
142,
|
| 91 |
+
143,
|
| 92 |
+
144,
|
| 93 |
+
145,
|
| 94 |
+
146,
|
| 95 |
+
147,
|
| 96 |
+
148,
|
| 97 |
+
149,
|
| 98 |
+
150,
|
| 99 |
+
151,
|
| 100 |
+
152,
|
| 101 |
+
153,
|
| 102 |
+
154,
|
| 103 |
+
155,
|
| 104 |
+
156,
|
| 105 |
+
157,
|
| 106 |
+
158,
|
| 107 |
+
159,
|
| 108 |
+
160,
|
| 109 |
+
161,
|
| 110 |
+
162,
|
| 111 |
+
163,
|
| 112 |
+
164,
|
| 113 |
+
165,
|
| 114 |
+
166,
|
| 115 |
+
167,
|
| 116 |
+
168,
|
| 117 |
+
169,
|
| 118 |
+
170,
|
| 119 |
+
171,
|
| 120 |
+
172,
|
| 121 |
+
173,
|
| 122 |
+
174,
|
| 123 |
+
175,
|
| 124 |
+
176,
|
| 125 |
+
177,
|
| 126 |
+
178,
|
| 127 |
+
179,
|
| 128 |
+
180,
|
| 129 |
+
181,
|
| 130 |
+
182,
|
| 131 |
+
183,
|
| 132 |
+
184,
|
| 133 |
+
185,
|
| 134 |
+
186,
|
| 135 |
+
187,
|
| 136 |
+
222,
|
| 137 |
+
223,
|
| 138 |
+
224,
|
| 139 |
+
225,
|
| 140 |
+
226,
|
| 141 |
+
227,
|
| 142 |
+
228,
|
| 143 |
+
229,
|
| 144 |
+
230,
|
| 145 |
+
231,
|
| 146 |
+
232,
|
| 147 |
+
233,
|
| 148 |
+
234,
|
| 149 |
+
235,
|
| 150 |
+
236,
|
| 151 |
+
237,
|
| 152 |
+
238,
|
| 153 |
+
239,
|
| 154 |
+
240,
|
| 155 |
+
241,
|
| 156 |
+
242,
|
| 157 |
+
243,
|
| 158 |
+
244,
|
| 159 |
+
245,
|
| 160 |
+
246,
|
| 161 |
+
247,
|
| 162 |
+
248,
|
| 163 |
+
249,
|
| 164 |
+
250,
|
| 165 |
+
251,
|
| 166 |
+
252,
|
| 167 |
+
253,
|
| 168 |
+
254,
|
| 169 |
+
255,
|
| 170 |
+
378,
|
| 171 |
+
1277,
|
| 172 |
+
1540,
|
| 173 |
+
2194,
|
| 174 |
+
2775,
|
| 175 |
+
3023,
|
| 176 |
+
3219,
|
| 177 |
+
3402,
|
| 178 |
+
3490,
|
| 179 |
+
4811,
|
| 180 |
+
4973,
|
| 181 |
+
5502,
|
| 182 |
+
5564,
|
| 183 |
+
5691,
|
| 184 |
+
5758,
|
| 185 |
+
5902,
|
| 186 |
+
5953,
|
| 187 |
+
6142,
|
| 188 |
+
6518,
|
| 189 |
+
6564,
|
| 190 |
+
6571,
|
| 191 |
+
6606,
|
| 192 |
+
6684,
|
| 193 |
+
7045,
|
| 194 |
+
7158,
|
| 195 |
+
7311,
|
| 196 |
+
7367,
|
| 197 |
+
7492,
|
| 198 |
+
7536,
|
| 199 |
+
7588,
|
| 200 |
+
7908,
|
| 201 |
+
8032,
|
| 202 |
+
8079,
|
| 203 |
+
8158,
|
| 204 |
+
8508,
|
| 205 |
+
8519,
|
| 206 |
+
8843,
|
| 207 |
+
9260,
|
| 208 |
+
9284,
|
| 209 |
+
9722,
|
| 210 |
+
9973,
|
| 211 |
+
10081,
|
| 212 |
+
10203,
|
| 213 |
+
10417,
|
| 214 |
+
10663,
|
| 215 |
+
10996,
|
| 216 |
+
11125,
|
| 217 |
+
11336,
|
| 218 |
+
11484,
|
| 219 |
+
11534,
|
| 220 |
+
11620,
|
| 221 |
+
11621,
|
| 222 |
+
12274,
|
| 223 |
+
12491,
|
| 224 |
+
12585,
|
| 225 |
+
12619,
|
| 226 |
+
12787,
|
| 227 |
+
13058,
|
| 228 |
+
13092,
|
| 229 |
+
13165,
|
| 230 |
+
13344,
|
| 231 |
+
13465,
|
| 232 |
+
13512,
|
| 233 |
+
13519,
|
| 234 |
+
13531,
|
| 235 |
+
13558,
|
| 236 |
+
13567,
|
| 237 |
+
13846,
|
| 238 |
+
13869,
|
| 239 |
+
13949,
|
| 240 |
+
13982,
|
| 241 |
+
14273,
|
| 242 |
+
14368,
|
| 243 |
+
14467,
|
| 244 |
+
14546,
|
| 245 |
+
14559,
|
| 246 |
+
14675,
|
| 247 |
+
14922,
|
| 248 |
+
14936,
|
| 249 |
+
14942,
|
| 250 |
+
14959,
|
| 251 |
+
15005,
|
| 252 |
+
15127,
|
| 253 |
+
15213,
|
| 254 |
+
15224,
|
| 255 |
+
15362,
|
| 256 |
+
15393,
|
| 257 |
+
15600,
|
| 258 |
+
15675,
|
| 259 |
+
15798,
|
| 260 |
+
15827,
|
| 261 |
+
15896,
|
| 262 |
+
15902,
|
| 263 |
+
15927,
|
| 264 |
+
16160,
|
| 265 |
+
16499,
|
| 266 |
+
16633,
|
| 267 |
+
16747,
|
| 268 |
+
16825,
|
| 269 |
+
17049,
|
| 270 |
+
17156,
|
| 271 |
+
17158,
|
| 272 |
+
17401,
|
| 273 |
+
17429,
|
| 274 |
+
17462,
|
| 275 |
+
17467,
|
| 276 |
+
17641,
|
| 277 |
+
17730,
|
| 278 |
+
17783,
|
| 279 |
+
18059,
|
| 280 |
+
18505,
|
| 281 |
+
18535,
|
| 282 |
+
19088,
|
| 283 |
+
19113,
|
| 284 |
+
19261,
|
| 285 |
+
19457,
|
| 286 |
+
19549,
|
| 287 |
+
19564,
|
| 288 |
+
19741,
|
| 289 |
+
19956,
|
| 290 |
+
20026,
|
| 291 |
+
20047,
|
| 292 |
+
20098,
|
| 293 |
+
20382,
|
| 294 |
+
20741,
|
| 295 |
+
20778,
|
| 296 |
+
20879,
|
| 297 |
+
20885,
|
| 298 |
+
20919,
|
| 299 |
+
21012,
|
| 300 |
+
21135,
|
| 301 |
+
21280,
|
| 302 |
+
21530,
|
| 303 |
+
21562,
|
| 304 |
+
21704,
|
| 305 |
+
21849,
|
| 306 |
+
22009,
|
| 307 |
+
22129,
|
| 308 |
+
22247,
|
| 309 |
+
22597,
|
| 310 |
+
22762,
|
| 311 |
+
22859,
|
| 312 |
+
23093,
|
| 313 |
+
23272,
|
| 314 |
+
23433,
|
| 315 |
+
23444,
|
| 316 |
+
23479,
|
| 317 |
+
23687,
|
| 318 |
+
23781,
|
| 319 |
+
24071,
|
| 320 |
+
24159,
|
| 321 |
+
24345,
|
| 322 |
+
24447,
|
| 323 |
+
24735,
|
| 324 |
+
24749,
|
| 325 |
+
24831,
|
| 326 |
+
24864,
|
| 327 |
+
25145,
|
| 328 |
+
25209,
|
| 329 |
+
25452,
|
| 330 |
+
25703,
|
| 331 |
+
25870,
|
| 332 |
+
25928,
|
| 333 |
+
26188,
|
| 334 |
+
26254,
|
| 335 |
+
26336,
|
| 336 |
+
26454,
|
| 337 |
+
26601,
|
| 338 |
+
26771,
|
| 339 |
+
26927,
|
| 340 |
+
27095,
|
| 341 |
+
27209,
|
| 342 |
+
27214,
|
| 343 |
+
27325,
|
| 344 |
+
27398,
|
| 345 |
+
27517,
|
| 346 |
+
27538,
|
| 347 |
+
27640,
|
| 348 |
+
27757,
|
| 349 |
+
27999,
|
| 350 |
+
28107,
|
| 351 |
+
28145,
|
| 352 |
+
28757,
|
| 353 |
+
29150,
|
| 354 |
+
29220,
|
| 355 |
+
29237,
|
| 356 |
+
29389,
|
| 357 |
+
29675,
|
| 358 |
+
29768,
|
| 359 |
+
29955,
|
| 360 |
+
29975,
|
| 361 |
+
30006,
|
| 362 |
+
30274,
|
| 363 |
+
30395,
|
| 364 |
+
30828,
|
| 365 |
+
30838,
|
| 366 |
+
30916,
|
| 367 |
+
31305,
|
| 368 |
+
31482,
|
| 369 |
+
31501,
|
| 370 |
+
32208,
|
| 371 |
+
32254,
|
| 372 |
+
32343,
|
| 373 |
+
32465,
|
| 374 |
+
32843,
|
| 375 |
+
32926,
|
| 376 |
+
33173,
|
| 377 |
+
33352,
|
| 378 |
+
33543,
|
| 379 |
+
33556,
|
| 380 |
+
33593,
|
| 381 |
+
33739,
|
| 382 |
+
33986,
|
| 383 |
+
34429,
|
| 384 |
+
34577,
|
| 385 |
+
34622,
|
| 386 |
+
34629,
|
| 387 |
+
34759,
|
| 388 |
+
34811,
|
| 389 |
+
34992,
|
| 390 |
+
35017,
|
| 391 |
+
35049,
|
| 392 |
+
35055,
|
| 393 |
+
35146,
|
| 394 |
+
35293,
|
| 395 |
+
35496,
|
| 396 |
+
35635,
|
| 397 |
+
36097,
|
| 398 |
+
36109,
|
| 399 |
+
36677,
|
| 400 |
+
36695,
|
| 401 |
+
37289,
|
| 402 |
+
37440,
|
| 403 |
+
37472,
|
| 404 |
+
37698,
|
| 405 |
+
37913,
|
| 406 |
+
38177,
|
| 407 |
+
38419,
|
| 408 |
+
38522,
|
| 409 |
+
38911,
|
| 410 |
+
39098,
|
| 411 |
+
39175,
|
| 412 |
+
39317,
|
| 413 |
+
39834,
|
| 414 |
+
40419,
|
| 415 |
+
40714,
|
| 416 |
+
40732,
|
| 417 |
+
40747,
|
| 418 |
+
41902,
|
| 419 |
+
42144,
|
| 420 |
+
43410,
|
| 421 |
+
43459,
|
| 422 |
+
43547,
|
| 423 |
+
43559,
|
| 424 |
+
43752,
|
| 425 |
+
44014,
|
| 426 |
+
44044,
|
| 427 |
+
44104,
|
| 428 |
+
44258,
|
| 429 |
+
44401,
|
| 430 |
+
44680,
|
| 431 |
+
44706,
|
| 432 |
+
44726,
|
| 433 |
+
44818,
|
| 434 |
+
44832,
|
| 435 |
+
44851,
|
| 436 |
+
44965,
|
| 437 |
+
45881,
|
| 438 |
+
46282,
|
| 439 |
+
46353,
|
| 440 |
+
46800,
|
| 441 |
+
47378,
|
| 442 |
+
47379,
|
| 443 |
+
47972,
|
| 444 |
+
48312,
|
| 445 |
+
48533,
|
| 446 |
+
48591,
|
| 447 |
+
48749,
|
| 448 |
+
48800,
|
| 449 |
+
49166,
|
| 450 |
+
49173,
|
| 451 |
+
49420,
|
| 452 |
+
49943,
|
| 453 |
+
50111,
|
| 454 |
+
51275,
|
| 455 |
+
51497,
|
| 456 |
+
52133,
|
| 457 |
+
52408,
|
| 458 |
+
52798,
|
| 459 |
+
52887,
|
| 460 |
+
53496,
|
| 461 |
+
53556,
|
| 462 |
+
54128,
|
| 463 |
+
54492,
|
| 464 |
+
54642,
|
| 465 |
+
55890,
|
| 466 |
+
56252,
|
| 467 |
+
56823,
|
| 468 |
+
56842,
|
| 469 |
+
57154,
|
| 470 |
+
57160,
|
| 471 |
+
57332,
|
| 472 |
+
57599,
|
| 473 |
+
57743,
|
| 474 |
+
58098,
|
| 475 |
+
58169,
|
| 476 |
+
58299,
|
| 477 |
+
58557,
|
| 478 |
+
58715,
|
| 479 |
+
58899,
|
| 480 |
+
58994,
|
| 481 |
+
60627,
|
| 482 |
+
60757,
|
| 483 |
+
60864,
|
| 484 |
+
62005,
|
| 485 |
+
62416,
|
| 486 |
+
62544,
|
| 487 |
+
63046,
|
| 488 |
+
63219,
|
| 489 |
+
63761,
|
| 490 |
+
64520,
|
| 491 |
+
64893,
|
| 492 |
+
65185,
|
| 493 |
+
65291,
|
| 494 |
+
65850,
|
| 495 |
+
65877,
|
| 496 |
+
66118,
|
| 497 |
+
66498,
|
| 498 |
+
67895,
|
| 499 |
+
68405,
|
| 500 |
+
68597,
|
| 501 |
+
69382,
|
| 502 |
+
69687,
|
| 503 |
+
69792,
|
| 504 |
+
70179,
|
| 505 |
+
70297,
|
| 506 |
+
70467,
|
| 507 |
+
70731,
|
| 508 |
+
71306,
|
| 509 |
+
71443,
|
| 510 |
+
71481,
|
| 511 |
+
71933,
|
| 512 |
+
72219,
|
| 513 |
+
72496,
|
| 514 |
+
72497,
|
| 515 |
+
72509,
|
| 516 |
+
74165,
|
| 517 |
+
74209,
|
| 518 |
+
75107,
|
| 519 |
+
75142,
|
| 520 |
+
75360,
|
| 521 |
+
75375,
|
| 522 |
+
75598,
|
| 523 |
+
75962,
|
| 524 |
+
76080,
|
| 525 |
+
76986,
|
| 526 |
+
77156,
|
| 527 |
+
78910,
|
| 528 |
+
79142,
|
| 529 |
+
79531,
|
| 530 |
+
79590,
|
| 531 |
+
79888,
|
| 532 |
+
80080,
|
| 533 |
+
80702,
|
| 534 |
+
82501,
|
| 535 |
+
82712,
|
| 536 |
+
82798,
|
| 537 |
+
82912,
|
| 538 |
+
83050,
|
| 539 |
+
83164,
|
| 540 |
+
83191,
|
| 541 |
+
83643,
|
| 542 |
+
83849,
|
| 543 |
+
84200,
|
| 544 |
+
84215,
|
| 545 |
+
85794,
|
| 546 |
+
86643,
|
| 547 |
+
87299,
|
| 548 |
+
87959,
|
| 549 |
+
88541,
|
| 550 |
+
89061,
|
| 551 |
+
89083,
|
| 552 |
+
89179,
|
| 553 |
+
89297,
|
| 554 |
+
90557,
|
| 555 |
+
90639,
|
| 556 |
+
90679,
|
| 557 |
+
90734,
|
| 558 |
+
90839,
|
| 559 |
+
90894,
|
| 560 |
+
91048,
|
| 561 |
+
91771,
|
| 562 |
+
91888,
|
| 563 |
+
92120,
|
| 564 |
+
92173,
|
| 565 |
+
94964,
|
| 566 |
+
95211,
|
| 567 |
+
96938,
|
| 568 |
+
97015,
|
| 569 |
+
97946,
|
| 570 |
+
98642,
|
| 571 |
+
98734,
|
| 572 |
+
99156,
|
| 573 |
+
99157,
|
| 574 |
+
99158,
|
| 575 |
+
99159,
|
| 576 |
+
99160,
|
| 577 |
+
99161,
|
| 578 |
+
99162,
|
| 579 |
+
99163,
|
| 580 |
+
99166,
|
| 581 |
+
99167,
|
| 582 |
+
99168,
|
| 583 |
+
99169,
|
| 584 |
+
99170,
|
| 585 |
+
99171,
|
| 586 |
+
99173,
|
| 587 |
+
99174,
|
| 588 |
+
99175,
|
| 589 |
+
99176,
|
| 590 |
+
99177,
|
| 591 |
+
99179,
|
| 592 |
+
99181,
|
| 593 |
+
99183,
|
| 594 |
+
99184,
|
| 595 |
+
99187,
|
| 596 |
+
99188,
|
| 597 |
+
99189,
|
| 598 |
+
99192,
|
| 599 |
+
99196,
|
| 600 |
+
99197,
|
| 601 |
+
99198,
|
| 602 |
+
99201,
|
| 603 |
+
99202,
|
| 604 |
+
99203,
|
| 605 |
+
99206,
|
| 606 |
+
99207,
|
| 607 |
+
99211,
|
| 608 |
+
99214,
|
| 609 |
+
99215,
|
| 610 |
+
99220,
|
| 611 |
+
99221,
|
| 612 |
+
99224,
|
| 613 |
+
99228,
|
| 614 |
+
99229,
|
| 615 |
+
99230,
|
| 616 |
+
99231,
|
| 617 |
+
99238,
|
| 618 |
+
99239,
|
| 619 |
+
99240,
|
| 620 |
+
99247,
|
| 621 |
+
99248,
|
| 622 |
+
99249,
|
| 623 |
+
99254,
|
| 624 |
+
99255,
|
| 625 |
+
99256,
|
| 626 |
+
99264,
|
| 627 |
+
99265,
|
| 628 |
+
99266,
|
| 629 |
+
99267,
|
| 630 |
+
99268,
|
| 631 |
+
99269,
|
| 632 |
+
99274,
|
| 633 |
+
99275,
|
| 634 |
+
99276,
|
| 635 |
+
99281,
|
| 636 |
+
99282,
|
| 637 |
+
99289,
|
| 638 |
+
99290,
|
| 639 |
+
99291,
|
| 640 |
+
99300,
|
| 641 |
+
99301,
|
| 642 |
+
99302,
|
| 643 |
+
99303,
|
| 644 |
+
99311,
|
| 645 |
+
99323,
|
| 646 |
+
99324,
|
| 647 |
+
99325,
|
| 648 |
+
99341,
|
| 649 |
+
99342,
|
| 650 |
+
99343,
|
| 651 |
+
99344,
|
| 652 |
+
99359,
|
| 653 |
+
99374,
|
| 654 |
+
99380,
|
| 655 |
+
99381,
|
| 656 |
+
99382,
|
| 657 |
+
99401,
|
| 658 |
+
99402,
|
| 659 |
+
99423,
|
| 660 |
+
99439,
|
| 661 |
+
99442,
|
| 662 |
+
99443,
|
| 663 |
+
99444,
|
| 664 |
+
99456,
|
| 665 |
+
99484,
|
| 666 |
+
99485,
|
| 667 |
+
99516,
|
| 668 |
+
99551,
|
| 669 |
+
99552,
|
| 670 |
+
99597,
|
| 671 |
+
99598,
|
| 672 |
+
99643,
|
| 673 |
+
99648,
|
| 674 |
+
99649,
|
| 675 |
+
99714,
|
| 676 |
+
99715,
|
| 677 |
+
99777,
|
| 678 |
+
99785,
|
| 679 |
+
99874,
|
| 680 |
+
99875,
|
| 681 |
+
99977,
|
| 682 |
+
99997,
|
| 683 |
+
100024,
|
| 684 |
+
100120,
|
| 685 |
+
100121,
|
| 686 |
+
100127,
|
| 687 |
+
100128,
|
| 688 |
+
100129,
|
| 689 |
+
100130,
|
| 690 |
+
100337,
|
| 691 |
+
100459,
|
| 692 |
+
100563,
|
| 693 |
+
100620,
|
| 694 |
+
100621,
|
| 695 |
+
100988,
|
| 696 |
+
101018,
|
| 697 |
+
101022,
|
| 698 |
+
101024,
|
| 699 |
+
101025,
|
| 700 |
+
101026,
|
| 701 |
+
101027,
|
| 702 |
+
101028,
|
| 703 |
+
101029,
|
| 704 |
+
101030,
|
| 705 |
+
101031,
|
| 706 |
+
101032,
|
| 707 |
+
101033,
|
| 708 |
+
101759,
|
| 709 |
+
101838,
|
| 710 |
+
101851,
|
| 711 |
+
101860,
|
| 712 |
+
101861,
|
| 713 |
+
101862,
|
| 714 |
+
101863,
|
| 715 |
+
101864,
|
| 716 |
+
101865,
|
| 717 |
+
101866,
|
| 718 |
+
101867,
|
| 719 |
+
101868,
|
| 720 |
+
101869,
|
| 721 |
+
101870,
|
| 722 |
+
101871,
|
| 723 |
+
101872,
|
| 724 |
+
101873,
|
| 725 |
+
101874,
|
| 726 |
+
101875,
|
| 727 |
+
101876,
|
| 728 |
+
101877,
|
| 729 |
+
101878,
|
| 730 |
+
101879,
|
| 731 |
+
101880,
|
| 732 |
+
101881,
|
| 733 |
+
103893,
|
| 734 |
+
103894,
|
| 735 |
+
103895,
|
| 736 |
+
103896,
|
| 737 |
+
103897,
|
| 738 |
+
103898,
|
| 739 |
+
103899,
|
| 740 |
+
103900,
|
| 741 |
+
103901,
|
| 742 |
+
103902,
|
| 743 |
+
103903,
|
| 744 |
+
103904,
|
| 745 |
+
103905,
|
| 746 |
+
103906,
|
| 747 |
+
103907,
|
| 748 |
+
103908,
|
| 749 |
+
103909,
|
| 750 |
+
103910,
|
| 751 |
+
103911,
|
| 752 |
+
103912,
|
| 753 |
+
103913,
|
| 754 |
+
103914,
|
| 755 |
+
103915,
|
| 756 |
+
103916,
|
| 757 |
+
103917,
|
| 758 |
+
104905,
|
| 759 |
+
109992,
|
| 760 |
+
119158,
|
| 761 |
+
119941,
|
| 762 |
+
119964,
|
| 763 |
+
120100,
|
| 764 |
+
120409,
|
| 765 |
+
121404,
|
| 766 |
+
121667,
|
| 767 |
+
121773,
|
| 768 |
+
122154,
|
| 769 |
+
122174,
|
| 770 |
+
122202,
|
| 771 |
+
122219,
|
| 772 |
+
122222,
|
| 773 |
+
122259,
|
| 774 |
+
122267,
|
| 775 |
+
122289,
|
| 776 |
+
122317,
|
| 777 |
+
122375,
|
| 778 |
+
122382,
|
| 779 |
+
122427,
|
| 780 |
+
122448,
|
| 781 |
+
122455,
|
| 782 |
+
122514,
|
| 783 |
+
122568,
|
| 784 |
+
122596,
|
| 785 |
+
122614,
|
| 786 |
+
122618,
|
| 787 |
+
122634,
|
| 788 |
+
122659,
|
| 789 |
+
122725,
|
| 790 |
+
122740,
|
| 791 |
+
122757,
|
| 792 |
+
122802,
|
| 793 |
+
122843,
|
| 794 |
+
122855,
|
| 795 |
+
122866,
|
| 796 |
+
122890,
|
| 797 |
+
122948,
|
| 798 |
+
122950,
|
| 799 |
+
122976,
|
| 800 |
+
122985,
|
| 801 |
+
122999,
|
| 802 |
+
123007,
|
| 803 |
+
123008,
|
| 804 |
+
123016,
|
| 805 |
+
123057,
|
| 806 |
+
123064,
|
| 807 |
+
123067,
|
| 808 |
+
123072,
|
| 809 |
+
123084,
|
| 810 |
+
123091,
|
| 811 |
+
123131,
|
| 812 |
+
123164,
|
| 813 |
+
123178,
|
| 814 |
+
123182,
|
| 815 |
+
123204,
|
| 816 |
+
123206,
|
| 817 |
+
123287,
|
| 818 |
+
123301,
|
| 819 |
+
123305,
|
| 820 |
+
123318,
|
| 821 |
+
123332,
|
| 822 |
+
123378,
|
| 823 |
+
123400,
|
| 824 |
+
123408,
|
| 825 |
+
123420,
|
| 826 |
+
123489,
|
| 827 |
+
123516,
|
| 828 |
+
123527,
|
| 829 |
+
123547,
|
| 830 |
+
123614,
|
| 831 |
+
123658,
|
| 832 |
+
123676,
|
| 833 |
+
123701,
|
| 834 |
+
123714,
|
| 835 |
+
123740,
|
| 836 |
+
123747,
|
| 837 |
+
123760,
|
| 838 |
+
123806,
|
| 839 |
+
123807,
|
| 840 |
+
123808,
|
| 841 |
+
123810,
|
| 842 |
+
123811,
|
| 843 |
+
123812,
|
| 844 |
+
123813,
|
| 845 |
+
123814,
|
| 846 |
+
123815,
|
| 847 |
+
123816,
|
| 848 |
+
123817,
|
| 849 |
+
123819,
|
| 850 |
+
123821,
|
| 851 |
+
123825,
|
| 852 |
+
123827,
|
| 853 |
+
123830,
|
| 854 |
+
123836,
|
| 855 |
+
123837,
|
| 856 |
+
123839,
|
| 857 |
+
123840,
|
| 858 |
+
123841,
|
| 859 |
+
123842,
|
| 860 |
+
123844,
|
| 861 |
+
123846,
|
| 862 |
+
123847,
|
| 863 |
+
123848,
|
| 864 |
+
123851,
|
| 865 |
+
123853,
|
| 866 |
+
123854,
|
| 867 |
+
123859,
|
| 868 |
+
123867,
|
| 869 |
+
123870,
|
| 870 |
+
123871,
|
| 871 |
+
123875,
|
| 872 |
+
123876,
|
| 873 |
+
123882,
|
| 874 |
+
123889,
|
| 875 |
+
123892,
|
| 876 |
+
123893,
|
| 877 |
+
123907,
|
| 878 |
+
123908,
|
| 879 |
+
123911,
|
| 880 |
+
123912,
|
| 881 |
+
123916,
|
| 882 |
+
123917,
|
| 883 |
+
123918,
|
| 884 |
+
123927,
|
| 885 |
+
123928,
|
| 886 |
+
123929,
|
| 887 |
+
123930,
|
| 888 |
+
123931,
|
| 889 |
+
123932,
|
| 890 |
+
123933,
|
| 891 |
+
123934,
|
| 892 |
+
123946,
|
| 893 |
+
123947,
|
| 894 |
+
123950,
|
| 895 |
+
123951,
|
| 896 |
+
123953,
|
| 897 |
+
123954,
|
| 898 |
+
123955,
|
| 899 |
+
123956,
|
| 900 |
+
123957,
|
| 901 |
+
123965,
|
| 902 |
+
123967,
|
| 903 |
+
123968,
|
| 904 |
+
123969,
|
| 905 |
+
123970,
|
| 906 |
+
123986,
|
| 907 |
+
123989,
|
| 908 |
+
123996,
|
| 909 |
+
124000,
|
| 910 |
+
124001,
|
| 911 |
+
124002,
|
| 912 |
+
124003,
|
| 913 |
+
124004,
|
| 914 |
+
124005,
|
| 915 |
+
124018,
|
| 916 |
+
124019,
|
| 917 |
+
124020,
|
| 918 |
+
124021,
|
| 919 |
+
124022,
|
| 920 |
+
124023,
|
| 921 |
+
124024,
|
| 922 |
+
124025,
|
| 923 |
+
124026,
|
| 924 |
+
124049,
|
| 925 |
+
124050,
|
| 926 |
+
124051,
|
| 927 |
+
124052,
|
| 928 |
+
124053,
|
| 929 |
+
124054,
|
| 930 |
+
124063,
|
| 931 |
+
124064,
|
| 932 |
+
124066,
|
| 933 |
+
124067,
|
| 934 |
+
124068,
|
| 935 |
+
124069,
|
| 936 |
+
124070,
|
| 937 |
+
124071,
|
| 938 |
+
124092,
|
| 939 |
+
124096,
|
| 940 |
+
124098,
|
| 941 |
+
124099,
|
| 942 |
+
124100,
|
| 943 |
+
124101,
|
| 944 |
+
124102,
|
| 945 |
+
124118,
|
| 946 |
+
124134,
|
| 947 |
+
124135,
|
| 948 |
+
124136,
|
| 949 |
+
124137,
|
| 950 |
+
124149,
|
| 951 |
+
124154,
|
| 952 |
+
124159,
|
| 953 |
+
124160,
|
| 954 |
+
124161,
|
| 955 |
+
124162,
|
| 956 |
+
124163,
|
| 957 |
+
124164,
|
| 958 |
+
124165,
|
| 959 |
+
124166,
|
| 960 |
+
124167,
|
| 961 |
+
124168,
|
| 962 |
+
124193,
|
| 963 |
+
124194,
|
| 964 |
+
124195,
|
| 965 |
+
124196,
|
| 966 |
+
124197,
|
| 967 |
+
124198,
|
| 968 |
+
124199,
|
| 969 |
+
124200,
|
| 970 |
+
124201,
|
| 971 |
+
124222,
|
| 972 |
+
124235,
|
| 973 |
+
124236,
|
| 974 |
+
124240,
|
| 975 |
+
124241,
|
| 976 |
+
124243,
|
| 977 |
+
124244,
|
| 978 |
+
124245,
|
| 979 |
+
124246,
|
| 980 |
+
124247,
|
| 981 |
+
124248,
|
| 982 |
+
124249,
|
| 983 |
+
124250,
|
| 984 |
+
124251,
|
| 985 |
+
124252,
|
| 986 |
+
124287,
|
| 987 |
+
124296,
|
| 988 |
+
124297,
|
| 989 |
+
124298,
|
| 990 |
+
124299,
|
| 991 |
+
124300,
|
| 992 |
+
124301,
|
| 993 |
+
124302,
|
| 994 |
+
124303,
|
| 995 |
+
124304,
|
| 996 |
+
124305,
|
| 997 |
+
124306,
|
| 998 |
+
124307,
|
| 999 |
+
124308,
|
| 1000 |
+
124309,
|
| 1001 |
+
124334,
|
| 1002 |
+
124349,
|
| 1003 |
+
124364,
|
| 1004 |
+
124365,
|
| 1005 |
+
124366,
|
| 1006 |
+
124367,
|
| 1007 |
+
124368,
|
| 1008 |
+
124369,
|
| 1009 |
+
124370,
|
| 1010 |
+
124371,
|
| 1011 |
+
124372,
|
| 1012 |
+
124373,
|
| 1013 |
+
124374,
|
| 1014 |
+
124433,
|
| 1015 |
+
124470,
|
| 1016 |
+
124471,
|
| 1017 |
+
124472,
|
| 1018 |
+
124473,
|
| 1019 |
+
124474,
|
| 1020 |
+
124475,
|
| 1021 |
+
124570,
|
| 1022 |
+
124577,
|
| 1023 |
+
124578,
|
| 1024 |
+
124579,
|
| 1025 |
+
124580,
|
| 1026 |
+
124581,
|
| 1027 |
+
124582,
|
| 1028 |
+
124583,
|
| 1029 |
+
124584,
|
| 1030 |
+
124585,
|
| 1031 |
+
124586,
|
| 1032 |
+
124587,
|
| 1033 |
+
124588,
|
| 1034 |
+
124589,
|
| 1035 |
+
124590,
|
| 1036 |
+
124591,
|
| 1037 |
+
124592,
|
| 1038 |
+
124593,
|
| 1039 |
+
124594,
|
| 1040 |
+
124595,
|
| 1041 |
+
124596,
|
| 1042 |
+
124727,
|
| 1043 |
+
124744,
|
| 1044 |
+
124745,
|
| 1045 |
+
124746,
|
| 1046 |
+
124747,
|
| 1047 |
+
124748,
|
| 1048 |
+
124749,
|
| 1049 |
+
124750,
|
| 1050 |
+
124751,
|
| 1051 |
+
124752,
|
| 1052 |
+
124753,
|
| 1053 |
+
124754,
|
| 1054 |
+
124755,
|
| 1055 |
+
124995,
|
| 1056 |
+
124996,
|
| 1057 |
+
124997,
|
| 1058 |
+
124998,
|
| 1059 |
+
124999,
|
| 1060 |
+
125000,
|
| 1061 |
+
125001,
|
| 1062 |
+
125002,
|
| 1063 |
+
125003,
|
| 1064 |
+
125004,
|
| 1065 |
+
125413,
|
| 1066 |
+
125414,
|
| 1067 |
+
125415,
|
| 1068 |
+
125416,
|
| 1069 |
+
125417,
|
| 1070 |
+
125418,
|
| 1071 |
+
125419,
|
| 1072 |
+
125420,
|
| 1073 |
+
125421,
|
| 1074 |
+
125422,
|
| 1075 |
+
125423,
|
| 1076 |
+
125424,
|
| 1077 |
+
125425,
|
| 1078 |
+
125426,
|
| 1079 |
+
125427,
|
| 1080 |
+
125428,
|
| 1081 |
+
125429,
|
| 1082 |
+
125430,
|
| 1083 |
+
126159,
|
| 1084 |
+
126177,
|
| 1085 |
+
126178,
|
| 1086 |
+
126179,
|
| 1087 |
+
126180,
|
| 1088 |
+
126181,
|
| 1089 |
+
126182,
|
| 1090 |
+
126183,
|
| 1091 |
+
126184,
|
| 1092 |
+
126185,
|
| 1093 |
+
126186,
|
| 1094 |
+
126187,
|
| 1095 |
+
126188,
|
| 1096 |
+
126189,
|
| 1097 |
+
126190,
|
| 1098 |
+
126191,
|
| 1099 |
+
126192,
|
| 1100 |
+
126193,
|
| 1101 |
+
127964,
|
| 1102 |
+
128222,
|
| 1103 |
+
128223,
|
| 1104 |
+
128224,
|
| 1105 |
+
128225,
|
| 1106 |
+
128226,
|
| 1107 |
+
128227,
|
| 1108 |
+
128228,
|
| 1109 |
+
128229,
|
| 1110 |
+
128230,
|
| 1111 |
+
128231,
|
| 1112 |
+
128232,
|
| 1113 |
+
128233,
|
| 1114 |
+
128234,
|
| 1115 |
+
128235,
|
| 1116 |
+
128236,
|
| 1117 |
+
128237,
|
| 1118 |
+
128238,
|
| 1119 |
+
128239,
|
| 1120 |
+
128240,
|
| 1121 |
+
128241,
|
| 1122 |
+
128242,
|
| 1123 |
+
145773,
|
| 1124 |
+
146047,
|
| 1125 |
+
146632,
|
| 1126 |
+
148462,
|
| 1127 |
+
148774,
|
| 1128 |
+
148827,
|
| 1129 |
+
148860,
|
| 1130 |
+
148864,
|
| 1131 |
+
148880,
|
| 1132 |
+
149175,
|
| 1133 |
+
149178,
|
| 1134 |
+
149287,
|
| 1135 |
+
149352,
|
| 1136 |
+
149392,
|
| 1137 |
+
149394,
|
| 1138 |
+
149589,
|
| 1139 |
+
149591,
|
| 1140 |
+
149593,
|
| 1141 |
+
149714,
|
| 1142 |
+
149716,
|
| 1143 |
+
149718,
|
| 1144 |
+
149721,
|
| 1145 |
+
149946,
|
| 1146 |
+
149961,
|
| 1147 |
+
149963,
|
| 1148 |
+
149990,
|
| 1149 |
+
150114,
|
| 1150 |
+
150151,
|
| 1151 |
+
150168,
|
| 1152 |
+
150195,
|
| 1153 |
+
150223,
|
| 1154 |
+
150270,
|
| 1155 |
+
150479,
|
| 1156 |
+
150579,
|
| 1157 |
+
150792,
|
| 1158 |
+
150794,
|
| 1159 |
+
150800,
|
| 1160 |
+
150802,
|
| 1161 |
+
150807,
|
| 1162 |
+
150809,
|
| 1163 |
+
150814,
|
| 1164 |
+
150817,
|
| 1165 |
+
150819,
|
| 1166 |
+
150821,
|
| 1167 |
+
150824,
|
| 1168 |
+
150829,
|
| 1169 |
+
150836,
|
| 1170 |
+
151233,
|
| 1171 |
+
151254,
|
| 1172 |
+
151264,
|
| 1173 |
+
151266,
|
| 1174 |
+
151268,
|
| 1175 |
+
151270,
|
| 1176 |
+
151272,
|
| 1177 |
+
151274,
|
| 1178 |
+
151276,
|
| 1179 |
+
151278,
|
| 1180 |
+
151282,
|
| 1181 |
+
151366,
|
| 1182 |
+
151560
|
| 1183 |
+
]
|
| 1184 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"temperature": 0.7,
|
| 3 |
+
"repetition_penalty": 1.5,
|
| 4 |
+
"num_steps": 128,
|
| 5 |
+
"max_new_tokens": 96,
|
| 6 |
+
"top_p": 0.0,
|
| 7 |
+
"min_p": 0.1,
|
| 8 |
+
"im_end_bias": 2.0,
|
| 9 |
+
"im_end_bias_t": 0.3,
|
| 10 |
+
"do_sample": true,
|
| 11 |
+
"transformers_version": "4.49.0",
|
| 12 |
+
"eos_token_id": [
|
| 13 |
+
151645
|
| 14 |
+
],
|
| 15 |
+
"pad_token_id": 151643,
|
| 16 |
+
"mask_token_id": 151669
|
| 17 |
+
}
|
hf_modeling.py
ADDED
|
@@ -0,0 +1,494 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# hf_modeling.py: standalone transformers modeling file for released
|
| 2 |
+
# MetaDiffusion-600M artifacts (AutoModelForCausalLM with trust_remote_code).
|
| 3 |
+
# Copied into the export dir by export_hf.py.
|
| 4 |
+
#
|
| 5 |
+
# The generate() override runs LLaDA-style iterative denoising with
|
| 6 |
+
# left-to-right block commit: the leftmost masked positions are unmasked
|
| 7 |
+
# first, so an <|im_end|> cannot win at position 0 and produce empty output.
|
| 8 |
+
# Generation stops once a terminator is committed in the response region.
|
| 9 |
+
|
| 10 |
+
import math
|
| 11 |
+
|
| 12 |
+
import torch
|
| 13 |
+
import torch.nn as nn
|
| 14 |
+
import torch.nn.functional as F
|
| 15 |
+
|
| 16 |
+
from transformers import GenerationMixin, PretrainedConfig, PreTrainedModel
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class MetaDiffusion600MConfig(PretrainedConfig):
|
| 20 |
+
model_type = "metadiffusion"
|
| 21 |
+
|
| 22 |
+
def __init__(
|
| 23 |
+
self,
|
| 24 |
+
hidden_size=1024,
|
| 25 |
+
intermediate_size=3072,
|
| 26 |
+
num_hidden_layers=28,
|
| 27 |
+
num_attention_heads=16,
|
| 28 |
+
num_key_value_heads=8,
|
| 29 |
+
head_dim=128,
|
| 30 |
+
vocab_size=151669,
|
| 31 |
+
mask_vocab_size=151677,
|
| 32 |
+
mask_token_id=151669,
|
| 33 |
+
pad_token_id=151643,
|
| 34 |
+
max_position_embeddings=32768,
|
| 35 |
+
rope_theta=1000000.0,
|
| 36 |
+
rms_norm_eps=1e-6,
|
| 37 |
+
hidden_act="silu",
|
| 38 |
+
qk_norm=True,
|
| 39 |
+
timestep_emb_hidden=1024,
|
| 40 |
+
tie_word_embeddings=False,
|
| 41 |
+
eos_token_id=None,
|
| 42 |
+
**kwargs,
|
| 43 |
+
):
|
| 44 |
+
super().__init__(
|
| 45 |
+
pad_token_id=pad_token_id,
|
| 46 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 47 |
+
eos_token_id=eos_token_id,
|
| 48 |
+
**kwargs,
|
| 49 |
+
)
|
| 50 |
+
self.hidden_size = hidden_size
|
| 51 |
+
self.intermediate_size = intermediate_size
|
| 52 |
+
self.num_hidden_layers = num_hidden_layers
|
| 53 |
+
self.num_attention_heads = num_attention_heads
|
| 54 |
+
self.num_key_value_heads = num_key_value_heads
|
| 55 |
+
self.head_dim = head_dim
|
| 56 |
+
self.vocab_size = vocab_size
|
| 57 |
+
self.mask_vocab_size = mask_vocab_size
|
| 58 |
+
self.mask_token_id = mask_token_id
|
| 59 |
+
self.max_position_embeddings = max_position_embeddings
|
| 60 |
+
self.rope_theta = rope_theta
|
| 61 |
+
self.rms_norm_eps = rms_norm_eps
|
| 62 |
+
self.hidden_act = hidden_act
|
| 63 |
+
self.qk_norm = qk_norm
|
| 64 |
+
self.timestep_emb_hidden = timestep_emb_hidden
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
class RMSNorm(nn.Module):
|
| 68 |
+
def __init__(self, hidden_size, eps=1e-6):
|
| 69 |
+
super().__init__()
|
| 70 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
| 71 |
+
self.eps = eps
|
| 72 |
+
|
| 73 |
+
def forward(self, x):
|
| 74 |
+
orig = x.dtype
|
| 75 |
+
x = x.float()
|
| 76 |
+
var = x.pow(2).mean(-1, keepdim=True)
|
| 77 |
+
x = x * torch.rsqrt(var + self.eps)
|
| 78 |
+
return (self.weight.float() * x).to(orig)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class RotaryEmbedding(nn.Module):
|
| 82 |
+
def __init__(self, dim, max_position_embeddings=32768, base=1000000.0):
|
| 83 |
+
super().__init__()
|
| 84 |
+
self.dim = dim
|
| 85 |
+
self.base = base
|
| 86 |
+
|
| 87 |
+
def forward(self, x, position_ids):
|
| 88 |
+
# computed fresh each call on purpose: a stored inv_freq buffer is
|
| 89 |
+
# non-persistent, so it is NOT in the state dict and from_pretrained
|
| 90 |
+
# leaves it UNINITIALIZED, producing garbage cos/sin and NaN logits
|
| 91 |
+
# in the entire forward. Computing here is 28 tiny ops, immune to
|
| 92 |
+
# whatever transformers does to buffers during loading.
|
| 93 |
+
#
|
| 94 |
+
# Numerics replicate training (model.py + train.py): init computes
|
| 95 |
+
# inv_freq on CPU in fp32, then `model.to(device, dtype=bfloat16)`
|
| 96 |
+
# rounds the buffer to bf16, and the forward upcasts it back to fp32.
|
| 97 |
+
# Matching that here keeps the released file BITWISE-consistent with
|
| 98 |
+
# the training implementation (plain fp32 inv_freq differs by ~1 bf16
|
| 99 |
+
# ULP in the rotary, which drifts final logits by ~1.0 after 28
|
| 100 |
+
# layers).
|
| 101 |
+
inv_freq = 1.0 / (self.base ** (torch.arange(
|
| 102 |
+
0, self.dim, 2).float() / self.dim))
|
| 103 |
+
inv_freq = inv_freq.to(torch.bfloat16).to(torch.float32)
|
| 104 |
+
inv = inv_freq[None, :, None].to(x.device).expand(position_ids.shape[0], -1, 1)
|
| 105 |
+
pos = position_ids[:, None, :].float()
|
| 106 |
+
freqs = (inv @ pos).transpose(1, 2)
|
| 107 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 108 |
+
return emb.cos().to(dtype=x.dtype), emb.sin().to(dtype=x.dtype)
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def rotate_half(x):
|
| 112 |
+
x1, x2 = x.chunk(2, dim=-1)
|
| 113 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def apply_rotary_pos_emb(q, k, cos, sin):
|
| 117 |
+
cos, sin = cos.unsqueeze(1), sin.unsqueeze(1)
|
| 118 |
+
return (q * cos) + (rotate_half(q) * sin), (k * cos) + (rotate_half(k) * sin)
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
class TimestepEmbedding(nn.Module):
|
| 122 |
+
def __init__(self, hidden_size):
|
| 123 |
+
super().__init__()
|
| 124 |
+
self.hidden_size = hidden_size
|
| 125 |
+
self.mlp = nn.Sequential(
|
| 126 |
+
nn.Linear(hidden_size, hidden_size * 4), nn.SiLU(),
|
| 127 |
+
nn.Linear(hidden_size * 4, hidden_size),
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
def forward(self, t):
|
| 131 |
+
half_dim = self.hidden_size // 2
|
| 132 |
+
emb = math.log(10000.0) / (half_dim - 1)
|
| 133 |
+
emb = torch.exp(torch.arange(half_dim, device=t.device, dtype=torch.float32) * -emb)
|
| 134 |
+
emb = t[:, None].float() * emb[None, :]
|
| 135 |
+
emb = torch.cat([emb.sin(), emb.cos()], dim=-1)
|
| 136 |
+
# cast to the MLP weight dtype: the model may be bf16 while t is fp32
|
| 137 |
+
return self.mlp(emb.to(self.mlp[0].weight.dtype))
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
class TimestepModulation(nn.Module):
|
| 141 |
+
"""adaLN-style timestep conditioning: scale + shift the hidden state.
|
| 142 |
+
|
| 143 |
+
Zero-init scale/shift so the model is identity at step 0. Gradient is
|
| 144 |
+
dL/dscale = dL/dx * x (x nonzero), so the t-path trains: the old
|
| 145 |
+
zero-init additive residual deadlocked (zero output x zero weight =
|
| 146 |
+
zero gradient forever), leaving models noise-schedule-agnostic."""
|
| 147 |
+
|
| 148 |
+
def __init__(self, hidden_size):
|
| 149 |
+
super().__init__()
|
| 150 |
+
self.proj = nn.Linear(hidden_size, hidden_size * 2)
|
| 151 |
+
nn.init.zeros_(self.proj.weight)
|
| 152 |
+
nn.init.zeros_(self.proj.bias)
|
| 153 |
+
|
| 154 |
+
def forward(self, x, emb):
|
| 155 |
+
scale, shift = self.proj(emb).chunk(2, dim=-1)
|
| 156 |
+
scale, shift = scale[:, None, :], shift[:, None, :]
|
| 157 |
+
return x * (1.0 + scale) + shift
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
class Attention(nn.Module):
|
| 161 |
+
def __init__(self, config):
|
| 162 |
+
super().__init__()
|
| 163 |
+
self.num_heads = config.num_attention_heads
|
| 164 |
+
self.num_kv_heads = config.num_key_value_heads
|
| 165 |
+
self.head_dim = config.head_dim
|
| 166 |
+
self.num_kv_groups = self.num_heads // self.num_kv_heads
|
| 167 |
+
self.q_proj = nn.Linear(config.hidden_size, self.num_heads * self.head_dim, bias=False)
|
| 168 |
+
self.k_proj = nn.Linear(config.hidden_size, self.num_kv_heads * self.head_dim, bias=False)
|
| 169 |
+
self.v_proj = nn.Linear(config.hidden_size, self.num_kv_heads * self.head_dim, bias=False)
|
| 170 |
+
self.o_proj = nn.Linear(self.num_heads * self.head_dim, config.hidden_size, bias=False)
|
| 171 |
+
self.q_norm = RMSNorm(self.head_dim, eps=config.rms_norm_eps) if config.qk_norm else nn.Identity()
|
| 172 |
+
self.k_norm = RMSNorm(self.head_dim, eps=config.rms_norm_eps) if config.qk_norm else nn.Identity()
|
| 173 |
+
self.rotary_emb = RotaryEmbedding(config.head_dim,
|
| 174 |
+
max_position_embeddings=config.max_position_embeddings,
|
| 175 |
+
base=config.rope_theta)
|
| 176 |
+
|
| 177 |
+
def forward(self, x, attention_mask=None, position_ids=None):
|
| 178 |
+
batch, seq, _ = x.shape
|
| 179 |
+
q = self.q_proj(x).view(batch, seq, self.num_heads, self.head_dim).transpose(1, 2)
|
| 180 |
+
k = self.k_proj(x).view(batch, seq, self.num_kv_heads, self.head_dim).transpose(1, 2)
|
| 181 |
+
v = self.v_proj(x).view(batch, seq, self.num_kv_heads, self.head_dim).transpose(1, 2)
|
| 182 |
+
q, k = self.q_norm(q), self.k_norm(k)
|
| 183 |
+
cos, sin = self.rotary_emb(x, position_ids)
|
| 184 |
+
q, k = apply_rotary_pos_emb(q, k, cos, sin)
|
| 185 |
+
if self.num_kv_groups > 1:
|
| 186 |
+
k = k.repeat_interleave(self.num_kv_groups, dim=1)
|
| 187 |
+
v = v.repeat_interleave(self.num_kv_groups, dim=1)
|
| 188 |
+
out = F.scaled_dot_product_attention(q, k, v, attn_mask=attention_mask)
|
| 189 |
+
return self.o_proj(out.transpose(1, 2).contiguous().view(batch, seq, -1))
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
class MLP(nn.Module):
|
| 193 |
+
def __init__(self, config):
|
| 194 |
+
super().__init__()
|
| 195 |
+
self.gate_proj = nn.Linear(config.hidden_size, config.intermediate_size, bias=False)
|
| 196 |
+
self.up_proj = nn.Linear(config.hidden_size, config.intermediate_size, bias=False)
|
| 197 |
+
self.down_proj = nn.Linear(config.intermediate_size, config.hidden_size, bias=False)
|
| 198 |
+
|
| 199 |
+
def forward(self, x):
|
| 200 |
+
return self.down_proj(F.silu(self.gate_proj(x)) * self.up_proj(x))
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
class Block(nn.Module):
|
| 204 |
+
def __init__(self, config):
|
| 205 |
+
super().__init__()
|
| 206 |
+
self.input_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 207 |
+
self.self_attn = Attention(config)
|
| 208 |
+
self.post_attention_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 209 |
+
self.mlp = MLP(config)
|
| 210 |
+
self.timestep_modulation = TimestepModulation(config.hidden_size)
|
| 211 |
+
|
| 212 |
+
def forward(self, x, t_emb, attention_mask=None, position_ids=None):
|
| 213 |
+
residual = x
|
| 214 |
+
x = self.input_layernorm(x)
|
| 215 |
+
x = self.self_attn(x, attention_mask, position_ids)
|
| 216 |
+
x = residual + x
|
| 217 |
+
x = self.timestep_modulation(x, t_emb)
|
| 218 |
+
residual = x
|
| 219 |
+
x = self.post_attention_layernorm(x)
|
| 220 |
+
x = self.mlp(x)
|
| 221 |
+
x = residual + x
|
| 222 |
+
x = self.timestep_modulation(x, t_emb)
|
| 223 |
+
return x
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
class MetaDiffusion600MModel(PreTrainedModel):
|
| 227 |
+
config_class = MetaDiffusion600MConfig
|
| 228 |
+
|
| 229 |
+
def __init__(self, config):
|
| 230 |
+
super().__init__(config)
|
| 231 |
+
self.config = config
|
| 232 |
+
self.embed_tokens = nn.Embedding(config.mask_vocab_size, config.hidden_size)
|
| 233 |
+
self.timestep_emb = TimestepEmbedding(config.timestep_emb_hidden)
|
| 234 |
+
self.layers = nn.ModuleList([Block(config) for _ in range(config.num_hidden_layers)])
|
| 235 |
+
self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 236 |
+
self.lm_head = nn.Linear(config.hidden_size, config.mask_vocab_size, bias=False)
|
| 237 |
+
self.post_init()
|
| 238 |
+
|
| 239 |
+
def forward(self, input_ids, timesteps=None, attention_mask=None):
|
| 240 |
+
batch, seq = input_ids.shape
|
| 241 |
+
position_ids = torch.arange(seq, device=input_ids.device).unsqueeze(0).expand(batch, -1)
|
| 242 |
+
if timesteps is None:
|
| 243 |
+
timesteps = torch.full((batch,), 1.0, device=input_ids.device)
|
| 244 |
+
x = self.embed_tokens(input_ids)
|
| 245 |
+
t_emb = self.timestep_emb(timesteps)
|
| 246 |
+
attn_mask = None
|
| 247 |
+
if attention_mask is not None:
|
| 248 |
+
attn_mask = ((1.0 - attention_mask[:, None, None, :].float()) * -1e9).to(x.dtype)
|
| 249 |
+
for layer in self.layers:
|
| 250 |
+
x = layer(x, t_emb, attn_mask, position_ids)
|
| 251 |
+
x = self.norm(x)
|
| 252 |
+
return F.linear(x, self.lm_head.weight)
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
class MetaDiffusion600MForCausalLM(PreTrainedModel, GenerationMixin):
|
| 256 |
+
config_class = MetaDiffusion600MConfig
|
| 257 |
+
|
| 258 |
+
def __init__(self, config):
|
| 259 |
+
super().__init__(config)
|
| 260 |
+
self.model = MetaDiffusion600MModel(config)
|
| 261 |
+
self.post_init()
|
| 262 |
+
|
| 263 |
+
def forward(self, input_ids, timesteps=None, attention_mask=None, **kwargs):
|
| 264 |
+
logits = self.model(input_ids, timesteps, attention_mask)
|
| 265 |
+
return type("MDOutput", (), {"logits": logits})()
|
| 266 |
+
|
| 267 |
+
def prepare_inputs_for_generation(self, input_ids, **kwargs):
|
| 268 |
+
return {"input_ids": input_ids}
|
| 269 |
+
|
| 270 |
+
def _cumulative_unmask_frac(self, i, n):
|
| 271 |
+
return 0.5 * (1 - math.cos(math.pi * i / n))
|
| 272 |
+
|
| 273 |
+
def generate(self, input_ids, max_new_tokens=None, num_steps=None,
|
| 274 |
+
temperature=None, repetition_penalty=None, top_p=None,
|
| 275 |
+
min_p=None, im_end_bias=None, im_end_bias_t=None,
|
| 276 |
+
smart_remask=None, smart_remask_thresh=None,
|
| 277 |
+
smart_remask_iters=None, **kwargs):
|
| 278 |
+
"""LLaDA-style iterative denoising with left-to-right commit.
|
| 279 |
+
|
| 280 |
+
All sampling params fall back to generation_config.json values when
|
| 281 |
+
not passed explicitly (release defaults ship in the config):
|
| 282 |
+
top_p/min_p: truncation sampling that cuts the unreliable tail of the
|
| 283 |
+
distribution (the junk-token source); use at most one (min_p 0.05-0.1
|
| 284 |
+
recommended, Nguyen 2024; top-p 0.9 Holtzman 2020).
|
| 285 |
+
im_end_bias: pragmatic logit nudge on the stop tokens when t is low
|
| 286 |
+
(release guardrail for terminator reliability)."""
|
| 287 |
+
device = input_ids.device
|
| 288 |
+
config = self.config
|
| 289 |
+
gc = self.generation_config
|
| 290 |
+
max_new_tokens = max_new_tokens if max_new_tokens is not None else getattr(gc, "max_new_tokens", 96)
|
| 291 |
+
num_steps = num_steps if num_steps is not None else getattr(gc, "num_steps", 128)
|
| 292 |
+
temperature = temperature if temperature is not None else getattr(gc, "temperature", 0.7)
|
| 293 |
+
repetition_penalty = repetition_penalty if repetition_penalty is not None else getattr(gc, "repetition_penalty", 1.5)
|
| 294 |
+
top_p = top_p if top_p is not None else getattr(gc, "top_p", 0.0)
|
| 295 |
+
min_p = min_p if min_p is not None else getattr(gc, "min_p", 0.1)
|
| 296 |
+
im_end_bias = im_end_bias if im_end_bias is not None else getattr(gc, "im_end_bias", 0.0)
|
| 297 |
+
im_end_bias_t = im_end_bias_t if im_end_bias_t is not None else getattr(gc, "im_end_bias_t", 0.3)
|
| 298 |
+
smart_remask = smart_remask if smart_remask is not None else getattr(gc, "smart_remask", False)
|
| 299 |
+
smart_remask_thresh = smart_remask_thresh if smart_remask_thresh is not None else getattr(gc, "smart_remask_thresh", 0.5)
|
| 300 |
+
smart_remask_iters = smart_remask_iters if smart_remask_iters is not None else getattr(gc, "smart_remask_iters", 2)
|
| 301 |
+
refine_steps = getattr(gc, "refine_steps", 16)
|
| 302 |
+
mask_id = config.mask_token_id
|
| 303 |
+
eos_ids = self.generation_config.eos_token_id
|
| 304 |
+
if not isinstance(eos_ids, (list, tuple)):
|
| 305 |
+
eos_ids = [eos_ids] if eos_ids is not None else []
|
| 306 |
+
eos_ids = [int(e) for e in eos_ids if e is not None]
|
| 307 |
+
|
| 308 |
+
prompt_len = input_ids.shape[1]
|
| 309 |
+
x = torch.full((1, prompt_len + max_new_tokens), mask_id, device=device, dtype=torch.long)
|
| 310 |
+
x[0, :prompt_len] = input_ids[0]
|
| 311 |
+
# commit-confidence map for smart remasking (top-1 prob at commit time)
|
| 312 |
+
conf = (torch.ones((1, x.shape[1]), dtype=torch.float32, device=device)
|
| 313 |
+
if smart_remask else None)
|
| 314 |
+
|
| 315 |
+
self.eval()
|
| 316 |
+
with torch.no_grad():
|
| 317 |
+
for i in range(num_steps):
|
| 318 |
+
frac_now = self._cumulative_unmask_frac(i, num_steps)
|
| 319 |
+
frac_next = self._cumulative_unmask_frac(i + 1, num_steps)
|
| 320 |
+
n_masked = (x == mask_id).sum().item()
|
| 321 |
+
if i == num_steps - 1:
|
| 322 |
+
n_unmask = n_masked
|
| 323 |
+
else:
|
| 324 |
+
n_unmask = max(int((frac_next - frac_now) * max_new_tokens + 0.5), 1) if n_masked > 0 else 0
|
| 325 |
+
if n_unmask == 0:
|
| 326 |
+
break
|
| 327 |
+
t = torch.full((1,), 1.0 - frac_now, device=device)
|
| 328 |
+
logits = self.model(x, t)
|
| 329 |
+
logits = logits.logits if hasattr(logits, "logits") else logits
|
| 330 |
+
# fp32 sampling path + sanitize (chat.py parity): models
|
| 331 |
+
# trained with a mask-ratio curriculum have never seen t near
|
| 332 |
+
# 1.0, so the timestep embedding can emit NaN/inf in bf16 when
|
| 333 |
+
# generating; softmax/multinomial must never see them
|
| 334 |
+
logits = logits.float()
|
| 335 |
+
logits = torch.nan_to_num(logits, nan=0.0, posinf=50.0, neginf=-50.0)
|
| 336 |
+
logits[:, :, mask_id] = -1e9
|
| 337 |
+
rainbow_ids = getattr(config, "rainbow_token_ids", None) or \
|
| 338 |
+
list(range(mask_id + 1, mask_id + 8))
|
| 339 |
+
logits[:, :, rainbow_ids] = -1e9
|
| 340 |
+
bad_ids = getattr(config, "invalid_utf8_token_ids", None)
|
| 341 |
+
if bad_ids:
|
| 342 |
+
logits[:, :, bad_ids] = -1e9
|
| 343 |
+
if repetition_penalty != 1.0:
|
| 344 |
+
committed = x[0, prompt_len:]
|
| 345 |
+
committed = committed[committed != mask_id]
|
| 346 |
+
if committed.numel() > 0:
|
| 347 |
+
for tok in committed.unique():
|
| 348 |
+
ti = tok.item()
|
| 349 |
+
logits[0, :, ti] = torch.where(
|
| 350 |
+
logits[0, :, ti] < 0,
|
| 351 |
+
logits[0, :, ti] * repetition_penalty,
|
| 352 |
+
logits[0, :, ti] / repetition_penalty)
|
| 353 |
+
if im_end_bias != 0.0 and 1.0 - frac_now < im_end_bias_t:
|
| 354 |
+
# pragmatic terminator nudge: BEFORE softmax so it actually
|
| 355 |
+
# shapes the sampled distribution
|
| 356 |
+
for eid in eos_ids:
|
| 357 |
+
logits[0, :, eid] = logits[0, :, eid] + im_end_bias
|
| 358 |
+
mask_positions = x == mask_id
|
| 359 |
+
probs = F.softmax(logits[mask_positions] / max(temperature, 1e-8), dim=-1)
|
| 360 |
+
probs = torch.nan_to_num(probs, nan=0.0, posinf=0.0, neginf=0.0)
|
| 361 |
+
if top_p > 0.0:
|
| 362 |
+
sorted_probs, indices = probs.sort(dim=-1, descending=True)
|
| 363 |
+
drop = (sorted_probs.cumsum(dim=-1) - sorted_probs) > top_p
|
| 364 |
+
sorted_probs = sorted_probs.masked_fill(drop, 0.0)
|
| 365 |
+
sorted_probs = sorted_probs / sorted_probs.sum(dim=-1, keepdim=True).clamp(min=1e-12)
|
| 366 |
+
probs = torch.zeros_like(probs).scatter_(-1, indices, sorted_probs)
|
| 367 |
+
elif min_p > 0.0:
|
| 368 |
+
threshold = min_p * probs.max(dim=-1, keepdim=True).values
|
| 369 |
+
probs = probs.masked_fill(probs < threshold, 0.0)
|
| 370 |
+
probs = probs / probs.sum(dim=-1, keepdim=True).clamp(min=1e-12)
|
| 371 |
+
zero_rows = probs.sum(dim=-1, keepdim=True) <= 0
|
| 372 |
+
if zero_rows.any():
|
| 373 |
+
probs = probs + zero_rows.to(probs.dtype)
|
| 374 |
+
probs = probs / probs.sum(dim=-1, keepdim=True).clamp(min=1e-12)
|
| 375 |
+
p_max = probs.max(dim=-1).values
|
| 376 |
+
sampled = torch.multinomial(probs, 1).squeeze(-1)
|
| 377 |
+
mask_flat = mask_positions.nonzero(as_tuple=False)
|
| 378 |
+
if n_unmask < mask_positions.sum():
|
| 379 |
+
fill_positions = mask_flat[:n_unmask]
|
| 380 |
+
for idx, tok in zip(fill_positions, sampled[:n_unmask]):
|
| 381 |
+
x[idx[0], idx[1]] = tok
|
| 382 |
+
if conf is not None:
|
| 383 |
+
conf[fill_positions[:, 0], fill_positions[:, 1]] = p_max[:n_unmask]
|
| 384 |
+
else:
|
| 385 |
+
x[mask_positions] = sampled
|
| 386 |
+
if conf is not None:
|
| 387 |
+
conf[mask_positions] = p_max
|
| 388 |
+
if any((x[0, prompt_len:] == e).any().item() for e in eos_ids):
|
| 389 |
+
break
|
| 390 |
+
if smart_remask and conf is not None:
|
| 391 |
+
rainbow_ids = getattr(config, "rainbow_token_ids", None) or \
|
| 392 |
+
list(range(mask_id + 1, mask_id + 8))
|
| 393 |
+
bad_ids = getattr(config, "invalid_utf8_token_ids", None)
|
| 394 |
+
x = _smart_remask(self.model, x, prompt_len, max_new_tokens, conf,
|
| 395 |
+
eos_ids, mask_id, rainbow_ids, bad_ids,
|
| 396 |
+
smart_remask_thresh, smart_remask_iters,
|
| 397 |
+
refine_steps, temperature, repetition_penalty,
|
| 398 |
+
top_p, min_p, im_end_bias, im_end_bias_t,
|
| 399 |
+
self._cumulative_unmask_frac)
|
| 400 |
+
return x
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
def _smart_remask(model, x, prompt_len, gen_len, conf, eos_ids, mask_id,
|
| 404 |
+
rainbow_ids, bad_ids, thresh, max_iters, refine_steps,
|
| 405 |
+
temperature, repetition_penalty, top_p, min_p, im_end_bias,
|
| 406 |
+
im_end_bias_t, cumfrac):
|
| 407 |
+
"""Confidence-gated re-denoising (PURE-style smart remasking): re-mask
|
| 408 |
+
exactly the tokens whose top-1 commit probability fell below `thresh`
|
| 409 |
+
and re-denoise them with the head fixed (chat.py parity). Runs even when
|
| 410 |
+
a terminator committed, cleaning low-confidence junk before it. Stops
|
| 411 |
+
early once a terminator commits or nothing is below the bar."""
|
| 412 |
+
device = x.device
|
| 413 |
+
lo = prompt_len
|
| 414 |
+
hi = prompt_len + gen_len
|
| 415 |
+
for _ in range(max_iters):
|
| 416 |
+
if eos_ids:
|
| 417 |
+
term_mask = (x[0, lo:hi] == eos_ids[0])
|
| 418 |
+
for e in eos_ids[1:]:
|
| 419 |
+
term_mask = term_mask | (x[0, lo:hi] == e)
|
| 420 |
+
if term_mask.any():
|
| 421 |
+
# never touch the terminator or anything past it
|
| 422 |
+
hi = lo + term_mask.nonzero(as_tuple=True)[0][0].item()
|
| 423 |
+
if hi <= lo:
|
| 424 |
+
break
|
| 425 |
+
low = (conf[0, lo:hi] < thresh).nonzero(as_tuple=True)[0]
|
| 426 |
+
if low.numel() == 0:
|
| 427 |
+
break
|
| 428 |
+
n_remask = low.numel()
|
| 429 |
+
x[0, lo + low] = mask_id
|
| 430 |
+
conf[0, lo + low] = 1.0 # re-commits below the bar get caught again
|
| 431 |
+
for i in range(refine_steps):
|
| 432 |
+
n_masked = (x[0, lo:hi] == mask_id).sum().item()
|
| 433 |
+
if n_masked == 0:
|
| 434 |
+
break
|
| 435 |
+
if i == refine_steps - 1:
|
| 436 |
+
n_unmask = n_masked
|
| 437 |
+
else:
|
| 438 |
+
n_unmask = max(int((cumfrac(i + 1, refine_steps)
|
| 439 |
+
- cumfrac(i, refine_steps))
|
| 440 |
+
* n_remask + 0.5), 1)
|
| 441 |
+
n_unmask = min(n_unmask, n_masked)
|
| 442 |
+
t_now = 1.0 - cumfrac(i, refine_steps)
|
| 443 |
+
t_val = torch.full((1,), t_now, device=device)
|
| 444 |
+
out = model(x, t_val)
|
| 445 |
+
logits = out.logits if hasattr(out, "logits") else out
|
| 446 |
+
logits = logits.float()
|
| 447 |
+
logits = torch.nan_to_num(logits, nan=0.0, posinf=50.0, neginf=-50.0)
|
| 448 |
+
logits[:, :, mask_id] = -1e9
|
| 449 |
+
logits[:, :, rainbow_ids] = -1e9
|
| 450 |
+
if bad_ids:
|
| 451 |
+
logits[:, :, bad_ids] = -1e9
|
| 452 |
+
if im_end_bias != 0.0 and t_now < im_end_bias_t:
|
| 453 |
+
for e in eos_ids:
|
| 454 |
+
logits[0, :, e] = logits[0, :, e] + im_end_bias
|
| 455 |
+
if repetition_penalty != 1.0:
|
| 456 |
+
committed = x[0, prompt_len:]
|
| 457 |
+
committed = committed[committed != mask_id]
|
| 458 |
+
if committed.numel() > 0:
|
| 459 |
+
for tok in committed.unique():
|
| 460 |
+
ti = tok.item()
|
| 461 |
+
logits[0, :, ti] = torch.where(
|
| 462 |
+
logits[0, :, ti] < 0,
|
| 463 |
+
logits[0, :, ti] * repetition_penalty,
|
| 464 |
+
logits[0, :, ti] / repetition_penalty)
|
| 465 |
+
mask_positions = x == mask_id
|
| 466 |
+
probs = F.softmax(logits[mask_positions] / max(temperature, 1e-8), dim=-1)
|
| 467 |
+
probs = torch.nan_to_num(probs, nan=0.0, posinf=0.0, neginf=0.0)
|
| 468 |
+
if top_p > 0.0:
|
| 469 |
+
sorted_probs, indices = probs.sort(dim=-1, descending=True)
|
| 470 |
+
drop = (sorted_probs.cumsum(dim=-1) - sorted_probs) > top_p
|
| 471 |
+
sorted_probs = sorted_probs.masked_fill(drop, 0.0)
|
| 472 |
+
sorted_probs = sorted_probs / sorted_probs.sum(dim=-1, keepdim=True).clamp(min=1e-12)
|
| 473 |
+
probs = torch.zeros_like(probs).scatter_(-1, indices, sorted_probs)
|
| 474 |
+
elif min_p > 0.0:
|
| 475 |
+
threshold = min_p * probs.max(dim=-1, keepdim=True).values
|
| 476 |
+
probs = probs.masked_fill(probs < threshold, 0.0)
|
| 477 |
+
probs = probs / probs.sum(dim=-1, keepdim=True).clamp(min=1e-12)
|
| 478 |
+
zero_rows = probs.sum(dim=-1, keepdim=True) <= 0
|
| 479 |
+
if zero_rows.any():
|
| 480 |
+
probs = probs + zero_rows.to(probs.dtype)
|
| 481 |
+
probs = probs / probs.sum(dim=-1, keepdim=True).clamp(min=1e-12)
|
| 482 |
+
p_max = probs.max(dim=-1).values
|
| 483 |
+
sampled = torch.multinomial(probs, 1).squeeze(-1)
|
| 484 |
+
mask_flat = mask_positions.nonzero(as_tuple=False)
|
| 485 |
+
n_fill = min(n_unmask, mask_flat.shape[0])
|
| 486 |
+
if n_fill:
|
| 487 |
+
idxs = mask_flat[:n_fill]
|
| 488 |
+
x[idxs[:, 0], idxs[:, 1]] = sampled[:n_fill]
|
| 489 |
+
conf[idxs[:, 0], idxs[:, 1]] = p_max[:n_fill]
|
| 490 |
+
if eos_ids and any((x[0, lo:hi] == e).any().item() for e in eos_ids):
|
| 491 |
+
break
|
| 492 |
+
if eos_ids and any((x[0, lo:hi] == e).any().item() for e in eos_ids):
|
| 493 |
+
break
|
| 494 |
+
return x
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b5f28935e6ced4305d1a5c0f5eadc03cd89573bae1cd7730c9bbad72e7e7d58
|
| 3 |
+
size 1636589136
|
tokenizer/chat_template.jinja
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{{ '<|im_start|>' + message['role'] }}
|
| 2 |
+
{{ message['content'] }}<|im_end|>
|
| 3 |
+
{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 4 |
+
{% endif %}
|
tokenizer/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8495023a2b15619775c552c6d5da73a8bc65f3031ddf8d2be937385e22611791
|
| 3 |
+
size 11424114
|
tokenizer/tokenizer_config.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"chat_template": "{% for message in messages %}{{ '<|im_start|>' + message['role'] }}\n{{ message['content'] }}<|im_end|>\n{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}",
|
| 6 |
+
"clean_up_tokenization_spaces": false,
|
| 7 |
+
"eos_token": "<|im_end|>",
|
| 8 |
+
"errors": "replace",
|
| 9 |
+
"extra_special_tokens": [
|
| 10 |
+
"[MASK]",
|
| 11 |
+
"<|r1|>",
|
| 12 |
+
"<|r2|>",
|
| 13 |
+
"<|r3|>",
|
| 14 |
+
"<|r4|>",
|
| 15 |
+
"<|r5|>",
|
| 16 |
+
"<|r6|>",
|
| 17 |
+
"<|r7|>"
|
| 18 |
+
],
|
| 19 |
+
"is_local": false,
|
| 20 |
+
"local_files_only": false,
|
| 21 |
+
"model_max_length": 131072,
|
| 22 |
+
"pad_token": "<|endoftext|>",
|
| 23 |
+
"split_special_tokens": false,
|
| 24 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 25 |
+
"unk_token": null
|
| 26 |
+
}
|