yevvonlim commited on
Commit
ef5e4da
·
1 Parent(s): 03313e2

Transfer sionic-dllm-instruct → Llada-8B-Instruct-Kor

Browse files
README.md ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags:
4
+ - llada
5
+ - sft
6
+ - instruction-tuning
7
+ - korean
8
+ - english
9
+ language:
10
+ - ko
11
+ - en
12
+ base_model:
13
+ - GSAI-ML/LLaDA-8B-Instruct
14
+ ---
15
+
16
+ # Model Card for SionicAI/LLADA-SFT
17
+
18
+ <!-- Provide a quick summary of what the model is/does. -->
19
+
20
+ SionicAI/LLADA-SFT is an instruction-tuned variant of LLADA-8B designed for high-quality conversational responses in both Korean and English. Fine-tuned with supervised data, it excels at understanding and generating context-aware replies for chat applications.
21
+
22
+ ## Model Details
23
+
24
+ ### Model Description
25
+
26
+ This model is a supervised fine-tuned (SFT) version of [GSAI-ML/LLaDA-8B-Instruct], developed and shared by Sionic AI. It leverages parameter-efficient fine-tuning (PEFT) with LoRA to adapt the base LLADA-8B model to instruction-following tasks.
27
+
28
+ - **Developed by:** Sionic AI
29
+ - **Model type:** 8B-parameter encoder-only transformer
30
+ - **Language(s):** Korean, English
31
+ - **License:** Apache-2.0
32
+ - **Fine-tuned from:** GSAI-ML/LLaDA-8B-Instruct
33
+
34
+ ### Model Sources
35
+
36
+ - **Repository:** https://github.com/sionic-ai/llada-trainer
37
+ - **Paper:** N/A
38
+ - **Demo:** N/A
39
+
40
+ ## Uses
41
+
42
+ ### Direct Use
43
+
44
+ - Conversational agents and chatbots in Korean and English
45
+ - Instruction-following and question-answering tasks
46
+ - Assistive tools for writing, translation, and summarization
47
+
48
+ ### Out-of-Scope Use
49
+
50
+ - Tasks requiring specialized domain knowledge outside the training data
51
+ - Real-time high-stakes decision-making without human oversight
52
+
53
+ ## Bias, Risks, and Limitations
54
+
55
+ - May produce incorrect or outdated facts
56
+ - Vulnerable to generating biased or stereotypical language present in training data
57
+
58
+ ### Recommendations
59
+
60
+ Users should review and verify model outputs before deployment in critical applications. Implement human-in-the-loop validation for high-stakes use cases.
61
+
62
+ ## How to Get Started with the Model
63
+
64
+ Use the code below to load and generate with the model. Ensure you have defined or imported the `generate_stream` function provided in the repository.
65
+
66
+ ```python
67
+
68
+ from transformers import AutoTokenizer, AutoModel
69
+
70
+
71
+ device = "cuda"
72
+ model_path = "sionic-ai/sionic-dllm-instruct"
73
+
74
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
75
+ model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to(device).eval()
76
+
77
+ prompt = "6나누기 0은 뭐야? let's think step by step."
78
+ chat_input = tokenizer.apply_chat_template(
79
+ [{"role": "user", "content": prompt}],
80
+ add_generation_prompt=True,
81
+ tokenize=False,
82
+ )
83
+ prompt_ids = tokenizer(chat_input, return_tensors="pt").input_ids.to(device)
84
+
85
+ final_ids = model.generate(prompt_ids)[0, prompt_ids.shape[1]:]
86
+ print(tokenizer.decode(final_ids, skip_special_tokens=True))
87
+ ```
88
+
89
+ ## Contact
90
+
91
+ For issues or questions, please open an issue on the repo or contact ye@sionic.ai.
config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_type": "silu",
3
+ "alibi": false,
4
+ "alibi_bias_max": 8.0,
5
+ "architectures": [
6
+ "LLaDAModelLM"
7
+ ],
8
+ "attention_dropout": 0.0,
9
+ "attention_layer_norm": false,
10
+ "attention_layer_norm_with_affine": true,
11
+ "auto_map": {
12
+ "AutoConfig": "sionic-ai/sionic-dllm-instruct--configuration_llada.LLaDAConfig",
13
+ "AutoModel": "sionic-ai/sionic-dllm-instruct--modeling_llada.LLaDAModelLM",
14
+ "AutoModelForCausalLM": "sionic-ai/sionic-dllm-instruct--modeling_llada.LLaDAModelLM"
15
+ },
16
+ "bias_for_layer_norm": false,
17
+ "block_group_size": 1,
18
+ "block_type": "llama",
19
+ "d_model": 4096,
20
+ "embedding_dropout": 0.0,
21
+ "embedding_size": 126464,
22
+ "eos_token_id": 126081,
23
+ "flash_attention": false,
24
+ "include_bias": false,
25
+ "include_qkv_bias": false,
26
+ "init_cutoff_factor": null,
27
+ "init_device": "meta",
28
+ "init_fn": "mitchell",
29
+ "init_std": 0.02,
30
+ "input_emb_norm": false,
31
+ "layer_norm_type": "rms",
32
+ "layer_norm_with_affine": true,
33
+ "mask_token_id": 126336,
34
+ "max_sequence_length": 4096,
35
+ "mlp_hidden_size": 12288,
36
+ "mlp_ratio": 4,
37
+ "model_type": "llada",
38
+ "multi_query_attention": null,
39
+ "n_heads": 32,
40
+ "n_kv_heads": 32,
41
+ "n_layers": 32,
42
+ "pad_token_id": 126081,
43
+ "precision": "amp_bf16",
44
+ "residual_dropout": 0.0,
45
+ "rms_norm_eps": 1e-05,
46
+ "rope": true,
47
+ "rope_full_precision": true,
48
+ "rope_theta": 500000.0,
49
+ "scale_logits": false,
50
+ "torch_dtype": "float32",
51
+ "transformers_version": "4.51.3",
52
+ "use_cache": false,
53
+ "vocab_size": 126464,
54
+ "weight_tying": false
55
+ }
configuration_llada.py ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ LLaDA configuration
3
+ """
4
+ from transformers import AutoConfig, PretrainedConfig
5
+
6
+ from enum import Enum
7
+ from os import PathLike
8
+ from typing import Union
9
+ from dataclasses import asdict, dataclass, field
10
+ from glob import glob
11
+ from pathlib import Path
12
+ from typing import (
13
+ Any,
14
+ Dict,
15
+ Iterable,
16
+ List,
17
+ Optional,
18
+ Tuple,
19
+ Type,
20
+ TypeVar,
21
+ Union,
22
+ cast,
23
+ )
24
+
25
+
26
+ __all__ = [
27
+ "ActivationType",
28
+ "ActivationCheckpointingStrategy",
29
+ "BlockType",
30
+ "LayerNormType",
31
+ "InitFnType",
32
+ "ModelConfig",
33
+ ]
34
+
35
+ PathOrStr = Union[str, PathLike]
36
+
37
+
38
+ class StrEnum(str, Enum):
39
+ """
40
+ This is equivalent to Python's :class:`enum.StrEnum` since version 3.11.
41
+ We include this here for compatibility with older version of Python.
42
+ """
43
+
44
+ def __str__(self) -> str:
45
+ return self.value
46
+
47
+ def __repr__(self) -> str:
48
+ return f"'{str(self)}'"
49
+
50
+
51
+ class LayerNormType(StrEnum):
52
+ default = "default"
53
+ """
54
+ The default LayerNorm implementation, equivalent to PyTorch's built-in version.
55
+ """
56
+
57
+ low_precision = "low_precision"
58
+ """
59
+ A low-precision version of the default LayerNorm.
60
+ """
61
+
62
+ rms = "rms"
63
+ """
64
+ An RMSNorm implementation. When using ``torch.compile`` this is
65
+ probably the fastest implementation.
66
+ """
67
+
68
+ gemma_rms = "gemma_rms"
69
+ """
70
+ An RMSNorm implementation by gemmma. When using ``torch.compile`` this is
71
+ probably the fastest implementation.
72
+ """
73
+
74
+ amd_compatible = "amd_compatible"
75
+ """
76
+ LayerNorm implemented manually to work around an issue with ROCm.
77
+ """
78
+
79
+
80
+ class ActivationType(StrEnum):
81
+ gelu = "gelu"
82
+ relu = "relu"
83
+ silu = "silu"
84
+ swiglu = "swiglu"
85
+
86
+
87
+ class BlockType(StrEnum):
88
+ sequential = "sequential"
89
+ parallel = "parallel"
90
+
91
+ llama = "llama"
92
+ """
93
+ A block similar to the sequential block with slightly different
94
+ implementations of operations like attention to imitate the behavior of Llama.
95
+ """
96
+
97
+
98
+ class InitFnType(StrEnum):
99
+ mitchell = "mitchell"
100
+ """
101
+ The strategy suggested to us by Mitchell Wortsman from UW.
102
+ This uses a truncated normal distribution with an adaptive standard deviation that depends
103
+ on the size of the weights as well as the depth of the layer.
104
+ """
105
+
106
+ normal = "normal"
107
+ """
108
+ All weights are initialized from the same normal distribution.
109
+ """
110
+
111
+ kaiming_normal = "kaiming_normal"
112
+ """
113
+ All weights are initialized with the Kaiming method from a normal distribution.
114
+ Note this currently won't work with FSDP.
115
+ """
116
+
117
+ fan_in = "fan_in"
118
+ """
119
+ "Fan-in variance scaling", i.e. normal with a standard deviation of ``1/sqrt(d_in)`` where ``d_in``
120
+ is the input dimensionality of the kernel.
121
+ """
122
+
123
+ full_megatron = "full_megatron"
124
+ """
125
+ This is what metaseq calls "full megatron init". It is the init used for Llama 2.
126
+ """
127
+
128
+
129
+ @dataclass
130
+ class ModelConfig():
131
+ """
132
+ LLaDA (model) configuration.
133
+ """
134
+
135
+ # Note that the defaults for these attributes are equivalent to the base GPT2 model.
136
+
137
+ d_model: int = 768
138
+ """
139
+ The hidden size of the model.
140
+ """
141
+
142
+ n_heads: int = 12
143
+ """
144
+ The number of self-attention heads.
145
+ """
146
+
147
+ n_kv_heads: Optional[int] = None
148
+ """
149
+ The number of heads to use for keys and values. Defaults to `n_heads`.
150
+ Set this to ``None`` or ``n_heads`` for normal multi-head attention.
151
+ Set this to 1 for multi-query attention.
152
+ Set it to some in-between value for Llama2-style grouped query attention.
153
+ """
154
+
155
+ n_layers: int = 12
156
+ """
157
+ The number of layers/blocks.
158
+ """
159
+
160
+ mlp_ratio: int = 4
161
+ """
162
+ The ratio of the inner MLP dimensionality to ``d_model``.
163
+ This is only used when ``mlp_hidden_size`` is not set.
164
+ """
165
+
166
+ mlp_hidden_size: Optional[int] = None
167
+ """
168
+ Set the exact hidden size for the MLP. Otherwise the inner MLP hidden size will be set to `mlp_ratio * d_model`.
169
+ """
170
+
171
+ activation_type: ActivationType = ActivationType.swiglu
172
+ """
173
+ The activation function to use within the MLP layers.
174
+ """
175
+
176
+ block_type: BlockType = BlockType.sequential
177
+ """
178
+ The transformer block implementation.
179
+ """
180
+
181
+ block_group_size: int = 1
182
+ """
183
+ The number of blocks to group together into a single parent block.
184
+ This has no affect on the number of parameters in the model and is only used to wrap groups
185
+ of blocks together with a single FSDP wrapper during training.
186
+ """
187
+
188
+ alibi: bool = False
189
+ """
190
+ If ``True``, use ALiBi embeddings. Mutually exclusive with ``rope``.
191
+ """
192
+
193
+ alibi_bias_max: float = 8.0
194
+ """
195
+ Maximum absolute value of ALiBi bias.
196
+ """
197
+
198
+ rope: bool = False
199
+ """
200
+ Use rotary positional embeddings (RoPE). Mutually exclusive with ``alibi``.
201
+ """
202
+
203
+ rope_full_precision: bool = True
204
+ """
205
+ If ``True``, apply RoPE embeddings at full precision regardless of the input type. Otherwise,
206
+ apply RoPE at the precision of the input.
207
+ """
208
+
209
+ flash_attention: bool = False
210
+ """
211
+ If ``True``, use ``FlashAttention``.
212
+ """
213
+
214
+ attention_dropout: float = 0.1
215
+ """
216
+ The dropout probability within the attention modules.
217
+ """
218
+
219
+ multi_query_attention: Optional[bool] = None
220
+ """
221
+ Use the Multi-Query formulation of attention used in PaLM. This reduces the number of parameters
222
+ and is more efficient during inference.
223
+ """
224
+
225
+ attention_layer_norm: bool = False
226
+ """
227
+ Apply layer norm to the keys and queries within the attention mechanism.
228
+ This can help stabilize training.
229
+ """
230
+
231
+ residual_dropout: float = 0.1
232
+ """
233
+ The dropout probability for the MLP and attention output within each block.
234
+ """
235
+
236
+ embedding_dropout: float = 0.1
237
+ """
238
+ The dropout probability for embeddings.
239
+ """
240
+
241
+ input_emb_norm: bool = False
242
+ """
243
+ An input hidden_states norm implementation by gemmma.
244
+ """
245
+
246
+ layer_norm_type: LayerNormType = LayerNormType.default
247
+ """
248
+ The layernorm implementation to use.
249
+ """
250
+
251
+ layer_norm_with_affine: bool = True
252
+ """
253
+ Whether to include bias and weight parameters for the layer norms.
254
+ This only affects layer norms that are immediately followed by a linear layer in the forward pass,
255
+ so everything except QK-norms. To turn off affines for QK norms as well, set :attr:`attention_layer_norm_with_affine`
256
+ to ``False``.
257
+ """
258
+
259
+ rms_norm_eps: float = 1e-05
260
+ """
261
+ The rms layernorm eps param.
262
+ """
263
+
264
+ attention_layer_norm_with_affine: bool = True
265
+ """
266
+ Toggle affine transform for the QK norms.
267
+ """
268
+
269
+ max_sequence_length: int = 1024
270
+ """
271
+ The maximum input sequence length supported by the model.
272
+ """
273
+
274
+ rope_theta: float = 10000.0
275
+ """
276
+ The rope base param.
277
+ """
278
+
279
+ include_qkv_bias: Optional[bool] = False
280
+ """
281
+ Whether or not to include bias parameters in qkv linear layers.
282
+ """
283
+
284
+ include_bias: bool = False
285
+ """
286
+ Whether or not to include bias parameters in linear layers.
287
+ In PaLM, they got rid of all bias terms because they found that large
288
+ models tend to have near 0 bias terms anyway.
289
+ """
290
+
291
+ bias_for_layer_norm: Optional[bool] = None
292
+ """
293
+ Whether or not to include bias parameters in layer norm.
294
+ This is separate from the include_bias parameter, because of a ROCm crash when biases are disabled in
295
+ layer norm.
296
+ When this is None (the default), it inherits the setting from include_bias.
297
+ """
298
+
299
+ scale_logits: bool = False
300
+ """
301
+ If ``True``, scale the output logits by ``1 / sqrt(d_model)``.
302
+ """
303
+
304
+ vocab_size: int = 50257
305
+ """
306
+ Vocabulary size of the model.
307
+ """
308
+
309
+ embedding_size: Optional[int] = 50304
310
+ """
311
+ The number of embeddings, i.e. the number of tokens. If set to ``None`` it will default
312
+ to ``vocab_size``. If ``vocab_size`` is not a multiple of 128, setting this to the
313
+ next multiple of 128 that's greater than ``vocab_size`` can improve throughput
314
+ substantially.
315
+ """
316
+
317
+ weight_tying: bool = True
318
+ """
319
+ Whether to tie output linear weights to the input embedding.
320
+ """
321
+
322
+ eos_token_id: int = 50256
323
+ """
324
+ The ID of the end-of-sentence special token.
325
+ """
326
+
327
+ pad_token_id: int = 50256
328
+ """
329
+ The ID of the token to use for padding. Defaults to the ID of the EOS token.
330
+ """
331
+
332
+ mask_token_id: Optional[int] = 50256
333
+ """
334
+ The ID of the token to use for mask token. Defaults to the ID of the EOS token.
335
+ """
336
+
337
+ init_device: Optional[str] = None
338
+ """
339
+ The torch device to use when initializing the model parameters, e.g. "cpu", "cuda:0", "meta".
340
+ """
341
+
342
+ init_fn: InitFnType = InitFnType.normal
343
+ """
344
+ The weight initialization strategy.
345
+ """
346
+
347
+ init_std: float = 0.02
348
+ """
349
+ The standard deviation to use when initializing weights with a "fixed distribution" ``init_fn``, such
350
+ as "normal".
351
+ """
352
+
353
+ init_cutoff_factor: Optional[float] = None
354
+ """
355
+ A positive factor used to scale the cutoff values when initializing weights with a "fixed distribution" ``init_fn``, such
356
+ as "normal". Setting this to None means values are not cutoff.
357
+ """
358
+
359
+ precision: Optional[str] = None
360
+ """
361
+ Precision used to train/evaluate with. You shouldn't set this directly.
362
+ See :data:`TrainConfig.precision` instead.
363
+ """
364
+
365
+ @property
366
+ def effective_n_kv_heads(self) -> int:
367
+ if self.n_kv_heads is None:
368
+ if self.multi_query_attention is True:
369
+ return 1
370
+ else:
371
+ return self.n_heads
372
+ else:
373
+ if self.multi_query_attention is None:
374
+ return self.n_kv_heads
375
+ if self.multi_query_attention:
376
+ n_kv_heads_should_be = 1
377
+ else:
378
+ n_kv_heads_should_be = self.n_heads
379
+ if self.n_kv_heads == n_kv_heads_should_be:
380
+ return n_kv_heads_should_be
381
+ else:
382
+ raise Exception(
383
+ "You can't set `multi_query_attention` and `n_kv_heads` at the same time."
384
+ )
385
+
386
+ class ActivationCheckpointingStrategy(StrEnum):
387
+ whole_layer = "whole_layer"
388
+ """
389
+ Checkpoint every transformer layer.
390
+ """
391
+
392
+ one_in_two = "one_in_two"
393
+ """
394
+ Checkpoint one in two transformer layers.
395
+ """
396
+
397
+ one_in_three = "one_in_three"
398
+ """
399
+ Checkpoint one in three transformer layers.
400
+ """
401
+
402
+ one_in_four = "one_in_four"
403
+ """
404
+ Checkpoint one in four transformer layers.
405
+ """
406
+
407
+ two_in_three = "two_in_three"
408
+ """
409
+ Checkpoint two out of every three transformer layers.
410
+ """
411
+
412
+ three_in_four = "three_in_four"
413
+ """
414
+ Checkpoint three out of four of every transformer layers.
415
+ """
416
+
417
+ four_in_five = "four_in_five"
418
+ """
419
+ Checkpoint four out of five of every transformer layers.
420
+ """
421
+
422
+ nine_in_ten = "nine_in_ten"
423
+ """
424
+ Checkpoint nine out of ten of every transformer layers.
425
+ """
426
+
427
+ fine_grained = "fine_grained"
428
+ """
429
+ Focus checkpointing on where it is cheap to recompute and saves most memory.
430
+ """
431
+
432
+
433
+ class LLaDAConfig(PretrainedConfig):
434
+ model_type = "llada"
435
+ keys_to_ignore_at_inference = ["past_key_values"] # TODO: confirm
436
+
437
+ def __init__(self, use_cache: bool = False, **kwargs):
438
+ model_config = ModelConfig()
439
+ all_kwargs = model_config.__dict__
440
+ all_kwargs.update(kwargs)
441
+ all_kwargs.update({"use_cache": use_cache})
442
+ all_kwargs.update(
443
+ {
444
+ "architectures": all_kwargs.get("architectures", ["LLaDAModelLM"])
445
+ }
446
+ )
447
+ super().__init__(**all_kwargs)
448
+
449
+ @property
450
+ def num_attention_heads(self):
451
+ return self.n_heads
452
+
453
+ @property
454
+ def num_hidden_layers(self):
455
+ return self.n_layers
456
+
457
+ @property
458
+ def hidden_size(self):
459
+ return self.d_model
460
+
461
+
462
+ # Register the config class so that it is available for transformer pipelines, auto-loading etc.
463
+ AutoConfig.register("llada", LLaDAConfig)
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": 126081,
4
+ "pad_token_id": 126081,
5
+ "transformers_version": "4.51.3",
6
+ "use_cache": false
7
+ }
model-00001-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df7ac99fd5a9bd95835740b159590ea0308125a80e455b699777a5d17cb450a9
3
+ size 4957818648
model-00002-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4be81fc8d32d36aac0f15e5f6d9c91d89654c0ccc7dafb799bed2e0d5aebb861
3
+ size 4966225704
model-00003-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea33ef35111e7ff390aae4fc0b0d6cfd1098bc648c27037a5a219362079a4811
3
+ size 4832040992
model-00004-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74e9aa8181f798dabb7340215ded7e2c9e5e326e888e9968f0e78978761781c8
3
+ size 4832007792
model-00005-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5563bb05009d536ce554a8671db4d598ecfacc090b3d9edffdf9c4682b52490
3
+ size 4966258728
model-00006-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0a714e53f4bc508bc47a9cbbf42d0f4d2df0a2b128dfa78de6392bae94e5867
3
+ size 4966258752
model-00007-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5e8c94bdac12c5f177d8e4b290168b56c162a87f9e4ba6602e71068d4c1d1dd
3
+ size 2541748728
model.safetensors.index.json ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 32062324736
4
+ },
5
+ "weight_map": {
6
+ "model.transformer.blocks.0.attn_norm.weight": "model-00001-of-00007.safetensors",
7
+ "model.transformer.blocks.0.attn_out.weight": "model-00001-of-00007.safetensors",
8
+ "model.transformer.blocks.0.ff_norm.weight": "model-00001-of-00007.safetensors",
9
+ "model.transformer.blocks.0.ff_out.weight": "model-00001-of-00007.safetensors",
10
+ "model.transformer.blocks.0.ff_proj.weight": "model-00001-of-00007.safetensors",
11
+ "model.transformer.blocks.0.k_proj.weight": "model-00001-of-00007.safetensors",
12
+ "model.transformer.blocks.0.q_proj.weight": "model-00001-of-00007.safetensors",
13
+ "model.transformer.blocks.0.up_proj.weight": "model-00001-of-00007.safetensors",
14
+ "model.transformer.blocks.0.v_proj.weight": "model-00001-of-00007.safetensors",
15
+ "model.transformer.blocks.1.attn_norm.weight": "model-00001-of-00007.safetensors",
16
+ "model.transformer.blocks.1.attn_out.weight": "model-00001-of-00007.safetensors",
17
+ "model.transformer.blocks.1.ff_norm.weight": "model-00001-of-00007.safetensors",
18
+ "model.transformer.blocks.1.ff_out.weight": "model-00001-of-00007.safetensors",
19
+ "model.transformer.blocks.1.ff_proj.weight": "model-00001-of-00007.safetensors",
20
+ "model.transformer.blocks.1.k_proj.weight": "model-00001-of-00007.safetensors",
21
+ "model.transformer.blocks.1.q_proj.weight": "model-00001-of-00007.safetensors",
22
+ "model.transformer.blocks.1.up_proj.weight": "model-00001-of-00007.safetensors",
23
+ "model.transformer.blocks.1.v_proj.weight": "model-00001-of-00007.safetensors",
24
+ "model.transformer.blocks.10.attn_norm.weight": "model-00003-of-00007.safetensors",
25
+ "model.transformer.blocks.10.attn_out.weight": "model-00003-of-00007.safetensors",
26
+ "model.transformer.blocks.10.ff_norm.weight": "model-00003-of-00007.safetensors",
27
+ "model.transformer.blocks.10.ff_out.weight": "model-00003-of-00007.safetensors",
28
+ "model.transformer.blocks.10.ff_proj.weight": "model-00003-of-00007.safetensors",
29
+ "model.transformer.blocks.10.k_proj.weight": "model-00003-of-00007.safetensors",
30
+ "model.transformer.blocks.10.q_proj.weight": "model-00003-of-00007.safetensors",
31
+ "model.transformer.blocks.10.up_proj.weight": "model-00003-of-00007.safetensors",
32
+ "model.transformer.blocks.10.v_proj.weight": "model-00003-of-00007.safetensors",
33
+ "model.transformer.blocks.11.attn_norm.weight": "model-00003-of-00007.safetensors",
34
+ "model.transformer.blocks.11.attn_out.weight": "model-00003-of-00007.safetensors",
35
+ "model.transformer.blocks.11.ff_norm.weight": "model-00003-of-00007.safetensors",
36
+ "model.transformer.blocks.11.ff_out.weight": "model-00003-of-00007.safetensors",
37
+ "model.transformer.blocks.11.ff_proj.weight": "model-00003-of-00007.safetensors",
38
+ "model.transformer.blocks.11.k_proj.weight": "model-00003-of-00007.safetensors",
39
+ "model.transformer.blocks.11.q_proj.weight": "model-00003-of-00007.safetensors",
40
+ "model.transformer.blocks.11.up_proj.weight": "model-00003-of-00007.safetensors",
41
+ "model.transformer.blocks.11.v_proj.weight": "model-00003-of-00007.safetensors",
42
+ "model.transformer.blocks.12.attn_norm.weight": "model-00003-of-00007.safetensors",
43
+ "model.transformer.blocks.12.attn_out.weight": "model-00003-of-00007.safetensors",
44
+ "model.transformer.blocks.12.ff_norm.weight": "model-00003-of-00007.safetensors",
45
+ "model.transformer.blocks.12.ff_out.weight": "model-00003-of-00007.safetensors",
46
+ "model.transformer.blocks.12.ff_proj.weight": "model-00003-of-00007.safetensors",
47
+ "model.transformer.blocks.12.k_proj.weight": "model-00003-of-00007.safetensors",
48
+ "model.transformer.blocks.12.q_proj.weight": "model-00003-of-00007.safetensors",
49
+ "model.transformer.blocks.12.up_proj.weight": "model-00003-of-00007.safetensors",
50
+ "model.transformer.blocks.12.v_proj.weight": "model-00003-of-00007.safetensors",
51
+ "model.transformer.blocks.13.attn_norm.weight": "model-00003-of-00007.safetensors",
52
+ "model.transformer.blocks.13.attn_out.weight": "model-00003-of-00007.safetensors",
53
+ "model.transformer.blocks.13.ff_norm.weight": "model-00003-of-00007.safetensors",
54
+ "model.transformer.blocks.13.ff_out.weight": "model-00003-of-00007.safetensors",
55
+ "model.transformer.blocks.13.ff_proj.weight": "model-00003-of-00007.safetensors",
56
+ "model.transformer.blocks.13.k_proj.weight": "model-00003-of-00007.safetensors",
57
+ "model.transformer.blocks.13.q_proj.weight": "model-00003-of-00007.safetensors",
58
+ "model.transformer.blocks.13.up_proj.weight": "model-00003-of-00007.safetensors",
59
+ "model.transformer.blocks.13.v_proj.weight": "model-00003-of-00007.safetensors",
60
+ "model.transformer.blocks.14.attn_norm.weight": "model-00003-of-00007.safetensors",
61
+ "model.transformer.blocks.14.attn_out.weight": "model-00003-of-00007.safetensors",
62
+ "model.transformer.blocks.14.ff_norm.weight": "model-00003-of-00007.safetensors",
63
+ "model.transformer.blocks.14.ff_out.weight": "model-00003-of-00007.safetensors",
64
+ "model.transformer.blocks.14.ff_proj.weight": "model-00004-of-00007.safetensors",
65
+ "model.transformer.blocks.14.k_proj.weight": "model-00003-of-00007.safetensors",
66
+ "model.transformer.blocks.14.q_proj.weight": "model-00003-of-00007.safetensors",
67
+ "model.transformer.blocks.14.up_proj.weight": "model-00004-of-00007.safetensors",
68
+ "model.transformer.blocks.14.v_proj.weight": "model-00003-of-00007.safetensors",
69
+ "model.transformer.blocks.15.attn_norm.weight": "model-00004-of-00007.safetensors",
70
+ "model.transformer.blocks.15.attn_out.weight": "model-00004-of-00007.safetensors",
71
+ "model.transformer.blocks.15.ff_norm.weight": "model-00004-of-00007.safetensors",
72
+ "model.transformer.blocks.15.ff_out.weight": "model-00004-of-00007.safetensors",
73
+ "model.transformer.blocks.15.ff_proj.weight": "model-00004-of-00007.safetensors",
74
+ "model.transformer.blocks.15.k_proj.weight": "model-00004-of-00007.safetensors",
75
+ "model.transformer.blocks.15.q_proj.weight": "model-00004-of-00007.safetensors",
76
+ "model.transformer.blocks.15.up_proj.weight": "model-00004-of-00007.safetensors",
77
+ "model.transformer.blocks.15.v_proj.weight": "model-00004-of-00007.safetensors",
78
+ "model.transformer.blocks.16.attn_norm.weight": "model-00004-of-00007.safetensors",
79
+ "model.transformer.blocks.16.attn_out.weight": "model-00004-of-00007.safetensors",
80
+ "model.transformer.blocks.16.ff_norm.weight": "model-00004-of-00007.safetensors",
81
+ "model.transformer.blocks.16.ff_out.weight": "model-00004-of-00007.safetensors",
82
+ "model.transformer.blocks.16.ff_proj.weight": "model-00004-of-00007.safetensors",
83
+ "model.transformer.blocks.16.k_proj.weight": "model-00004-of-00007.safetensors",
84
+ "model.transformer.blocks.16.q_proj.weight": "model-00004-of-00007.safetensors",
85
+ "model.transformer.blocks.16.up_proj.weight": "model-00004-of-00007.safetensors",
86
+ "model.transformer.blocks.16.v_proj.weight": "model-00004-of-00007.safetensors",
87
+ "model.transformer.blocks.17.attn_norm.weight": "model-00004-of-00007.safetensors",
88
+ "model.transformer.blocks.17.attn_out.weight": "model-00004-of-00007.safetensors",
89
+ "model.transformer.blocks.17.ff_norm.weight": "model-00004-of-00007.safetensors",
90
+ "model.transformer.blocks.17.ff_out.weight": "model-00004-of-00007.safetensors",
91
+ "model.transformer.blocks.17.ff_proj.weight": "model-00004-of-00007.safetensors",
92
+ "model.transformer.blocks.17.k_proj.weight": "model-00004-of-00007.safetensors",
93
+ "model.transformer.blocks.17.q_proj.weight": "model-00004-of-00007.safetensors",
94
+ "model.transformer.blocks.17.up_proj.weight": "model-00004-of-00007.safetensors",
95
+ "model.transformer.blocks.17.v_proj.weight": "model-00004-of-00007.safetensors",
96
+ "model.transformer.blocks.18.attn_norm.weight": "model-00004-of-00007.safetensors",
97
+ "model.transformer.blocks.18.attn_out.weight": "model-00004-of-00007.safetensors",
98
+ "model.transformer.blocks.18.ff_norm.weight": "model-00004-of-00007.safetensors",
99
+ "model.transformer.blocks.18.ff_out.weight": "model-00004-of-00007.safetensors",
100
+ "model.transformer.blocks.18.ff_proj.weight": "model-00004-of-00007.safetensors",
101
+ "model.transformer.blocks.18.k_proj.weight": "model-00004-of-00007.safetensors",
102
+ "model.transformer.blocks.18.q_proj.weight": "model-00004-of-00007.safetensors",
103
+ "model.transformer.blocks.18.up_proj.weight": "model-00004-of-00007.safetensors",
104
+ "model.transformer.blocks.18.v_proj.weight": "model-00004-of-00007.safetensors",
105
+ "model.transformer.blocks.19.attn_norm.weight": "model-00004-of-00007.safetensors",
106
+ "model.transformer.blocks.19.attn_out.weight": "model-00004-of-00007.safetensors",
107
+ "model.transformer.blocks.19.ff_norm.weight": "model-00004-of-00007.safetensors",
108
+ "model.transformer.blocks.19.ff_out.weight": "model-00004-of-00007.safetensors",
109
+ "model.transformer.blocks.19.ff_proj.weight": "model-00004-of-00007.safetensors",
110
+ "model.transformer.blocks.19.k_proj.weight": "model-00004-of-00007.safetensors",
111
+ "model.transformer.blocks.19.q_proj.weight": "model-00004-of-00007.safetensors",
112
+ "model.transformer.blocks.19.up_proj.weight": "model-00004-of-00007.safetensors",
113
+ "model.transformer.blocks.19.v_proj.weight": "model-00004-of-00007.safetensors",
114
+ "model.transformer.blocks.2.attn_norm.weight": "model-00001-of-00007.safetensors",
115
+ "model.transformer.blocks.2.attn_out.weight": "model-00001-of-00007.safetensors",
116
+ "model.transformer.blocks.2.ff_norm.weight": "model-00001-of-00007.safetensors",
117
+ "model.transformer.blocks.2.ff_out.weight": "model-00001-of-00007.safetensors",
118
+ "model.transformer.blocks.2.ff_proj.weight": "model-00001-of-00007.safetensors",
119
+ "model.transformer.blocks.2.k_proj.weight": "model-00001-of-00007.safetensors",
120
+ "model.transformer.blocks.2.q_proj.weight": "model-00001-of-00007.safetensors",
121
+ "model.transformer.blocks.2.up_proj.weight": "model-00001-of-00007.safetensors",
122
+ "model.transformer.blocks.2.v_proj.weight": "model-00001-of-00007.safetensors",
123
+ "model.transformer.blocks.20.attn_norm.weight": "model-00005-of-00007.safetensors",
124
+ "model.transformer.blocks.20.attn_out.weight": "model-00004-of-00007.safetensors",
125
+ "model.transformer.blocks.20.ff_norm.weight": "model-00005-of-00007.safetensors",
126
+ "model.transformer.blocks.20.ff_out.weight": "model-00005-of-00007.safetensors",
127
+ "model.transformer.blocks.20.ff_proj.weight": "model-00005-of-00007.safetensors",
128
+ "model.transformer.blocks.20.k_proj.weight": "model-00005-of-00007.safetensors",
129
+ "model.transformer.blocks.20.q_proj.weight": "model-00005-of-00007.safetensors",
130
+ "model.transformer.blocks.20.up_proj.weight": "model-00005-of-00007.safetensors",
131
+ "model.transformer.blocks.20.v_proj.weight": "model-00005-of-00007.safetensors",
132
+ "model.transformer.blocks.21.attn_norm.weight": "model-00005-of-00007.safetensors",
133
+ "model.transformer.blocks.21.attn_out.weight": "model-00005-of-00007.safetensors",
134
+ "model.transformer.blocks.21.ff_norm.weight": "model-00005-of-00007.safetensors",
135
+ "model.transformer.blocks.21.ff_out.weight": "model-00005-of-00007.safetensors",
136
+ "model.transformer.blocks.21.ff_proj.weight": "model-00005-of-00007.safetensors",
137
+ "model.transformer.blocks.21.k_proj.weight": "model-00005-of-00007.safetensors",
138
+ "model.transformer.blocks.21.q_proj.weight": "model-00005-of-00007.safetensors",
139
+ "model.transformer.blocks.21.up_proj.weight": "model-00005-of-00007.safetensors",
140
+ "model.transformer.blocks.21.v_proj.weight": "model-00005-of-00007.safetensors",
141
+ "model.transformer.blocks.22.attn_norm.weight": "model-00005-of-00007.safetensors",
142
+ "model.transformer.blocks.22.attn_out.weight": "model-00005-of-00007.safetensors",
143
+ "model.transformer.blocks.22.ff_norm.weight": "model-00005-of-00007.safetensors",
144
+ "model.transformer.blocks.22.ff_out.weight": "model-00005-of-00007.safetensors",
145
+ "model.transformer.blocks.22.ff_proj.weight": "model-00005-of-00007.safetensors",
146
+ "model.transformer.blocks.22.k_proj.weight": "model-00005-of-00007.safetensors",
147
+ "model.transformer.blocks.22.q_proj.weight": "model-00005-of-00007.safetensors",
148
+ "model.transformer.blocks.22.up_proj.weight": "model-00005-of-00007.safetensors",
149
+ "model.transformer.blocks.22.v_proj.weight": "model-00005-of-00007.safetensors",
150
+ "model.transformer.blocks.23.attn_norm.weight": "model-00005-of-00007.safetensors",
151
+ "model.transformer.blocks.23.attn_out.weight": "model-00005-of-00007.safetensors",
152
+ "model.transformer.blocks.23.ff_norm.weight": "model-00005-of-00007.safetensors",
153
+ "model.transformer.blocks.23.ff_out.weight": "model-00005-of-00007.safetensors",
154
+ "model.transformer.blocks.23.ff_proj.weight": "model-00005-of-00007.safetensors",
155
+ "model.transformer.blocks.23.k_proj.weight": "model-00005-of-00007.safetensors",
156
+ "model.transformer.blocks.23.q_proj.weight": "model-00005-of-00007.safetensors",
157
+ "model.transformer.blocks.23.up_proj.weight": "model-00005-of-00007.safetensors",
158
+ "model.transformer.blocks.23.v_proj.weight": "model-00005-of-00007.safetensors",
159
+ "model.transformer.blocks.24.attn_norm.weight": "model-00005-of-00007.safetensors",
160
+ "model.transformer.blocks.24.attn_out.weight": "model-00005-of-00007.safetensors",
161
+ "model.transformer.blocks.24.ff_norm.weight": "model-00005-of-00007.safetensors",
162
+ "model.transformer.blocks.24.ff_out.weight": "model-00005-of-00007.safetensors",
163
+ "model.transformer.blocks.24.ff_proj.weight": "model-00005-of-00007.safetensors",
164
+ "model.transformer.blocks.24.k_proj.weight": "model-00005-of-00007.safetensors",
165
+ "model.transformer.blocks.24.q_proj.weight": "model-00005-of-00007.safetensors",
166
+ "model.transformer.blocks.24.up_proj.weight": "model-00005-of-00007.safetensors",
167
+ "model.transformer.blocks.24.v_proj.weight": "model-00005-of-00007.safetensors",
168
+ "model.transformer.blocks.25.attn_norm.weight": "model-00005-of-00007.safetensors",
169
+ "model.transformer.blocks.25.attn_out.weight": "model-00005-of-00007.safetensors",
170
+ "model.transformer.blocks.25.ff_norm.weight": "model-00005-of-00007.safetensors",
171
+ "model.transformer.blocks.25.ff_out.weight": "model-00005-of-00007.safetensors",
172
+ "model.transformer.blocks.25.ff_proj.weight": "model-00005-of-00007.safetensors",
173
+ "model.transformer.blocks.25.k_proj.weight": "model-00005-of-00007.safetensors",
174
+ "model.transformer.blocks.25.q_proj.weight": "model-00005-of-00007.safetensors",
175
+ "model.transformer.blocks.25.up_proj.weight": "model-00006-of-00007.safetensors",
176
+ "model.transformer.blocks.25.v_proj.weight": "model-00005-of-00007.safetensors",
177
+ "model.transformer.blocks.26.attn_norm.weight": "model-00006-of-00007.safetensors",
178
+ "model.transformer.blocks.26.attn_out.weight": "model-00006-of-00007.safetensors",
179
+ "model.transformer.blocks.26.ff_norm.weight": "model-00006-of-00007.safetensors",
180
+ "model.transformer.blocks.26.ff_out.weight": "model-00006-of-00007.safetensors",
181
+ "model.transformer.blocks.26.ff_proj.weight": "model-00006-of-00007.safetensors",
182
+ "model.transformer.blocks.26.k_proj.weight": "model-00006-of-00007.safetensors",
183
+ "model.transformer.blocks.26.q_proj.weight": "model-00006-of-00007.safetensors",
184
+ "model.transformer.blocks.26.up_proj.weight": "model-00006-of-00007.safetensors",
185
+ "model.transformer.blocks.26.v_proj.weight": "model-00006-of-00007.safetensors",
186
+ "model.transformer.blocks.27.attn_norm.weight": "model-00006-of-00007.safetensors",
187
+ "model.transformer.blocks.27.attn_out.weight": "model-00006-of-00007.safetensors",
188
+ "model.transformer.blocks.27.ff_norm.weight": "model-00006-of-00007.safetensors",
189
+ "model.transformer.blocks.27.ff_out.weight": "model-00006-of-00007.safetensors",
190
+ "model.transformer.blocks.27.ff_proj.weight": "model-00006-of-00007.safetensors",
191
+ "model.transformer.blocks.27.k_proj.weight": "model-00006-of-00007.safetensors",
192
+ "model.transformer.blocks.27.q_proj.weight": "model-00006-of-00007.safetensors",
193
+ "model.transformer.blocks.27.up_proj.weight": "model-00006-of-00007.safetensors",
194
+ "model.transformer.blocks.27.v_proj.weight": "model-00006-of-00007.safetensors",
195
+ "model.transformer.blocks.28.attn_norm.weight": "model-00006-of-00007.safetensors",
196
+ "model.transformer.blocks.28.attn_out.weight": "model-00006-of-00007.safetensors",
197
+ "model.transformer.blocks.28.ff_norm.weight": "model-00006-of-00007.safetensors",
198
+ "model.transformer.blocks.28.ff_out.weight": "model-00006-of-00007.safetensors",
199
+ "model.transformer.blocks.28.ff_proj.weight": "model-00006-of-00007.safetensors",
200
+ "model.transformer.blocks.28.k_proj.weight": "model-00006-of-00007.safetensors",
201
+ "model.transformer.blocks.28.q_proj.weight": "model-00006-of-00007.safetensors",
202
+ "model.transformer.blocks.28.up_proj.weight": "model-00006-of-00007.safetensors",
203
+ "model.transformer.blocks.28.v_proj.weight": "model-00006-of-00007.safetensors",
204
+ "model.transformer.blocks.29.attn_norm.weight": "model-00006-of-00007.safetensors",
205
+ "model.transformer.blocks.29.attn_out.weight": "model-00006-of-00007.safetensors",
206
+ "model.transformer.blocks.29.ff_norm.weight": "model-00006-of-00007.safetensors",
207
+ "model.transformer.blocks.29.ff_out.weight": "model-00006-of-00007.safetensors",
208
+ "model.transformer.blocks.29.ff_proj.weight": "model-00006-of-00007.safetensors",
209
+ "model.transformer.blocks.29.k_proj.weight": "model-00006-of-00007.safetensors",
210
+ "model.transformer.blocks.29.q_proj.weight": "model-00006-of-00007.safetensors",
211
+ "model.transformer.blocks.29.up_proj.weight": "model-00006-of-00007.safetensors",
212
+ "model.transformer.blocks.29.v_proj.weight": "model-00006-of-00007.safetensors",
213
+ "model.transformer.blocks.3.attn_norm.weight": "model-00001-of-00007.safetensors",
214
+ "model.transformer.blocks.3.attn_out.weight": "model-00001-of-00007.safetensors",
215
+ "model.transformer.blocks.3.ff_norm.weight": "model-00001-of-00007.safetensors",
216
+ "model.transformer.blocks.3.ff_out.weight": "model-00001-of-00007.safetensors",
217
+ "model.transformer.blocks.3.ff_proj.weight": "model-00002-of-00007.safetensors",
218
+ "model.transformer.blocks.3.k_proj.weight": "model-00002-of-00007.safetensors",
219
+ "model.transformer.blocks.3.q_proj.weight": "model-00002-of-00007.safetensors",
220
+ "model.transformer.blocks.3.up_proj.weight": "model-00002-of-00007.safetensors",
221
+ "model.transformer.blocks.3.v_proj.weight": "model-00002-of-00007.safetensors",
222
+ "model.transformer.blocks.30.attn_norm.weight": "model-00006-of-00007.safetensors",
223
+ "model.transformer.blocks.30.attn_out.weight": "model-00006-of-00007.safetensors",
224
+ "model.transformer.blocks.30.ff_norm.weight": "model-00006-of-00007.safetensors",
225
+ "model.transformer.blocks.30.ff_out.weight": "model-00006-of-00007.safetensors",
226
+ "model.transformer.blocks.30.ff_proj.weight": "model-00006-of-00007.safetensors",
227
+ "model.transformer.blocks.30.k_proj.weight": "model-00006-of-00007.safetensors",
228
+ "model.transformer.blocks.30.q_proj.weight": "model-00006-of-00007.safetensors",
229
+ "model.transformer.blocks.30.up_proj.weight": "model-00006-of-00007.safetensors",
230
+ "model.transformer.blocks.30.v_proj.weight": "model-00006-of-00007.safetensors",
231
+ "model.transformer.blocks.31.attn_norm.weight": "model-00006-of-00007.safetensors",
232
+ "model.transformer.blocks.31.attn_out.weight": "model-00006-of-00007.safetensors",
233
+ "model.transformer.blocks.31.ff_norm.weight": "model-00006-of-00007.safetensors",
234
+ "model.transformer.blocks.31.ff_out.weight": "model-00006-of-00007.safetensors",
235
+ "model.transformer.blocks.31.ff_proj.weight": "model-00007-of-00007.safetensors",
236
+ "model.transformer.blocks.31.k_proj.weight": "model-00006-of-00007.safetensors",
237
+ "model.transformer.blocks.31.q_proj.weight": "model-00006-of-00007.safetensors",
238
+ "model.transformer.blocks.31.up_proj.weight": "model-00007-of-00007.safetensors",
239
+ "model.transformer.blocks.31.v_proj.weight": "model-00007-of-00007.safetensors",
240
+ "model.transformer.blocks.4.attn_norm.weight": "model-00002-of-00007.safetensors",
241
+ "model.transformer.blocks.4.attn_out.weight": "model-00002-of-00007.safetensors",
242
+ "model.transformer.blocks.4.ff_norm.weight": "model-00002-of-00007.safetensors",
243
+ "model.transformer.blocks.4.ff_out.weight": "model-00002-of-00007.safetensors",
244
+ "model.transformer.blocks.4.ff_proj.weight": "model-00002-of-00007.safetensors",
245
+ "model.transformer.blocks.4.k_proj.weight": "model-00002-of-00007.safetensors",
246
+ "model.transformer.blocks.4.q_proj.weight": "model-00002-of-00007.safetensors",
247
+ "model.transformer.blocks.4.up_proj.weight": "model-00002-of-00007.safetensors",
248
+ "model.transformer.blocks.4.v_proj.weight": "model-00002-of-00007.safetensors",
249
+ "model.transformer.blocks.5.attn_norm.weight": "model-00002-of-00007.safetensors",
250
+ "model.transformer.blocks.5.attn_out.weight": "model-00002-of-00007.safetensors",
251
+ "model.transformer.blocks.5.ff_norm.weight": "model-00002-of-00007.safetensors",
252
+ "model.transformer.blocks.5.ff_out.weight": "model-00002-of-00007.safetensors",
253
+ "model.transformer.blocks.5.ff_proj.weight": "model-00002-of-00007.safetensors",
254
+ "model.transformer.blocks.5.k_proj.weight": "model-00002-of-00007.safetensors",
255
+ "model.transformer.blocks.5.q_proj.weight": "model-00002-of-00007.safetensors",
256
+ "model.transformer.blocks.5.up_proj.weight": "model-00002-of-00007.safetensors",
257
+ "model.transformer.blocks.5.v_proj.weight": "model-00002-of-00007.safetensors",
258
+ "model.transformer.blocks.6.attn_norm.weight": "model-00002-of-00007.safetensors",
259
+ "model.transformer.blocks.6.attn_out.weight": "model-00002-of-00007.safetensors",
260
+ "model.transformer.blocks.6.ff_norm.weight": "model-00002-of-00007.safetensors",
261
+ "model.transformer.blocks.6.ff_out.weight": "model-00002-of-00007.safetensors",
262
+ "model.transformer.blocks.6.ff_proj.weight": "model-00002-of-00007.safetensors",
263
+ "model.transformer.blocks.6.k_proj.weight": "model-00002-of-00007.safetensors",
264
+ "model.transformer.blocks.6.q_proj.weight": "model-00002-of-00007.safetensors",
265
+ "model.transformer.blocks.6.up_proj.weight": "model-00002-of-00007.safetensors",
266
+ "model.transformer.blocks.6.v_proj.weight": "model-00002-of-00007.safetensors",
267
+ "model.transformer.blocks.7.attn_norm.weight": "model-00002-of-00007.safetensors",
268
+ "model.transformer.blocks.7.attn_out.weight": "model-00002-of-00007.safetensors",
269
+ "model.transformer.blocks.7.ff_norm.weight": "model-00002-of-00007.safetensors",
270
+ "model.transformer.blocks.7.ff_out.weight": "model-00002-of-00007.safetensors",
271
+ "model.transformer.blocks.7.ff_proj.weight": "model-00002-of-00007.safetensors",
272
+ "model.transformer.blocks.7.k_proj.weight": "model-00002-of-00007.safetensors",
273
+ "model.transformer.blocks.7.q_proj.weight": "model-00002-of-00007.safetensors",
274
+ "model.transformer.blocks.7.up_proj.weight": "model-00002-of-00007.safetensors",
275
+ "model.transformer.blocks.7.v_proj.weight": "model-00002-of-00007.safetensors",
276
+ "model.transformer.blocks.8.attn_norm.weight": "model-00002-of-00007.safetensors",
277
+ "model.transformer.blocks.8.attn_out.weight": "model-00002-of-00007.safetensors",
278
+ "model.transformer.blocks.8.ff_norm.weight": "model-00002-of-00007.safetensors",
279
+ "model.transformer.blocks.8.ff_out.weight": "model-00002-of-00007.safetensors",
280
+ "model.transformer.blocks.8.ff_proj.weight": "model-00002-of-00007.safetensors",
281
+ "model.transformer.blocks.8.k_proj.weight": "model-00002-of-00007.safetensors",
282
+ "model.transformer.blocks.8.q_proj.weight": "model-00002-of-00007.safetensors",
283
+ "model.transformer.blocks.8.up_proj.weight": "model-00002-of-00007.safetensors",
284
+ "model.transformer.blocks.8.v_proj.weight": "model-00002-of-00007.safetensors",
285
+ "model.transformer.blocks.9.attn_norm.weight": "model-00003-of-00007.safetensors",
286
+ "model.transformer.blocks.9.attn_out.weight": "model-00003-of-00007.safetensors",
287
+ "model.transformer.blocks.9.ff_norm.weight": "model-00003-of-00007.safetensors",
288
+ "model.transformer.blocks.9.ff_out.weight": "model-00003-of-00007.safetensors",
289
+ "model.transformer.blocks.9.ff_proj.weight": "model-00003-of-00007.safetensors",
290
+ "model.transformer.blocks.9.k_proj.weight": "model-00003-of-00007.safetensors",
291
+ "model.transformer.blocks.9.q_proj.weight": "model-00003-of-00007.safetensors",
292
+ "model.transformer.blocks.9.up_proj.weight": "model-00003-of-00007.safetensors",
293
+ "model.transformer.blocks.9.v_proj.weight": "model-00003-of-00007.safetensors",
294
+ "model.transformer.ff_out.weight": "model-00007-of-00007.safetensors",
295
+ "model.transformer.ln_f.weight": "model-00001-of-00007.safetensors",
296
+ "model.transformer.wte.weight": "model-00001-of-00007.safetensors"
297
+ }
298
+ }
modeling_llada.py ADDED
@@ -0,0 +1,1983 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ import math
5
+ import sys
6
+ from abc import abstractmethod
7
+ from functools import partial
8
+ from typing import (
9
+ Callable,
10
+ Iterable,
11
+ List,
12
+ NamedTuple,
13
+ Optional,
14
+ Sequence,
15
+ Tuple,
16
+ cast,
17
+ )
18
+ from dataclasses import fields
19
+ from typing import Union
20
+
21
+ import torch
22
+ import torch.backends.cuda
23
+ import torch.nn as nn
24
+ import torch.nn.functional as F
25
+ from torch import einsum
26
+ from transformers import PreTrainedModel
27
+ from transformers.modeling_outputs import CausalLMOutputWithPast
28
+ from transformers.models.auto import AutoModel
29
+ from transformers.cache_utils import Cache
30
+
31
+ from .configuration_llada import (
32
+ LLaDAConfig,
33
+ StrEnum,
34
+ InitFnType,
35
+ ActivationType,
36
+ BlockType,
37
+ LayerNormType,
38
+ ModelConfig,
39
+ ActivationCheckpointingStrategy,
40
+ )
41
+
42
+
43
+ def add_gumbel_noise(
44
+ logits: torch.Tensor, temperature: float
45
+ ) -> torch.Tensor:
46
+ """
47
+ Apply Gumbel noise to logits for sampling.
48
+
49
+ Args:
50
+ logits (torch.Tensor): Unnormalized log-probabilities.
51
+ temperature (float): Sampling temperature. If 0, returns logits unchanged.
52
+
53
+ Returns:
54
+ torch.Tensor: Noisy scores ready for sampling.
55
+ """
56
+ if temperature <= 0:
57
+ return logits
58
+
59
+ # Sample standard Gumbel noise
60
+ gumbel = -torch.log(-torch.log(torch.rand_like(logits, dtype=torch.float64)))
61
+ noisy_logits = logits.to(torch.float64) + temperature * gumbel
62
+ return noisy_logits.to(logits.dtype)
63
+
64
+
65
+ def get_num_transfer_tokens(
66
+ mask_index: torch.Tensor, steps: int
67
+ ) -> torch.Tensor:
68
+ """
69
+ Compute how many masked tokens to update per inner step.
70
+
71
+ Args:
72
+ mask_index (torch.Tensor): Boolean tensor indicating masked positions (batch, seq_len).
73
+ steps (int): Total number of refinement steps per block.
74
+
75
+ Returns:
76
+ torch.Tensor: Tensor of shape (batch, steps) with counts per step.
77
+ """
78
+ batch_size = mask_index.size(0)
79
+ total_masks = mask_index.sum(dim=1)
80
+ base = total_masks // steps
81
+ rem = total_masks % steps
82
+
83
+ counts = base.unsqueeze(-1).expand(-1, steps).clone()
84
+ for i in range(batch_size):
85
+ counts[i, :rem[i]] += 1
86
+
87
+ return counts
88
+
89
+
90
+ @torch.no_grad()
91
+ def generate_stream(
92
+ model: torch.nn.Module,
93
+ prompt_ids: torch.Tensor,
94
+ steps: int = 128,
95
+ gen_length: int = 128,
96
+ block_length: int = 128,
97
+ temperature: float = 0.0,
98
+ cfg_scale: float = 0.0,
99
+ remasking: str = "low_confidence",
100
+ mask_token_id: int = 126336,
101
+ ):
102
+ """
103
+ Yields intermediate token sequences while iteratively filling masked positions.
104
+
105
+ Args:
106
+ model (torch.nn.Module): Language model with .logits output.
107
+ prompt_ids (torch.Tensor): Input IDs of shape (batch, prompt_len).
108
+ steps (int): Total refinement steps per block.
109
+ gen_length (int): Number of tokens to generate.
110
+ block_length (int): Block size for progressive generation.
111
+ temperature (float): Gumbel noise temperature.
112
+ cfg_scale (float): Classifier-free guidance scale.
113
+ remasking (str): "low_confidence" or "random".
114
+ mask_token_id (int): Token ID for masking.
115
+
116
+ Yields:
117
+ torch.Tensor: Current sequence tensor of shape (batch, prompt_len + gen_length).
118
+ """
119
+ device = model.device
120
+ batch_size, prompt_len = prompt_ids.shape
121
+ total_len = prompt_len + gen_length
122
+
123
+ # Initialize sequence with masks
124
+ seq = torch.full(
125
+ (batch_size, total_len), mask_token_id, dtype=torch.long, device=device
126
+ )
127
+ seq[:, :prompt_len] = prompt_ids
128
+ fixed = seq != mask_token_id
129
+
130
+ assert gen_length % block_length == 0, "gen_length must be multiple of block_length"
131
+ num_blocks = gen_length // block_length
132
+ assert steps % num_blocks == 0, "steps must be divisible by num_blocks"
133
+ inner_steps = steps // num_blocks
134
+
135
+ for block in range(num_blocks):
136
+ start = prompt_len + block * block_length
137
+ end = start + block_length
138
+ block_mask = seq[:, start:end] == mask_token_id
139
+ transfer_counts = get_num_transfer_tokens(block_mask, inner_steps)
140
+
141
+ for step in range(inner_steps):
142
+ mask_positions = seq == mask_token_id
143
+
144
+ # Classifier-free guidance
145
+ if cfg_scale > 0:
146
+ uncond_seq = seq.clone()
147
+ uncond_seq[fixed] = mask_token_id
148
+ inputs = torch.cat([seq, uncond_seq], dim=0)
149
+ logits = model(inputs).logits
150
+ cond_logits, uncond_logits = torch.chunk(logits, 2, dim=0)
151
+ logits = uncond_logits + (cfg_scale + 1) * (cond_logits - uncond_logits)
152
+ else:
153
+ logits = model(seq).logits
154
+
155
+ # Sample tokens
156
+ noisy = add_gumbel_noise(logits, temperature)
157
+ sampled = noisy.argmax(dim=-1)
158
+
159
+ # Compute remasking confidence
160
+ if remasking == "low_confidence":
161
+ probs = F.softmax(logits.to(torch.float64), dim=-1)
162
+ sel_p = probs.gather(-1, sampled.unsqueeze(-1)).squeeze(-1)
163
+ elif remasking == "random":
164
+ sel_p = torch.rand_like(sampled, dtype=torch.float64)
165
+ else:
166
+ raise ValueError(f"Unknown remasking mode: {remasking}")
167
+
168
+ # Prevent updates outside current block
169
+ sel_p[:, end:] = float("-inf")
170
+
171
+ # Keep original tokens
172
+ candidate = torch.where(mask_positions, sampled, seq)
173
+ confidence = torch.where(mask_positions, sel_p, float("-inf"))
174
+
175
+ # Select positions to update
176
+ update_mask = torch.zeros_like(seq, dtype=torch.bool)
177
+ for i in range(batch_size):
178
+ topk_idx = confidence[i].topk(int(transfer_counts[i, step]))[1]
179
+ update_mask[i, topk_idx] = True
180
+
181
+ seq = torch.where(update_mask, candidate, seq)
182
+ yield seq.clone()
183
+
184
+
185
+ if sys.version_info.minor > 8:
186
+ from collections.abc import MutableMapping
187
+ elif sys.version_info.minor == 8:
188
+ from typing import MutableMapping
189
+ else:
190
+ raise SystemExit("This script supports Python 3.8 or higher")
191
+
192
+ __all__ = [
193
+ "LayerNormBase",
194
+ "LayerNorm",
195
+ "RMSLayerNorm",
196
+ "GemmaRMSLayerNorm",
197
+ "RotaryEmbedding",
198
+ "Activation",
199
+ "GELU",
200
+ "ReLU",
201
+ "SwiGLU",
202
+ "LLaDABlock",
203
+ "LLaDASequentialBlock",
204
+ "LLaDAModel",
205
+ "LLaDAOutput",
206
+ "LLaDAGenerateOutput",
207
+ ]
208
+
209
+
210
+ log = logging.getLogger(__name__)
211
+
212
+
213
+ class ModuleType(StrEnum):
214
+ in_module = "in"
215
+ out_module = "out"
216
+ emb = "emb"
217
+ final_out = "final_out"
218
+
219
+
220
+ def init_weights(
221
+ config: ModelConfig,
222
+ module: Union[nn.Linear, nn.Embedding],
223
+ d: Optional[int] = None,
224
+ layer_id: Optional[int] = None,
225
+ std_factor: float = 1.0,
226
+ type_of_module: Optional[ModuleType] = None,
227
+ ) -> None:
228
+ """
229
+ Initialize weights of a linear or embedding module.
230
+
231
+ :param config: The model config.
232
+ :param module: The linear or embedding submodule to initialize.
233
+ :param d: The effective input dimensionality of the weights. This could be smaller than the actual dimensions
234
+ for fused layers.
235
+ :param layer_id: When set, the standard deviation for the "mitchell" method will be adjusted by
236
+ ``1 / sqrt(2 * (layer_id + 1))``.
237
+ """
238
+ d = d if d is not None else config.d_model
239
+ if config.init_fn == InitFnType.normal:
240
+ std = config.init_std * std_factor
241
+ if config.init_cutoff_factor is not None:
242
+ cutoff_value = config.init_cutoff_factor * std
243
+ nn.init.trunc_normal_(
244
+ module.weight, mean=0.0, std=std, a=-cutoff_value, b=cutoff_value
245
+ )
246
+ else:
247
+ nn.init.normal_(module.weight, mean=0.0, std=std)
248
+ elif config.init_fn == InitFnType.mitchell:
249
+ std = std_factor / math.sqrt(d)
250
+ if layer_id is not None:
251
+ std = std / math.sqrt(2 * (layer_id + 1))
252
+ nn.init.trunc_normal_(module.weight, mean=0.0, std=std, a=-3 * std, b=3 * std)
253
+ elif config.init_fn == InitFnType.kaiming_normal:
254
+ nn.init.kaiming_normal_(module.weight, nonlinearity="relu")
255
+ elif config.init_fn == InitFnType.fan_in:
256
+ std = std_factor / math.sqrt(d)
257
+ nn.init.normal_(module.weight, mean=0.0, std=std)
258
+ elif config.init_fn == InitFnType.full_megatron:
259
+ if type_of_module is None:
260
+ raise RuntimeError(
261
+ f"When using the {InitFnType.full_megatron} init, every module must have a type."
262
+ )
263
+
264
+ cutoff_factor = config.init_cutoff_factor
265
+ if cutoff_factor is None:
266
+ cutoff_factor = 3
267
+
268
+ if type_of_module == ModuleType.in_module:
269
+ # for att_proj (same as QKV), ff_proj
270
+ std = config.init_std
271
+ elif type_of_module == ModuleType.out_module:
272
+ # for attn_out, ff_out
273
+ std = config.init_std / math.sqrt(2.0 * config.n_layers)
274
+ elif type_of_module == ModuleType.emb:
275
+ # positional embeddings (wpe)
276
+ # token embeddings (wte)
277
+ std = config.init_std
278
+ elif type_of_module == ModuleType.final_out:
279
+ # final output (ff_out)
280
+ std = config.d_model**-0.5
281
+ else:
282
+ raise RuntimeError(f"Unknown module type '{type_of_module}'")
283
+ nn.init.trunc_normal_(
284
+ module.weight,
285
+ mean=0.0,
286
+ std=std,
287
+ a=-cutoff_factor * std,
288
+ b=cutoff_factor * std,
289
+ )
290
+ else:
291
+ raise NotImplementedError(config.init_fn)
292
+
293
+ if isinstance(module, nn.Linear):
294
+ if module.bias is not None:
295
+ nn.init.zeros_(module.bias)
296
+
297
+ if config.init_fn == InitFnType.normal and getattr(
298
+ module, "_is_residual", False
299
+ ):
300
+ with torch.no_grad():
301
+ module.weight.div_(math.sqrt(2 * config.n_layers))
302
+
303
+
304
+ def ensure_finite_(
305
+ x: torch.Tensor, check_neg_inf: bool = True, check_pos_inf: bool = False
306
+ ):
307
+ """
308
+ Modify ``x`` in place to replace ``float("-inf")`` with the minimum value of the dtype when ``check_neg_inf``
309
+ is ``True`` and to replace ``float("inf")`` with the maximum value of the dtype when ``check_pos_inf`` is ``True``.
310
+ """
311
+ if check_neg_inf:
312
+ x.masked_fill_(x == float("-inf"), torch.finfo(x.dtype).min)
313
+ if check_pos_inf:
314
+ x.masked_fill_(x == float("inf"), torch.finfo(x.dtype).max)
315
+
316
+
317
+ def activation_checkpoint_function(cfg: ModelConfig):
318
+ preserve_rng_state = (
319
+ (cfg.attention_dropout == 0.0)
320
+ and (cfg.embedding_dropout == 0.0)
321
+ and (cfg.residual_dropout == 0.0)
322
+ )
323
+ from torch.utils.checkpoint import checkpoint
324
+
325
+ return partial(
326
+ checkpoint,
327
+ preserve_rng_state=preserve_rng_state,
328
+ use_reentrant=False,
329
+ )
330
+
331
+
332
+ class BufferCache(dict, MutableMapping[str, torch.Tensor]):
333
+ """
334
+ Cache for attention biases and other things that would normally be stored as buffers.
335
+ We avoid using buffers because we've run into various issues doing so with FSDP.
336
+ In general it appears the way FSDP handles buffers is not well-defined.
337
+ It doesn't shard them but apparently it does synchronize them across processes, which we want to avoid
338
+ since (A) it isn't necessary, and (B) we sometimes have `-inf` in these biases which might get turned into
339
+ NaNs when they're synchronized due to casting or some other issue.
340
+ """
341
+
342
+
343
+ def _non_meta_init_device(config: ModelConfig) -> torch.device:
344
+ if config.init_device is not None and config.init_device != "meta":
345
+ return torch.device(config.init_device)
346
+ else:
347
+ return torch.device("cuda" if torch.cuda.is_available() else "cpu")
348
+
349
+
350
+ class Dropout(nn.Dropout):
351
+ def forward(self, input: torch.Tensor) -> torch.Tensor:
352
+ if self.p == 0.0:
353
+ return input
354
+ else:
355
+ return F.dropout(input, self.p, self.training, self.inplace)
356
+
357
+
358
+ class LayerNormBase(nn.Module):
359
+ def __init__(
360
+ self,
361
+ config: ModelConfig,
362
+ *,
363
+ size: Optional[int] = None,
364
+ elementwise_affine: Optional[bool] = True,
365
+ eps: float = 1e-05,
366
+ ):
367
+ super().__init__()
368
+ self.config = config
369
+ self.eps = eps
370
+ self.normalized_shape = (size or config.d_model,)
371
+ if elementwise_affine or (
372
+ elementwise_affine is None and self.config.layer_norm_with_affine
373
+ ):
374
+ self.weight = nn.Parameter(
375
+ torch.ones(self.normalized_shape, device=config.init_device)
376
+ )
377
+ use_bias = self.config.bias_for_layer_norm
378
+ if use_bias is None:
379
+ use_bias = self.config.include_bias
380
+ if use_bias:
381
+ self.bias = nn.Parameter(
382
+ torch.zeros(self.normalized_shape, device=config.init_device)
383
+ )
384
+ else:
385
+ self.register_parameter("bias", None)
386
+ else:
387
+ self.register_parameter("bias", None)
388
+ self.register_parameter("weight", None)
389
+
390
+ @abstractmethod
391
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
392
+ raise NotImplementedError
393
+
394
+ @classmethod
395
+ def build(
396
+ cls, config: ModelConfig, size: Optional[int] = None, **kwargs
397
+ ) -> LayerNormBase:
398
+ if config.layer_norm_type == LayerNormType.default:
399
+ return LayerNorm(config, size=size, low_precision=False, **kwargs)
400
+ elif config.layer_norm_type == LayerNormType.low_precision:
401
+ return LayerNorm(config, size=size, low_precision=True, **kwargs)
402
+ elif config.layer_norm_type == LayerNormType.rms:
403
+ return RMSLayerNorm(config, size=size, **kwargs)
404
+ elif config.layer_norm_type == LayerNormType.gemma_rms:
405
+ return GemmaRMSLayerNorm(config, size=size, **kwargs)
406
+ else:
407
+ raise NotImplementedError(
408
+ f"Unknown LayerNorm type: '{config.layer_norm_type}'"
409
+ )
410
+
411
+ def _cast_if_autocast_enabled(
412
+ self, tensor: torch.Tensor, dtype: Optional[torch.dtype] = None
413
+ ) -> torch.Tensor:
414
+ # NOTE: `is_autocast_enabled()` only checks for CUDA autocast, so we use the separate function
415
+ # `is_autocast_cpu_enabled()` for CPU autocast.
416
+ # See https://github.com/pytorch/pytorch/issues/110966.
417
+ if tensor.device.type == "cuda" and torch.is_autocast_enabled():
418
+ return tensor.to(
419
+ dtype=dtype if dtype is not None else torch.get_autocast_gpu_dtype()
420
+ )
421
+ elif tensor.device.type == "cpu" and torch.is_autocast_cpu_enabled():
422
+ return tensor.to(
423
+ dtype=dtype if dtype is not None else torch.get_autocast_cpu_dtype()
424
+ )
425
+ else:
426
+ return tensor
427
+
428
+ def reset_parameters(self):
429
+ if self.weight is not None:
430
+ torch.nn.init.ones_(self.weight) # type: ignore
431
+ if self.bias is not None:
432
+ torch.nn.init.zeros_(self.bias) # type: ignore
433
+
434
+
435
+ class LayerNorm(LayerNormBase):
436
+ """
437
+ The default :class:`LayerNorm` implementation which can optionally run in low precision.
438
+ """
439
+
440
+ def __init__(
441
+ self,
442
+ config: ModelConfig,
443
+ size: Optional[int] = None,
444
+ low_precision: bool = False,
445
+ elementwise_affine: Optional[bool] = None,
446
+ eps: float = 1e-05,
447
+ ):
448
+ super().__init__(
449
+ config, size=size, elementwise_affine=elementwise_affine, eps=eps
450
+ )
451
+ self.low_precision = low_precision
452
+
453
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
454
+ if self.low_precision:
455
+ module_device = x.device
456
+ downcast_x = self._cast_if_autocast_enabled(x)
457
+ downcast_weight = (
458
+ self._cast_if_autocast_enabled(self.weight)
459
+ if self.weight is not None
460
+ else self.weight
461
+ )
462
+ downcast_bias = (
463
+ self._cast_if_autocast_enabled(self.bias)
464
+ if self.bias is not None
465
+ else self.bias
466
+ )
467
+ with torch.autocast(enabled=False, device_type=module_device.type):
468
+ return F.layer_norm(
469
+ downcast_x,
470
+ self.normalized_shape,
471
+ weight=downcast_weight,
472
+ bias=downcast_bias,
473
+ eps=self.eps,
474
+ )
475
+ else:
476
+ return F.layer_norm(
477
+ x,
478
+ self.normalized_shape,
479
+ weight=self.weight,
480
+ bias=self.bias,
481
+ eps=self.eps,
482
+ )
483
+
484
+
485
+ class RMSLayerNorm(LayerNormBase):
486
+ """
487
+ RMS layer norm, a simplified :class:`LayerNorm` implementation
488
+ """
489
+
490
+ def __init__(
491
+ self,
492
+ config: ModelConfig,
493
+ size: Optional[int] = None,
494
+ elementwise_affine: Optional[bool] = None,
495
+ eps: float = 1e-5,
496
+ ):
497
+ super().__init__(
498
+ config,
499
+ size=size,
500
+ elementwise_affine=elementwise_affine,
501
+ eps=config.rms_norm_eps,
502
+ )
503
+
504
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
505
+ with torch.autocast(enabled=False, device_type=x.device.type):
506
+ og_dtype = x.dtype
507
+ x = x.to(torch.float32)
508
+ variance = x.pow(2).mean(-1, keepdim=True)
509
+ x = x * torch.rsqrt(variance + self.eps)
510
+ x = x.to(og_dtype)
511
+
512
+ if self.weight is not None:
513
+ if self.bias is not None:
514
+ return self.weight * x + self.bias
515
+ else:
516
+ return self.weight * x
517
+ else:
518
+ return x
519
+
520
+
521
+ class GemmaRMSLayerNorm(LayerNormBase):
522
+ """
523
+ Gemma RMS layer norm, a simplified :class:`LayerNorm` implementation
524
+ """
525
+
526
+ def __init__(
527
+ self,
528
+ config: ModelConfig,
529
+ size: Optional[int] = None,
530
+ elementwise_affine: Optional[bool] = None,
531
+ eps: float = 1e-5,
532
+ ):
533
+ super().__init__(
534
+ config,
535
+ size=size,
536
+ elementwise_affine=elementwise_affine,
537
+ eps=config.rms_norm_eps,
538
+ )
539
+
540
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
541
+ with torch.autocast(enabled=False, device_type=x.device.type):
542
+ og_dtype = x.dtype
543
+ x = x.to(torch.float32)
544
+ variance = x.pow(2).mean(-1, keepdim=True)
545
+ x = x * torch.rsqrt(variance + self.eps)
546
+ x = x.to(og_dtype)
547
+
548
+ if self.weight is not None:
549
+ if self.bias is not None:
550
+ return x * (1 + self.weight) + self.bias
551
+ else:
552
+ return x * (1 + self.weight)
553
+ else:
554
+ return x
555
+
556
+
557
+ class RotaryEmbedding(nn.Module):
558
+ """
559
+ [Rotary positional embeddings (RoPE)](https://arxiv.org/abs/2104.09864).
560
+ """
561
+
562
+ def __init__(self, config: ModelConfig, cache: BufferCache):
563
+ super().__init__()
564
+ self.config = config
565
+ self.__cache = cache
566
+ # Warm up cache.
567
+ self.rope_theta = config.rope_theta
568
+ self.get_rotary_embedding(
569
+ config.max_sequence_length, _non_meta_init_device(config)
570
+ )
571
+
572
+ def get_rotary_embedding(
573
+ self, seq_len: int, device: torch.device
574
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
575
+ if (
576
+ (pos_sin := self.__cache.get("rope_pos_sin")) is not None
577
+ and (pos_cos := self.__cache.get("rope_pos_cos")) is not None
578
+ and pos_sin.shape[-2] >= seq_len
579
+ and pos_cos.shape[-2] >= seq_len
580
+ ):
581
+ if pos_sin.device != device:
582
+ pos_sin = pos_sin.to(device)
583
+ self.__cache["rope_pos_sin"] = pos_sin
584
+ if pos_cos.device != device:
585
+ pos_cos = pos_cos.to(device)
586
+ self.__cache["rope_pos_cos"] = pos_cos
587
+ return pos_sin[:, :, :seq_len, :], pos_cos[:, :, :seq_len, :]
588
+
589
+ with torch.autocast(device.type, enabled=False):
590
+ dim = self.config.d_model // self.config.n_heads
591
+ inv_freq = 1.0 / (
592
+ self.rope_theta
593
+ ** (torch.arange(0, dim, 2, device=device, dtype=torch.float) / dim)
594
+ )
595
+ seq = torch.arange(seq_len, device=device, dtype=torch.float)
596
+ freqs = einsum("i , j -> i j", seq, inv_freq)
597
+ positions = torch.cat((freqs, freqs), dim=-1)
598
+ pos_sin, pos_cos = (
599
+ positions.sin()[None, None, :, :],
600
+ positions.cos()[None, None, :, :],
601
+ )
602
+ self.__cache["rope_pos_sin"] = pos_sin
603
+ self.__cache["rope_pos_cos"] = pos_cos
604
+ return pos_sin, pos_cos
605
+
606
+ def rotate_half(self, x: torch.Tensor) -> torch.Tensor:
607
+ B, nh, T, hs = x.size()
608
+ x = x.view(B, nh, T, 2, hs // 2)
609
+ x1, x2 = x.unbind(dim=-2)
610
+ return torch.cat((-x2, x1), dim=-1)
611
+
612
+ def apply_rotary_pos_emb(
613
+ self, pos_sin: torch.Tensor, pos_cos: torch.Tensor, t: torch.Tensor
614
+ ) -> torch.Tensor:
615
+ return ((t * pos_cos) + (self.rotate_half(t) * pos_sin)).to(t.dtype)
616
+
617
+ def forward(
618
+ self, q: torch.Tensor, k: torch.Tensor
619
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
620
+ if self.config.rope_full_precision:
621
+ q_, k_ = q.float(), k.float()
622
+ else:
623
+ q_, k_ = q, k
624
+
625
+ with torch.autocast(q.device.type, enabled=False):
626
+ query_len, key_len = (
627
+ q_.shape[-2],
628
+ k_.shape[-2],
629
+ ) # could be different if layer_past not None
630
+ pos_sin, pos_cos = self.get_rotary_embedding(key_len, q_.device)
631
+ pos_sin = pos_sin.type_as(q_)
632
+ pos_cos = pos_cos.type_as(q_)
633
+ q_ = self.apply_rotary_pos_emb(
634
+ pos_sin[:, :, key_len - query_len : key_len, :],
635
+ pos_cos[:, :, key_len - query_len : key_len, :],
636
+ q_,
637
+ )
638
+ k_ = self.apply_rotary_pos_emb(pos_sin, pos_cos, k_)
639
+ return q_.type_as(q), k_.type_as(k)
640
+
641
+
642
+ class Activation(nn.Module):
643
+ def __init__(self, config: ModelConfig):
644
+ super().__init__()
645
+ self.config = config
646
+
647
+ @abstractmethod
648
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
649
+ raise NotImplementedError
650
+
651
+ @property
652
+ @abstractmethod
653
+ def output_multiplier(self) -> float:
654
+ raise NotImplementedError
655
+
656
+ @classmethod
657
+ def build(cls, config: ModelConfig) -> Activation:
658
+ if config.activation_type == ActivationType.gelu:
659
+ return cast(Activation, GELU(approximate="none"))
660
+ elif config.activation_type == ActivationType.relu:
661
+ return cast(Activation, ReLU(inplace=False))
662
+ elif config.activation_type == ActivationType.silu:
663
+ return cast(Activation, SiLU(inplace=False))
664
+ elif config.activation_type == ActivationType.swiglu:
665
+ return SwiGLU(config)
666
+ else:
667
+ raise NotImplementedError(f"Unknown activation: '{config.activation_type}'")
668
+
669
+
670
+ class GELU(nn.GELU):
671
+ @property
672
+ def output_multiplier(self) -> float:
673
+ return 1.0
674
+
675
+
676
+ class ReLU(nn.ReLU):
677
+ @property
678
+ def output_multiplier(self) -> float:
679
+ return 1.0
680
+
681
+
682
+ class SiLU(nn.SiLU):
683
+ @property
684
+ def output_multiplier(self) -> float:
685
+ return 1.0
686
+
687
+
688
+ class SwiGLU(Activation):
689
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
690
+ x, gate = x.chunk(2, dim=-1)
691
+ return F.silu(gate) * x
692
+
693
+ @property
694
+ def output_multiplier(self) -> float:
695
+ return 0.5
696
+
697
+
698
+ def causal_attention_bias(seq_len: int, device: torch.device) -> torch.FloatTensor:
699
+ att_bias = torch.triu(
700
+ torch.ones(seq_len, seq_len, device=device, dtype=torch.float),
701
+ diagonal=1,
702
+ )
703
+ att_bias.masked_fill_(att_bias == 1, torch.finfo(att_bias.dtype).min)
704
+ return att_bias.view(1, 1, seq_len, seq_len) # type: ignore
705
+
706
+
707
+ def get_causal_attention_bias(
708
+ cache: BufferCache, seq_len: int, device: torch.device
709
+ ) -> torch.Tensor:
710
+ if (
711
+ causal_bias := cache.get("causal_attention_bias")
712
+ ) is not None and causal_bias.shape[-1] >= seq_len:
713
+ if causal_bias.device != device:
714
+ causal_bias = causal_bias.to(device)
715
+ cache["causal_attention_bias"] = causal_bias
716
+ return causal_bias
717
+ with torch.autocast(device.type, enabled=False):
718
+ causal_bias = causal_attention_bias(seq_len, device)
719
+ cache["causal_attention_bias"] = causal_bias
720
+ return causal_bias
721
+
722
+
723
+ def alibi_attention_bias(
724
+ seq_len: int, config: ModelConfig, device: torch.device
725
+ ) -> torch.FloatTensor:
726
+ alibi_bias = torch.arange(1 - seq_len, 1, dtype=torch.float, device=device).view(
727
+ 1, 1, 1, seq_len
728
+ )
729
+
730
+ # shape: (1, 1, seq_len, seq_len)
731
+ alibi_bias = alibi_bias - torch.arange(
732
+ 1 - seq_len, 1, dtype=torch.float, device=device
733
+ ).view(1, 1, seq_len, 1)
734
+ alibi_bias.abs_().mul_(-1)
735
+
736
+ # shape: (n_heads,)
737
+ m = torch.arange(1, config.n_heads + 1, dtype=torch.float, device=device)
738
+ m.mul_(config.alibi_bias_max / config.n_heads)
739
+
740
+ # shape: (1, n_heads, seq_len, seq_len)
741
+ return alibi_bias * (1.0 / (2 ** m.view(1, config.n_heads, 1, 1))) # type: ignore
742
+
743
+
744
+ class LLaDABlock(nn.Module):
745
+ """
746
+ A base class for transformer block implementations.
747
+ """
748
+
749
+ def __init__(self, layer_id: int, config: ModelConfig, cache: BufferCache):
750
+ super().__init__()
751
+ self.layer_id = layer_id
752
+ self.config = config
753
+ self.hidden_size = (
754
+ config.mlp_hidden_size
755
+ if config.mlp_hidden_size is not None
756
+ else config.mlp_ratio * config.d_model
757
+ )
758
+ self.__cache = cache
759
+ assert config.d_model % config.n_heads == 0
760
+
761
+ self._activation_checkpoint_fn = None
762
+
763
+ # Dropout.
764
+ self.dropout = Dropout(config.residual_dropout)
765
+
766
+ # Layer norms.
767
+ self.k_norm: Optional[LayerNormBase] = None
768
+ self.q_norm: Optional[LayerNormBase] = None
769
+ if config.attention_layer_norm:
770
+ self.k_norm = LayerNormBase.build(
771
+ config,
772
+ size=(config.d_model // config.n_heads) * config.effective_n_kv_heads,
773
+ elementwise_affine=config.attention_layer_norm_with_affine,
774
+ )
775
+ self.q_norm = LayerNormBase.build(
776
+ config, elementwise_affine=config.attention_layer_norm_with_affine
777
+ )
778
+
779
+ # Activation function.
780
+ self.act = Activation.build(config)
781
+ assert (self.act.output_multiplier * self.hidden_size) % 1 == 0
782
+
783
+ # Attention output projection.
784
+ self.attn_out = nn.Linear(
785
+ config.d_model,
786
+ config.d_model,
787
+ bias=config.include_bias,
788
+ device=config.init_device,
789
+ )
790
+
791
+ # Feed-forward output projection.
792
+ self.ff_out = nn.Linear(
793
+ int(self.act.output_multiplier * self.hidden_size),
794
+ config.d_model,
795
+ bias=config.include_bias,
796
+ device=config.init_device,
797
+ )
798
+ self.ff_out._is_residual = True # type: ignore
799
+
800
+ # Rotary embeddings.
801
+ if self.config.rope:
802
+ self.rotary_emb = RotaryEmbedding(config, self.__cache)
803
+
804
+ self.flash_attn_func = None
805
+ if config.flash_attention:
806
+ try:
807
+ from flash_attn import flash_attn_func # type: ignore
808
+
809
+ self.flash_attn_func = flash_attn_func
810
+ except ModuleNotFoundError:
811
+ pass
812
+
813
+ def reset_parameters(self):
814
+ if self.k_norm is not None:
815
+ self.k_norm.reset_parameters()
816
+ if self.q_norm is not None:
817
+ self.q_norm.reset_parameters()
818
+ init_weights(
819
+ self.config,
820
+ self.attn_out,
821
+ d=self.config.d_model,
822
+ layer_id=self.layer_id,
823
+ type_of_module=ModuleType.out_module,
824
+ )
825
+ init_weights(
826
+ self.config,
827
+ self.ff_out,
828
+ d=self.ff_out.in_features,
829
+ layer_id=self.layer_id,
830
+ type_of_module=ModuleType.out_module,
831
+ )
832
+
833
+ def set_activation_checkpointing(
834
+ self, strategy: Optional[ActivationCheckpointingStrategy]
835
+ ):
836
+ if strategy == ActivationCheckpointingStrategy.fine_grained:
837
+ self._activation_checkpoint_fn = activation_checkpoint_function(self.config)
838
+ else:
839
+ self._activation_checkpoint_fn = None
840
+
841
+ @classmethod
842
+ def _cast_attn_bias(
843
+ cls, bias: torch.Tensor, input_dtype: torch.dtype
844
+ ) -> torch.Tensor:
845
+ target_dtype = input_dtype
846
+ # NOTE: `is_autocast_enabled()` only checks for CUDA autocast, so we use the separate function
847
+ # `is_autocast_cpu_enabled()` for CPU autocast.
848
+ # See https://github.com/pytorch/pytorch/issues/110966.
849
+ if bias.device.type == "cuda" and torch.is_autocast_enabled():
850
+ target_dtype = torch.get_autocast_gpu_dtype()
851
+ elif bias.device.type == "cpu" and torch.is_autocast_cpu_enabled():
852
+ target_dtype = torch.get_autocast_cpu_dtype()
853
+ if bias.dtype != target_dtype:
854
+ bias = bias.to(target_dtype)
855
+ ensure_finite_(bias, check_neg_inf=True, check_pos_inf=False)
856
+ return bias
857
+
858
+ def _scaled_dot_product_attention(
859
+ self,
860
+ q: torch.Tensor,
861
+ k: torch.Tensor,
862
+ v: torch.Tensor,
863
+ attn_mask: Optional[torch.Tensor] = None,
864
+ dropout_p: float = 0.0,
865
+ is_causal: bool = False,
866
+ ) -> torch.Tensor:
867
+ """
868
+ Computes scaled dot product attention on query, key and value tensors, using an optional
869
+ attention mask if passed, and applying dropout if a probability greater than 0.0 is specified.
870
+ """
871
+ if self.flash_attn_func is not None and attn_mask is None:
872
+ r = self.flash_attn_func(
873
+ q.transpose(1, 2),
874
+ k.transpose(1, 2),
875
+ v.transpose(1, 2),
876
+ dropout_p=dropout_p,
877
+ causal=False,
878
+ )
879
+ return r.transpose(1, 2)
880
+ else:
881
+ # torch's sdpa doesn't support GQA, so we're doing this
882
+ assert k.size(1) == v.size(1)
883
+ num_kv_heads = k.size(1)
884
+ num_q_heads = q.size(1)
885
+ if num_q_heads != num_kv_heads:
886
+ assert num_q_heads % num_kv_heads == 0
887
+ k = k.repeat_interleave(
888
+ num_q_heads // num_kv_heads, dim=1, output_size=num_q_heads
889
+ )
890
+ v = v.repeat_interleave(
891
+ num_q_heads // num_kv_heads, dim=1, output_size=num_q_heads
892
+ )
893
+
894
+ # Modify: MDM set causal to False, and with no attn_mask.
895
+ return F.scaled_dot_product_attention(
896
+ q,
897
+ k,
898
+ v,
899
+ attn_mask=None,
900
+ dropout_p=dropout_p,
901
+ is_causal=False,
902
+ )
903
+
904
+ def attention(
905
+ self,
906
+ q: torch.Tensor,
907
+ k: torch.Tensor,
908
+ v: torch.Tensor,
909
+ attention_bias: Optional[torch.Tensor] = None,
910
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
911
+ use_cache: bool = False,
912
+ ) -> Tuple[torch.Tensor, Optional[Tuple[torch.Tensor, torch.Tensor]]]:
913
+ B, T, C = q.size() # batch size, sequence length, d_model
914
+ dtype = k.dtype
915
+
916
+ # Optionally apply layer norm to keys and queries.
917
+ if self.q_norm is not None and self.k_norm is not None:
918
+ q = self.q_norm(q).to(dtype=dtype)
919
+ k = self.k_norm(k).to(dtype=dtype)
920
+
921
+ # Move head forward to be next to the batch dim.
922
+ # shape: (B, nh, T, hs)
923
+ q = q.view(B, T, self.config.n_heads, C // self.config.n_heads).transpose(1, 2)
924
+ # shape: (B, n_kv_h, T, hs)
925
+ k = k.view(
926
+ B, T, self.config.effective_n_kv_heads, C // self.config.n_heads
927
+ ).transpose(1, 2)
928
+ # shape: (B, n_kv_h, T, hs)
929
+ v = v.view(
930
+ B, T, self.config.effective_n_kv_heads, C // self.config.n_heads
931
+ ).transpose(1, 2)
932
+
933
+ if layer_past is not None:
934
+ past_key, past_value = layer_past
935
+ k = torch.cat((past_key, k), dim=-2)
936
+ v = torch.cat((past_value, v), dim=-2)
937
+
938
+ present = (k, v) if use_cache else None
939
+ query_len, key_len = (
940
+ q.shape[-2],
941
+ k.shape[-2],
942
+ ) # could be different if layer_past not None
943
+
944
+ if self.config.rope:
945
+ # Apply rotary embeddings.
946
+ q, k = self.rotary_emb(q, k)
947
+
948
+ if attention_bias is not None:
949
+ # Resize and cast attention bias.
950
+ # The current dtype of the attention bias might not match the dtype that the SDP attn function will
951
+ # run in if AMP is enabled, and this can be a problem if some tokens are masked out due to padding
952
+ # as down-casting the attention bias to the autocast precision will result in -infs, which will
953
+ # cause the SDP attn function to produce NaNs.
954
+ attention_bias = self._cast_attn_bias(
955
+ attention_bias[:, :, key_len - query_len : key_len, :key_len], dtype
956
+ )
957
+
958
+ # Get the attention scores.
959
+ # shape: (B, nh, T, hs)
960
+ att = self._scaled_dot_product_attention(
961
+ q,
962
+ k,
963
+ v,
964
+ attn_mask=None,
965
+ dropout_p=0.0 if not self.training else self.config.attention_dropout,
966
+ is_causal=False,
967
+ )
968
+
969
+ # Re-assemble all head outputs side-by-side.
970
+ att = att.transpose(1, 2).contiguous().view(B, T, C)
971
+
972
+ # Apply output projection.
973
+ return self.attn_out(att), present
974
+
975
+ @abstractmethod
976
+ def forward(
977
+ self,
978
+ x: torch.Tensor,
979
+ attention_bias: Optional[torch.FloatTensor] = None,
980
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
981
+ use_cache: bool = False,
982
+ ) -> Tuple[torch.Tensor, Optional[Tuple[torch.Tensor, torch.Tensor]]]:
983
+ raise NotImplementedError
984
+
985
+ @classmethod
986
+ def build(
987
+ cls, layer_id: int, config: ModelConfig, cache: BufferCache
988
+ ) -> LLaDABlock:
989
+ if config.block_type == BlockType.sequential:
990
+ return LLaDASequentialBlock(layer_id, config, cache)
991
+ elif config.block_type == BlockType.llama:
992
+ return LLaDALlamaBlock(layer_id, config, cache)
993
+ else:
994
+ raise NotImplementedError(f"Unknown block type: '{config.block_type}'")
995
+
996
+
997
+ class LLaDASequentialBlock(LLaDABlock):
998
+ """
999
+ This is a typical transformer block where the output is computed as ``MLP(LN(x + Attention(LN(x))))``
1000
+ (plus another skip connection).
1001
+ """
1002
+
1003
+ def __init__(self, layer_id: int, config: ModelConfig, cache: BufferCache):
1004
+ super().__init__(layer_id, config, cache)
1005
+ # Layer norms.
1006
+ self.attn_norm = LayerNorm.build(config)
1007
+ self.ff_norm = LayerNorm.build(config)
1008
+ # Attention input projection. Projects x -> (q, k, v)
1009
+ head_dim = config.d_model // config.n_heads
1010
+ self.fused_dims = (
1011
+ config.d_model,
1012
+ config.effective_n_kv_heads * head_dim,
1013
+ config.effective_n_kv_heads * head_dim,
1014
+ )
1015
+ self.att_proj = nn.Linear(
1016
+ config.d_model,
1017
+ sum(self.fused_dims),
1018
+ bias=config.include_bias | config.include_qkv_bias,
1019
+ device=config.init_device,
1020
+ )
1021
+ # Feed-forward input projection.
1022
+ self.ff_proj = nn.Linear(
1023
+ config.d_model,
1024
+ self.hidden_size,
1025
+ bias=config.include_bias,
1026
+ device=config.init_device,
1027
+ )
1028
+
1029
+ def reset_parameters(self):
1030
+ super().reset_parameters()
1031
+ self.attn_norm.reset_parameters()
1032
+ self.ff_norm.reset_parameters()
1033
+ # NOTE: the standard deviation for these weights does not depend on the layer.
1034
+ init_weights(
1035
+ self.config,
1036
+ self.att_proj,
1037
+ d=self.config.d_model,
1038
+ layer_id=None,
1039
+ type_of_module=ModuleType.in_module,
1040
+ )
1041
+ init_weights(
1042
+ self.config,
1043
+ self.ff_proj,
1044
+ d=self.config.d_model,
1045
+ layer_id=None,
1046
+ type_of_module=ModuleType.in_module,
1047
+ )
1048
+
1049
+ def forward(
1050
+ self,
1051
+ x: torch.Tensor,
1052
+ attention_bias: Optional[torch.Tensor] = None,
1053
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
1054
+ use_cache: bool = False,
1055
+ ) -> Tuple[torch.Tensor, Optional[Tuple[torch.Tensor, torch.Tensor]]]:
1056
+ # Get query, key, value projections.
1057
+ # shape:
1058
+ # - for regular attn q, k, v: (batch_size, seq_len, d_model)
1059
+ # - for multi-query attn q: (batch_size, seq_len, d_model)
1060
+ # k, v: (batch_size, seq_len, d_model // n_heads)
1061
+ # - for group query attn q: (batch_size, seq_len, d_model)
1062
+ # k, v: (batch_size, seq_len, d_model // n_kv_heads)
1063
+ if self._activation_checkpoint_fn is not None:
1064
+ q, k, v = self.att_proj(
1065
+ self._activation_checkpoint_fn(self.attn_norm, x)
1066
+ ).split(self.fused_dims, dim=-1)
1067
+ else:
1068
+ q, k, v = self.att_proj(self.attn_norm(x)).split(self.fused_dims, dim=-1)
1069
+
1070
+ # Get attention scores.
1071
+ if self._activation_checkpoint_fn is not None:
1072
+ att, cache = self._activation_checkpoint_fn( # type: ignore
1073
+ self.attention,
1074
+ q,
1075
+ k,
1076
+ v,
1077
+ attention_bias,
1078
+ layer_past=layer_past,
1079
+ use_cache=use_cache,
1080
+ )
1081
+ else:
1082
+ att, cache = self.attention(
1083
+ q, k, v, attention_bias, layer_past=layer_past, use_cache=use_cache
1084
+ )
1085
+
1086
+ # Add attention scores.
1087
+ # shape: (B, T, C)
1088
+ x = x + self.dropout(att)
1089
+
1090
+ # Add feed-forward projection.
1091
+ # shape: (batch_size, seq_len, d_model)
1092
+ og_x = x
1093
+ if self._activation_checkpoint_fn is not None:
1094
+ x = self._activation_checkpoint_fn(self.ff_norm, x) # type: ignore
1095
+ else:
1096
+ x = self.ff_norm(x)
1097
+ x = self.ff_proj(x)
1098
+ if self._activation_checkpoint_fn is not None:
1099
+ x = self._activation_checkpoint_fn(self.act, x) # type: ignore
1100
+ else:
1101
+ x = self.act(x)
1102
+ x = self.ff_out(x)
1103
+ x = self.dropout(x)
1104
+ x = og_x + x
1105
+
1106
+ return x, cache
1107
+
1108
+
1109
+ class LLaDALlamaBlock(LLaDABlock):
1110
+ """
1111
+ This is a transformer block where the output is computed as ``MLP(LN(x + Attention(LN(x))))``
1112
+ (plus another skip connection). This block is similar to `LLaDASequentialBlock`
1113
+ but some operations have slightly different implementations to imitate the
1114
+ behavior of Llama.
1115
+ """
1116
+
1117
+ def __init__(self, layer_id: int, config: ModelConfig, cache: BufferCache):
1118
+ super().__init__(layer_id, config, cache)
1119
+ # Layer norms.
1120
+ self.attn_norm = LayerNorm.build(config)
1121
+ self.ff_norm = LayerNorm.build(config)
1122
+ self.__cache = cache
1123
+
1124
+ # Attention input projection. Projects x -> (q, k, v)
1125
+ head_dim = config.d_model // config.n_heads
1126
+ q_proj_out_dim = config.d_model
1127
+ k_proj_out_dim = config.effective_n_kv_heads * head_dim
1128
+ v_proj_out_dim = config.effective_n_kv_heads * head_dim
1129
+ self.q_proj = nn.Linear(
1130
+ config.d_model,
1131
+ q_proj_out_dim,
1132
+ bias=config.include_bias | config.include_qkv_bias,
1133
+ device=config.init_device,
1134
+ )
1135
+ self.k_proj = nn.Linear(
1136
+ config.d_model,
1137
+ k_proj_out_dim,
1138
+ bias=config.include_bias | config.include_qkv_bias,
1139
+ device=config.init_device,
1140
+ )
1141
+ self.v_proj = nn.Linear(
1142
+ config.d_model,
1143
+ v_proj_out_dim,
1144
+ bias=config.include_bias | config.include_qkv_bias,
1145
+ device=config.init_device,
1146
+ )
1147
+
1148
+ # Feed-forward input projection.
1149
+ self.ff_proj = nn.Linear(
1150
+ config.d_model,
1151
+ self.hidden_size,
1152
+ bias=config.include_bias,
1153
+ device=config.init_device,
1154
+ )
1155
+ # new add
1156
+ self.up_proj = nn.Linear(
1157
+ config.d_model,
1158
+ self.hidden_size,
1159
+ bias=config.include_bias,
1160
+ device=config.init_device,
1161
+ )
1162
+
1163
+ def reset_parameters(self):
1164
+ super().reset_parameters()
1165
+ self.attn_norm.reset_parameters()
1166
+ self.ff_norm.reset_parameters()
1167
+ # NOTE: the standard deviation for these weights does not depend on the layer.
1168
+ init_weights(self.config, self.q_proj, d=self.config.d_model, layer_id=None)
1169
+ init_weights(self.config, self.k_proj, d=self.config.d_model, layer_id=None)
1170
+ init_weights(self.config, self.v_proj, d=self.config.d_model, layer_id=None)
1171
+ init_weights(self.config, self.ff_proj, d=self.config.d_model, layer_id=None)
1172
+ init_weights(
1173
+ self.config, self.up_proj, d=self.config.d_model, layer_id=None
1174
+ ) # new add
1175
+
1176
+ def forward(
1177
+ self,
1178
+ x: torch.Tensor,
1179
+ attention_bias: Optional[torch.Tensor] = None,
1180
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
1181
+ use_cache: bool = False,
1182
+ ) -> Tuple[torch.Tensor, Optional[Tuple[torch.Tensor, torch.Tensor]]]:
1183
+ # Get query, key, value projections.
1184
+ # shape:
1185
+ # - for regular attn q, k, v: (batch_size, seq_len, d_model)
1186
+ # - for multi-query attn q: (batch_size, seq_len, d_model)
1187
+ # k, v: (batch_size, seq_len, d_model // n_heads)
1188
+ # - for group query attn q: (batch_size, seq_len, d_model)
1189
+ # k, v: (batch_size, seq_len, d_model // n_kv_heads)
1190
+ x_normed = self.attn_norm(x)
1191
+ q = self.q_proj(x_normed)
1192
+ k = self.k_proj(x_normed)
1193
+ v = self.v_proj(x_normed)
1194
+
1195
+ # Get attention scores.
1196
+ if self._activation_checkpoint_fn is not None:
1197
+ att, cache = self._activation_checkpoint_fn( # type: ignore
1198
+ self.attention,
1199
+ q,
1200
+ k,
1201
+ v,
1202
+ attention_bias,
1203
+ layer_past=layer_past,
1204
+ use_cache=use_cache,
1205
+ )
1206
+ else:
1207
+ att, cache = self.attention(
1208
+ q, k, v, attention_bias, layer_past=layer_past, use_cache=use_cache
1209
+ )
1210
+
1211
+ # Add attention scores.
1212
+ # shape: (B, T, C)
1213
+ x = x + self.dropout(att)
1214
+
1215
+ # Add feed-forward projection.
1216
+ # shape: (batch_size, seq_len, d_model)
1217
+ og_x = x
1218
+ if self._activation_checkpoint_fn is not None:
1219
+ x = self._activation_checkpoint_fn(self.ff_norm, x) # type: ignore
1220
+ else:
1221
+ x = self.ff_norm(x)
1222
+ x, x_up = self.ff_proj(x), self.up_proj(x) # new add
1223
+ if self._activation_checkpoint_fn is not None:
1224
+ x = self._activation_checkpoint_fn(self.act, x) # type: ignore
1225
+ else:
1226
+ x = self.act(x)
1227
+ x = x * x_up # new add
1228
+ x = self.ff_out(x)
1229
+ x = self.dropout(x)
1230
+ x = og_x + x
1231
+
1232
+ return x, cache
1233
+
1234
+
1235
+ class LLaDAOutput(NamedTuple):
1236
+ logits: torch.FloatTensor
1237
+ """
1238
+ A tensor of shape `(batch_size, seq_len, vocab_size)` representing the log probabilities
1239
+ for the next token *before* normalization via (log) softmax.
1240
+ """
1241
+
1242
+ attn_key_values: Optional[List[Tuple[torch.Tensor, torch.Tensor]]]
1243
+ """
1244
+ Attention keys and values from each block.
1245
+ """
1246
+
1247
+ hidden_states: Optional[Tuple[torch.Tensor]]
1248
+ """
1249
+ Hidden states from each block.
1250
+ """
1251
+
1252
+
1253
+ class LLaDAGenerateOutput(NamedTuple):
1254
+ token_ids: torch.LongTensor
1255
+ """
1256
+ The generated token IDs, a tensor of shape `(batch_size, beam_size, max_steps)`.
1257
+ These do *not* include the original input IDs.
1258
+ """
1259
+
1260
+ scores: torch.FloatTensor
1261
+ """
1262
+ The scores of the generated sequences, a tensor of shape `(batch_size, beam_size)`.
1263
+ """
1264
+
1265
+
1266
+ class LLaDABlockGroup(nn.ModuleList):
1267
+ def __init__(
1268
+ self,
1269
+ config: ModelConfig,
1270
+ layer_offset: int,
1271
+ modules: Optional[Iterable[nn.Module]] = None,
1272
+ ):
1273
+ super().__init__(modules)
1274
+ self.config = config
1275
+ self.layer_offset = layer_offset
1276
+ self.activation_checkpointing_strategy: Optional[
1277
+ ActivationCheckpointingStrategy
1278
+ ] = None
1279
+ self._activation_checkpoint_fn = activation_checkpoint_function(self.config)
1280
+
1281
+ def forward(
1282
+ self,
1283
+ x: torch.Tensor,
1284
+ attention_bias: Optional[torch.FloatTensor] = None,
1285
+ layers_past: Optional[List[Tuple[torch.Tensor, torch.Tensor]]] = None,
1286
+ use_cache: bool = False,
1287
+ ) -> Tuple[torch.Tensor, Optional[List[Tuple[torch.Tensor, torch.Tensor]]]]:
1288
+ attn_key_values: Optional[List[Tuple[torch.Tensor, torch.Tensor]]] = (
1289
+ [] if use_cache else None
1290
+ )
1291
+ for block_idx, block in enumerate(self):
1292
+ layer_past = None if layers_past is None else layers_past[block_idx]
1293
+ block_idx += self.layer_offset
1294
+ if (
1295
+ (
1296
+ self.activation_checkpointing_strategy
1297
+ == ActivationCheckpointingStrategy.whole_layer
1298
+ )
1299
+ or (
1300
+ self.activation_checkpointing_strategy
1301
+ == ActivationCheckpointingStrategy.one_in_two
1302
+ and block_idx % 2 == 0
1303
+ )
1304
+ or (
1305
+ self.activation_checkpointing_strategy
1306
+ == ActivationCheckpointingStrategy.one_in_three
1307
+ and block_idx % 3 == 0
1308
+ )
1309
+ or (
1310
+ self.activation_checkpointing_strategy
1311
+ == ActivationCheckpointingStrategy.one_in_four
1312
+ and block_idx % 4 == 0
1313
+ )
1314
+ ):
1315
+ # shape: (batch_size, seq_len, d_model)
1316
+ x, cache = self._activation_checkpoint_fn( # type: ignore
1317
+ block,
1318
+ x,
1319
+ attention_bias=attention_bias,
1320
+ layer_past=layer_past,
1321
+ use_cache=use_cache,
1322
+ )
1323
+ else:
1324
+ # shape: (batch_size, seq_len, d_model)
1325
+ x, cache = block(
1326
+ x,
1327
+ attention_bias=attention_bias,
1328
+ layer_past=layer_past,
1329
+ use_cache=use_cache,
1330
+ )
1331
+ if attn_key_values is not None:
1332
+ assert cache is not None
1333
+ attn_key_values.append(cache)
1334
+ return x, attn_key_values
1335
+
1336
+ def reset_parameters(self):
1337
+ for block in self:
1338
+ block.reset_parameters()
1339
+
1340
+ def set_activation_checkpointing(
1341
+ self, strategy: Optional[ActivationCheckpointingStrategy]
1342
+ ):
1343
+ self.activation_checkpointing_strategy = strategy
1344
+ for block in self:
1345
+ block.set_activation_checkpointing(strategy)
1346
+
1347
+
1348
+ class LLaDAModel(nn.Module):
1349
+ def __init__(self, config: ModelConfig, init_params: bool = True):
1350
+ super().__init__()
1351
+ self.config = config
1352
+ self.__cache = BufferCache()
1353
+
1354
+ # Validate config.
1355
+ if self.config.alibi and self.config.flash_attention:
1356
+ raise Exception("ALiBi is currently not supported with FlashAttention")
1357
+
1358
+ if self.config.alibi and self.config.rope:
1359
+ raise Exception("ALiBi and RoPE are mutually exclusive")
1360
+
1361
+ if (
1362
+ self.config.embedding_size is not None
1363
+ and self.config.embedding_size != self.config.vocab_size
1364
+ ):
1365
+ if self.config.embedding_size < self.config.vocab_size:
1366
+ raise Exception(
1367
+ "embedding size should be at least as big as vocab size"
1368
+ )
1369
+ elif self.config.embedding_size % 128 != 0:
1370
+ import warnings
1371
+
1372
+ warnings.warn(
1373
+ "Embedding size is not a multiple of 128! This could hurt throughput performance.",
1374
+ UserWarning,
1375
+ )
1376
+
1377
+ self.activation_checkpointing_strategy: Optional[
1378
+ ActivationCheckpointingStrategy
1379
+ ] = None
1380
+ self._activation_checkpoint_fn: Callable = activation_checkpoint_function(
1381
+ self.config
1382
+ )
1383
+
1384
+ if not (
1385
+ 0 < self.config.block_group_size <= self.config.n_layers
1386
+ and self.config.n_layers % self.config.block_group_size == 0
1387
+ ):
1388
+ raise Exception("n layers must be divisible by block group size")
1389
+
1390
+ torch.backends.cuda.enable_flash_sdp(True)
1391
+ torch.backends.cuda.enable_mem_efficient_sdp(
1392
+ False
1393
+ ) # this is super slow so make sure torch won't use it
1394
+
1395
+ self.transformer = nn.ModuleDict(
1396
+ dict(
1397
+ wte=nn.Embedding(
1398
+ config.embedding_size or config.vocab_size,
1399
+ config.d_model,
1400
+ device=config.init_device,
1401
+ ),
1402
+ emb_drop=Dropout(config.embedding_dropout),
1403
+ ln_f=LayerNorm.build(config),
1404
+ )
1405
+ )
1406
+
1407
+ blocks = [
1408
+ LLaDABlock.build(i, config, self.__cache) for i in range(config.n_layers)
1409
+ ]
1410
+ if self.config.block_group_size > 1:
1411
+ block_groups = [
1412
+ LLaDABlockGroup(config, i, blocks[i : i + config.block_group_size])
1413
+ for i in range(0, config.n_layers, config.block_group_size)
1414
+ ]
1415
+ self.transformer.update({"block_groups": nn.ModuleList(block_groups)})
1416
+ else:
1417
+ self.transformer.update({"blocks": nn.ModuleList(blocks)})
1418
+
1419
+ if not (self.config.alibi or self.config.rope):
1420
+ self.transformer.update(
1421
+ {
1422
+ "wpe": nn.Embedding(
1423
+ config.max_sequence_length,
1424
+ config.d_model,
1425
+ device=config.init_device,
1426
+ )
1427
+ }
1428
+ )
1429
+ if not config.weight_tying:
1430
+ self.transformer.update(
1431
+ {
1432
+ "ff_out": nn.Linear(
1433
+ config.d_model,
1434
+ config.embedding_size or config.vocab_size,
1435
+ bias=config.include_bias,
1436
+ device=config.init_device,
1437
+ )
1438
+ }
1439
+ )
1440
+ # When `init_device="meta"` FSDP will call `reset_parameters()` to initialize weights.
1441
+ if init_params and self.config.init_device != "meta":
1442
+ self.reset_parameters()
1443
+ self.__num_fwd_flops: Optional[int] = None
1444
+
1445
+ # Warm up cache.
1446
+ if self.config.alibi:
1447
+ get_causal_attention_bias(
1448
+ self.__cache, config.max_sequence_length, _non_meta_init_device(config)
1449
+ )
1450
+ self.get_alibi_attention_bias(
1451
+ config.max_sequence_length, _non_meta_init_device(config)
1452
+ )
1453
+
1454
+ def set_activation_checkpointing(
1455
+ self, strategy: Optional[ActivationCheckpointingStrategy]
1456
+ ):
1457
+ self.activation_checkpointing_strategy = strategy
1458
+ if self.config.block_group_size != 1:
1459
+ for block_group in self.transformer.block_groups:
1460
+ block_group.set_activation_checkpointing(strategy)
1461
+ else:
1462
+ for block in self.transformer.blocks:
1463
+ block.set_activation_checkpointing(strategy)
1464
+
1465
+ @property
1466
+ def device(self) -> torch.device:
1467
+ device: torch.device = self.transformer.wte.weight.device # type: ignore
1468
+ if device.type == "meta":
1469
+ return _non_meta_init_device(self.config)
1470
+ else:
1471
+ return device
1472
+
1473
+ def reset_parameters(self):
1474
+ log.info("Initializing model parameters...")
1475
+ # Top-level embeddings / linear layers.
1476
+ init_weights(
1477
+ self.config,
1478
+ self.transformer.wte, # type: ignore
1479
+ std_factor=(0.5 * math.sqrt(self.config.d_model))
1480
+ if self.config.scale_logits
1481
+ else 1.0,
1482
+ type_of_module=ModuleType.emb,
1483
+ )
1484
+ if hasattr(self.transformer, "wpe"):
1485
+ init_weights(
1486
+ self.config, self.transformer.wpe, type_of_module=ModuleType.emb
1487
+ ) # type: ignore
1488
+
1489
+ # Top-level layer norm.
1490
+ self.transformer.ln_f.reset_parameters() # type: ignore
1491
+
1492
+ # Output weights.
1493
+ if hasattr(self.transformer, "ff_out"):
1494
+ init_weights(
1495
+ self.config,
1496
+ self.transformer.ff_out,
1497
+ type_of_module=ModuleType.final_out,
1498
+ ) # type: ignore
1499
+
1500
+ # Let the blocks handle themselves.
1501
+ if self.config.block_group_size == 1:
1502
+ for block in self.transformer.blocks:
1503
+ block.reset_parameters()
1504
+ else:
1505
+ for block_group in self.transformer.block_groups:
1506
+ block_group.reset_parameters()
1507
+
1508
+ def get_alibi_attention_bias(
1509
+ self, seq_len: int, device: torch.device
1510
+ ) -> torch.Tensor:
1511
+ if (
1512
+ alibi_bias := self.__cache.get("alibi_attention_bias")
1513
+ ) is not None and alibi_bias.shape[-1] >= seq_len:
1514
+ if alibi_bias.device != device:
1515
+ alibi_bias = alibi_bias.to(device)
1516
+ self.__cache["alibi_attention_bias"] = alibi_bias
1517
+ return alibi_bias
1518
+ with torch.autocast(device.type, enabled=False):
1519
+ alibi_bias = alibi_attention_bias(seq_len, self.config, device)
1520
+ self.__cache["alibi_attention_bias"] = alibi_bias
1521
+ return alibi_bias
1522
+
1523
+ def forward(
1524
+ self,
1525
+ input_ids: torch.LongTensor,
1526
+ input_embeddings: Optional[torch.FloatTensor] = None,
1527
+ attention_mask: Optional[torch.Tensor] = None,
1528
+ attention_bias: Optional[torch.Tensor] = None,
1529
+ past_key_values: Optional[Sequence[Tuple[torch.Tensor, torch.Tensor]]] = None,
1530
+ use_cache: bool = False,
1531
+ last_logits_only: bool = False,
1532
+ output_hidden_states: Optional[bool] = None,
1533
+ ) -> LLaDAOutput:
1534
+ """
1535
+ :param input_ids: A tensor of shape `(batch_size, seq_len)`.
1536
+ :param input_embeddings: A tensor of shape `(batch_size, seq_len, d_model)` with input
1537
+ embeddings. When provided, it is treated as the output of the input embedding layer.
1538
+ :param attention_mask: A tensor of shape `(batch_size, seq_len)` that indicates
1539
+ which input IDs are masked. A `1` value in the mask means that
1540
+ the corresponding input ID should *not* be ignored. A `0` means
1541
+ that the corresponding input ID is masked.
1542
+
1543
+ This has the same meaning as the `attention_mask` in HuggingFace's `transformers`
1544
+ library.
1545
+ :param attention_bias: A tensor of shape `(batch_size, 1, seq_len, seq_len)`,
1546
+ `(1, 1, seq_len, seq_len)`, or `(seq_len, seq_len)`. This is used
1547
+ to introduce causal or other biases.
1548
+
1549
+ If the tensor is a bool or byte tensor, a `True` or `1` at `attention_bias[:, :, i, j]`
1550
+ indicates that the i-th element in the sequence is allowed to attend to the j-th
1551
+ element in the sequence.
1552
+
1553
+ If the tensor is a float tensor, it will just be added to the attention
1554
+ scores before the softmax.
1555
+
1556
+ The default is causal, which corresponds to a lower-diagonal byte matrix of ones.
1557
+ :param past_key_values: Pre-computed keys and values for each attention block.
1558
+ Can be used to speed up sequential decoding. The `input_ids` which have
1559
+ their past given to this model should not be passed as `input_ids` as they have already been computed.
1560
+ :param use_cache: If `True`, return key and value tensors for each block.
1561
+ :param last_logits_only: If `True`, only compute the logits for the last token of each sequence.
1562
+ This can speed up decoding when you only care about the next token.
1563
+ """
1564
+ # Add Basic MDM Model config check
1565
+ assert not self.config.alibi, (
1566
+ "Alibi length extrapolation is not supported for MDM."
1567
+ )
1568
+ assert self.config.rope, "Rope must be used in Llama-Encoder for MDM."
1569
+ assert past_key_values is None and not use_cache, (
1570
+ "The kvcache is not suppotred for MDM."
1571
+ )
1572
+
1573
+ output_hidden_states = (
1574
+ output_hidden_states if output_hidden_states is not None else False
1575
+ )
1576
+
1577
+ if past_key_values:
1578
+ assert len(past_key_values) == self.config.n_layers
1579
+
1580
+ batch_size, seq_len = (
1581
+ input_ids.size()
1582
+ if input_embeddings is None
1583
+ else input_embeddings.size()[:2]
1584
+ )
1585
+ if past_key_values is None:
1586
+ past_length = 0
1587
+ else:
1588
+ past_length = past_key_values[0][0].size(-2)
1589
+
1590
+ # Get embeddings of input.
1591
+ # shape: (batch_size, seq_len, d_model)
1592
+ x = (
1593
+ self.transformer.wte(input_ids)
1594
+ if input_embeddings is None
1595
+ else input_embeddings
1596
+ ) # type: ignore
1597
+
1598
+ if self.config.input_emb_norm:
1599
+ x = x * (self.config.d_model**0.5)
1600
+
1601
+ if not (self.config.alibi or self.config.rope):
1602
+ # Get positional embeddings.
1603
+ # shape: (1, seq_len)
1604
+ pos = torch.arange(
1605
+ past_length, past_length + seq_len, dtype=torch.long, device=x.device
1606
+ ).unsqueeze(0)
1607
+ # shape: (1, seq_len, d_model)
1608
+ pos_emb = self.transformer.wpe(pos) # type: ignore
1609
+ x = pos_emb + x
1610
+
1611
+ # Add input + positional embeddings and apply dropout.
1612
+ # shape: (batch_size, seq_len, d_model)
1613
+ x = self.transformer.emb_drop(x) # type: ignore
1614
+
1615
+ # Transform the attention mask into what the blocks expect.
1616
+ if attention_mask is not None and 0.0 in attention_mask:
1617
+ # shape: (batch_size, 1, 1, seq_len)
1618
+ attention_mask = attention_mask.to(dtype=torch.float).view(batch_size, -1)[
1619
+ :, None, None, :
1620
+ ]
1621
+ attention_mask = (1.0 - attention_mask) * torch.finfo(
1622
+ attention_mask.dtype
1623
+ ).min
1624
+ else:
1625
+ attention_mask = None
1626
+
1627
+ # Merge attention mask with attention bias.
1628
+ if (
1629
+ attention_bias is not None
1630
+ or attention_mask is not None
1631
+ or self.config.alibi
1632
+ # NOTE (epwalsh): we need to initialize the attn bias in order for attn to work properly
1633
+ # with key+value cache. Otherwise `F.scaled_dot_product_attention()` doesn't seem to compute
1634
+ # scores correctly.
1635
+ or past_key_values is not None
1636
+ ):
1637
+ if attention_bias is None and self.config.alibi:
1638
+ attention_bias = get_causal_attention_bias(
1639
+ self.__cache, past_length + seq_len, x.device
1640
+ ) + self.get_alibi_attention_bias(past_length + seq_len, x.device)
1641
+ elif attention_bias is None:
1642
+ attention_bias = get_causal_attention_bias(
1643
+ self.__cache, past_length + seq_len, x.device
1644
+ )
1645
+ elif attention_bias.dtype in (torch.int8, torch.bool):
1646
+ attention_bias = attention_bias.to(dtype=torch.float)
1647
+ attention_bias.masked_fill_(
1648
+ attention_bias == 0.0, torch.finfo(attention_bias.dtype).min
1649
+ )
1650
+
1651
+ # Transform to the right shape and data type.
1652
+ mask_len = seq_len
1653
+ if attention_mask is not None:
1654
+ mask_len = attention_mask.shape[-1]
1655
+ elif past_key_values is not None:
1656
+ mask_len = past_key_values[0][0].shape[-2] + seq_len
1657
+ attention_bias = attention_bias[:, :, :mask_len, :mask_len].to(
1658
+ dtype=torch.float
1659
+ )
1660
+
1661
+ # Add in the masking bias.
1662
+ if attention_mask is not None:
1663
+ attention_bias = attention_bias + attention_mask
1664
+ # Might get -infs after adding attention mask, since dtype.min + dtype.min = -inf.
1665
+ # `F.scaled_dot_product_attention()` doesn't handle -inf like you'd expect, instead
1666
+ # it can produce NaNs.
1667
+ ensure_finite_(attention_bias, check_neg_inf=True, check_pos_inf=False)
1668
+
1669
+ attn_key_values: Optional[List[Tuple[torch.Tensor, torch.Tensor]]] = (
1670
+ [] if use_cache else None
1671
+ )
1672
+
1673
+ # decoder layers
1674
+ all_hidden_states = []
1675
+
1676
+ # Apply blocks one-by-one.
1677
+ if self.config.block_group_size == 1:
1678
+ for block_idx, block in enumerate(self.transformer.blocks):
1679
+ if output_hidden_states:
1680
+ # add hidden states
1681
+ all_hidden_states.append(x)
1682
+
1683
+ layer_past = (
1684
+ None if past_key_values is None else past_key_values[block_idx]
1685
+ )
1686
+ if (
1687
+ (
1688
+ self.activation_checkpointing_strategy
1689
+ == ActivationCheckpointingStrategy.whole_layer
1690
+ )
1691
+ or (
1692
+ self.activation_checkpointing_strategy
1693
+ == ActivationCheckpointingStrategy.one_in_two
1694
+ and block_idx % 2 == 0
1695
+ )
1696
+ or (
1697
+ self.activation_checkpointing_strategy
1698
+ == ActivationCheckpointingStrategy.one_in_three
1699
+ and block_idx % 3 == 0
1700
+ )
1701
+ or (
1702
+ self.activation_checkpointing_strategy
1703
+ == ActivationCheckpointingStrategy.one_in_four
1704
+ and block_idx % 4 == 0
1705
+ )
1706
+ ):
1707
+ # shape: (batch_size, seq_len, d_model)
1708
+ x, cache = self._activation_checkpoint_fn(
1709
+ block,
1710
+ x,
1711
+ attention_bias=attention_bias,
1712
+ layer_past=layer_past,
1713
+ use_cache=use_cache,
1714
+ )
1715
+ else:
1716
+ # shape: (batch_size, seq_len, d_model)
1717
+ x, cache = block(
1718
+ x,
1719
+ attention_bias=attention_bias,
1720
+ layer_past=layer_past,
1721
+ use_cache=use_cache,
1722
+ )
1723
+ if attn_key_values is not None:
1724
+ assert cache is not None
1725
+ attn_key_values.append(cache)
1726
+ else:
1727
+ for group_idx, block_group in enumerate(self.transformer.block_groups):
1728
+ if output_hidden_states:
1729
+ # add hidden states
1730
+ all_hidden_states.append(x)
1731
+
1732
+ layers_past = (
1733
+ None
1734
+ if past_key_values is None
1735
+ else past_key_values[
1736
+ group_idx * self.config.block_group_size : (group_idx + 1)
1737
+ * self.config.block_group_size
1738
+ ]
1739
+ )
1740
+ x, cache = block_group(
1741
+ x,
1742
+ attention_bias=attention_bias,
1743
+ layers_past=layers_past,
1744
+ use_cache=use_cache,
1745
+ )
1746
+ if attn_key_values is not None:
1747
+ assert cache is not None
1748
+ attn_key_values.extend(cache)
1749
+
1750
+ if last_logits_only:
1751
+ # shape: (batch_size, 1, d_model)
1752
+ x = x[:, -1, :].unsqueeze(1)
1753
+
1754
+ # Apply final layer norm.
1755
+ # shape: (batch_size, seq_len or 1, d_model)
1756
+ x = self.transformer.ln_f(x) # type: ignore
1757
+ if output_hidden_states:
1758
+ # add final hidden state post-final-layernorm, following HuggingFace's convention
1759
+ all_hidden_states.append(x)
1760
+
1761
+ # Get logits.
1762
+ # shape: (batch_size, seq_len or 1, vocab_size)
1763
+ if self.config.weight_tying:
1764
+ logits = F.linear(x, self.transformer.wte.weight, None) # type: ignore
1765
+ else:
1766
+ logits = self.transformer.ff_out(x) # type: ignore
1767
+ if self.config.scale_logits:
1768
+ logits.mul_(1 / math.sqrt(self.config.d_model))
1769
+
1770
+ return LLaDAOutput(
1771
+ logits=logits,
1772
+ attn_key_values=attn_key_values,
1773
+ hidden_states=tuple(all_hidden_states) if output_hidden_states else None,
1774
+ ) # type: ignore[arg-type]
1775
+
1776
+
1777
+ def create_model_config_from_pretrained_config(config: LLaDAConfig):
1778
+ """
1779
+ Utility function
1780
+ """
1781
+
1782
+ kwargs = {}
1783
+ for field in fields(ModelConfig):
1784
+ kwargs[field.name] = getattr(config, field.name)
1785
+
1786
+ model_config = ModelConfig(**kwargs)
1787
+ return model_config
1788
+
1789
+
1790
+ class LLaDAModelLM(PreTrainedModel):
1791
+ """
1792
+ Extremely barebones HF model wrapper.
1793
+ """
1794
+
1795
+ config_class = LLaDAConfig
1796
+ base_model_prefix = "model"
1797
+ _no_split_modules = ["LLaDABlock", "LLaDASequentialBlock", "LLaDALlamaBlock"]
1798
+
1799
+ def __init__(
1800
+ self,
1801
+ config: LLaDAConfig,
1802
+ model: Optional[LLaDAModel] = None,
1803
+ init_params: bool = False,
1804
+ ):
1805
+ super().__init__(config)
1806
+
1807
+ if not model:
1808
+ model_config = create_model_config_from_pretrained_config(config)
1809
+ # Initialize model (always on CPU to start with so we don't run out of GPU memory).
1810
+ model_config.init_device = "cpu"
1811
+ self.model = LLaDAModel(model_config, init_params=init_params)
1812
+ else:
1813
+ self.model = model
1814
+
1815
+ def forward(
1816
+ self,
1817
+ input_ids: torch.LongTensor = None,
1818
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1819
+ attention_mask: Optional[torch.Tensor] = None,
1820
+ attention_bias: Optional[torch.Tensor] = None,
1821
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1822
+ labels: Optional[torch.LongTensor] = None,
1823
+ use_cache: Optional[bool] = None,
1824
+ output_attentions: Optional[bool] = None,
1825
+ output_hidden_states: Optional[bool] = None,
1826
+ return_dict: Optional[bool] = None,
1827
+ cache_position: Optional[
1828
+ Cache
1829
+ ] = None, # This is a hack mitigation of an issue in transformers `4.39.x`
1830
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1831
+ if use_cache is None:
1832
+ use_cache = self.config.use_cache
1833
+
1834
+ if output_attentions:
1835
+ raise ValueError("output_attentions is not yet supported in LLaDA")
1836
+
1837
+ return_dict = (
1838
+ return_dict if return_dict is not None else self.config.use_return_dict
1839
+ )
1840
+
1841
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1842
+ outputs = self.model.forward(
1843
+ input_ids=input_ids,
1844
+ input_embeddings=inputs_embeds,
1845
+ attention_mask=attention_mask,
1846
+ attention_bias=attention_bias,
1847
+ past_key_values=past_key_values,
1848
+ use_cache=use_cache,
1849
+ output_hidden_states=output_hidden_states,
1850
+ )
1851
+
1852
+ logits = outputs.logits
1853
+ hidden_states = outputs.hidden_states
1854
+
1855
+ loss = None
1856
+ if labels is not None:
1857
+ import warnings
1858
+
1859
+ warnings.warn(
1860
+ "Note that for LLaDA, you cannot calculate the loss here.", UserWarning
1861
+ )
1862
+ if not return_dict:
1863
+ output = (logits,) + outputs[1:]
1864
+ return (loss,) + output if loss is not None else output
1865
+
1866
+ return CausalLMOutputWithPast(
1867
+ logits=logits,
1868
+ past_key_values=outputs.attn_key_values,
1869
+ hidden_states=hidden_states,
1870
+ )
1871
+
1872
+ @torch.no_grad()
1873
+ def generate(
1874
+ self,
1875
+ input_ids: torch.Tensor,
1876
+ max_new_tokens: int = 128,
1877
+ steps: int = 128,
1878
+ # block_length: int = 128,
1879
+ temperature: float = 0.0,
1880
+ cfg_scale: float = 0.0,
1881
+ remasking: str = "low_confidence",
1882
+ mask_token_id: int = 126336, # Default from generate_stream
1883
+ ):
1884
+ """
1885
+ Generates token sequences iteratively using the LLaDA masked diffusion approach.
1886
+
1887
+ Args:
1888
+ input_ids (torch.Tensor): Input IDs of shape (batch, prompt_len).
1889
+ max_new_tokens (int): Number of tokens to generate after the prompt.
1890
+ steps (int): Total refinement steps for the generation process.
1891
+ Each block of block_length will be refined over steps/num_blocks.
1892
+ block_length (int): Block size for progressive generation within gen_length.
1893
+ temperature (float): Gumbel noise temperature for sampling. 0 means deterministic.
1894
+ cfg_scale (float): Classifier-free guidance scale. 0 means no CFG.
1895
+ If > 0, model's forward pass is called twice.
1896
+ remasking (str): Remasking strategy ("low_confidence" or "random").
1897
+ mask_token_id (int): Token ID used for masking.
1898
+
1899
+ Returns:
1900
+ torch.Tensor: The final generated sequence tensor of shape
1901
+ (batch, prompt_len + gen_length).
1902
+ """
1903
+ block_length = max_new_tokens // 4
1904
+ self.eval() # Ensure model is in evaluation mode
1905
+ gen_length = max_new_tokens
1906
+ prompt_ids = input_ids
1907
+ if gen_length == 0:
1908
+ return prompt_ids.clone() # Return prompt if no new tokens are requested
1909
+
1910
+ # Ensure prompt_ids are on the same device as the model
1911
+ prompt_ids = prompt_ids.to(self.device)
1912
+
1913
+ final_sequence = None
1914
+ for sequence_at_step in generate_stream(
1915
+ model=self, # Pass the LLaDAModel instance itself
1916
+ prompt_ids=prompt_ids,
1917
+ steps=steps,
1918
+ gen_length=gen_length,
1919
+ block_length=block_length,
1920
+ temperature=temperature,
1921
+ cfg_scale=cfg_scale,
1922
+ remasking=remasking,
1923
+ mask_token_id=mask_token_id,
1924
+ ):
1925
+ final_sequence = sequence_at_step
1926
+
1927
+ # final_sequence should always be populated if gen_length > 0 due to generate_stream logic
1928
+ return final_sequence
1929
+
1930
+
1931
+ def can_generate(self) -> bool:
1932
+ return True
1933
+
1934
+ def prepare_inputs_for_generation(
1935
+ self,
1936
+ input_ids: torch.LongTensor,
1937
+ past_key_values: Optional[List[Tuple]] = None,
1938
+ **kwargs,
1939
+ ):
1940
+ if past_key_values:
1941
+ # This is because we want the model to only process the last generated token.
1942
+ input_ids = input_ids[:, -1:]
1943
+ model_inputs = {"input_ids": input_ids, "past_key_values": past_key_values}
1944
+
1945
+ model_inputs.update(kwargs)
1946
+ model_inputs["use_cache"] = kwargs.pop("use_cache", self.config.use_cache)
1947
+ return model_inputs
1948
+
1949
+ # TODO: these are required to make the implementation complete.
1950
+ # def resize_position_embeddings(self, new_num_position_embeddings: int):
1951
+ # pass
1952
+ #
1953
+ # def get_position_embeddings(self) -> Union[nn.Embedding, Tuple[nn.Embedding]]:
1954
+ # pass
1955
+ #
1956
+ # def _reorder_cache(self, past_key_values, beam_idx):
1957
+ # pass
1958
+
1959
+ def get_input_embeddings(self) -> torch.nn.Module:
1960
+ return self.model.transformer.wte
1961
+
1962
+ def set_input_embeddings(self, value: torch.nn.Module):
1963
+ self.model.transformer.wte = value
1964
+
1965
+ def get_output_embeddings(self):
1966
+ if self.config.weight_tying:
1967
+ return self.model.transformer.wte
1968
+ else:
1969
+ return self.model.transformer.ff_out
1970
+
1971
+ def set_output_embeddings(self, value: torch.nn.Module):
1972
+ if self.config.weight_tying:
1973
+ self.model.transformer.wte = value
1974
+ else:
1975
+ self.model.transformer.ff_out = value
1976
+
1977
+ def tie_weights(self):
1978
+ if self.config.weight_tying:
1979
+ self.model.transformer.ff_out = self.model.transformer.wte
1980
+
1981
+
1982
+ # Register the model so that it is available for transformer pipelines, auto-loading, etc.
1983
+ AutoModel.register(LLaDAConfig, LLaDAModelLM)
special_tokens_map.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<role>",
4
+ "</role>",
5
+ "<|arithmetic_start|>",
6
+ "<|arithmetic_end|>",
7
+ "<|number_start|>",
8
+ "<|number_end|>"
9
+ ],
10
+ "bos_token": {
11
+ "content": "<|startoftext|>",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ },
17
+ "cls_token": {
18
+ "content": "[CLS]",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "eos_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ "pad_token": {
32
+ "content": "<|endoftext|>",
33
+ "lstrip": false,
34
+ "normalized": false,
35
+ "rstrip": false,
36
+ "single_word": false
37
+ }
38
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,2183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "126080": {
6
+ "content": "<|startoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "126081": {
14
+ "content": "<|endoftext|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "126082": {
22
+ "content": "[CLS]",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "126083": {
30
+ "content": "[gMASK]",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "126084": {
38
+ "content": "<|reserved_token_0|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "126085": {
46
+ "content": "<|reserved_token_1|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "126086": {
54
+ "content": "<|reserved_token_2|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "126087": {
62
+ "content": "<|reserved_token_3|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "126088": {
70
+ "content": "<|reserved_token_4|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "126089": {
78
+ "content": "<|reserved_token_5|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "126090": {
86
+ "content": "<|reserved_token_6|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "126091": {
94
+ "content": "<|reserved_token_7|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "126092": {
102
+ "content": "<|reserved_token_8|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "126093": {
110
+ "content": "<|reserved_token_9|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "126094": {
118
+ "content": "<|reserved_token_10|>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": true
124
+ },
125
+ "126095": {
126
+ "content": "<|reserved_token_11|>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": true
132
+ },
133
+ "126096": {
134
+ "content": "<|reserved_token_12|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": true
140
+ },
141
+ "126097": {
142
+ "content": "<|reserved_token_13|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": true
148
+ },
149
+ "126098": {
150
+ "content": "<|reserved_token_14|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": true
156
+ },
157
+ "126099": {
158
+ "content": "<|reserved_token_15|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": true
164
+ },
165
+ "126100": {
166
+ "content": "<|reserved_token_16|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": true
172
+ },
173
+ "126101": {
174
+ "content": "<|reserved_token_17|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": true
180
+ },
181
+ "126102": {
182
+ "content": "<|reserved_token_18|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
+ },
189
+ "126103": {
190
+ "content": "<|reserved_token_19|>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": true
196
+ },
197
+ "126104": {
198
+ "content": "<|reserved_token_20|>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": true
204
+ },
205
+ "126105": {
206
+ "content": "<|reserved_token_21|>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": true
212
+ },
213
+ "126106": {
214
+ "content": "<|reserved_token_22|>",
215
+ "lstrip": false,
216
+ "normalized": false,
217
+ "rstrip": false,
218
+ "single_word": false,
219
+ "special": true
220
+ },
221
+ "126107": {
222
+ "content": "<|reserved_token_23|>",
223
+ "lstrip": false,
224
+ "normalized": false,
225
+ "rstrip": false,
226
+ "single_word": false,
227
+ "special": true
228
+ },
229
+ "126108": {
230
+ "content": "<|reserved_token_24|>",
231
+ "lstrip": false,
232
+ "normalized": false,
233
+ "rstrip": false,
234
+ "single_word": false,
235
+ "special": true
236
+ },
237
+ "126109": {
238
+ "content": "<|reserved_token_25|>",
239
+ "lstrip": false,
240
+ "normalized": false,
241
+ "rstrip": false,
242
+ "single_word": false,
243
+ "special": true
244
+ },
245
+ "126110": {
246
+ "content": "<|reserved_token_26|>",
247
+ "lstrip": false,
248
+ "normalized": false,
249
+ "rstrip": false,
250
+ "single_word": false,
251
+ "special": true
252
+ },
253
+ "126111": {
254
+ "content": "<|reserved_token_27|>",
255
+ "lstrip": false,
256
+ "normalized": false,
257
+ "rstrip": false,
258
+ "single_word": false,
259
+ "special": true
260
+ },
261
+ "126112": {
262
+ "content": "<|reserved_token_28|>",
263
+ "lstrip": false,
264
+ "normalized": false,
265
+ "rstrip": false,
266
+ "single_word": false,
267
+ "special": true
268
+ },
269
+ "126113": {
270
+ "content": "<|reserved_token_29|>",
271
+ "lstrip": false,
272
+ "normalized": false,
273
+ "rstrip": false,
274
+ "single_word": false,
275
+ "special": true
276
+ },
277
+ "126114": {
278
+ "content": "<|reserved_token_30|>",
279
+ "lstrip": false,
280
+ "normalized": false,
281
+ "rstrip": false,
282
+ "single_word": false,
283
+ "special": true
284
+ },
285
+ "126115": {
286
+ "content": "<|reserved_token_31|>",
287
+ "lstrip": false,
288
+ "normalized": false,
289
+ "rstrip": false,
290
+ "single_word": false,
291
+ "special": true
292
+ },
293
+ "126116": {
294
+ "content": "<|reserved_token_32|>",
295
+ "lstrip": false,
296
+ "normalized": false,
297
+ "rstrip": false,
298
+ "single_word": false,
299
+ "special": true
300
+ },
301
+ "126117": {
302
+ "content": "<|reserved_token_33|>",
303
+ "lstrip": false,
304
+ "normalized": false,
305
+ "rstrip": false,
306
+ "single_word": false,
307
+ "special": true
308
+ },
309
+ "126118": {
310
+ "content": "<|reserved_token_34|>",
311
+ "lstrip": false,
312
+ "normalized": false,
313
+ "rstrip": false,
314
+ "single_word": false,
315
+ "special": true
316
+ },
317
+ "126119": {
318
+ "content": "<|reserved_token_35|>",
319
+ "lstrip": false,
320
+ "normalized": false,
321
+ "rstrip": false,
322
+ "single_word": false,
323
+ "special": true
324
+ },
325
+ "126120": {
326
+ "content": "<|reserved_token_36|>",
327
+ "lstrip": false,
328
+ "normalized": false,
329
+ "rstrip": false,
330
+ "single_word": false,
331
+ "special": true
332
+ },
333
+ "126121": {
334
+ "content": "<|reserved_token_37|>",
335
+ "lstrip": false,
336
+ "normalized": false,
337
+ "rstrip": false,
338
+ "single_word": false,
339
+ "special": true
340
+ },
341
+ "126122": {
342
+ "content": "<|reserved_token_38|>",
343
+ "lstrip": false,
344
+ "normalized": false,
345
+ "rstrip": false,
346
+ "single_word": false,
347
+ "special": true
348
+ },
349
+ "126123": {
350
+ "content": "<|reserved_token_39|>",
351
+ "lstrip": false,
352
+ "normalized": false,
353
+ "rstrip": false,
354
+ "single_word": false,
355
+ "special": true
356
+ },
357
+ "126124": {
358
+ "content": "<|reserved_token_40|>",
359
+ "lstrip": false,
360
+ "normalized": false,
361
+ "rstrip": false,
362
+ "single_word": false,
363
+ "special": true
364
+ },
365
+ "126125": {
366
+ "content": "<|reserved_token_41|>",
367
+ "lstrip": false,
368
+ "normalized": false,
369
+ "rstrip": false,
370
+ "single_word": false,
371
+ "special": true
372
+ },
373
+ "126126": {
374
+ "content": "<|reserved_token_42|>",
375
+ "lstrip": false,
376
+ "normalized": false,
377
+ "rstrip": false,
378
+ "single_word": false,
379
+ "special": true
380
+ },
381
+ "126127": {
382
+ "content": "<|reserved_token_43|>",
383
+ "lstrip": false,
384
+ "normalized": false,
385
+ "rstrip": false,
386
+ "single_word": false,
387
+ "special": true
388
+ },
389
+ "126128": {
390
+ "content": "<|reserved_token_44|>",
391
+ "lstrip": false,
392
+ "normalized": false,
393
+ "rstrip": false,
394
+ "single_word": false,
395
+ "special": true
396
+ },
397
+ "126129": {
398
+ "content": "<|reserved_token_45|>",
399
+ "lstrip": false,
400
+ "normalized": false,
401
+ "rstrip": false,
402
+ "single_word": false,
403
+ "special": true
404
+ },
405
+ "126130": {
406
+ "content": "<|reserved_token_46|>",
407
+ "lstrip": false,
408
+ "normalized": false,
409
+ "rstrip": false,
410
+ "single_word": false,
411
+ "special": true
412
+ },
413
+ "126131": {
414
+ "content": "<|reserved_token_47|>",
415
+ "lstrip": false,
416
+ "normalized": false,
417
+ "rstrip": false,
418
+ "single_word": false,
419
+ "special": true
420
+ },
421
+ "126132": {
422
+ "content": "<|reserved_token_48|>",
423
+ "lstrip": false,
424
+ "normalized": false,
425
+ "rstrip": false,
426
+ "single_word": false,
427
+ "special": true
428
+ },
429
+ "126133": {
430
+ "content": "<|reserved_token_49|>",
431
+ "lstrip": false,
432
+ "normalized": false,
433
+ "rstrip": false,
434
+ "single_word": false,
435
+ "special": true
436
+ },
437
+ "126134": {
438
+ "content": "<|reserved_token_50|>",
439
+ "lstrip": false,
440
+ "normalized": false,
441
+ "rstrip": false,
442
+ "single_word": false,
443
+ "special": true
444
+ },
445
+ "126135": {
446
+ "content": "<|reserved_token_51|>",
447
+ "lstrip": false,
448
+ "normalized": false,
449
+ "rstrip": false,
450
+ "single_word": false,
451
+ "special": true
452
+ },
453
+ "126136": {
454
+ "content": "<|reserved_token_52|>",
455
+ "lstrip": false,
456
+ "normalized": false,
457
+ "rstrip": false,
458
+ "single_word": false,
459
+ "special": true
460
+ },
461
+ "126137": {
462
+ "content": "<|reserved_token_53|>",
463
+ "lstrip": false,
464
+ "normalized": false,
465
+ "rstrip": false,
466
+ "single_word": false,
467
+ "special": true
468
+ },
469
+ "126138": {
470
+ "content": "<|reserved_token_54|>",
471
+ "lstrip": false,
472
+ "normalized": false,
473
+ "rstrip": false,
474
+ "single_word": false,
475
+ "special": true
476
+ },
477
+ "126139": {
478
+ "content": "<|reserved_token_55|>",
479
+ "lstrip": false,
480
+ "normalized": false,
481
+ "rstrip": false,
482
+ "single_word": false,
483
+ "special": true
484
+ },
485
+ "126140": {
486
+ "content": "<|reserved_token_56|>",
487
+ "lstrip": false,
488
+ "normalized": false,
489
+ "rstrip": false,
490
+ "single_word": false,
491
+ "special": true
492
+ },
493
+ "126141": {
494
+ "content": "<|reserved_token_57|>",
495
+ "lstrip": false,
496
+ "normalized": false,
497
+ "rstrip": false,
498
+ "single_word": false,
499
+ "special": true
500
+ },
501
+ "126142": {
502
+ "content": "<|reserved_token_58|>",
503
+ "lstrip": false,
504
+ "normalized": false,
505
+ "rstrip": false,
506
+ "single_word": false,
507
+ "special": true
508
+ },
509
+ "126143": {
510
+ "content": "<|reserved_token_59|>",
511
+ "lstrip": false,
512
+ "normalized": false,
513
+ "rstrip": false,
514
+ "single_word": false,
515
+ "special": true
516
+ },
517
+ "126144": {
518
+ "content": "<|reserved_token_60|>",
519
+ "lstrip": false,
520
+ "normalized": false,
521
+ "rstrip": false,
522
+ "single_word": false,
523
+ "special": true
524
+ },
525
+ "126145": {
526
+ "content": "<|reserved_token_61|>",
527
+ "lstrip": false,
528
+ "normalized": false,
529
+ "rstrip": false,
530
+ "single_word": false,
531
+ "special": true
532
+ },
533
+ "126146": {
534
+ "content": "<|reserved_token_62|>",
535
+ "lstrip": false,
536
+ "normalized": false,
537
+ "rstrip": false,
538
+ "single_word": false,
539
+ "special": true
540
+ },
541
+ "126147": {
542
+ "content": "<|reserved_token_63|>",
543
+ "lstrip": false,
544
+ "normalized": false,
545
+ "rstrip": false,
546
+ "single_word": false,
547
+ "special": true
548
+ },
549
+ "126148": {
550
+ "content": "<|reserved_token_64|>",
551
+ "lstrip": false,
552
+ "normalized": false,
553
+ "rstrip": false,
554
+ "single_word": false,
555
+ "special": true
556
+ },
557
+ "126149": {
558
+ "content": "<|reserved_token_65|>",
559
+ "lstrip": false,
560
+ "normalized": false,
561
+ "rstrip": false,
562
+ "single_word": false,
563
+ "special": true
564
+ },
565
+ "126150": {
566
+ "content": "<|reserved_token_66|>",
567
+ "lstrip": false,
568
+ "normalized": false,
569
+ "rstrip": false,
570
+ "single_word": false,
571
+ "special": true
572
+ },
573
+ "126151": {
574
+ "content": "<|reserved_token_67|>",
575
+ "lstrip": false,
576
+ "normalized": false,
577
+ "rstrip": false,
578
+ "single_word": false,
579
+ "special": true
580
+ },
581
+ "126152": {
582
+ "content": "<|reserved_token_68|>",
583
+ "lstrip": false,
584
+ "normalized": false,
585
+ "rstrip": false,
586
+ "single_word": false,
587
+ "special": true
588
+ },
589
+ "126153": {
590
+ "content": "<|reserved_token_69|>",
591
+ "lstrip": false,
592
+ "normalized": false,
593
+ "rstrip": false,
594
+ "single_word": false,
595
+ "special": true
596
+ },
597
+ "126154": {
598
+ "content": "<|reserved_token_70|>",
599
+ "lstrip": false,
600
+ "normalized": false,
601
+ "rstrip": false,
602
+ "single_word": false,
603
+ "special": true
604
+ },
605
+ "126155": {
606
+ "content": "<|reserved_token_71|>",
607
+ "lstrip": false,
608
+ "normalized": false,
609
+ "rstrip": false,
610
+ "single_word": false,
611
+ "special": true
612
+ },
613
+ "126156": {
614
+ "content": "<|reserved_token_72|>",
615
+ "lstrip": false,
616
+ "normalized": false,
617
+ "rstrip": false,
618
+ "single_word": false,
619
+ "special": true
620
+ },
621
+ "126157": {
622
+ "content": "<|reserved_token_73|>",
623
+ "lstrip": false,
624
+ "normalized": false,
625
+ "rstrip": false,
626
+ "single_word": false,
627
+ "special": true
628
+ },
629
+ "126158": {
630
+ "content": "<|reserved_token_74|>",
631
+ "lstrip": false,
632
+ "normalized": false,
633
+ "rstrip": false,
634
+ "single_word": false,
635
+ "special": true
636
+ },
637
+ "126159": {
638
+ "content": "<|reserved_token_75|>",
639
+ "lstrip": false,
640
+ "normalized": false,
641
+ "rstrip": false,
642
+ "single_word": false,
643
+ "special": true
644
+ },
645
+ "126160": {
646
+ "content": "<|reserved_token_76|>",
647
+ "lstrip": false,
648
+ "normalized": false,
649
+ "rstrip": false,
650
+ "single_word": false,
651
+ "special": true
652
+ },
653
+ "126161": {
654
+ "content": "<|reserved_token_77|>",
655
+ "lstrip": false,
656
+ "normalized": false,
657
+ "rstrip": false,
658
+ "single_word": false,
659
+ "special": true
660
+ },
661
+ "126162": {
662
+ "content": "<|reserved_token_78|>",
663
+ "lstrip": false,
664
+ "normalized": false,
665
+ "rstrip": false,
666
+ "single_word": false,
667
+ "special": true
668
+ },
669
+ "126163": {
670
+ "content": "<|reserved_token_79|>",
671
+ "lstrip": false,
672
+ "normalized": false,
673
+ "rstrip": false,
674
+ "single_word": false,
675
+ "special": true
676
+ },
677
+ "126164": {
678
+ "content": "<|reserved_token_80|>",
679
+ "lstrip": false,
680
+ "normalized": false,
681
+ "rstrip": false,
682
+ "single_word": false,
683
+ "special": true
684
+ },
685
+ "126165": {
686
+ "content": "<|reserved_token_81|>",
687
+ "lstrip": false,
688
+ "normalized": false,
689
+ "rstrip": false,
690
+ "single_word": false,
691
+ "special": true
692
+ },
693
+ "126166": {
694
+ "content": "<|reserved_token_82|>",
695
+ "lstrip": false,
696
+ "normalized": false,
697
+ "rstrip": false,
698
+ "single_word": false,
699
+ "special": true
700
+ },
701
+ "126167": {
702
+ "content": "<|reserved_token_83|>",
703
+ "lstrip": false,
704
+ "normalized": false,
705
+ "rstrip": false,
706
+ "single_word": false,
707
+ "special": true
708
+ },
709
+ "126168": {
710
+ "content": "<|reserved_token_84|>",
711
+ "lstrip": false,
712
+ "normalized": false,
713
+ "rstrip": false,
714
+ "single_word": false,
715
+ "special": true
716
+ },
717
+ "126169": {
718
+ "content": "<|reserved_token_85|>",
719
+ "lstrip": false,
720
+ "normalized": false,
721
+ "rstrip": false,
722
+ "single_word": false,
723
+ "special": true
724
+ },
725
+ "126170": {
726
+ "content": "<|reserved_token_86|>",
727
+ "lstrip": false,
728
+ "normalized": false,
729
+ "rstrip": false,
730
+ "single_word": false,
731
+ "special": true
732
+ },
733
+ "126171": {
734
+ "content": "<|reserved_token_87|>",
735
+ "lstrip": false,
736
+ "normalized": false,
737
+ "rstrip": false,
738
+ "single_word": false,
739
+ "special": true
740
+ },
741
+ "126172": {
742
+ "content": "<|reserved_token_88|>",
743
+ "lstrip": false,
744
+ "normalized": false,
745
+ "rstrip": false,
746
+ "single_word": false,
747
+ "special": true
748
+ },
749
+ "126173": {
750
+ "content": "<|reserved_token_89|>",
751
+ "lstrip": false,
752
+ "normalized": false,
753
+ "rstrip": false,
754
+ "single_word": false,
755
+ "special": true
756
+ },
757
+ "126174": {
758
+ "content": "<|reserved_token_90|>",
759
+ "lstrip": false,
760
+ "normalized": false,
761
+ "rstrip": false,
762
+ "single_word": false,
763
+ "special": true
764
+ },
765
+ "126175": {
766
+ "content": "<|reserved_token_91|>",
767
+ "lstrip": false,
768
+ "normalized": false,
769
+ "rstrip": false,
770
+ "single_word": false,
771
+ "special": true
772
+ },
773
+ "126176": {
774
+ "content": "<|reserved_token_92|>",
775
+ "lstrip": false,
776
+ "normalized": false,
777
+ "rstrip": false,
778
+ "single_word": false,
779
+ "special": true
780
+ },
781
+ "126177": {
782
+ "content": "<|reserved_token_93|>",
783
+ "lstrip": false,
784
+ "normalized": false,
785
+ "rstrip": false,
786
+ "single_word": false,
787
+ "special": true
788
+ },
789
+ "126178": {
790
+ "content": "<|reserved_token_94|>",
791
+ "lstrip": false,
792
+ "normalized": false,
793
+ "rstrip": false,
794
+ "single_word": false,
795
+ "special": true
796
+ },
797
+ "126179": {
798
+ "content": "<|reserved_token_95|>",
799
+ "lstrip": false,
800
+ "normalized": false,
801
+ "rstrip": false,
802
+ "single_word": false,
803
+ "special": true
804
+ },
805
+ "126180": {
806
+ "content": "<|reserved_token_96|>",
807
+ "lstrip": false,
808
+ "normalized": false,
809
+ "rstrip": false,
810
+ "single_word": false,
811
+ "special": true
812
+ },
813
+ "126181": {
814
+ "content": "<|reserved_token_97|>",
815
+ "lstrip": false,
816
+ "normalized": false,
817
+ "rstrip": false,
818
+ "single_word": false,
819
+ "special": true
820
+ },
821
+ "126182": {
822
+ "content": "<|reserved_token_98|>",
823
+ "lstrip": false,
824
+ "normalized": false,
825
+ "rstrip": false,
826
+ "single_word": false,
827
+ "special": true
828
+ },
829
+ "126183": {
830
+ "content": "<|reserved_token_99|>",
831
+ "lstrip": false,
832
+ "normalized": false,
833
+ "rstrip": false,
834
+ "single_word": false,
835
+ "special": true
836
+ },
837
+ "126184": {
838
+ "content": "<|reserved_token_100|>",
839
+ "lstrip": false,
840
+ "normalized": false,
841
+ "rstrip": false,
842
+ "single_word": false,
843
+ "special": true
844
+ },
845
+ "126185": {
846
+ "content": "<|reserved_token_101|>",
847
+ "lstrip": false,
848
+ "normalized": false,
849
+ "rstrip": false,
850
+ "single_word": false,
851
+ "special": true
852
+ },
853
+ "126186": {
854
+ "content": "<|reserved_token_102|>",
855
+ "lstrip": false,
856
+ "normalized": false,
857
+ "rstrip": false,
858
+ "single_word": false,
859
+ "special": true
860
+ },
861
+ "126187": {
862
+ "content": "<|reserved_token_103|>",
863
+ "lstrip": false,
864
+ "normalized": false,
865
+ "rstrip": false,
866
+ "single_word": false,
867
+ "special": true
868
+ },
869
+ "126188": {
870
+ "content": "<|reserved_token_104|>",
871
+ "lstrip": false,
872
+ "normalized": false,
873
+ "rstrip": false,
874
+ "single_word": false,
875
+ "special": true
876
+ },
877
+ "126189": {
878
+ "content": "<|reserved_token_105|>",
879
+ "lstrip": false,
880
+ "normalized": false,
881
+ "rstrip": false,
882
+ "single_word": false,
883
+ "special": true
884
+ },
885
+ "126190": {
886
+ "content": "<|reserved_token_106|>",
887
+ "lstrip": false,
888
+ "normalized": false,
889
+ "rstrip": false,
890
+ "single_word": false,
891
+ "special": true
892
+ },
893
+ "126191": {
894
+ "content": "<|reserved_token_107|>",
895
+ "lstrip": false,
896
+ "normalized": false,
897
+ "rstrip": false,
898
+ "single_word": false,
899
+ "special": true
900
+ },
901
+ "126192": {
902
+ "content": "<|reserved_token_108|>",
903
+ "lstrip": false,
904
+ "normalized": false,
905
+ "rstrip": false,
906
+ "single_word": false,
907
+ "special": true
908
+ },
909
+ "126193": {
910
+ "content": "<|reserved_token_109|>",
911
+ "lstrip": false,
912
+ "normalized": false,
913
+ "rstrip": false,
914
+ "single_word": false,
915
+ "special": true
916
+ },
917
+ "126194": {
918
+ "content": "<|reserved_token_110|>",
919
+ "lstrip": false,
920
+ "normalized": false,
921
+ "rstrip": false,
922
+ "single_word": false,
923
+ "special": true
924
+ },
925
+ "126195": {
926
+ "content": "<|reserved_token_111|>",
927
+ "lstrip": false,
928
+ "normalized": false,
929
+ "rstrip": false,
930
+ "single_word": false,
931
+ "special": true
932
+ },
933
+ "126196": {
934
+ "content": "<|reserved_token_112|>",
935
+ "lstrip": false,
936
+ "normalized": false,
937
+ "rstrip": false,
938
+ "single_word": false,
939
+ "special": true
940
+ },
941
+ "126197": {
942
+ "content": "<|reserved_token_113|>",
943
+ "lstrip": false,
944
+ "normalized": false,
945
+ "rstrip": false,
946
+ "single_word": false,
947
+ "special": true
948
+ },
949
+ "126198": {
950
+ "content": "<|reserved_token_114|>",
951
+ "lstrip": false,
952
+ "normalized": false,
953
+ "rstrip": false,
954
+ "single_word": false,
955
+ "special": true
956
+ },
957
+ "126199": {
958
+ "content": "<|reserved_token_115|>",
959
+ "lstrip": false,
960
+ "normalized": false,
961
+ "rstrip": false,
962
+ "single_word": false,
963
+ "special": true
964
+ },
965
+ "126200": {
966
+ "content": "<|reserved_token_116|>",
967
+ "lstrip": false,
968
+ "normalized": false,
969
+ "rstrip": false,
970
+ "single_word": false,
971
+ "special": true
972
+ },
973
+ "126201": {
974
+ "content": "<|reserved_token_117|>",
975
+ "lstrip": false,
976
+ "normalized": false,
977
+ "rstrip": false,
978
+ "single_word": false,
979
+ "special": true
980
+ },
981
+ "126202": {
982
+ "content": "<|reserved_token_118|>",
983
+ "lstrip": false,
984
+ "normalized": false,
985
+ "rstrip": false,
986
+ "single_word": false,
987
+ "special": true
988
+ },
989
+ "126203": {
990
+ "content": "<|reserved_token_119|>",
991
+ "lstrip": false,
992
+ "normalized": false,
993
+ "rstrip": false,
994
+ "single_word": false,
995
+ "special": true
996
+ },
997
+ "126204": {
998
+ "content": "<|reserved_token_120|>",
999
+ "lstrip": false,
1000
+ "normalized": false,
1001
+ "rstrip": false,
1002
+ "single_word": false,
1003
+ "special": true
1004
+ },
1005
+ "126205": {
1006
+ "content": "<|reserved_token_121|>",
1007
+ "lstrip": false,
1008
+ "normalized": false,
1009
+ "rstrip": false,
1010
+ "single_word": false,
1011
+ "special": true
1012
+ },
1013
+ "126206": {
1014
+ "content": "<|reserved_token_122|>",
1015
+ "lstrip": false,
1016
+ "normalized": false,
1017
+ "rstrip": false,
1018
+ "single_word": false,
1019
+ "special": true
1020
+ },
1021
+ "126207": {
1022
+ "content": "<|reserved_token_123|>",
1023
+ "lstrip": false,
1024
+ "normalized": false,
1025
+ "rstrip": false,
1026
+ "single_word": false,
1027
+ "special": true
1028
+ },
1029
+ "126208": {
1030
+ "content": "<|reserved_token_124|>",
1031
+ "lstrip": false,
1032
+ "normalized": false,
1033
+ "rstrip": false,
1034
+ "single_word": false,
1035
+ "special": true
1036
+ },
1037
+ "126209": {
1038
+ "content": "<|reserved_token_125|>",
1039
+ "lstrip": false,
1040
+ "normalized": false,
1041
+ "rstrip": false,
1042
+ "single_word": false,
1043
+ "special": true
1044
+ },
1045
+ "126210": {
1046
+ "content": "<|reserved_token_126|>",
1047
+ "lstrip": false,
1048
+ "normalized": false,
1049
+ "rstrip": false,
1050
+ "single_word": false,
1051
+ "special": true
1052
+ },
1053
+ "126211": {
1054
+ "content": "<|reserved_token_127|>",
1055
+ "lstrip": false,
1056
+ "normalized": false,
1057
+ "rstrip": false,
1058
+ "single_word": false,
1059
+ "special": true
1060
+ },
1061
+ "126212": {
1062
+ "content": "<|reserved_token_128|>",
1063
+ "lstrip": false,
1064
+ "normalized": false,
1065
+ "rstrip": false,
1066
+ "single_word": false,
1067
+ "special": true
1068
+ },
1069
+ "126213": {
1070
+ "content": "<|reserved_token_129|>",
1071
+ "lstrip": false,
1072
+ "normalized": false,
1073
+ "rstrip": false,
1074
+ "single_word": false,
1075
+ "special": true
1076
+ },
1077
+ "126214": {
1078
+ "content": "<|reserved_token_130|>",
1079
+ "lstrip": false,
1080
+ "normalized": false,
1081
+ "rstrip": false,
1082
+ "single_word": false,
1083
+ "special": true
1084
+ },
1085
+ "126215": {
1086
+ "content": "<|reserved_token_131|>",
1087
+ "lstrip": false,
1088
+ "normalized": false,
1089
+ "rstrip": false,
1090
+ "single_word": false,
1091
+ "special": true
1092
+ },
1093
+ "126216": {
1094
+ "content": "<|reserved_token_132|>",
1095
+ "lstrip": false,
1096
+ "normalized": false,
1097
+ "rstrip": false,
1098
+ "single_word": false,
1099
+ "special": true
1100
+ },
1101
+ "126217": {
1102
+ "content": "<|reserved_token_133|>",
1103
+ "lstrip": false,
1104
+ "normalized": false,
1105
+ "rstrip": false,
1106
+ "single_word": false,
1107
+ "special": true
1108
+ },
1109
+ "126218": {
1110
+ "content": "<|reserved_token_134|>",
1111
+ "lstrip": false,
1112
+ "normalized": false,
1113
+ "rstrip": false,
1114
+ "single_word": false,
1115
+ "special": true
1116
+ },
1117
+ "126219": {
1118
+ "content": "<|reserved_token_135|>",
1119
+ "lstrip": false,
1120
+ "normalized": false,
1121
+ "rstrip": false,
1122
+ "single_word": false,
1123
+ "special": true
1124
+ },
1125
+ "126220": {
1126
+ "content": "<|reserved_token_136|>",
1127
+ "lstrip": false,
1128
+ "normalized": false,
1129
+ "rstrip": false,
1130
+ "single_word": false,
1131
+ "special": true
1132
+ },
1133
+ "126221": {
1134
+ "content": "<|reserved_token_137|>",
1135
+ "lstrip": false,
1136
+ "normalized": false,
1137
+ "rstrip": false,
1138
+ "single_word": false,
1139
+ "special": true
1140
+ },
1141
+ "126222": {
1142
+ "content": "<|reserved_token_138|>",
1143
+ "lstrip": false,
1144
+ "normalized": false,
1145
+ "rstrip": false,
1146
+ "single_word": false,
1147
+ "special": true
1148
+ },
1149
+ "126223": {
1150
+ "content": "<|reserved_token_139|>",
1151
+ "lstrip": false,
1152
+ "normalized": false,
1153
+ "rstrip": false,
1154
+ "single_word": false,
1155
+ "special": true
1156
+ },
1157
+ "126224": {
1158
+ "content": "<|reserved_token_140|>",
1159
+ "lstrip": false,
1160
+ "normalized": false,
1161
+ "rstrip": false,
1162
+ "single_word": false,
1163
+ "special": true
1164
+ },
1165
+ "126225": {
1166
+ "content": "<|reserved_token_141|>",
1167
+ "lstrip": false,
1168
+ "normalized": false,
1169
+ "rstrip": false,
1170
+ "single_word": false,
1171
+ "special": true
1172
+ },
1173
+ "126226": {
1174
+ "content": "<|reserved_token_142|>",
1175
+ "lstrip": false,
1176
+ "normalized": false,
1177
+ "rstrip": false,
1178
+ "single_word": false,
1179
+ "special": true
1180
+ },
1181
+ "126227": {
1182
+ "content": "<|reserved_token_143|>",
1183
+ "lstrip": false,
1184
+ "normalized": false,
1185
+ "rstrip": false,
1186
+ "single_word": false,
1187
+ "special": true
1188
+ },
1189
+ "126228": {
1190
+ "content": "<|reserved_token_144|>",
1191
+ "lstrip": false,
1192
+ "normalized": false,
1193
+ "rstrip": false,
1194
+ "single_word": false,
1195
+ "special": true
1196
+ },
1197
+ "126229": {
1198
+ "content": "<|reserved_token_145|>",
1199
+ "lstrip": false,
1200
+ "normalized": false,
1201
+ "rstrip": false,
1202
+ "single_word": false,
1203
+ "special": true
1204
+ },
1205
+ "126230": {
1206
+ "content": "<|reserved_token_146|>",
1207
+ "lstrip": false,
1208
+ "normalized": false,
1209
+ "rstrip": false,
1210
+ "single_word": false,
1211
+ "special": true
1212
+ },
1213
+ "126231": {
1214
+ "content": "<|reserved_token_147|>",
1215
+ "lstrip": false,
1216
+ "normalized": false,
1217
+ "rstrip": false,
1218
+ "single_word": false,
1219
+ "special": true
1220
+ },
1221
+ "126232": {
1222
+ "content": "<|reserved_token_148|>",
1223
+ "lstrip": false,
1224
+ "normalized": false,
1225
+ "rstrip": false,
1226
+ "single_word": false,
1227
+ "special": true
1228
+ },
1229
+ "126233": {
1230
+ "content": "<|reserved_token_149|>",
1231
+ "lstrip": false,
1232
+ "normalized": false,
1233
+ "rstrip": false,
1234
+ "single_word": false,
1235
+ "special": true
1236
+ },
1237
+ "126234": {
1238
+ "content": "<|reserved_token_150|>",
1239
+ "lstrip": false,
1240
+ "normalized": false,
1241
+ "rstrip": false,
1242
+ "single_word": false,
1243
+ "special": true
1244
+ },
1245
+ "126235": {
1246
+ "content": "<|reserved_token_151|>",
1247
+ "lstrip": false,
1248
+ "normalized": false,
1249
+ "rstrip": false,
1250
+ "single_word": false,
1251
+ "special": true
1252
+ },
1253
+ "126236": {
1254
+ "content": "<|reserved_token_152|>",
1255
+ "lstrip": false,
1256
+ "normalized": false,
1257
+ "rstrip": false,
1258
+ "single_word": false,
1259
+ "special": true
1260
+ },
1261
+ "126237": {
1262
+ "content": "<|reserved_token_153|>",
1263
+ "lstrip": false,
1264
+ "normalized": false,
1265
+ "rstrip": false,
1266
+ "single_word": false,
1267
+ "special": true
1268
+ },
1269
+ "126238": {
1270
+ "content": "<|reserved_token_154|>",
1271
+ "lstrip": false,
1272
+ "normalized": false,
1273
+ "rstrip": false,
1274
+ "single_word": false,
1275
+ "special": true
1276
+ },
1277
+ "126239": {
1278
+ "content": "<|reserved_token_155|>",
1279
+ "lstrip": false,
1280
+ "normalized": false,
1281
+ "rstrip": false,
1282
+ "single_word": false,
1283
+ "special": true
1284
+ },
1285
+ "126240": {
1286
+ "content": "<|reserved_token_156|>",
1287
+ "lstrip": false,
1288
+ "normalized": false,
1289
+ "rstrip": false,
1290
+ "single_word": false,
1291
+ "special": true
1292
+ },
1293
+ "126241": {
1294
+ "content": "<|reserved_token_157|>",
1295
+ "lstrip": false,
1296
+ "normalized": false,
1297
+ "rstrip": false,
1298
+ "single_word": false,
1299
+ "special": true
1300
+ },
1301
+ "126242": {
1302
+ "content": "<|reserved_token_158|>",
1303
+ "lstrip": false,
1304
+ "normalized": false,
1305
+ "rstrip": false,
1306
+ "single_word": false,
1307
+ "special": true
1308
+ },
1309
+ "126243": {
1310
+ "content": "<|reserved_token_159|>",
1311
+ "lstrip": false,
1312
+ "normalized": false,
1313
+ "rstrip": false,
1314
+ "single_word": false,
1315
+ "special": true
1316
+ },
1317
+ "126244": {
1318
+ "content": "<|reserved_token_160|>",
1319
+ "lstrip": false,
1320
+ "normalized": false,
1321
+ "rstrip": false,
1322
+ "single_word": false,
1323
+ "special": true
1324
+ },
1325
+ "126245": {
1326
+ "content": "<|reserved_token_161|>",
1327
+ "lstrip": false,
1328
+ "normalized": false,
1329
+ "rstrip": false,
1330
+ "single_word": false,
1331
+ "special": true
1332
+ },
1333
+ "126246": {
1334
+ "content": "<|reserved_token_162|>",
1335
+ "lstrip": false,
1336
+ "normalized": false,
1337
+ "rstrip": false,
1338
+ "single_word": false,
1339
+ "special": true
1340
+ },
1341
+ "126247": {
1342
+ "content": "<|reserved_token_163|>",
1343
+ "lstrip": false,
1344
+ "normalized": false,
1345
+ "rstrip": false,
1346
+ "single_word": false,
1347
+ "special": true
1348
+ },
1349
+ "126248": {
1350
+ "content": "<|reserved_token_164|>",
1351
+ "lstrip": false,
1352
+ "normalized": false,
1353
+ "rstrip": false,
1354
+ "single_word": false,
1355
+ "special": true
1356
+ },
1357
+ "126249": {
1358
+ "content": "<|reserved_token_165|>",
1359
+ "lstrip": false,
1360
+ "normalized": false,
1361
+ "rstrip": false,
1362
+ "single_word": false,
1363
+ "special": true
1364
+ },
1365
+ "126250": {
1366
+ "content": "<|reserved_token_166|>",
1367
+ "lstrip": false,
1368
+ "normalized": false,
1369
+ "rstrip": false,
1370
+ "single_word": false,
1371
+ "special": true
1372
+ },
1373
+ "126251": {
1374
+ "content": "<|reserved_token_167|>",
1375
+ "lstrip": false,
1376
+ "normalized": false,
1377
+ "rstrip": false,
1378
+ "single_word": false,
1379
+ "special": true
1380
+ },
1381
+ "126252": {
1382
+ "content": "<|reserved_token_168|>",
1383
+ "lstrip": false,
1384
+ "normalized": false,
1385
+ "rstrip": false,
1386
+ "single_word": false,
1387
+ "special": true
1388
+ },
1389
+ "126253": {
1390
+ "content": "<|reserved_token_169|>",
1391
+ "lstrip": false,
1392
+ "normalized": false,
1393
+ "rstrip": false,
1394
+ "single_word": false,
1395
+ "special": true
1396
+ },
1397
+ "126254": {
1398
+ "content": "<|reserved_token_170|>",
1399
+ "lstrip": false,
1400
+ "normalized": false,
1401
+ "rstrip": false,
1402
+ "single_word": false,
1403
+ "special": true
1404
+ },
1405
+ "126255": {
1406
+ "content": "<|reserved_token_171|>",
1407
+ "lstrip": false,
1408
+ "normalized": false,
1409
+ "rstrip": false,
1410
+ "single_word": false,
1411
+ "special": true
1412
+ },
1413
+ "126256": {
1414
+ "content": "<|reserved_token_172|>",
1415
+ "lstrip": false,
1416
+ "normalized": false,
1417
+ "rstrip": false,
1418
+ "single_word": false,
1419
+ "special": true
1420
+ },
1421
+ "126257": {
1422
+ "content": "<|reserved_token_173|>",
1423
+ "lstrip": false,
1424
+ "normalized": false,
1425
+ "rstrip": false,
1426
+ "single_word": false,
1427
+ "special": true
1428
+ },
1429
+ "126258": {
1430
+ "content": "<|reserved_token_174|>",
1431
+ "lstrip": false,
1432
+ "normalized": false,
1433
+ "rstrip": false,
1434
+ "single_word": false,
1435
+ "special": true
1436
+ },
1437
+ "126259": {
1438
+ "content": "<|reserved_token_175|>",
1439
+ "lstrip": false,
1440
+ "normalized": false,
1441
+ "rstrip": false,
1442
+ "single_word": false,
1443
+ "special": true
1444
+ },
1445
+ "126260": {
1446
+ "content": "<|reserved_token_176|>",
1447
+ "lstrip": false,
1448
+ "normalized": false,
1449
+ "rstrip": false,
1450
+ "single_word": false,
1451
+ "special": true
1452
+ },
1453
+ "126261": {
1454
+ "content": "<|reserved_token_177|>",
1455
+ "lstrip": false,
1456
+ "normalized": false,
1457
+ "rstrip": false,
1458
+ "single_word": false,
1459
+ "special": true
1460
+ },
1461
+ "126262": {
1462
+ "content": "<|reserved_token_178|>",
1463
+ "lstrip": false,
1464
+ "normalized": false,
1465
+ "rstrip": false,
1466
+ "single_word": false,
1467
+ "special": true
1468
+ },
1469
+ "126263": {
1470
+ "content": "<|reserved_token_179|>",
1471
+ "lstrip": false,
1472
+ "normalized": false,
1473
+ "rstrip": false,
1474
+ "single_word": false,
1475
+ "special": true
1476
+ },
1477
+ "126264": {
1478
+ "content": "<|reserved_token_180|>",
1479
+ "lstrip": false,
1480
+ "normalized": false,
1481
+ "rstrip": false,
1482
+ "single_word": false,
1483
+ "special": true
1484
+ },
1485
+ "126265": {
1486
+ "content": "<|reserved_token_181|>",
1487
+ "lstrip": false,
1488
+ "normalized": false,
1489
+ "rstrip": false,
1490
+ "single_word": false,
1491
+ "special": true
1492
+ },
1493
+ "126266": {
1494
+ "content": "<|reserved_token_182|>",
1495
+ "lstrip": false,
1496
+ "normalized": false,
1497
+ "rstrip": false,
1498
+ "single_word": false,
1499
+ "special": true
1500
+ },
1501
+ "126267": {
1502
+ "content": "<|reserved_token_183|>",
1503
+ "lstrip": false,
1504
+ "normalized": false,
1505
+ "rstrip": false,
1506
+ "single_word": false,
1507
+ "special": true
1508
+ },
1509
+ "126268": {
1510
+ "content": "<|reserved_token_184|>",
1511
+ "lstrip": false,
1512
+ "normalized": false,
1513
+ "rstrip": false,
1514
+ "single_word": false,
1515
+ "special": true
1516
+ },
1517
+ "126269": {
1518
+ "content": "<|reserved_token_185|>",
1519
+ "lstrip": false,
1520
+ "normalized": false,
1521
+ "rstrip": false,
1522
+ "single_word": false,
1523
+ "special": true
1524
+ },
1525
+ "126270": {
1526
+ "content": "<|reserved_token_186|>",
1527
+ "lstrip": false,
1528
+ "normalized": false,
1529
+ "rstrip": false,
1530
+ "single_word": false,
1531
+ "special": true
1532
+ },
1533
+ "126271": {
1534
+ "content": "<|reserved_token_187|>",
1535
+ "lstrip": false,
1536
+ "normalized": false,
1537
+ "rstrip": false,
1538
+ "single_word": false,
1539
+ "special": true
1540
+ },
1541
+ "126272": {
1542
+ "content": "<|reserved_token_188|>",
1543
+ "lstrip": false,
1544
+ "normalized": false,
1545
+ "rstrip": false,
1546
+ "single_word": false,
1547
+ "special": true
1548
+ },
1549
+ "126273": {
1550
+ "content": "<|reserved_token_189|>",
1551
+ "lstrip": false,
1552
+ "normalized": false,
1553
+ "rstrip": false,
1554
+ "single_word": false,
1555
+ "special": true
1556
+ },
1557
+ "126274": {
1558
+ "content": "<|reserved_token_190|>",
1559
+ "lstrip": false,
1560
+ "normalized": false,
1561
+ "rstrip": false,
1562
+ "single_word": false,
1563
+ "special": true
1564
+ },
1565
+ "126275": {
1566
+ "content": "<|reserved_token_191|>",
1567
+ "lstrip": false,
1568
+ "normalized": false,
1569
+ "rstrip": false,
1570
+ "single_word": false,
1571
+ "special": true
1572
+ },
1573
+ "126276": {
1574
+ "content": "<|reserved_token_192|>",
1575
+ "lstrip": false,
1576
+ "normalized": false,
1577
+ "rstrip": false,
1578
+ "single_word": false,
1579
+ "special": true
1580
+ },
1581
+ "126277": {
1582
+ "content": "<|reserved_token_193|>",
1583
+ "lstrip": false,
1584
+ "normalized": false,
1585
+ "rstrip": false,
1586
+ "single_word": false,
1587
+ "special": true
1588
+ },
1589
+ "126278": {
1590
+ "content": "<|reserved_token_194|>",
1591
+ "lstrip": false,
1592
+ "normalized": false,
1593
+ "rstrip": false,
1594
+ "single_word": false,
1595
+ "special": true
1596
+ },
1597
+ "126279": {
1598
+ "content": "<|reserved_token_195|>",
1599
+ "lstrip": false,
1600
+ "normalized": false,
1601
+ "rstrip": false,
1602
+ "single_word": false,
1603
+ "special": true
1604
+ },
1605
+ "126280": {
1606
+ "content": "<|reserved_token_196|>",
1607
+ "lstrip": false,
1608
+ "normalized": false,
1609
+ "rstrip": false,
1610
+ "single_word": false,
1611
+ "special": true
1612
+ },
1613
+ "126281": {
1614
+ "content": "<|reserved_token_197|>",
1615
+ "lstrip": false,
1616
+ "normalized": false,
1617
+ "rstrip": false,
1618
+ "single_word": false,
1619
+ "special": true
1620
+ },
1621
+ "126282": {
1622
+ "content": "<|reserved_token_198|>",
1623
+ "lstrip": false,
1624
+ "normalized": false,
1625
+ "rstrip": false,
1626
+ "single_word": false,
1627
+ "special": true
1628
+ },
1629
+ "126283": {
1630
+ "content": "<|reserved_token_199|>",
1631
+ "lstrip": false,
1632
+ "normalized": false,
1633
+ "rstrip": false,
1634
+ "single_word": false,
1635
+ "special": true
1636
+ },
1637
+ "126284": {
1638
+ "content": "<|reserved_token_200|>",
1639
+ "lstrip": false,
1640
+ "normalized": false,
1641
+ "rstrip": false,
1642
+ "single_word": false,
1643
+ "special": true
1644
+ },
1645
+ "126285": {
1646
+ "content": "<|reserved_token_201|>",
1647
+ "lstrip": false,
1648
+ "normalized": false,
1649
+ "rstrip": false,
1650
+ "single_word": false,
1651
+ "special": true
1652
+ },
1653
+ "126286": {
1654
+ "content": "<|reserved_token_202|>",
1655
+ "lstrip": false,
1656
+ "normalized": false,
1657
+ "rstrip": false,
1658
+ "single_word": false,
1659
+ "special": true
1660
+ },
1661
+ "126287": {
1662
+ "content": "<|reserved_token_203|>",
1663
+ "lstrip": false,
1664
+ "normalized": false,
1665
+ "rstrip": false,
1666
+ "single_word": false,
1667
+ "special": true
1668
+ },
1669
+ "126288": {
1670
+ "content": "<|reserved_token_204|>",
1671
+ "lstrip": false,
1672
+ "normalized": false,
1673
+ "rstrip": false,
1674
+ "single_word": false,
1675
+ "special": true
1676
+ },
1677
+ "126289": {
1678
+ "content": "<|reserved_token_205|>",
1679
+ "lstrip": false,
1680
+ "normalized": false,
1681
+ "rstrip": false,
1682
+ "single_word": false,
1683
+ "special": true
1684
+ },
1685
+ "126290": {
1686
+ "content": "<|reserved_token_206|>",
1687
+ "lstrip": false,
1688
+ "normalized": false,
1689
+ "rstrip": false,
1690
+ "single_word": false,
1691
+ "special": true
1692
+ },
1693
+ "126291": {
1694
+ "content": "<|reserved_token_207|>",
1695
+ "lstrip": false,
1696
+ "normalized": false,
1697
+ "rstrip": false,
1698
+ "single_word": false,
1699
+ "special": true
1700
+ },
1701
+ "126292": {
1702
+ "content": "<|reserved_token_208|>",
1703
+ "lstrip": false,
1704
+ "normalized": false,
1705
+ "rstrip": false,
1706
+ "single_word": false,
1707
+ "special": true
1708
+ },
1709
+ "126293": {
1710
+ "content": "<|reserved_token_209|>",
1711
+ "lstrip": false,
1712
+ "normalized": false,
1713
+ "rstrip": false,
1714
+ "single_word": false,
1715
+ "special": true
1716
+ },
1717
+ "126294": {
1718
+ "content": "<|reserved_token_210|>",
1719
+ "lstrip": false,
1720
+ "normalized": false,
1721
+ "rstrip": false,
1722
+ "single_word": false,
1723
+ "special": true
1724
+ },
1725
+ "126295": {
1726
+ "content": "<|reserved_token_211|>",
1727
+ "lstrip": false,
1728
+ "normalized": false,
1729
+ "rstrip": false,
1730
+ "single_word": false,
1731
+ "special": true
1732
+ },
1733
+ "126296": {
1734
+ "content": "<|reserved_token_212|>",
1735
+ "lstrip": false,
1736
+ "normalized": false,
1737
+ "rstrip": false,
1738
+ "single_word": false,
1739
+ "special": true
1740
+ },
1741
+ "126297": {
1742
+ "content": "<|reserved_token_213|>",
1743
+ "lstrip": false,
1744
+ "normalized": false,
1745
+ "rstrip": false,
1746
+ "single_word": false,
1747
+ "special": true
1748
+ },
1749
+ "126298": {
1750
+ "content": "<|reserved_token_214|>",
1751
+ "lstrip": false,
1752
+ "normalized": false,
1753
+ "rstrip": false,
1754
+ "single_word": false,
1755
+ "special": true
1756
+ },
1757
+ "126299": {
1758
+ "content": "<|reserved_token_215|>",
1759
+ "lstrip": false,
1760
+ "normalized": false,
1761
+ "rstrip": false,
1762
+ "single_word": false,
1763
+ "special": true
1764
+ },
1765
+ "126300": {
1766
+ "content": "<|reserved_token_216|>",
1767
+ "lstrip": false,
1768
+ "normalized": false,
1769
+ "rstrip": false,
1770
+ "single_word": false,
1771
+ "special": true
1772
+ },
1773
+ "126301": {
1774
+ "content": "<|reserved_token_217|>",
1775
+ "lstrip": false,
1776
+ "normalized": false,
1777
+ "rstrip": false,
1778
+ "single_word": false,
1779
+ "special": true
1780
+ },
1781
+ "126302": {
1782
+ "content": "<|reserved_token_218|>",
1783
+ "lstrip": false,
1784
+ "normalized": false,
1785
+ "rstrip": false,
1786
+ "single_word": false,
1787
+ "special": true
1788
+ },
1789
+ "126303": {
1790
+ "content": "<|reserved_token_219|>",
1791
+ "lstrip": false,
1792
+ "normalized": false,
1793
+ "rstrip": false,
1794
+ "single_word": false,
1795
+ "special": true
1796
+ },
1797
+ "126304": {
1798
+ "content": "<|reserved_token_220|>",
1799
+ "lstrip": false,
1800
+ "normalized": false,
1801
+ "rstrip": false,
1802
+ "single_word": false,
1803
+ "special": true
1804
+ },
1805
+ "126305": {
1806
+ "content": "<|reserved_token_221|>",
1807
+ "lstrip": false,
1808
+ "normalized": false,
1809
+ "rstrip": false,
1810
+ "single_word": false,
1811
+ "special": true
1812
+ },
1813
+ "126306": {
1814
+ "content": "<|reserved_token_222|>",
1815
+ "lstrip": false,
1816
+ "normalized": false,
1817
+ "rstrip": false,
1818
+ "single_word": false,
1819
+ "special": true
1820
+ },
1821
+ "126307": {
1822
+ "content": "<|reserved_token_223|>",
1823
+ "lstrip": false,
1824
+ "normalized": false,
1825
+ "rstrip": false,
1826
+ "single_word": false,
1827
+ "special": true
1828
+ },
1829
+ "126308": {
1830
+ "content": "<|reserved_token_224|>",
1831
+ "lstrip": false,
1832
+ "normalized": false,
1833
+ "rstrip": false,
1834
+ "single_word": false,
1835
+ "special": true
1836
+ },
1837
+ "126309": {
1838
+ "content": "<|reserved_token_225|>",
1839
+ "lstrip": false,
1840
+ "normalized": false,
1841
+ "rstrip": false,
1842
+ "single_word": false,
1843
+ "special": true
1844
+ },
1845
+ "126310": {
1846
+ "content": "<|reserved_token_226|>",
1847
+ "lstrip": false,
1848
+ "normalized": false,
1849
+ "rstrip": false,
1850
+ "single_word": false,
1851
+ "special": true
1852
+ },
1853
+ "126311": {
1854
+ "content": "<|reserved_token_227|>",
1855
+ "lstrip": false,
1856
+ "normalized": false,
1857
+ "rstrip": false,
1858
+ "single_word": false,
1859
+ "special": true
1860
+ },
1861
+ "126312": {
1862
+ "content": "<|reserved_token_228|>",
1863
+ "lstrip": false,
1864
+ "normalized": false,
1865
+ "rstrip": false,
1866
+ "single_word": false,
1867
+ "special": true
1868
+ },
1869
+ "126313": {
1870
+ "content": "<|reserved_token_229|>",
1871
+ "lstrip": false,
1872
+ "normalized": false,
1873
+ "rstrip": false,
1874
+ "single_word": false,
1875
+ "special": true
1876
+ },
1877
+ "126314": {
1878
+ "content": "<|reserved_token_230|>",
1879
+ "lstrip": false,
1880
+ "normalized": false,
1881
+ "rstrip": false,
1882
+ "single_word": false,
1883
+ "special": true
1884
+ },
1885
+ "126315": {
1886
+ "content": "<|reserved_token_231|>",
1887
+ "lstrip": false,
1888
+ "normalized": false,
1889
+ "rstrip": false,
1890
+ "single_word": false,
1891
+ "special": true
1892
+ },
1893
+ "126316": {
1894
+ "content": "<|reserved_token_232|>",
1895
+ "lstrip": false,
1896
+ "normalized": false,
1897
+ "rstrip": false,
1898
+ "single_word": false,
1899
+ "special": true
1900
+ },
1901
+ "126317": {
1902
+ "content": "<|reserved_token_233|>",
1903
+ "lstrip": false,
1904
+ "normalized": false,
1905
+ "rstrip": false,
1906
+ "single_word": false,
1907
+ "special": true
1908
+ },
1909
+ "126318": {
1910
+ "content": "<|reserved_token_234|>",
1911
+ "lstrip": false,
1912
+ "normalized": false,
1913
+ "rstrip": false,
1914
+ "single_word": false,
1915
+ "special": true
1916
+ },
1917
+ "126319": {
1918
+ "content": "<|reserved_token_235|>",
1919
+ "lstrip": false,
1920
+ "normalized": false,
1921
+ "rstrip": false,
1922
+ "single_word": false,
1923
+ "special": true
1924
+ },
1925
+ "126320": {
1926
+ "content": "<|reserved_token_236|>",
1927
+ "lstrip": false,
1928
+ "normalized": false,
1929
+ "rstrip": false,
1930
+ "single_word": false,
1931
+ "special": true
1932
+ },
1933
+ "126321": {
1934
+ "content": "<|reserved_token_237|>",
1935
+ "lstrip": false,
1936
+ "normalized": false,
1937
+ "rstrip": false,
1938
+ "single_word": false,
1939
+ "special": true
1940
+ },
1941
+ "126322": {
1942
+ "content": "<|reserved_token_238|>",
1943
+ "lstrip": false,
1944
+ "normalized": false,
1945
+ "rstrip": false,
1946
+ "single_word": false,
1947
+ "special": true
1948
+ },
1949
+ "126323": {
1950
+ "content": "<|reserved_token_239|>",
1951
+ "lstrip": false,
1952
+ "normalized": false,
1953
+ "rstrip": false,
1954
+ "single_word": false,
1955
+ "special": true
1956
+ },
1957
+ "126324": {
1958
+ "content": "<|reserved_token_240|>",
1959
+ "lstrip": false,
1960
+ "normalized": false,
1961
+ "rstrip": false,
1962
+ "single_word": false,
1963
+ "special": true
1964
+ },
1965
+ "126325": {
1966
+ "content": "<|reserved_token_241|>",
1967
+ "lstrip": false,
1968
+ "normalized": false,
1969
+ "rstrip": false,
1970
+ "single_word": false,
1971
+ "special": true
1972
+ },
1973
+ "126326": {
1974
+ "content": "<|reserved_token_242|>",
1975
+ "lstrip": false,
1976
+ "normalized": false,
1977
+ "rstrip": false,
1978
+ "single_word": false,
1979
+ "special": true
1980
+ },
1981
+ "126327": {
1982
+ "content": "<|reserved_token_243|>",
1983
+ "lstrip": false,
1984
+ "normalized": false,
1985
+ "rstrip": false,
1986
+ "single_word": false,
1987
+ "special": true
1988
+ },
1989
+ "126328": {
1990
+ "content": "<|reserved_token_244|>",
1991
+ "lstrip": false,
1992
+ "normalized": false,
1993
+ "rstrip": false,
1994
+ "single_word": false,
1995
+ "special": true
1996
+ },
1997
+ "126329": {
1998
+ "content": "<|reserved_token_245|>",
1999
+ "lstrip": false,
2000
+ "normalized": false,
2001
+ "rstrip": false,
2002
+ "single_word": false,
2003
+ "special": true
2004
+ },
2005
+ "126330": {
2006
+ "content": "<|reserved_token_246|>",
2007
+ "lstrip": false,
2008
+ "normalized": false,
2009
+ "rstrip": false,
2010
+ "single_word": false,
2011
+ "special": true
2012
+ },
2013
+ "126331": {
2014
+ "content": "<|reserved_token_247|>",
2015
+ "lstrip": false,
2016
+ "normalized": false,
2017
+ "rstrip": false,
2018
+ "single_word": false,
2019
+ "special": true
2020
+ },
2021
+ "126332": {
2022
+ "content": "<|reserved_token_248|>",
2023
+ "lstrip": false,
2024
+ "normalized": false,
2025
+ "rstrip": false,
2026
+ "single_word": false,
2027
+ "special": true
2028
+ },
2029
+ "126333": {
2030
+ "content": "<|reserved_token_249|>",
2031
+ "lstrip": false,
2032
+ "normalized": false,
2033
+ "rstrip": false,
2034
+ "single_word": false,
2035
+ "special": true
2036
+ },
2037
+ "126334": {
2038
+ "content": "<|reserved_token_250|>",
2039
+ "lstrip": false,
2040
+ "normalized": false,
2041
+ "rstrip": false,
2042
+ "single_word": false,
2043
+ "special": true
2044
+ },
2045
+ "126335": {
2046
+ "content": "<|reserved_token_251|>",
2047
+ "lstrip": false,
2048
+ "normalized": false,
2049
+ "rstrip": false,
2050
+ "single_word": false,
2051
+ "special": true
2052
+ },
2053
+ "126336": {
2054
+ "content": "<|mdm_mask|>",
2055
+ "lstrip": false,
2056
+ "normalized": false,
2057
+ "rstrip": false,
2058
+ "single_word": false,
2059
+ "special": true
2060
+ },
2061
+ "126337": {
2062
+ "content": "<|reserved_token_253|>",
2063
+ "lstrip": false,
2064
+ "normalized": false,
2065
+ "rstrip": false,
2066
+ "single_word": false,
2067
+ "special": true
2068
+ },
2069
+ "126338": {
2070
+ "content": "<|reserved_token_254|>",
2071
+ "lstrip": false,
2072
+ "normalized": false,
2073
+ "rstrip": false,
2074
+ "single_word": false,
2075
+ "special": true
2076
+ },
2077
+ "126339": {
2078
+ "content": "<|reserved_token_255|>",
2079
+ "lstrip": false,
2080
+ "normalized": false,
2081
+ "rstrip": false,
2082
+ "single_word": false,
2083
+ "special": true
2084
+ },
2085
+ "126340": {
2086
+ "content": "<role>",
2087
+ "lstrip": false,
2088
+ "normalized": false,
2089
+ "rstrip": false,
2090
+ "single_word": false,
2091
+ "special": true
2092
+ },
2093
+ "126341": {
2094
+ "content": "</role>",
2095
+ "lstrip": false,
2096
+ "normalized": false,
2097
+ "rstrip": false,
2098
+ "single_word": false,
2099
+ "special": true
2100
+ },
2101
+ "126342": {
2102
+ "content": "<|arithmetic_start|>",
2103
+ "lstrip": false,
2104
+ "normalized": false,
2105
+ "rstrip": false,
2106
+ "single_word": false,
2107
+ "special": true
2108
+ },
2109
+ "126343": {
2110
+ "content": "<|arithmetic_end|>",
2111
+ "lstrip": false,
2112
+ "normalized": false,
2113
+ "rstrip": false,
2114
+ "single_word": false,
2115
+ "special": true
2116
+ },
2117
+ "126344": {
2118
+ "content": "<|number_start|>",
2119
+ "lstrip": false,
2120
+ "normalized": false,
2121
+ "rstrip": false,
2122
+ "single_word": false,
2123
+ "special": true
2124
+ },
2125
+ "126345": {
2126
+ "content": "<|number_end|>",
2127
+ "lstrip": false,
2128
+ "normalized": false,
2129
+ "rstrip": false,
2130
+ "single_word": false,
2131
+ "special": true
2132
+ },
2133
+ "126346": {
2134
+ "content": "<|start_header_id|>",
2135
+ "lstrip": false,
2136
+ "normalized": false,
2137
+ "rstrip": false,
2138
+ "single_word": false,
2139
+ "special": true
2140
+ },
2141
+ "126347": {
2142
+ "content": "<|end_header_id|>",
2143
+ "lstrip": false,
2144
+ "normalized": false,
2145
+ "rstrip": false,
2146
+ "single_word": false,
2147
+ "special": true
2148
+ },
2149
+ "126348": {
2150
+ "content": "<|eot_id|>",
2151
+ "lstrip": false,
2152
+ "normalized": false,
2153
+ "rstrip": false,
2154
+ "single_word": false,
2155
+ "special": true
2156
+ }
2157
+ },
2158
+ "additional_special_tokens": [
2159
+ "<role>",
2160
+ "</role>",
2161
+ "<|arithmetic_start|>",
2162
+ "<|arithmetic_end|>",
2163
+ "<|number_start|>",
2164
+ "<|number_end|>"
2165
+ ],
2166
+ "bos_token": "<|startoftext|>",
2167
+ "chat_template": "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}",
2168
+ "clean_up_tokenization_spaces": false,
2169
+ "cls_token": "[CLS]",
2170
+ "eos_token": "<|endoftext|>",
2171
+ "extra_special_tokens": {},
2172
+ "fast_tokenizer": true,
2173
+ "gmask_token": "[gMASK]",
2174
+ "merges_file": null,
2175
+ "model_input_names": [
2176
+ "input_ids",
2177
+ "attention_mask"
2178
+ ],
2179
+ "model_max_length": 1000000000000000019884624838656,
2180
+ "pad_token": "<|endoftext|>",
2181
+ "tokenizer_class": "PreTrainedTokenizer",
2182
+ "trust_remote_code": true
2183
+ }