p2o6e100 commited on
Commit
b6dcc99
·
1 Parent(s): ace8f35

init commit

Browse files
config.json ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "vocab_size": 77209,
3
+ "max_position_embeddings": 131072,
4
+ "hidden_size": 3584,
5
+ "intermediate_size": 14336,
6
+ "num_hidden_layers": 32,
7
+ "num_attention_heads": 28,
8
+ "pruned_layers": [
9
+ 4,
10
+ 5,
11
+ 6,
12
+ 7,
13
+ 8,
14
+ 9,
15
+ 10,
16
+ 11,
17
+ 12,
18
+ 13,
19
+ 14,
20
+ 15,
21
+ 16,
22
+ 17,
23
+ 18,
24
+ 19,
25
+ 20,
26
+ 21,
27
+ 22,
28
+ 23,
29
+ 24,
30
+ 25,
31
+ 26,
32
+ 27
33
+ ],
34
+ "pruned_intermediate_size": 11468,
35
+ "num_key_value_heads": 7,
36
+ "hidden_act": "silu",
37
+ "initializer_range": 0.02,
38
+ "rms_norm_eps": 1e-05,
39
+ "pretraining_tp": 1,
40
+ "use_cache": true,
41
+ "rope_theta": 500000.0,
42
+ "rope_scaling": {
43
+ "factor": 8.0,
44
+ "high_freq_factor": 4.0,
45
+ "low_freq_factor": 1.0,
46
+ "original_max_position_embeddings": 8192,
47
+ "rope_type": "llama3"
48
+ },
49
+ "attention_bias": false,
50
+ "attention_dropout": 0.0,
51
+ "mlp_bias": false,
52
+ "return_dict": true,
53
+ "output_hidden_states": false,
54
+ "output_attentions": false,
55
+ "torchscript": false,
56
+ "torch_dtype": "bfloat16",
57
+ "use_bfloat16": false,
58
+ "tf_legacy_loss": false,
59
+ "pruned_heads": {},
60
+ "tie_word_embeddings": false,
61
+ "chunk_size_feed_forward": 0,
62
+ "is_encoder_decoder": false,
63
+ "is_decoder": false,
64
+ "cross_attention_hidden_size": null,
65
+ "add_cross_attention": false,
66
+ "tie_encoder_decoder": false,
67
+ "max_length": 20,
68
+ "min_length": 0,
69
+ "do_sample": false,
70
+ "early_stopping": false,
71
+ "num_beams": 1,
72
+ "num_beam_groups": 1,
73
+ "diversity_penalty": 0.0,
74
+ "temperature": 1e-6,
75
+ "top_k": 1,
76
+ "top_p": 1.0,
77
+ "typical_p": 1.0,
78
+ "repetition_penalty": 1.0,
79
+ "length_penalty": 1.0,
80
+ "no_repeat_ngram_size": 0,
81
+ "encoder_no_repeat_ngram_size": 0,
82
+ "bad_words_ids": null,
83
+ "num_return_sequences": 1,
84
+ "output_scores": false,
85
+ "return_dict_in_generate": false,
86
+ "forced_bos_token_id": null,
87
+ "forced_eos_token_id": null,
88
+ "remove_invalid_values": false,
89
+ "exponential_decay_length_penalty": null,
90
+ "suppress_tokens": null,
91
+ "begin_suppress_tokens": null,
92
+ "architectures": [
93
+ "LlamaForCausalLM"
94
+ ],
95
+ "finetuning_task": null,
96
+ "id2label": {
97
+ "0": "LABEL_0",
98
+ "1": "LABEL_1"
99
+ },
100
+ "label2id": {
101
+ "LABEL_0": 0,
102
+ "LABEL_1": 1
103
+ },
104
+ "tokenizer_class": null,
105
+ "prefix": null,
106
+ "bos_token_id": 76953,
107
+ "pad_token_id": null,
108
+ "eos_token_id": [
109
+ 76954,
110
+ 76961,
111
+ 76962
112
+ ],
113
+ "sep_token_id": null,
114
+ "decoder_start_token_id": null,
115
+ "task_specific_params": null,
116
+ "problem_type": null,
117
+ "_name_or_path": "Llama-3.1-lm-pruned-0.6-ft3000-width-pruned-a0m4-ft3000-concat-alpaca_bi_chat-0.05-param-ratio-0.62-top5_delta0.15-ft/checkpoint-9000",
118
+ "transformers_version": "4.44.2",
119
+ "auto_map": {
120
+ "AutoConfig": "configuration_llama.LlamaConfig",
121
+ "AutoModelForCausalLM": "modeling_llama.LlamaForCausalLM"
122
+ },
123
+ "model_type": "llama",
124
+ "truncation_ranks": {
125
+ "model.layers.0.mlp.gate_up_proj": 2508,
126
+ "model.layers.0.self_attn.o_proj": 764,
127
+ "model.layers.0.self_attn.qkv_proj": 929,
128
+ "model.layers.1.mlp.gate_up_proj": 2508,
129
+ "model.layers.1.self_attn.o_proj": 477,
130
+ "model.layers.1.self_attn.qkv_proj": 581,
131
+ "model.layers.10.mlp.down_proj": 302,
132
+ "model.layers.10.mlp.gate_up_proj": 869,
133
+ "model.layers.10.self_attn.o_proj": 477,
134
+ "model.layers.10.self_attn.qkv_proj": 581,
135
+ "model.layers.11.mlp.down_proj": 302,
136
+ "model.layers.11.mlp.gate_up_proj": 348,
137
+ "model.layers.11.self_attn.o_proj": 477,
138
+ "model.layers.11.self_attn.qkv_proj": 581,
139
+ "model.layers.12.mlp.down_proj": 1207,
140
+ "model.layers.12.mlp.gate_up_proj": 1391,
141
+ "model.layers.12.self_attn.o_proj": 477,
142
+ "model.layers.12.self_attn.qkv_proj": 581,
143
+ "model.layers.13.self_attn.o_proj": 191,
144
+ "model.layers.13.self_attn.qkv_proj": 581,
145
+ "model.layers.14.self_attn.o_proj": 764,
146
+ "model.layers.14.self_attn.qkv_proj": 929,
147
+ "model.layers.15.mlp.down_proj": 1659,
148
+ "model.layers.15.mlp.gate_up_proj": 869,
149
+ "model.layers.15.self_attn.o_proj": 764,
150
+ "model.layers.15.self_attn.qkv_proj": 1278,
151
+ "model.layers.16.mlp.gate_up_proj": 1912,
152
+ "model.layers.16.self_attn.o_proj": 477,
153
+ "model.layers.16.self_attn.qkv_proj": 929,
154
+ "model.layers.17.mlp.gate_up_proj": 1912,
155
+ "model.layers.17.self_attn.o_proj": 477,
156
+ "model.layers.17.self_attn.qkv_proj": 929,
157
+ "model.layers.18.self_attn.o_proj": 477,
158
+ "model.layers.18.self_attn.qkv_proj": 929,
159
+ "model.layers.19.mlp.down_proj": 1659,
160
+ "model.layers.19.mlp.gate_up_proj": 1912,
161
+ "model.layers.19.self_attn.o_proj": 477,
162
+ "model.layers.19.self_attn.qkv_proj": 581,
163
+ "model.layers.2.self_attn.o_proj": 477,
164
+ "model.layers.2.self_attn.qkv_proj": 1278,
165
+ "model.layers.20.mlp.down_proj": 1207,
166
+ "model.layers.20.mlp.gate_up_proj": 1391,
167
+ "model.layers.20.self_attn.o_proj": 191,
168
+ "model.layers.20.self_attn.qkv_proj": 232,
169
+ "model.layers.21.mlp.down_proj": 2565,
170
+ "model.layers.21.mlp.gate_up_proj": 2433,
171
+ "model.layers.21.self_attn.o_proj": 477,
172
+ "model.layers.21.self_attn.qkv_proj": 581,
173
+ "model.layers.22.mlp.down_proj": 2112,
174
+ "model.layers.22.mlp.gate_up_proj": 1912,
175
+ "model.layers.22.self_attn.o_proj": 477,
176
+ "model.layers.22.self_attn.qkv_proj": 581,
177
+ "model.layers.23.mlp.down_proj": 1207,
178
+ "model.layers.23.mlp.gate_up_proj": 1391,
179
+ "model.layers.23.self_attn.o_proj": 477,
180
+ "model.layers.23.self_attn.qkv_proj": 581,
181
+ "model.layers.24.mlp.down_proj": 1207,
182
+ "model.layers.24.mlp.gate_up_proj": 1391,
183
+ "model.layers.24.self_attn.o_proj": 191,
184
+ "model.layers.24.self_attn.qkv_proj": 581,
185
+ "model.layers.25.mlp.down_proj": 1207,
186
+ "model.layers.25.mlp.gate_up_proj": 1391,
187
+ "model.layers.25.self_attn.o_proj": 477,
188
+ "model.layers.25.self_attn.qkv_proj": 581,
189
+ "model.layers.26.mlp.down_proj": 1207,
190
+ "model.layers.26.mlp.gate_up_proj": 1391,
191
+ "model.layers.26.self_attn.o_proj": 191,
192
+ "model.layers.26.self_attn.qkv_proj": 581,
193
+ "model.layers.27.mlp.down_proj": 1207,
194
+ "model.layers.27.mlp.gate_up_proj": 1391,
195
+ "model.layers.27.self_attn.o_proj": 191,
196
+ "model.layers.27.self_attn.qkv_proj": 581,
197
+ "model.layers.28.mlp.down_proj": 2707,
198
+ "model.layers.28.mlp.gate_up_proj": 1971,
199
+ "model.layers.28.self_attn.o_proj": 191,
200
+ "model.layers.28.self_attn.qkv_proj": 581,
201
+ "model.layers.29.self_attn.o_proj": 191,
202
+ "model.layers.29.self_attn.qkv_proj": 581,
203
+ "model.layers.3.self_attn.o_proj": 764,
204
+ "model.layers.3.self_attn.qkv_proj": 1278,
205
+ "model.layers.30.self_attn.o_proj": 191,
206
+ "model.layers.30.self_attn.qkv_proj": 581,
207
+ "model.layers.31.mlp.down_proj": 2229,
208
+ "model.layers.31.self_attn.o_proj": 477,
209
+ "model.layers.31.self_attn.qkv_proj": 581,
210
+ "model.layers.4.mlp.down_proj": 2112,
211
+ "model.layers.4.mlp.gate_up_proj": 2433,
212
+ "model.layers.4.self_attn.o_proj": 477,
213
+ "model.layers.4.self_attn.qkv_proj": 929,
214
+ "model.layers.5.mlp.down_proj": 1659,
215
+ "model.layers.5.mlp.gate_up_proj": 2433,
216
+ "model.layers.5.self_attn.o_proj": 477,
217
+ "model.layers.5.self_attn.qkv_proj": 929,
218
+ "model.layers.6.self_attn.o_proj": 477,
219
+ "model.layers.6.self_attn.qkv_proj": 581,
220
+ "model.layers.7.mlp.down_proj": 1207,
221
+ "model.layers.7.mlp.gate_up_proj": 1912,
222
+ "model.layers.7.self_attn.o_proj": 477,
223
+ "model.layers.7.self_attn.qkv_proj": 581,
224
+ "model.layers.8.mlp.down_proj": 754,
225
+ "model.layers.8.mlp.gate_up_proj": 1391,
226
+ "model.layers.8.self_attn.o_proj": 477,
227
+ "model.layers.8.self_attn.qkv_proj": 581,
228
+ "model.layers.9.mlp.down_proj": 302,
229
+ "model.layers.9.mlp.gate_up_proj": 869,
230
+ "model.layers.9.self_attn.o_proj": 477,
231
+ "model.layers.9.self_attn.qkv_proj": 581
232
+ },
233
+ "ori_hidden_size": 4096
234
+ }
configuration_llama.py ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
5
+ # and OPT implementations in this library. It has been modified from its
6
+ # original forms to accommodate minor architectural differences compared
7
+ # to GPT-NeoX and OPT used by the Meta AI team that trained the model.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ """LLaMA model configuration"""
21
+
22
+ from transformers.configuration_utils import PretrainedConfig
23
+ from transformers.modeling_rope_utils import rope_config_validation
24
+
25
+
26
+ class LlamaConfig(PretrainedConfig):
27
+ r"""
28
+ This is the configuration class to store the configuration of a [`LlamaModel`]. It is used to instantiate an LLaMA
29
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
30
+ defaults will yield a similar configuration to that of the LLaMA-7B.
31
+
32
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
33
+ documentation from [`PretrainedConfig`] for more information.
34
+
35
+
36
+ Args:
37
+ vocab_size (`int`, *optional*, defaults to 32000):
38
+ Vocabulary size of the LLaMA model. Defines the number of different tokens that can be represented by the
39
+ `inputs_ids` passed when calling [`LlamaModel`]
40
+ hidden_size (`int`, *optional*, defaults to 4096):
41
+ Dimension of the hidden representations.
42
+ intermediate_size (`int`, *optional*, defaults to 11008):
43
+ Dimension of the MLP representations.
44
+ num_hidden_layers (`int`, *optional*, defaults to 32):
45
+ Number of hidden layers in the Transformer decoder.
46
+ num_attention_heads (`int`, *optional*, defaults to 32):
47
+ Number of attention heads for each attention layer in the Transformer decoder.
48
+ num_key_value_heads (`int`, *optional*):
49
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
50
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
51
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
52
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
53
+ by meanpooling all the original heads within that group. For more details checkout [this
54
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
55
+ `num_attention_heads`.
56
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
57
+ The non-linear activation function (function or string) in the decoder.
58
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
59
+ The maximum sequence length that this model might ever be used with. Llama 1 supports up to 2048 tokens,
60
+ Llama 2 up to 4096, CodeLlama up to 16384.
61
+ initializer_range (`float`, *optional*, defaults to 0.02):
62
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
63
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
64
+ The epsilon used by the rms normalization layers.
65
+ use_cache (`bool`, *optional*, defaults to `True`):
66
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
67
+ relevant if `config.is_decoder=True`.
68
+ pad_token_id (`int`, *optional*):
69
+ Padding token id.
70
+ bos_token_id (`int`, *optional*, defaults to 1):
71
+ Beginning of stream token id.
72
+ eos_token_id (`int`, *optional*, defaults to 2):
73
+ End of stream token id.
74
+ pretraining_tp (`int`, *optional*, defaults to 1):
75
+ Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
76
+ document](https://huggingface.co/docs/transformers/main/perf_train_gpu_many#tensor-parallelism) to
77
+ understand more about it. This value is necessary to ensure exact reproducibility of the pretraining
78
+ results. Please refer to [this issue](https://github.com/pytorch/pytorch/issues/76232).
79
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
80
+ Whether to tie weight embeddings
81
+ rope_theta (`float`, *optional*, defaults to 10000.0):
82
+ The base period of the RoPE embeddings.
83
+ rope_scaling (`Dict`, *optional*):
84
+ Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
85
+ and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
86
+ accordingly.
87
+ Expected contents:
88
+ `rope_type` (`str`):
89
+ The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
90
+ 'llama3'], with 'default' being the original RoPE implementation.
91
+ `factor` (`float`, *optional*):
92
+ Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
93
+ most scaling types, a `factor` of x will enable the model to handle sequences of length x *
94
+ original maximum pre-trained length.
95
+ `original_max_position_embeddings` (`int`, *optional*):
96
+ Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
97
+ pretraining.
98
+ `attention_factor` (`float`, *optional*):
99
+ Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
100
+ computation. If unspecified, it defaults to value recommended by the implementation, using the
101
+ `factor` field to infer the suggested value.
102
+ `beta_fast` (`float`, *optional*):
103
+ Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
104
+ ramp function. If unspecified, it defaults to 32.
105
+ `beta_slow` (`float`, *optional*):
106
+ Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
107
+ ramp function. If unspecified, it defaults to 1.
108
+ `short_factor` (`List[float]`, *optional*):
109
+ Only used with 'longrope'. The scaling factor to be applied to short contexts (<
110
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
111
+ size divided by the number of attention heads divided by 2
112
+ `long_factor` (`List[float]`, *optional*):
113
+ Only used with 'longrope'. The scaling factor to be applied to long contexts (<
114
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
115
+ size divided by the number of attention heads divided by 2
116
+ `low_freq_factor` (`float`, *optional*):
117
+ Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
118
+ `high_freq_factor` (`float`, *optional*):
119
+ Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
120
+ attention_bias (`bool`, *optional*, defaults to `False`):
121
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
122
+ attention_dropout (`float`, *optional*, defaults to 0.0):
123
+ The dropout ratio for the attention probabilities.
124
+ mlp_bias (`bool`, *optional*, defaults to `False`):
125
+ Whether to use a bias in up_proj, down_proj and gate_proj layers in the MLP layers.
126
+
127
+ ```python
128
+ >>> from transformers import LlamaModel, LlamaConfig
129
+
130
+ >>> # Initializing a LLaMA llama-7b style configuration
131
+ >>> configuration = LlamaConfig()
132
+
133
+ >>> # Initializing a model from the llama-7b style configuration
134
+ >>> model = LlamaModel(configuration)
135
+
136
+ >>> # Accessing the model configuration
137
+ >>> configuration = model.config
138
+ ```"""
139
+
140
+ model_type = "llama"
141
+ keys_to_ignore_at_inference = ["past_key_values"]
142
+
143
+ def __init__(
144
+ self,
145
+ vocab_size=32000,
146
+ hidden_size=4096,
147
+ intermediate_size=11008,
148
+ num_hidden_layers=32,
149
+ num_attention_heads=32,
150
+ num_key_value_heads=None,
151
+ hidden_act="silu",
152
+ max_position_embeddings=2048,
153
+ initializer_range=0.02,
154
+ rms_norm_eps=1e-6,
155
+ use_cache=True,
156
+ pad_token_id=None,
157
+ bos_token_id=1,
158
+ eos_token_id=2,
159
+ pretraining_tp=1,
160
+ tie_word_embeddings=False,
161
+ rope_theta=10000.0,
162
+ rope_scaling=None,
163
+ attention_bias=False,
164
+ attention_dropout=0.0,
165
+ mlp_bias=False,
166
+ pruned_layers=[],
167
+ pruned_intermediate_size=12185,
168
+ truncation_ranks=None,
169
+ ori_hidden_size=4096,
170
+ **kwargs,
171
+ ):
172
+ self.vocab_size = vocab_size
173
+ self.max_position_embeddings = max_position_embeddings
174
+ self.hidden_size = hidden_size
175
+ self.intermediate_size = intermediate_size
176
+ self.num_hidden_layers = num_hidden_layers
177
+ self.num_attention_heads = num_attention_heads
178
+ self.pruned_layers = pruned_layers
179
+ self.pruned_intermediate_size = pruned_intermediate_size
180
+ self.ori_hidden_size = ori_hidden_size
181
+
182
+ # for backward compatibility
183
+ if num_key_value_heads is None:
184
+ num_key_value_heads = num_attention_heads
185
+
186
+ self.num_key_value_heads = num_key_value_heads
187
+ self.hidden_act = hidden_act
188
+ self.initializer_range = initializer_range
189
+ self.rms_norm_eps = rms_norm_eps
190
+ self.pretraining_tp = pretraining_tp
191
+ self.use_cache = use_cache
192
+ self.rope_theta = rope_theta
193
+ self.rope_scaling = rope_scaling
194
+ self.attention_bias = attention_bias
195
+ self.attention_dropout = attention_dropout
196
+ self.mlp_bias = mlp_bias
197
+
198
+ # Validate the correctness of rotary position embeddings parameters
199
+ # BC: if there is a 'type' field, move it to 'rope_type'.
200
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
201
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
202
+ rope_config_validation(self)
203
+
204
+ super().__init__(
205
+ pad_token_id=pad_token_id,
206
+ bos_token_id=bos_token_id,
207
+ eos_token_id=eos_token_id,
208
+ tie_word_embeddings=tie_word_embeddings,
209
+ **kwargs,
210
+ )
211
+
212
+ # for asvd
213
+ self.truncation_ranks = truncation_ranks
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 76953,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 76954,
6
+ 76961,
7
+ 76962
8
+ ],
9
+ "pad_token_id": 76957,
10
+ "temperature": 0.6,
11
+ "top_p": 0.9,
12
+ "transformers_version": "4.44.2"
13
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5fef1e329fa2b92bd6b19d34a9116ab15d20017c88bf0d02df712aca853ef4b0
3
+ size 4978140776
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fed18a3ba17c6f8bc213cba5e21dded1132a9cc8d708f6320879855240b93209
3
+ size 3161215880
model.safetensors.index.json ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 8139319952
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00002-of-00002.safetensors",
7
+ "model.embed_tokens.weight": "model-00001-of-00002.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
10
+ "model.layers.0.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
11
+ "model.layers.0.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
13
+ "model.layers.0.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
14
+ "model.layers.0.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
15
+ "model.layers.0.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
16
+ "model.layers.0.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
17
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
18
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
19
+ "model.layers.1.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
20
+ "model.layers.1.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
21
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
22
+ "model.layers.1.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
23
+ "model.layers.1.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
24
+ "model.layers.1.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
25
+ "model.layers.1.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
26
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
27
+ "model.layers.10.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
28
+ "model.layers.10.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
29
+ "model.layers.10.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
30
+ "model.layers.10.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
31
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
32
+ "model.layers.10.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
33
+ "model.layers.10.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
34
+ "model.layers.10.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
35
+ "model.layers.10.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
36
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
37
+ "model.layers.11.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
38
+ "model.layers.11.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
39
+ "model.layers.11.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
40
+ "model.layers.11.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
41
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
42
+ "model.layers.11.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
43
+ "model.layers.11.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
44
+ "model.layers.11.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
45
+ "model.layers.11.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
46
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
47
+ "model.layers.12.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
48
+ "model.layers.12.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
49
+ "model.layers.12.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
50
+ "model.layers.12.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
51
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
52
+ "model.layers.12.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
53
+ "model.layers.12.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
54
+ "model.layers.12.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
55
+ "model.layers.12.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
56
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
57
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
58
+ "model.layers.13.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
59
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
60
+ "model.layers.13.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
61
+ "model.layers.13.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
62
+ "model.layers.13.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
63
+ "model.layers.13.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
64
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
65
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
66
+ "model.layers.14.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
67
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
68
+ "model.layers.14.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
69
+ "model.layers.14.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
70
+ "model.layers.14.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
71
+ "model.layers.14.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
72
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
73
+ "model.layers.15.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
74
+ "model.layers.15.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
75
+ "model.layers.15.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
76
+ "model.layers.15.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
77
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
78
+ "model.layers.15.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
79
+ "model.layers.15.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
80
+ "model.layers.15.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
81
+ "model.layers.15.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
82
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
83
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
84
+ "model.layers.16.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
85
+ "model.layers.16.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
86
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
87
+ "model.layers.16.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
88
+ "model.layers.16.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
89
+ "model.layers.16.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
90
+ "model.layers.16.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
91
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
92
+ "model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
93
+ "model.layers.17.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
94
+ "model.layers.17.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
95
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
96
+ "model.layers.17.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
97
+ "model.layers.17.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
98
+ "model.layers.17.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
99
+ "model.layers.17.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
100
+ "model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
101
+ "model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
102
+ "model.layers.18.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
103
+ "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
104
+ "model.layers.18.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
105
+ "model.layers.18.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
106
+ "model.layers.18.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
107
+ "model.layers.18.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
108
+ "model.layers.19.input_layernorm.weight": "model-00002-of-00002.safetensors",
109
+ "model.layers.19.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
110
+ "model.layers.19.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
111
+ "model.layers.19.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
112
+ "model.layers.19.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
113
+ "model.layers.19.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
114
+ "model.layers.19.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
115
+ "model.layers.19.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
116
+ "model.layers.19.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
117
+ "model.layers.19.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
118
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
119
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
120
+ "model.layers.2.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
121
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
122
+ "model.layers.2.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
123
+ "model.layers.2.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
124
+ "model.layers.2.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
125
+ "model.layers.2.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
126
+ "model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
127
+ "model.layers.20.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
128
+ "model.layers.20.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
129
+ "model.layers.20.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
130
+ "model.layers.20.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
131
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
132
+ "model.layers.20.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
133
+ "model.layers.20.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
134
+ "model.layers.20.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
135
+ "model.layers.20.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
136
+ "model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
137
+ "model.layers.21.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
138
+ "model.layers.21.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
139
+ "model.layers.21.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
140
+ "model.layers.21.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
141
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
142
+ "model.layers.21.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
143
+ "model.layers.21.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
144
+ "model.layers.21.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
145
+ "model.layers.21.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
146
+ "model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
147
+ "model.layers.22.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
148
+ "model.layers.22.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
149
+ "model.layers.22.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
150
+ "model.layers.22.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
151
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
152
+ "model.layers.22.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
153
+ "model.layers.22.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
154
+ "model.layers.22.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
155
+ "model.layers.22.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
156
+ "model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
157
+ "model.layers.23.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
158
+ "model.layers.23.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
159
+ "model.layers.23.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
160
+ "model.layers.23.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
161
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
162
+ "model.layers.23.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
163
+ "model.layers.23.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
164
+ "model.layers.23.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
165
+ "model.layers.23.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
166
+ "model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
167
+ "model.layers.24.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
168
+ "model.layers.24.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
169
+ "model.layers.24.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
170
+ "model.layers.24.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
171
+ "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
172
+ "model.layers.24.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
173
+ "model.layers.24.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
174
+ "model.layers.24.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
175
+ "model.layers.24.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
176
+ "model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
177
+ "model.layers.25.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
178
+ "model.layers.25.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
179
+ "model.layers.25.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
180
+ "model.layers.25.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
181
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
182
+ "model.layers.25.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
183
+ "model.layers.25.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
184
+ "model.layers.25.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
185
+ "model.layers.25.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
186
+ "model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
187
+ "model.layers.26.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
188
+ "model.layers.26.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
189
+ "model.layers.26.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
190
+ "model.layers.26.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
191
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
192
+ "model.layers.26.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
193
+ "model.layers.26.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
194
+ "model.layers.26.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
195
+ "model.layers.26.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
196
+ "model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
197
+ "model.layers.27.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
198
+ "model.layers.27.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
199
+ "model.layers.27.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
200
+ "model.layers.27.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
201
+ "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
202
+ "model.layers.27.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
203
+ "model.layers.27.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
204
+ "model.layers.27.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
205
+ "model.layers.27.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
206
+ "model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
207
+ "model.layers.28.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
208
+ "model.layers.28.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
209
+ "model.layers.28.mlp.gate_up_proj.ALinear.weight": "model-00002-of-00002.safetensors",
210
+ "model.layers.28.mlp.gate_up_proj.BLinear.weight": "model-00002-of-00002.safetensors",
211
+ "model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
212
+ "model.layers.28.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
213
+ "model.layers.28.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
214
+ "model.layers.28.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
215
+ "model.layers.28.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
216
+ "model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
217
+ "model.layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
218
+ "model.layers.29.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
219
+ "model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
220
+ "model.layers.29.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
221
+ "model.layers.29.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
222
+ "model.layers.29.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
223
+ "model.layers.29.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
224
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
225
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
226
+ "model.layers.3.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
227
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
228
+ "model.layers.3.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
229
+ "model.layers.3.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
230
+ "model.layers.3.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
231
+ "model.layers.3.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
232
+ "model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
233
+ "model.layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
234
+ "model.layers.30.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
235
+ "model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
236
+ "model.layers.30.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
237
+ "model.layers.30.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
238
+ "model.layers.30.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
239
+ "model.layers.30.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
240
+ "model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
241
+ "model.layers.31.mlp.down_proj.ALinear.weight": "model-00002-of-00002.safetensors",
242
+ "model.layers.31.mlp.down_proj.BLinear.weight": "model-00002-of-00002.safetensors",
243
+ "model.layers.31.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
244
+ "model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
245
+ "model.layers.31.self_attn.o_proj.ALinear.weight": "model-00002-of-00002.safetensors",
246
+ "model.layers.31.self_attn.o_proj.BLinear.weight": "model-00002-of-00002.safetensors",
247
+ "model.layers.31.self_attn.qkv_proj.ALinear.weight": "model-00002-of-00002.safetensors",
248
+ "model.layers.31.self_attn.qkv_proj.BLinear.weight": "model-00002-of-00002.safetensors",
249
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
250
+ "model.layers.4.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
251
+ "model.layers.4.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
252
+ "model.layers.4.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
253
+ "model.layers.4.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
254
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
255
+ "model.layers.4.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
256
+ "model.layers.4.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
257
+ "model.layers.4.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
258
+ "model.layers.4.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
259
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
260
+ "model.layers.5.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
261
+ "model.layers.5.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
262
+ "model.layers.5.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
263
+ "model.layers.5.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
264
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
265
+ "model.layers.5.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
266
+ "model.layers.5.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
267
+ "model.layers.5.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
268
+ "model.layers.5.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
269
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
270
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
271
+ "model.layers.6.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
272
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
273
+ "model.layers.6.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
274
+ "model.layers.6.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
275
+ "model.layers.6.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
276
+ "model.layers.6.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
277
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
278
+ "model.layers.7.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
279
+ "model.layers.7.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
280
+ "model.layers.7.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
281
+ "model.layers.7.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
282
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
283
+ "model.layers.7.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
284
+ "model.layers.7.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
285
+ "model.layers.7.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
286
+ "model.layers.7.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
287
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
288
+ "model.layers.8.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
289
+ "model.layers.8.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
290
+ "model.layers.8.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
291
+ "model.layers.8.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
292
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
293
+ "model.layers.8.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
294
+ "model.layers.8.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
295
+ "model.layers.8.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
296
+ "model.layers.8.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
297
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
298
+ "model.layers.9.mlp.down_proj.ALinear.weight": "model-00001-of-00002.safetensors",
299
+ "model.layers.9.mlp.down_proj.BLinear.weight": "model-00001-of-00002.safetensors",
300
+ "model.layers.9.mlp.gate_up_proj.ALinear.weight": "model-00001-of-00002.safetensors",
301
+ "model.layers.9.mlp.gate_up_proj.BLinear.weight": "model-00001-of-00002.safetensors",
302
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
303
+ "model.layers.9.self_attn.o_proj.ALinear.weight": "model-00001-of-00002.safetensors",
304
+ "model.layers.9.self_attn.o_proj.BLinear.weight": "model-00001-of-00002.safetensors",
305
+ "model.layers.9.self_attn.qkv_proj.ALinear.weight": "model-00001-of-00002.safetensors",
306
+ "model.layers.9.self_attn.qkv_proj.BLinear.weight": "model-00001-of-00002.safetensors",
307
+ "model.norm.weight": "model-00002-of-00002.safetensors"
308
+ }
309
+ }
modeling_llama.py ADDED
@@ -0,0 +1,1675 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
5
+ # and OPT implementations in this library. It has been modified from its
6
+ # original forms to accommodate minor architectural differences compared
7
+ # to GPT-NeoX and OPT used by the Meta AI team that trained the model.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ import math
21
+ from typing import List, Optional, Tuple, Union
22
+
23
+ import torch
24
+ import torch.nn.functional as F
25
+ import torch.utils.checkpoint
26
+ from torch import nn
27
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
28
+
29
+ from transformers.activations import ACT2FN
30
+ from transformers.cache_utils import Cache, DynamicCache, StaticCache
31
+ from transformers.modeling_attn_mask_utils import AttentionMaskConverter
32
+ from transformers.modeling_flash_attention_utils import _flash_attention_forward
33
+ from transformers.modeling_outputs import (
34
+ BaseModelOutputWithPast,
35
+ CausalLMOutputWithPast,
36
+ QuestionAnsweringModelOutput,
37
+ SequenceClassifierOutputWithPast,
38
+ TokenClassifierOutput,
39
+ )
40
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS
41
+ from transformers.modeling_utils import PreTrainedModel
42
+ from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS
43
+ from transformers.utils import (
44
+ add_start_docstrings,
45
+ add_start_docstrings_to_model_forward,
46
+ is_flash_attn_greater_or_equal_2_10,
47
+ logging,
48
+ replace_return_docstrings,
49
+ )
50
+ from .configuration_llama import LlamaConfig
51
+
52
+
53
+ logger = logging.get_logger(__name__)
54
+
55
+ _CONFIG_FOR_DOC = "LlamaConfig"
56
+
57
+
58
+ def _prepare_4d_causal_attention_mask_with_cache_position(
59
+ attention_mask: torch.Tensor,
60
+ sequence_length: int,
61
+ target_length: int,
62
+ dtype: torch.dtype,
63
+ device: torch.device,
64
+ min_dtype: float,
65
+ cache_position: torch.Tensor,
66
+ batch_size: int,
67
+ ):
68
+ """
69
+ Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
70
+ `(batch_size, key_value_length)`, or if the input `attention_mask` is already 4D, do nothing.
71
+
72
+ Args:
73
+ attention_mask (`torch.Tensor`):
74
+ A 2D attention mask of shape `(batch_size, key_value_length)` or a 4D attention mask of shape `(batch_size, 1, query_length, key_value_length)`.
75
+ sequence_length (`int`):
76
+ The sequence length being processed.
77
+ target_length (`int`):
78
+ The target length: when generating with static cache, the mask should be as long as the static cache, to account for the 0 padding, the part of the cache that is not filled yet.
79
+ dtype (`torch.dtype`):
80
+ The dtype to use for the 4D attention mask.
81
+ device (`torch.device`):
82
+ The device to plcae the 4D attention mask on.
83
+ min_dtype (`float`):
84
+ The minimum value representable with the dtype `dtype`.
85
+ cache_position (`torch.Tensor`):
86
+ Indices depicting the position of the input sequence tokens in the sequence.
87
+ batch_size (`torch.Tensor`):
88
+ Batch size.
89
+ """
90
+ if attention_mask is not None and attention_mask.dim() == 4:
91
+ # In this case we assume that the mask comes already in inverted form and requires no inversion or slicing.
92
+ causal_mask = attention_mask
93
+ else:
94
+ causal_mask = torch.full((sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=device)
95
+ if sequence_length != 1:
96
+ causal_mask = torch.triu(causal_mask, diagonal=1)
97
+ causal_mask *= torch.arange(target_length, device=device) > cache_position.reshape(-1, 1)
98
+ causal_mask = causal_mask[None, None, :, :].expand(batch_size, 1, -1, -1)
99
+ if attention_mask is not None:
100
+ causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
101
+ mask_length = attention_mask.shape[-1]
102
+ padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :]
103
+ padding_mask = padding_mask == 0
104
+ causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(padding_mask, min_dtype)
105
+
106
+ return causal_mask
107
+
108
+
109
+ class ASVDLinear(nn.Module):
110
+ def __init__(self, in_features, out_features, rank, bias=False):
111
+ super().__init__()
112
+ # self.BLinear = nn.Linear(in_features, rank, bias=False)
113
+ # self.ALinear = nn.Linear(rank, out_features, bias=bias)
114
+ self.BLinear = nn.Linear(in_features, rank, bias=False)
115
+ self.ALinear = nn.Linear(rank, out_features, bias=bias)
116
+
117
+ self.BLinear.weight.requires_grad = False
118
+ self.ALinear.weight.requires_grad = False
119
+
120
+ def forward(self, input):
121
+ # return self.ALinear(self.BLinear(input))
122
+ y = self.BLinear(input)
123
+ y = self.ALinear(y)
124
+ return y
125
+
126
+
127
+ class LlamaRMSNorm(nn.Module):
128
+ def __init__(self, hidden_size, eps=1e-6):
129
+ """
130
+ LlamaRMSNorm is equivalent to T5LayerNorm
131
+ """
132
+ super().__init__()
133
+ self.weight = nn.Parameter(torch.ones(hidden_size))
134
+ self.variance_epsilon = eps
135
+
136
+ def forward(self, hidden_states):
137
+ input_dtype = hidden_states.dtype
138
+ hidden_states = hidden_states.to(torch.float32)
139
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
140
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
141
+ return self.weight * hidden_states.to(input_dtype)
142
+
143
+ def extra_repr(self):
144
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
145
+
146
+
147
+ ALL_LAYERNORM_LAYERS.append(LlamaRMSNorm)
148
+
149
+
150
+ class LlamaRotaryEmbedding(nn.Module):
151
+ def __init__(
152
+ self,
153
+ dim=None,
154
+ max_position_embeddings=2048,
155
+ base=10000,
156
+ device=None,
157
+ scaling_factor=1.0,
158
+ rope_type="default",
159
+ config: Optional[LlamaConfig] = None,
160
+ ):
161
+ super().__init__()
162
+ # TODO (joao): remove the `if` below, only used for BC
163
+ self.rope_kwargs = {}
164
+ if config is None:
165
+ logger.warning_once(
166
+ "`LlamaRotaryEmbedding` can now be fully parameterized by passing the model config through the "
167
+ "`config` argument. All other arguments will be removed in v4.45"
168
+ )
169
+ self.rope_kwargs = {
170
+ "rope_type": rope_type,
171
+ "factor": scaling_factor,
172
+ "dim": dim,
173
+ "base": base,
174
+ "max_position_embeddings": max_position_embeddings,
175
+ }
176
+ self.rope_type = rope_type
177
+ self.max_seq_len_cached = max_position_embeddings
178
+ self.original_max_seq_len = max_position_embeddings
179
+ else:
180
+ # BC: "rope_type" was originally "type"
181
+ if config.rope_scaling is not None:
182
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
183
+ else:
184
+ self.rope_type = "default"
185
+ self.max_seq_len_cached = config.max_position_embeddings
186
+ self.original_max_seq_len = config.max_position_embeddings
187
+
188
+ self.config = config
189
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
190
+
191
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device, **self.rope_kwargs)
192
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
193
+ self.original_inv_freq = self.inv_freq
194
+
195
+ def _dynamic_frequency_update(self, position_ids, device):
196
+ """
197
+ dynamic RoPE layers should recompute `inv_freq` in the following situations:
198
+ 1 - growing beyond the cached sequence length (allow scaling)
199
+ 2 - the current sequence length is in the original scale (avoid losing precision with small sequences)
200
+ """
201
+ seq_len = torch.max(position_ids) + 1
202
+ if seq_len > self.max_seq_len_cached: # growth
203
+ inv_freq, self.attention_scaling = self.rope_init_fn(
204
+ self.config, device, seq_len=seq_len, **self.rope_kwargs
205
+ )
206
+ self.register_buffer("inv_freq", inv_freq, persistent=False) # TODO joao: may break with compilation
207
+ self.max_seq_len_cached = seq_len
208
+
209
+ if seq_len < self.original_max_seq_len and self.max_seq_len_cached > self.original_max_seq_len: # reset
210
+ self.register_buffer("inv_freq", self.original_inv_freq, persistent=False)
211
+ self.max_seq_len_cached = self.original_max_seq_len
212
+
213
+ @torch.no_grad()
214
+ def forward(self, x, position_ids):
215
+ if "dynamic" in self.rope_type:
216
+ self._dynamic_frequency_update(position_ids, device=x.device)
217
+
218
+ # Core RoPE block
219
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
220
+ position_ids_expanded = position_ids[:, None, :].float()
221
+ # Force float32 (see https://github.com/huggingface/transformers/pull/29285)
222
+ device_type = x.device.type
223
+ device_type = device_type if isinstance(device_type, str) and device_type != "mps" else "cpu"
224
+ with torch.autocast(device_type=device_type, enabled=False):
225
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
226
+ emb = torch.cat((freqs, freqs), dim=-1)
227
+ cos = emb.cos()
228
+ sin = emb.sin()
229
+
230
+ # Advanced RoPE types (e.g. yarn) apply a post-processing scaling factor, equivalent to scaling attention
231
+ cos = cos * self.attention_scaling
232
+ sin = sin * self.attention_scaling
233
+
234
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
235
+
236
+
237
+ class LlamaLinearScalingRotaryEmbedding(LlamaRotaryEmbedding):
238
+ """LlamaRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""
239
+
240
+ def __init__(self, *args, **kwargs):
241
+ logger.warning_once(
242
+ "`LlamaLinearScalingRotaryEmbedding` is deprecated an will be removed in v4.45. Please use "
243
+ "`LlamaRotaryEmbedding`, which now also does linear scaling (simply pass the model config to __init__)."
244
+ )
245
+ kwargs["rope_type"] = "linear"
246
+ super().__init__(*args, **kwargs)
247
+
248
+
249
+ class LlamaDynamicNTKScalingRotaryEmbedding(LlamaRotaryEmbedding):
250
+ """LlamaRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla"""
251
+
252
+ def __init__(self, *args, **kwargs):
253
+ logger.warning_once(
254
+ "`LlamaDynamicNTKScalingRotaryEmbedding` is deprecated an will be removed in v4.45. Please use "
255
+ "`LlamaRotaryEmbedding`, which now also does dynamic ntk scaling (simply pass the model config to "
256
+ "__init__)."
257
+ )
258
+ kwargs["rope_type"] = "dynamic"
259
+ super().__init__(*args, **kwargs)
260
+
261
+
262
+ def rotate_half(x):
263
+ """Rotates half the hidden dims of the input."""
264
+ x1 = x[..., : x.shape[-1] // 2]
265
+ x2 = x[..., x.shape[-1] // 2 :]
266
+ return torch.cat((-x2, x1), dim=-1)
267
+
268
+
269
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
270
+ """Applies Rotary Position Embedding to the query and key tensors.
271
+
272
+ Args:
273
+ q (`torch.Tensor`): The query tensor.
274
+ k (`torch.Tensor`): The key tensor.
275
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
276
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
277
+ position_ids (`torch.Tensor`, *optional*):
278
+ Deprecated and unused.
279
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
280
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
281
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
282
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
283
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
284
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
285
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
286
+ Returns:
287
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
288
+ """
289
+ cos = cos.unsqueeze(unsqueeze_dim)
290
+ sin = sin.unsqueeze(unsqueeze_dim)
291
+ q_embed = (q * cos) + (rotate_half(q) * sin)
292
+ k_embed = (k * cos) + (rotate_half(k) * sin)
293
+ return q_embed, k_embed
294
+
295
+
296
+ class LlamaMLP(nn.Module):
297
+ def __init__(self, config, layer_idx: Optional[int] = None):
298
+ super().__init__()
299
+ self.config = config
300
+ self.hidden_size = config.ori_hidden_size
301
+ self.layer_idx = layer_idx
302
+ truncation_ranks = config.truncation_ranks
303
+ if self.layer_idx in config.pruned_layers:
304
+ self.intermediate_size = config.pruned_intermediate_size
305
+ else:
306
+ self.intermediate_size = config.intermediate_size
307
+ # self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
308
+ # self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
309
+
310
+ layer_name = f"model.layers.{self.layer_idx}.mlp.gate_up_proj"
311
+ if truncation_ranks.get(layer_name, None) is not None:
312
+ self.gate_up_proj = ASVDLinear(self.hidden_size, self.intermediate_size * 2, truncation_ranks[layer_name])
313
+ else:
314
+ self.gate_up_proj = nn.Linear(
315
+ in_features=self.hidden_size,
316
+ out_features=self.intermediate_size * 2,
317
+ bias=False,
318
+ )
319
+
320
+ layer_name = f"model.layers.{self.layer_idx}.mlp.down_proj"
321
+ if truncation_ranks.get(layer_name, None) is not None:
322
+ self.down_proj = ASVDLinear(self.intermediate_size, self.hidden_size, truncation_ranks[layer_name])
323
+ else:
324
+ self.down_proj = nn.Linear(
325
+ in_features=self.intermediate_size,
326
+ out_features=self.hidden_size,
327
+ bias=False,
328
+ )
329
+
330
+ self.act_fn = ACT2FN[config.hidden_act]
331
+
332
+ def forward(self, x):
333
+ if self.config.pretraining_tp > 1:
334
+ raise NotImplementedError
335
+ # slice = self.intermediate_size // self.config.pretraining_tp
336
+ # gate_proj_slices = self.gate_proj.weight.split(slice, dim=0)
337
+ # up_proj_slices = self.up_proj.weight.split(slice, dim=0)
338
+ # down_proj_slices = self.down_proj.weight.split(slice, dim=1)
339
+
340
+ # gate_proj = torch.cat([F.linear(x, gate_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1)
341
+ # up_proj = torch.cat([F.linear(x, up_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1)
342
+
343
+ # intermediate_states = (self.act_fn(gate_proj) * up_proj).split(slice, dim=2)
344
+ # down_proj = [
345
+ # F.linear(intermediate_states[i], down_proj_slices[i]) for i in range(self.config.pretraining_tp)
346
+ # ]
347
+ # down_proj = sum(down_proj)
348
+ else:
349
+ concat_x1_x2 = self.gate_up_proj(x)
350
+ x1, x2 = torch.split(concat_x1_x2, concat_x1_x2.size(-1) // 2, dim=-1)
351
+ down_proj = self.down_proj(self.act_fn(x1) * x2)
352
+
353
+ return down_proj
354
+
355
+
356
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
357
+ """
358
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
359
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
360
+ """
361
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
362
+ if n_rep == 1:
363
+ return hidden_states
364
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
365
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
366
+
367
+
368
+ class LlamaAttention(nn.Module):
369
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
370
+
371
+ def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
372
+ super().__init__()
373
+ self.config = config
374
+ self.layer_idx = layer_idx
375
+ if layer_idx is None:
376
+ logger.warning_once(
377
+ f"Instantiating {self.__class__.__name__} without passing a `layer_idx` is not recommended and will "
378
+ "lead to errors during the forward call if caching is used. Please make sure to provide a `layer_idx` "
379
+ "when creating this class."
380
+ )
381
+ truncation_ranks = config.truncation_ranks
382
+
383
+ self.attention_dropout = config.attention_dropout
384
+ self.hidden_size = config.ori_hidden_size
385
+
386
+ self.num_heads = config.num_attention_heads
387
+ self.head_dim = config.hidden_size // self.num_heads
388
+ self.num_key_value_heads = config.num_key_value_heads
389
+
390
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
391
+ self.max_position_embeddings = config.max_position_embeddings
392
+ self.rope_theta = config.rope_theta
393
+ self.is_causal = True
394
+
395
+ layer_name = f"model.layers.{self.layer_idx}.self_attn.qkv_proj"
396
+ if truncation_ranks.get(layer_name, None) is not None:
397
+ self.qkv_proj = ASVDLinear(
398
+ self.hidden_size, (self.num_heads + 2 * self.num_key_value_heads) * self.head_dim, truncation_ranks[layer_name], bias=False
399
+ )
400
+ else:
401
+ self.qkv_proj = nn.Linear(self.hidden_size, (self.num_heads + 2 * self.num_key_value_heads) * self.head_dim, bias=False)
402
+
403
+ layer_name = f"model.layers.{self.layer_idx}.self_attn.o_proj"
404
+ if truncation_ranks.get(layer_name, None) is not None:
405
+ self.o_proj = ASVDLinear(
406
+ self.num_heads * self.head_dim, self.hidden_size, truncation_ranks[layer_name], bias=False
407
+ )
408
+ else:
409
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
410
+
411
+ # TODO (joao): remove in v4.45 (RoPE is computed in the model, not in the decoder layers)
412
+ self.rotary_emb = LlamaRotaryEmbedding(config=self.config)
413
+
414
+ def forward(
415
+ self,
416
+ hidden_states: torch.Tensor,
417
+ attention_mask: Optional[torch.Tensor] = None,
418
+ position_ids: Optional[torch.LongTensor] = None,
419
+ past_key_value: Optional[Cache] = None,
420
+ output_attentions: bool = False,
421
+ use_cache: bool = False,
422
+ cache_position: Optional[torch.LongTensor] = None,
423
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.45
424
+ **kwargs,
425
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
426
+ bsz, q_len, _ = hidden_states.size()
427
+
428
+ if self.config.pretraining_tp > 1:
429
+ raise NotImplementedError
430
+ # key_value_slicing = (self.num_key_value_heads * self.head_dim) // self.config.pretraining_tp
431
+ # query_slices = self.q_proj.weight.split(
432
+ # (self.num_heads * self.head_dim) // self.config.pretraining_tp, dim=0
433
+ # )
434
+ # key_slices = self.k_proj.weight.split(key_value_slicing, dim=0)
435
+ # value_slices = self.v_proj.weight.split(key_value_slicing, dim=0)
436
+
437
+ # query_states = [F.linear(hidden_states, query_slices[i]) for i in range(self.config.pretraining_tp)]
438
+ # query_states = torch.cat(query_states, dim=-1)
439
+
440
+ # key_states = [F.linear(hidden_states, key_slices[i]) for i in range(self.config.pretraining_tp)]
441
+ # key_states = torch.cat(key_states, dim=-1)
442
+
443
+ # value_states = [F.linear(hidden_states, value_slices[i]) for i in range(self.config.pretraining_tp)]
444
+ # value_states = torch.cat(value_states, dim=-1)
445
+
446
+ else:
447
+ # query_states = self.q_proj(hidden_states)
448
+ # key_states = self.k_proj(hidden_states)
449
+ # value_states = self.v_proj(hidden_states)
450
+ qkv_states = self.qkv_proj(hidden_states)
451
+
452
+ # query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
453
+ # key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
454
+ # value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
455
+ qkv_states = qkv_states.view(
456
+ bsz, q_len, self.num_heads + 2 * self.num_key_value_heads, self.head_dim
457
+ ).transpose(1, 2)
458
+ query_states, key_states, value_states = torch.split(
459
+ qkv_states, [self.num_heads, self.num_heads + self.num_key_value_heads], dim=1
460
+ )
461
+
462
+ if position_embeddings is None:
463
+ logger.warning_once(
464
+ "The attention layers in this model are transitioning from computing the RoPE embeddings internally "
465
+ "through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed "
466
+ "`position_embeddings` (Tuple of tensors, containing cos and sin). In v4.45 `position_ids` will be "
467
+ "removed and `position_embeddings` will be mandatory."
468
+ )
469
+ cos, sin = self.rotary_emb(value_states, position_ids)
470
+ else:
471
+ cos, sin = position_embeddings
472
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
473
+
474
+ if past_key_value is not None:
475
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
476
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
477
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
478
+
479
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
480
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
481
+
482
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
483
+
484
+ if attention_mask is not None: # no matter the length, we just slice it
485
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
486
+ attn_weights = attn_weights + causal_mask
487
+
488
+ # upcast attention to fp32
489
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
490
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
491
+ attn_output = torch.matmul(attn_weights, value_states)
492
+
493
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
494
+ raise ValueError(
495
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
496
+ f" {attn_output.size()}"
497
+ )
498
+
499
+ attn_output = attn_output.transpose(1, 2).contiguous()
500
+
501
+ attn_output = attn_output.reshape(bsz, q_len, -1)
502
+
503
+ if self.config.pretraining_tp > 1:
504
+ attn_output = attn_output.split(self.hidden_size // self.config.pretraining_tp, dim=2)
505
+ o_proj_slices = self.o_proj.weight.split(self.hidden_size // self.config.pretraining_tp, dim=1)
506
+ attn_output = sum([F.linear(attn_output[i], o_proj_slices[i]) for i in range(self.config.pretraining_tp)])
507
+ else:
508
+ attn_output = self.o_proj(attn_output)
509
+
510
+ if not output_attentions:
511
+ attn_weights = None
512
+
513
+ return attn_output, attn_weights, past_key_value
514
+
515
+
516
+ class LlamaFlashAttention2(LlamaAttention):
517
+ """
518
+ Llama flash attention module. This module inherits from `LlamaAttention` as the weights of the module stays
519
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
520
+ flash attention and deal with padding tokens in case the input contains any of them.
521
+ """
522
+
523
+ def __init__(self, *args, **kwargs):
524
+ super().__init__(*args, **kwargs)
525
+
526
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
527
+ # flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
528
+ # Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
529
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
530
+
531
+ def forward(
532
+ self,
533
+ hidden_states: torch.Tensor,
534
+ attention_mask: Optional[torch.LongTensor] = None,
535
+ position_ids: Optional[torch.LongTensor] = None,
536
+ past_key_value: Optional[Cache] = None,
537
+ output_attentions: bool = False,
538
+ use_cache: bool = False,
539
+ cache_position: Optional[torch.LongTensor] = None,
540
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.45
541
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
542
+ if isinstance(past_key_value, StaticCache):
543
+ raise ValueError(
544
+ "`static` cache implementation is not compatible with `attn_implementation==flash_attention_2` "
545
+ "make sure to use `sdpa` in the mean time, and open an issue at https://github.com/huggingface/transformers"
546
+ )
547
+
548
+ output_attentions = False
549
+
550
+ bsz, q_len, _ = hidden_states.size()
551
+
552
+ query_states = self.q_proj(hidden_states)
553
+ key_states = self.k_proj(hidden_states)
554
+ value_states = self.v_proj(hidden_states)
555
+
556
+ # Flash attention requires the input to have the shape
557
+ # batch_size x seq_length x head_dim x hidden_dim
558
+ # therefore we just need to keep the original shape
559
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
560
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
561
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
562
+
563
+ if position_embeddings is None:
564
+ logger.warning_once(
565
+ "The attention layers in this model are transitioning from computing the RoPE embeddings internally "
566
+ "through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed "
567
+ "`position_embeddings` (Tuple of tensors, containing cos and sin). In v4.45 `position_ids` will be "
568
+ "removed and `position_embeddings` will be mandatory."
569
+ )
570
+ cos, sin = self.rotary_emb(value_states, position_ids)
571
+ else:
572
+ cos, sin = position_embeddings
573
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
574
+
575
+ if past_key_value is not None:
576
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
577
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
578
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
579
+
580
+ # TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
581
+ # to be able to avoid many of these transpose/reshape/view.
582
+ query_states = query_states.transpose(1, 2)
583
+ key_states = key_states.transpose(1, 2)
584
+ value_states = value_states.transpose(1, 2)
585
+
586
+ dropout_rate = self.attention_dropout if self.training else 0.0
587
+
588
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
589
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
590
+ # cast them back in the correct dtype just to be sure everything works as expected.
591
+ # This might slowdown training & inference so it is recommended to not cast the LayerNorms
592
+ # in fp32. (LlamaRMSNorm handles it correctly)
593
+
594
+ input_dtype = query_states.dtype
595
+ if input_dtype == torch.float32:
596
+ if torch.is_autocast_enabled():
597
+ target_dtype = torch.get_autocast_gpu_dtype()
598
+ # Handle the case where the model is quantized
599
+ elif hasattr(self.config, "_pre_quantization_dtype"):
600
+ target_dtype = self.config._pre_quantization_dtype
601
+ else:
602
+ target_dtype = self.q_proj.weight.dtype
603
+
604
+ logger.warning_once(
605
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
606
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
607
+ f" {target_dtype}."
608
+ )
609
+
610
+ query_states = query_states.to(target_dtype)
611
+ key_states = key_states.to(target_dtype)
612
+ value_states = value_states.to(target_dtype)
613
+
614
+ attn_output = _flash_attention_forward(
615
+ query_states,
616
+ key_states,
617
+ value_states,
618
+ attention_mask,
619
+ q_len,
620
+ position_ids=position_ids,
621
+ dropout=dropout_rate,
622
+ sliding_window=getattr(self, "sliding_window", None),
623
+ use_top_left_mask=self._flash_attn_uses_top_left_mask,
624
+ is_causal=self.is_causal,
625
+ )
626
+
627
+ attn_output = attn_output.reshape(bsz, q_len, -1).contiguous()
628
+ attn_output = self.o_proj(attn_output)
629
+
630
+ if not output_attentions:
631
+ attn_weights = None
632
+
633
+ return attn_output, attn_weights, past_key_value
634
+
635
+
636
+ class LlamaSdpaAttention(LlamaAttention):
637
+ """
638
+ Llama attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
639
+ `LlamaAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
640
+ SDPA API.
641
+ """
642
+
643
+ # Adapted from LlamaAttention.forward
644
+ def forward(
645
+ self,
646
+ hidden_states: torch.Tensor,
647
+ attention_mask: Optional[torch.Tensor] = None,
648
+ position_ids: Optional[torch.LongTensor] = None,
649
+ past_key_value: Optional[Cache] = None,
650
+ output_attentions: bool = False,
651
+ use_cache: bool = False,
652
+ cache_position: Optional[torch.LongTensor] = None,
653
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.45
654
+ **kwargs,
655
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
656
+ if output_attentions:
657
+ # TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
658
+ logger.warning_once(
659
+ "LlamaModel is using LlamaSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
660
+ 'but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.'
661
+ )
662
+ return super().forward(
663
+ hidden_states=hidden_states,
664
+ attention_mask=attention_mask,
665
+ position_ids=position_ids,
666
+ past_key_value=past_key_value,
667
+ output_attentions=output_attentions,
668
+ use_cache=use_cache,
669
+ cache_position=cache_position,
670
+ position_embeddings=position_embeddings,
671
+ )
672
+
673
+ bsz, q_len, _ = hidden_states.size()
674
+
675
+ # query_states = self.q_proj(hidden_states)
676
+ # key_states = self.k_proj(hidden_states)
677
+ # value_states = self.v_proj(hidden_states)
678
+ qkv_states = self.qkv_proj(hidden_states)
679
+
680
+ # query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
681
+ # key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
682
+ # value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
683
+ qkv_states = qkv_states.view(
684
+ bsz, q_len, self.num_heads + 2 * self.num_key_value_heads, self.head_dim
685
+ ).transpose(1, 2)
686
+ query_states, key_states, value_states = torch.split(
687
+ qkv_states, [self.num_heads, self.num_key_value_heads, self.num_key_value_heads], dim=1
688
+ )
689
+
690
+ if position_embeddings is None:
691
+ logger.warning_once(
692
+ "The attention layers in this model are transitioning from computing the RoPE embeddings internally "
693
+ "through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed "
694
+ "`position_embeddings` (Tuple of tensors, containing cos and sin). In v4.45 `position_ids` will be "
695
+ "removed and `position_embeddings` will be mandatory."
696
+ )
697
+ cos, sin = self.rotary_emb(value_states, position_ids)
698
+ else:
699
+ cos, sin = position_embeddings
700
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
701
+
702
+ if past_key_value is not None:
703
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
704
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
705
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
706
+
707
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
708
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
709
+
710
+ causal_mask = attention_mask
711
+ if attention_mask is not None:
712
+ causal_mask = causal_mask[:, :, :, : key_states.shape[-2]]
713
+
714
+ # SDPA with memory-efficient backend is currently (torch==2.1.2) bugged with non-contiguous inputs with custom attn_mask,
715
+ # Reference: https://github.com/pytorch/pytorch/issues/112577.
716
+ if query_states.device.type == "cuda" and causal_mask is not None:
717
+ query_states = query_states.contiguous()
718
+ key_states = key_states.contiguous()
719
+ value_states = value_states.contiguous()
720
+
721
+ # We dispatch to SDPA's Flash Attention or Efficient kernels via this `is_causal` if statement instead of an inline conditional assignment
722
+ # in SDPA to support both torch.compile's dynamic shapes and full graph options. An inline conditional prevents dynamic shapes from compiling.
723
+ is_causal = True if causal_mask is None and q_len > 1 else False
724
+
725
+ attn_output = torch.nn.functional.scaled_dot_product_attention(
726
+ query_states,
727
+ key_states,
728
+ value_states,
729
+ attn_mask=causal_mask,
730
+ dropout_p=self.attention_dropout if self.training else 0.0,
731
+ is_causal=is_causal,
732
+ )
733
+
734
+ attn_output = attn_output.transpose(1, 2).contiguous()
735
+ attn_output = attn_output.view(bsz, q_len, -1)
736
+
737
+ attn_output = self.o_proj(attn_output)
738
+
739
+ return attn_output, None, past_key_value
740
+
741
+
742
+ LLAMA_ATTENTION_CLASSES = {
743
+ "eager": LlamaAttention,
744
+ "flash_attention_2": LlamaFlashAttention2,
745
+ "sdpa": LlamaSdpaAttention,
746
+ }
747
+
748
+
749
+ class LlamaDecoderLayer(nn.Module):
750
+ def __init__(self, config: LlamaConfig, layer_idx: int):
751
+ super().__init__()
752
+ self.hidden_size = config.ori_hidden_size
753
+
754
+ self.self_attn = LLAMA_ATTENTION_CLASSES[config._attn_implementation](config=config, layer_idx=layer_idx)
755
+
756
+ self.mlp = LlamaMLP(config, layer_idx=layer_idx)
757
+ self.input_layernorm = LlamaRMSNorm(config.ori_hidden_size, eps=config.rms_norm_eps)
758
+ self.post_attention_layernorm = LlamaRMSNorm(config.ori_hidden_size, eps=config.rms_norm_eps)
759
+
760
+ def forward(
761
+ self,
762
+ hidden_states: torch.Tensor,
763
+ attention_mask: Optional[torch.Tensor] = None,
764
+ position_ids: Optional[torch.LongTensor] = None,
765
+ past_key_value: Optional[Cache] = None,
766
+ output_attentions: Optional[bool] = False,
767
+ use_cache: Optional[bool] = False,
768
+ cache_position: Optional[torch.LongTensor] = None,
769
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.45
770
+ **kwargs,
771
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
772
+ """
773
+ Args:
774
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
775
+ attention_mask (`torch.FloatTensor`, *optional*):
776
+ attention mask of size `(batch_size, sequence_length)` if flash attention is used or `(batch_size, 1,
777
+ query_sequence_length, key_sequence_length)` if default attention is used.
778
+ output_attentions (`bool`, *optional*):
779
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
780
+ returned tensors for more detail.
781
+ use_cache (`bool`, *optional*):
782
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
783
+ (see `past_key_values`).
784
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
785
+ cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
786
+ Indices depicting the position of the input sequence tokens in the sequence
787
+ position_embeddings (`Tuple[torch.FloatTensor, torch.FloatTensor]`, *optional*):
788
+ Tuple containing the cosine and sine positional embeddings of shape `(batch_size, seq_len, head_dim)`,
789
+ with `head_dim` being the embedding dimension of each attention head.
790
+ kwargs (`dict`, *optional*):
791
+ Arbitrary kwargs to be ignored, used for FSDP and other methods that injects code
792
+ into the model
793
+ """
794
+ residual = hidden_states
795
+
796
+ hidden_states = self.input_layernorm(hidden_states)
797
+
798
+ # Self Attention
799
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
800
+ hidden_states=hidden_states,
801
+ attention_mask=attention_mask,
802
+ position_ids=position_ids,
803
+ past_key_value=past_key_value,
804
+ output_attentions=output_attentions,
805
+ use_cache=use_cache,
806
+ cache_position=cache_position,
807
+ position_embeddings=position_embeddings,
808
+ **kwargs,
809
+ )
810
+ hidden_states = residual + hidden_states
811
+
812
+ # Fully Connected
813
+ residual = hidden_states
814
+ hidden_states = self.post_attention_layernorm(hidden_states)
815
+ hidden_states = self.mlp(hidden_states)
816
+ hidden_states = residual + hidden_states
817
+
818
+ outputs = (hidden_states,)
819
+
820
+ if output_attentions:
821
+ outputs += (self_attn_weights,)
822
+
823
+ if use_cache:
824
+ outputs += (present_key_value,)
825
+
826
+ return outputs
827
+
828
+
829
+ LLAMA_START_DOCSTRING = r"""
830
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
831
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
832
+ etc.)
833
+
834
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
835
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
836
+ and behavior.
837
+
838
+ Parameters:
839
+ config ([`LlamaConfig`]):
840
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
841
+ load the weights associated with the model, only the configuration. Check out the
842
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
843
+ """
844
+
845
+
846
+ @add_start_docstrings(
847
+ "The bare LLaMA Model outputting raw hidden-states without any specific head on top.",
848
+ LLAMA_START_DOCSTRING,
849
+ )
850
+ class LlamaPreTrainedModel(PreTrainedModel):
851
+ config_class = LlamaConfig
852
+ base_model_prefix = "model"
853
+ supports_gradient_checkpointing = True
854
+ _no_split_modules = ["LlamaDecoderLayer"]
855
+ _skip_keys_device_placement = ["past_key_values"]
856
+ _supports_flash_attn_2 = True
857
+ _supports_sdpa = True
858
+ _supports_cache_class = True
859
+ _supports_quantized_cache = True
860
+ _supports_static_cache = True
861
+
862
+ def _init_weights(self, module):
863
+ return
864
+ std = self.config.initializer_range
865
+ if isinstance(module, nn.Linear):
866
+ module.weight.data.normal_(mean=0.0, std=std)
867
+ if module.bias is not None:
868
+ module.bias.data.zero_()
869
+ elif isinstance(module, nn.Embedding):
870
+ module.weight.data.normal_(mean=0.0, std=std)
871
+ if module.padding_idx is not None:
872
+ module.weight.data[module.padding_idx].zero_()
873
+
874
+
875
+ LLAMA_INPUTS_DOCSTRING = r"""
876
+ Args:
877
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
878
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
879
+ it.
880
+
881
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
882
+ [`PreTrainedTokenizer.__call__`] for details.
883
+
884
+ [What are input IDs?](../glossary#input-ids)
885
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
886
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
887
+
888
+ - 1 for tokens that are **not masked**,
889
+ - 0 for tokens that are **masked**.
890
+
891
+ [What are attention masks?](../glossary#attention-mask)
892
+
893
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
894
+ [`PreTrainedTokenizer.__call__`] for details.
895
+
896
+ If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
897
+ `past_key_values`).
898
+
899
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
900
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
901
+ information on the default strategy.
902
+
903
+ - 1 indicates the head is **not masked**,
904
+ - 0 indicates the head is **masked**.
905
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
906
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
907
+ config.n_positions - 1]`.
908
+
909
+ [What are position IDs?](../glossary#position-ids)
910
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
911
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
912
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
913
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
914
+
915
+ Two formats are allowed:
916
+ - a [`~cache_utils.Cache`] instance;
917
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
918
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
919
+ cache format.
920
+
921
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
922
+ legacy cache format will be returned.
923
+
924
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
925
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
926
+ of shape `(batch_size, sequence_length)`.
927
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
928
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
929
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
930
+ model's internal embedding lookup matrix.
931
+ use_cache (`bool`, *optional*):
932
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
933
+ `past_key_values`).
934
+ output_attentions (`bool`, *optional*):
935
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
936
+ tensors for more detail.
937
+ output_hidden_states (`bool`, *optional*):
938
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
939
+ more detail.
940
+ return_dict (`bool`, *optional*):
941
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
942
+ cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
943
+ Indices depicting the position of the input sequence tokens in the sequence. Contrarily to `position_ids`,
944
+ this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
945
+ the complete sequence length.
946
+ """
947
+
948
+
949
+ @add_start_docstrings(
950
+ "The bare LLaMA Model outputting raw hidden-states without any specific head on top.",
951
+ LLAMA_START_DOCSTRING,
952
+ )
953
+ class LlamaModel(LlamaPreTrainedModel):
954
+ """
955
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`LlamaDecoderLayer`]
956
+
957
+ Args:
958
+ config: LlamaConfig
959
+ """
960
+
961
+ def __init__(self, config: LlamaConfig):
962
+ super().__init__(config)
963
+ self.padding_idx = config.pad_token_id
964
+ self.vocab_size = config.vocab_size
965
+
966
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.ori_hidden_size, self.padding_idx)
967
+ self.layers = nn.ModuleList(
968
+ [LlamaDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
969
+ )
970
+ self.norm = LlamaRMSNorm(config.ori_hidden_size, eps=config.rms_norm_eps)
971
+ self.rotary_emb = LlamaRotaryEmbedding(config=config)
972
+ self.gradient_checkpointing = False
973
+
974
+ # Initialize weights and apply final processing
975
+ self.post_init()
976
+
977
+ def get_input_embeddings(self):
978
+ return self.embed_tokens
979
+
980
+ def set_input_embeddings(self, value):
981
+ self.embed_tokens = value
982
+
983
+ @add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
984
+ def forward(
985
+ self,
986
+ input_ids: torch.LongTensor = None,
987
+ attention_mask: Optional[torch.Tensor] = None,
988
+ position_ids: Optional[torch.LongTensor] = None,
989
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
990
+ inputs_embeds: Optional[torch.FloatTensor] = None,
991
+ use_cache: Optional[bool] = None,
992
+ output_attentions: Optional[bool] = None,
993
+ output_hidden_states: Optional[bool] = None,
994
+ return_dict: Optional[bool] = None,
995
+ cache_position: Optional[torch.LongTensor] = None,
996
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
997
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
998
+ output_hidden_states = (
999
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1000
+ )
1001
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
1002
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1003
+
1004
+ if (input_ids is None) ^ (inputs_embeds is not None):
1005
+ raise ValueError(
1006
+ "You cannot specify both input_ids and inputs_embeds at the same time, and must specify either one"
1007
+ )
1008
+
1009
+ if self.gradient_checkpointing and self.training and use_cache:
1010
+ logger.warning_once(
1011
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
1012
+ )
1013
+ use_cache = False
1014
+
1015
+ if inputs_embeds is None:
1016
+ inputs_embeds = self.embed_tokens(input_ids)
1017
+
1018
+ return_legacy_cache = False
1019
+ if (
1020
+ use_cache and not isinstance(past_key_values, Cache) and not self.training
1021
+ ): # kept for BC (non `Cache` `past_key_values` inputs)
1022
+ return_legacy_cache = True
1023
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
1024
+ logger.warning_once(
1025
+ "We detected that you are passing `past_key_values` as a tuple and this is deprecated and will be removed in v4.43. "
1026
+ "Please use an appropriate `Cache` class (https://huggingface.co/docs/transformers/v4.41.3/en/internal/generation_utils#transformers.Cache)"
1027
+ )
1028
+
1029
+ if cache_position is None:
1030
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
1031
+ cache_position = torch.arange(
1032
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
1033
+ )
1034
+ if position_ids is None:
1035
+ position_ids = cache_position.unsqueeze(0)
1036
+
1037
+ causal_mask = self._update_causal_mask(
1038
+ attention_mask, inputs_embeds, cache_position, past_key_values, output_attentions
1039
+ )
1040
+ hidden_states = inputs_embeds
1041
+
1042
+ # create position embeddings to be shared across the decoder layers
1043
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
1044
+
1045
+ # decoder layers
1046
+ all_hidden_states = () if output_hidden_states else None
1047
+ all_self_attns = () if output_attentions else None
1048
+ next_decoder_cache = None
1049
+
1050
+ for decoder_layer in self.layers:
1051
+ if output_hidden_states:
1052
+ all_hidden_states += (hidden_states,)
1053
+
1054
+ if self.gradient_checkpointing and self.training:
1055
+ layer_outputs = self._gradient_checkpointing_func(
1056
+ decoder_layer.__call__,
1057
+ hidden_states,
1058
+ causal_mask,
1059
+ position_ids,
1060
+ past_key_values,
1061
+ output_attentions,
1062
+ use_cache,
1063
+ cache_position,
1064
+ position_embeddings,
1065
+ )
1066
+ else:
1067
+ layer_outputs = decoder_layer(
1068
+ hidden_states,
1069
+ attention_mask=causal_mask,
1070
+ position_ids=position_ids,
1071
+ past_key_value=past_key_values,
1072
+ output_attentions=output_attentions,
1073
+ use_cache=use_cache,
1074
+ cache_position=cache_position,
1075
+ position_embeddings=position_embeddings,
1076
+ )
1077
+
1078
+ hidden_states = layer_outputs[0]
1079
+
1080
+ if use_cache:
1081
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
1082
+
1083
+ if output_attentions:
1084
+ all_self_attns += (layer_outputs[1],)
1085
+
1086
+ hidden_states = self.norm(hidden_states)
1087
+
1088
+ # add hidden states from the last decoder layer
1089
+ if output_hidden_states:
1090
+ all_hidden_states += (hidden_states,)
1091
+
1092
+ next_cache = next_decoder_cache if use_cache else None
1093
+ if return_legacy_cache:
1094
+ next_cache = next_cache.to_legacy_cache()
1095
+
1096
+ if not return_dict:
1097
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
1098
+ return BaseModelOutputWithPast(
1099
+ last_hidden_state=hidden_states,
1100
+ past_key_values=next_cache,
1101
+ hidden_states=all_hidden_states,
1102
+ attentions=all_self_attns,
1103
+ )
1104
+
1105
+ def _update_causal_mask(
1106
+ self,
1107
+ attention_mask: torch.Tensor,
1108
+ input_tensor: torch.Tensor,
1109
+ cache_position: torch.Tensor,
1110
+ past_key_values: Cache,
1111
+ output_attentions: bool,
1112
+ ):
1113
+ # TODO: As of torch==2.2.0, the `attention_mask` passed to the model in `generate` is 2D and of dynamic length even when the static
1114
+ # KV cache is used. This is an issue for torch.compile which then recaptures cudagraphs at each decode steps due to the dynamic shapes.
1115
+ # (`recording cudagraph tree for symint key 13`, etc.), which is VERY slow. A workaround is `@torch.compiler.disable`, but this prevents using
1116
+ # `fullgraph=True`. See more context in https://github.com/huggingface/transformers/pull/29114
1117
+
1118
+ if self.config._attn_implementation == "flash_attention_2":
1119
+ if attention_mask is not None and 0.0 in attention_mask:
1120
+ return attention_mask
1121
+ return None
1122
+
1123
+ # For SDPA, when possible, we will rely on its `is_causal` argument instead of its `attn_mask` argument, in
1124
+ # order to dispatch on Flash Attention 2. This feature is not compatible with static cache, as SDPA will fail
1125
+ # to infer the attention mask.
1126
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
1127
+ using_static_cache = isinstance(past_key_values, StaticCache)
1128
+
1129
+ # When output attentions is True, sdpa implementation's forward method calls the eager implementation's forward
1130
+ if self.config._attn_implementation == "sdpa" and not using_static_cache and not output_attentions:
1131
+ if AttentionMaskConverter._ignore_causal_mask_sdpa(
1132
+ attention_mask,
1133
+ inputs_embeds=input_tensor,
1134
+ past_key_values_length=past_seen_tokens,
1135
+ is_training=self.training,
1136
+ ):
1137
+ return None
1138
+
1139
+ dtype, device = input_tensor.dtype, input_tensor.device
1140
+ min_dtype = torch.finfo(dtype).min
1141
+ sequence_length = input_tensor.shape[1]
1142
+ if using_static_cache:
1143
+ target_length = past_key_values.get_max_length()
1144
+ else:
1145
+ target_length = (
1146
+ attention_mask.shape[-1]
1147
+ if isinstance(attention_mask, torch.Tensor)
1148
+ else past_seen_tokens + sequence_length + 1
1149
+ )
1150
+
1151
+ # In case the provided `attention` mask is 2D, we generate a causal mask here (4D).
1152
+ causal_mask = _prepare_4d_causal_attention_mask_with_cache_position(
1153
+ attention_mask,
1154
+ sequence_length=sequence_length,
1155
+ target_length=target_length,
1156
+ dtype=dtype,
1157
+ device=device,
1158
+ min_dtype=min_dtype,
1159
+ cache_position=cache_position,
1160
+ batch_size=input_tensor.shape[0],
1161
+ )
1162
+
1163
+ if (
1164
+ self.config._attn_implementation == "sdpa"
1165
+ and attention_mask is not None
1166
+ and attention_mask.device.type == "cuda"
1167
+ and not output_attentions
1168
+ ):
1169
+ # Attend to all tokens in fully masked rows in the causal_mask, for example the relevant first rows when
1170
+ # using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path.
1171
+ # Details: https://github.com/pytorch/pytorch/issues/110213
1172
+ causal_mask = AttentionMaskConverter._unmask_unattended(causal_mask, min_dtype)
1173
+
1174
+ return causal_mask
1175
+
1176
+
1177
+ class LlamaForCausalLM(LlamaPreTrainedModel):
1178
+ _tied_weights_keys = ["lm_head.weight"]
1179
+
1180
+ def __init__(self, config):
1181
+ super().__init__(config)
1182
+ self.model = LlamaModel(config)
1183
+ self.vocab_size = config.vocab_size
1184
+ self.lm_head = nn.Linear(config.ori_hidden_size, config.vocab_size, bias=False)
1185
+
1186
+ # Initialize weights and apply final processing
1187
+ self.post_init()
1188
+
1189
+ def get_input_embeddings(self):
1190
+ return self.model.embed_tokens
1191
+
1192
+ def set_input_embeddings(self, value):
1193
+ self.model.embed_tokens = value
1194
+
1195
+ def get_output_embeddings(self):
1196
+ return self.lm_head
1197
+
1198
+ def set_output_embeddings(self, new_embeddings):
1199
+ self.lm_head = new_embeddings
1200
+
1201
+ def set_decoder(self, decoder):
1202
+ self.model = decoder
1203
+
1204
+ def get_decoder(self):
1205
+ return self.model
1206
+
1207
+ @add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
1208
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1209
+ def forward(
1210
+ self,
1211
+ input_ids: torch.LongTensor = None,
1212
+ attention_mask: Optional[torch.Tensor] = None,
1213
+ position_ids: Optional[torch.LongTensor] = None,
1214
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
1215
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1216
+ labels: Optional[torch.LongTensor] = None,
1217
+ use_cache: Optional[bool] = None,
1218
+ output_attentions: Optional[bool] = None,
1219
+ output_hidden_states: Optional[bool] = None,
1220
+ return_dict: Optional[bool] = None,
1221
+ cache_position: Optional[torch.LongTensor] = None,
1222
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1223
+ r"""
1224
+ Args:
1225
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1226
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1227
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1228
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1229
+
1230
+ Returns:
1231
+
1232
+ Example:
1233
+
1234
+ ```python
1235
+ >>> from transformers import AutoTokenizer, LlamaForCausalLM
1236
+
1237
+ >>> model = LlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf")
1238
+ >>> tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf")
1239
+
1240
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
1241
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1242
+
1243
+ >>> # Generate
1244
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1245
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1246
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
1247
+ ```"""
1248
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1249
+ output_hidden_states = (
1250
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1251
+ )
1252
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1253
+
1254
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1255
+ outputs = self.model(
1256
+ input_ids=input_ids,
1257
+ attention_mask=attention_mask,
1258
+ position_ids=position_ids,
1259
+ past_key_values=past_key_values,
1260
+ inputs_embeds=inputs_embeds,
1261
+ use_cache=use_cache,
1262
+ output_attentions=output_attentions,
1263
+ output_hidden_states=output_hidden_states,
1264
+ return_dict=return_dict,
1265
+ cache_position=cache_position,
1266
+ )
1267
+
1268
+ hidden_states = outputs[0]
1269
+ if self.config.pretraining_tp > 1:
1270
+ lm_head_slices = self.lm_head.weight.split(self.vocab_size // self.config.pretraining_tp, dim=0)
1271
+ logits = [F.linear(hidden_states, lm_head_slices[i]) for i in range(self.config.pretraining_tp)]
1272
+ logits = torch.cat(logits, dim=-1)
1273
+ else:
1274
+ logits = self.lm_head(hidden_states)
1275
+ logits = logits.float()
1276
+
1277
+ loss = None
1278
+ if labels is not None:
1279
+ # Shift so that tokens < n predict n
1280
+ shift_logits = logits[..., :-1, :].contiguous()
1281
+ shift_labels = labels[..., 1:].contiguous()
1282
+ # Flatten the tokens
1283
+ loss_fct = CrossEntropyLoss()
1284
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1285
+ shift_labels = shift_labels.view(-1)
1286
+ # Enable model parallelism
1287
+ shift_labels = shift_labels.to(shift_logits.device)
1288
+ loss = loss_fct(shift_logits, shift_labels)
1289
+
1290
+ if not return_dict:
1291
+ output = (logits,) + outputs[1:]
1292
+ return (loss,) + output if loss is not None else output
1293
+
1294
+ return CausalLMOutputWithPast(
1295
+ loss=loss,
1296
+ logits=logits,
1297
+ past_key_values=outputs.past_key_values,
1298
+ hidden_states=outputs.hidden_states,
1299
+ attentions=outputs.attentions,
1300
+ )
1301
+
1302
+ def prepare_inputs_for_generation(
1303
+ self,
1304
+ input_ids,
1305
+ past_key_values=None,
1306
+ attention_mask=None,
1307
+ inputs_embeds=None,
1308
+ cache_position=None,
1309
+ position_ids=None,
1310
+ use_cache=True,
1311
+ **kwargs,
1312
+ ):
1313
+ # If we have cache: let's slice `input_ids` through `cache_position`, to keep only the unprocessed tokens
1314
+ # Exception 1: when passing input_embeds, input_ids may be missing entries
1315
+ # Exception 2: some generation methods do special slicing of input_ids, so we don't need to do it here
1316
+ if past_key_values is not None:
1317
+ if inputs_embeds is not None: # Exception 1
1318
+ input_ids = input_ids[:, -cache_position.shape[0] :]
1319
+ elif input_ids.shape[1] != cache_position.shape[0]: # Default case (the "else", a no op, is Exception 2)
1320
+ input_ids = input_ids[:, cache_position]
1321
+
1322
+ if attention_mask is not None and position_ids is None:
1323
+ # create position_ids on the fly for batch generation
1324
+ position_ids = attention_mask.long().cumsum(-1) - 1
1325
+ position_ids.masked_fill_(attention_mask == 0, 1)
1326
+ if past_key_values:
1327
+ position_ids = position_ids[:, -input_ids.shape[1] :]
1328
+
1329
+ # This `clone` call is needed to avoid recapturing cuda graphs with `torch.compile`'s `mode="reduce-overhead`, as otherwise the input `position_ids` would have various stride during the decoding. Here, simply using `.contiguous()` is not sufficient as in the batch size = 1 case, `position_ids` is already contiguous but with varying stride which retriggers a capture.
1330
+ position_ids = position_ids.clone(memory_format=torch.contiguous_format)
1331
+
1332
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1333
+ if inputs_embeds is not None and cache_position[0] == 0:
1334
+ model_inputs = {"inputs_embeds": inputs_embeds}
1335
+ else:
1336
+ model_inputs = {"input_ids": input_ids}
1337
+
1338
+ if isinstance(past_key_values, StaticCache) and attention_mask.ndim == 2:
1339
+ if inputs_embeds is not None:
1340
+ batch_size, sequence_length = inputs_embeds.shape
1341
+ device = inputs_embeds.device
1342
+ else:
1343
+ batch_size, sequence_length = input_ids.shape
1344
+ device = input_ids.device
1345
+
1346
+ dtype = self.lm_head.weight.dtype
1347
+ min_dtype = torch.finfo(dtype).min
1348
+
1349
+ attention_mask = _prepare_4d_causal_attention_mask_with_cache_position(
1350
+ attention_mask,
1351
+ sequence_length=sequence_length,
1352
+ target_length=past_key_values.get_max_length(),
1353
+ dtype=dtype,
1354
+ device=device,
1355
+ min_dtype=min_dtype,
1356
+ cache_position=cache_position,
1357
+ batch_size=batch_size,
1358
+ )
1359
+
1360
+ model_inputs.update(
1361
+ {
1362
+ "position_ids": position_ids,
1363
+ "cache_position": cache_position,
1364
+ "past_key_values": past_key_values,
1365
+ "use_cache": use_cache,
1366
+ "attention_mask": attention_mask,
1367
+ }
1368
+ )
1369
+ return model_inputs
1370
+
1371
+
1372
+ @add_start_docstrings(
1373
+ """
1374
+ The LLaMa Model transformer with a sequence classification head on top (linear layer).
1375
+
1376
+ [`LlamaForSequenceClassification`] uses the last token in order to do the classification, as other causal models
1377
+ (e.g. GPT-2) do.
1378
+
1379
+ Since it does classification on the last token, it requires to know the position of the last token. If a
1380
+ `pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
1381
+ no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
1382
+ padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
1383
+ each row of the batch).
1384
+ """,
1385
+ LLAMA_START_DOCSTRING,
1386
+ )
1387
+ class LlamaForSequenceClassification(LlamaPreTrainedModel):
1388
+ def __init__(self, config):
1389
+ super().__init__(config)
1390
+ self.num_labels = config.num_labels
1391
+ self.model = LlamaModel(config)
1392
+ self.score = nn.Linear(config.ori_hidden_size, self.num_labels, bias=False)
1393
+
1394
+ # Initialize weights and apply final processing
1395
+ self.post_init()
1396
+
1397
+ def get_input_embeddings(self):
1398
+ return self.model.embed_tokens
1399
+
1400
+ def set_input_embeddings(self, value):
1401
+ self.model.embed_tokens = value
1402
+
1403
+ @add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
1404
+ def forward(
1405
+ self,
1406
+ input_ids: Optional[torch.LongTensor] = None,
1407
+ attention_mask: Optional[torch.Tensor] = None,
1408
+ position_ids: Optional[torch.LongTensor] = None,
1409
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
1410
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1411
+ labels: Optional[torch.LongTensor] = None,
1412
+ use_cache: Optional[bool] = None,
1413
+ output_attentions: Optional[bool] = None,
1414
+ output_hidden_states: Optional[bool] = None,
1415
+ return_dict: Optional[bool] = None,
1416
+ ) -> Union[Tuple, SequenceClassifierOutputWithPast]:
1417
+ r"""
1418
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1419
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1420
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1421
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1422
+ """
1423
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1424
+
1425
+ transformer_outputs = self.model(
1426
+ input_ids,
1427
+ attention_mask=attention_mask,
1428
+ position_ids=position_ids,
1429
+ past_key_values=past_key_values,
1430
+ inputs_embeds=inputs_embeds,
1431
+ use_cache=use_cache,
1432
+ output_attentions=output_attentions,
1433
+ output_hidden_states=output_hidden_states,
1434
+ return_dict=return_dict,
1435
+ )
1436
+ hidden_states = transformer_outputs[0]
1437
+ logits = self.score(hidden_states)
1438
+
1439
+ if input_ids is not None:
1440
+ batch_size = input_ids.shape[0]
1441
+ else:
1442
+ batch_size = inputs_embeds.shape[0]
1443
+
1444
+ if self.config.pad_token_id is None and batch_size != 1:
1445
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
1446
+ if self.config.pad_token_id is None:
1447
+ sequence_lengths = -1
1448
+ else:
1449
+ if input_ids is not None:
1450
+ # if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
1451
+ sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
1452
+ sequence_lengths = sequence_lengths % input_ids.shape[-1]
1453
+ sequence_lengths = sequence_lengths.to(logits.device)
1454
+ else:
1455
+ sequence_lengths = -1
1456
+
1457
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
1458
+
1459
+ loss = None
1460
+ if labels is not None:
1461
+ labels = labels.to(logits.device)
1462
+ if self.config.problem_type is None:
1463
+ if self.num_labels == 1:
1464
+ self.config.problem_type = "regression"
1465
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1466
+ self.config.problem_type = "single_label_classification"
1467
+ else:
1468
+ self.config.problem_type = "multi_label_classification"
1469
+
1470
+ if self.config.problem_type == "regression":
1471
+ loss_fct = MSELoss()
1472
+ if self.num_labels == 1:
1473
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
1474
+ else:
1475
+ loss = loss_fct(pooled_logits, labels)
1476
+ elif self.config.problem_type == "single_label_classification":
1477
+ loss_fct = CrossEntropyLoss()
1478
+ loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
1479
+ elif self.config.problem_type == "multi_label_classification":
1480
+ loss_fct = BCEWithLogitsLoss()
1481
+ loss = loss_fct(pooled_logits, labels)
1482
+ if not return_dict:
1483
+ output = (pooled_logits,) + transformer_outputs[1:]
1484
+ return ((loss,) + output) if loss is not None else output
1485
+
1486
+ return SequenceClassifierOutputWithPast(
1487
+ loss=loss,
1488
+ logits=pooled_logits,
1489
+ past_key_values=transformer_outputs.past_key_values,
1490
+ hidden_states=transformer_outputs.hidden_states,
1491
+ attentions=transformer_outputs.attentions,
1492
+ )
1493
+
1494
+
1495
+ @add_start_docstrings(
1496
+ """
1497
+ The Llama Model transformer with a span classification head on top for extractive question-answering tasks like
1498
+ SQuAD (a linear layer on top of the hidden-states output to compute `span start logits` and `span end logits`).
1499
+ """,
1500
+ LLAMA_START_DOCSTRING,
1501
+ )
1502
+ class LlamaForQuestionAnswering(LlamaPreTrainedModel):
1503
+ base_model_prefix = "transformer"
1504
+
1505
+ # Copied from transformers.models.bloom.modeling_bloom.BloomForQuestionAnswering.__init__ with Bloom->Llama
1506
+ def __init__(self, config):
1507
+ super().__init__(config)
1508
+ self.transformer = LlamaModel(config)
1509
+ self.qa_outputs = nn.Linear(config.ori_hidden_size, 2)
1510
+
1511
+ # Initialize weights and apply final processing
1512
+ self.post_init()
1513
+
1514
+ def get_input_embeddings(self):
1515
+ return self.transformer.embed_tokens
1516
+
1517
+ def set_input_embeddings(self, value):
1518
+ self.transformer.embed_tokens = value
1519
+
1520
+ @add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
1521
+ def forward(
1522
+ self,
1523
+ input_ids: Optional[torch.LongTensor] = None,
1524
+ attention_mask: Optional[torch.FloatTensor] = None,
1525
+ position_ids: Optional[torch.LongTensor] = None,
1526
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
1527
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1528
+ start_positions: Optional[torch.LongTensor] = None,
1529
+ end_positions: Optional[torch.LongTensor] = None,
1530
+ output_attentions: Optional[bool] = None,
1531
+ output_hidden_states: Optional[bool] = None,
1532
+ return_dict: Optional[bool] = None,
1533
+ ) -> Union[Tuple, QuestionAnsweringModelOutput]:
1534
+ r"""
1535
+ start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1536
+ Labels for position (index) of the start of the labelled span for computing the token classification loss.
1537
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1538
+ are not taken into account for computing the loss.
1539
+ end_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1540
+ Labels for position (index) of the end of the labelled span for computing the token classification loss.
1541
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1542
+ are not taken into account for computing the loss.
1543
+ """
1544
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1545
+
1546
+ outputs = self.transformer(
1547
+ input_ids,
1548
+ attention_mask=attention_mask,
1549
+ position_ids=position_ids,
1550
+ past_key_values=past_key_values,
1551
+ inputs_embeds=inputs_embeds,
1552
+ output_attentions=output_attentions,
1553
+ output_hidden_states=output_hidden_states,
1554
+ return_dict=return_dict,
1555
+ )
1556
+
1557
+ sequence_output = outputs[0]
1558
+
1559
+ logits = self.qa_outputs(sequence_output)
1560
+ start_logits, end_logits = logits.split(1, dim=-1)
1561
+ start_logits = start_logits.squeeze(-1).contiguous()
1562
+ end_logits = end_logits.squeeze(-1).contiguous()
1563
+
1564
+ total_loss = None
1565
+ if start_positions is not None and end_positions is not None:
1566
+ # If we are on multi-GPU, split add a dimension
1567
+ if len(start_positions.size()) > 1:
1568
+ start_positions = start_positions.squeeze(-1).to(start_logits.device)
1569
+ if len(end_positions.size()) > 1:
1570
+ end_positions = end_positions.squeeze(-1).to(end_logits.device)
1571
+ # sometimes the start/end positions are outside our model inputs, we ignore these terms
1572
+ ignored_index = start_logits.size(1)
1573
+ start_positions = start_positions.clamp(0, ignored_index)
1574
+ end_positions = end_positions.clamp(0, ignored_index)
1575
+
1576
+ loss_fct = CrossEntropyLoss(ignore_index=ignored_index)
1577
+ start_loss = loss_fct(start_logits, start_positions)
1578
+ end_loss = loss_fct(end_logits, end_positions)
1579
+ total_loss = (start_loss + end_loss) / 2
1580
+
1581
+ if not return_dict:
1582
+ output = (start_logits, end_logits) + outputs[2:]
1583
+ return ((total_loss,) + output) if total_loss is not None else output
1584
+
1585
+ return QuestionAnsweringModelOutput(
1586
+ loss=total_loss,
1587
+ start_logits=start_logits,
1588
+ end_logits=end_logits,
1589
+ hidden_states=outputs.hidden_states,
1590
+ attentions=outputs.attentions,
1591
+ )
1592
+
1593
+
1594
+ @add_start_docstrings(
1595
+ """
1596
+ The Llama Model transformer with a token classification head on top (a linear layer on top of the hidden-states
1597
+ output) e.g. for Named-Entity-Recognition (NER) tasks.
1598
+ """,
1599
+ LLAMA_START_DOCSTRING,
1600
+ )
1601
+ class LlamaForTokenClassification(LlamaPreTrainedModel):
1602
+ def __init__(self, config):
1603
+ super().__init__(config)
1604
+ self.num_labels = config.num_labels
1605
+ self.model = LlamaModel(config)
1606
+ if getattr(config, "classifier_dropout", None) is not None:
1607
+ classifier_dropout = config.classifier_dropout
1608
+ elif getattr(config, "hidden_dropout", None) is not None:
1609
+ classifier_dropout = config.hidden_dropout
1610
+ else:
1611
+ classifier_dropout = 0.1
1612
+ self.dropout = nn.Dropout(classifier_dropout)
1613
+ self.score = nn.Linear(config.ori_hidden_size, config.num_labels)
1614
+
1615
+ # Initialize weights and apply final processing
1616
+ self.post_init()
1617
+
1618
+ def get_input_embeddings(self):
1619
+ return self.model.embed_tokens
1620
+
1621
+ def set_input_embeddings(self, value):
1622
+ self.model.embed_tokens = value
1623
+
1624
+ @add_start_docstrings_to_model_forward(LLAMA_INPUTS_DOCSTRING)
1625
+ def forward(
1626
+ self,
1627
+ input_ids: Optional[torch.LongTensor] = None,
1628
+ attention_mask: Optional[torch.Tensor] = None,
1629
+ position_ids: Optional[torch.LongTensor] = None,
1630
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1631
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1632
+ labels: Optional[torch.LongTensor] = None,
1633
+ use_cache: Optional[bool] = None,
1634
+ output_attentions: Optional[bool] = None,
1635
+ output_hidden_states: Optional[bool] = None,
1636
+ return_dict: Optional[bool] = None,
1637
+ ) -> Union[Tuple, TokenClassifierOutput]:
1638
+ r"""
1639
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1640
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1641
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1642
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1643
+ """
1644
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1645
+
1646
+ outputs = self.model(
1647
+ input_ids,
1648
+ attention_mask=attention_mask,
1649
+ position_ids=position_ids,
1650
+ past_key_values=past_key_values,
1651
+ inputs_embeds=inputs_embeds,
1652
+ use_cache=use_cache,
1653
+ output_attentions=output_attentions,
1654
+ output_hidden_states=output_hidden_states,
1655
+ return_dict=return_dict,
1656
+ )
1657
+ sequence_output = outputs[0]
1658
+ sequence_output = self.dropout(sequence_output)
1659
+ logits = self.score(sequence_output)
1660
+
1661
+ loss = None
1662
+ if labels is not None:
1663
+ loss_fct = CrossEntropyLoss()
1664
+ loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
1665
+
1666
+ if not return_dict:
1667
+ output = (logits,) + outputs[2:]
1668
+ return ((loss,) + output) if loss is not None else output
1669
+
1670
+ return TokenClassifierOutput(
1671
+ loss=loss,
1672
+ logits=logits,
1673
+ hidden_states=outputs.hidden_states,
1674
+ attentions=outputs.attentions,
1675
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|begin_of_text|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|eot_id|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|finetune_right_pad_id|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,2063 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "76953": {
4
+ "content": "<|begin_of_text|>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "76954": {
12
+ "content": "<|end_of_text|>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "76955": {
20
+ "content": "<|reserved_special_token_0|>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "76956": {
28
+ "content": "<|reserved_special_token_1|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "76957": {
36
+ "content": "<|finetune_right_pad_id|>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "76958": {
44
+ "content": "<|reserved_special_token_2|>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "76959": {
52
+ "content": "<|start_header_id|>",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "76960": {
60
+ "content": "<|end_header_id|>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "76961": {
68
+ "content": "<|eom_id|>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "76962": {
76
+ "content": "<|eot_id|>",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "76963": {
84
+ "content": "<|python_tag|>",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "76964": {
92
+ "content": "<|reserved_special_token_3|>",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "76965": {
100
+ "content": "<|reserved_special_token_4|>",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "76966": {
108
+ "content": "<|reserved_special_token_5|>",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "76967": {
116
+ "content": "<|reserved_special_token_6|>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "76968": {
124
+ "content": "<|reserved_special_token_7|>",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "76969": {
132
+ "content": "<|reserved_special_token_8|>",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "76970": {
140
+ "content": "<|reserved_special_token_9|>",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "76971": {
148
+ "content": "<|reserved_special_token_10|>",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "76972": {
156
+ "content": "<|reserved_special_token_11|>",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "76973": {
164
+ "content": "<|reserved_special_token_12|>",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "76974": {
172
+ "content": "<|reserved_special_token_13|>",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "76975": {
180
+ "content": "<|reserved_special_token_14|>",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "76976": {
188
+ "content": "<|reserved_special_token_15|>",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "76977": {
196
+ "content": "<|reserved_special_token_16|>",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "76978": {
204
+ "content": "<|reserved_special_token_17|>",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "76979": {
212
+ "content": "<|reserved_special_token_18|>",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "76980": {
220
+ "content": "<|reserved_special_token_19|>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "76981": {
228
+ "content": "<|reserved_special_token_20|>",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "76982": {
236
+ "content": "<|reserved_special_token_21|>",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "76983": {
244
+ "content": "<|reserved_special_token_22|>",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "76984": {
252
+ "content": "<|reserved_special_token_23|>",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "76985": {
260
+ "content": "<|reserved_special_token_24|>",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "76986": {
268
+ "content": "<|reserved_special_token_25|>",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "76987": {
276
+ "content": "<|reserved_special_token_26|>",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "76988": {
284
+ "content": "<|reserved_special_token_27|>",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "76989": {
292
+ "content": "<|reserved_special_token_28|>",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "76990": {
300
+ "content": "<|reserved_special_token_29|>",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "76991": {
308
+ "content": "<|reserved_special_token_30|>",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "76992": {
316
+ "content": "<|reserved_special_token_31|>",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "76993": {
324
+ "content": "<|reserved_special_token_32|>",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "76994": {
332
+ "content": "<|reserved_special_token_33|>",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "76995": {
340
+ "content": "<|reserved_special_token_34|>",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "76996": {
348
+ "content": "<|reserved_special_token_35|>",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "76997": {
356
+ "content": "<|reserved_special_token_36|>",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "76998": {
364
+ "content": "<|reserved_special_token_37|>",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "76999": {
372
+ "content": "<|reserved_special_token_38|>",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "77000": {
380
+ "content": "<|reserved_special_token_39|>",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "77001": {
388
+ "content": "<|reserved_special_token_40|>",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "77002": {
396
+ "content": "<|reserved_special_token_41|>",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "77003": {
404
+ "content": "<|reserved_special_token_42|>",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "77004": {
412
+ "content": "<|reserved_special_token_43|>",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "77005": {
420
+ "content": "<|reserved_special_token_44|>",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "77006": {
428
+ "content": "<|reserved_special_token_45|>",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "77007": {
436
+ "content": "<|reserved_special_token_46|>",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "77008": {
444
+ "content": "<|reserved_special_token_47|>",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "77009": {
452
+ "content": "<|reserved_special_token_48|>",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "77010": {
460
+ "content": "<|reserved_special_token_49|>",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "77011": {
468
+ "content": "<|reserved_special_token_50|>",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "77012": {
476
+ "content": "<|reserved_special_token_51|>",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "77013": {
484
+ "content": "<|reserved_special_token_52|>",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "77014": {
492
+ "content": "<|reserved_special_token_53|>",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "77015": {
500
+ "content": "<|reserved_special_token_54|>",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "77016": {
508
+ "content": "<|reserved_special_token_55|>",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "77017": {
516
+ "content": "<|reserved_special_token_56|>",
517
+ "lstrip": false,
518
+ "normalized": false,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": true
522
+ },
523
+ "77018": {
524
+ "content": "<|reserved_special_token_57|>",
525
+ "lstrip": false,
526
+ "normalized": false,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": true
530
+ },
531
+ "77019": {
532
+ "content": "<|reserved_special_token_58|>",
533
+ "lstrip": false,
534
+ "normalized": false,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": true
538
+ },
539
+ "77020": {
540
+ "content": "<|reserved_special_token_59|>",
541
+ "lstrip": false,
542
+ "normalized": false,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": true
546
+ },
547
+ "77021": {
548
+ "content": "<|reserved_special_token_60|>",
549
+ "lstrip": false,
550
+ "normalized": false,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": true
554
+ },
555
+ "77022": {
556
+ "content": "<|reserved_special_token_61|>",
557
+ "lstrip": false,
558
+ "normalized": false,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": true
562
+ },
563
+ "77023": {
564
+ "content": "<|reserved_special_token_62|>",
565
+ "lstrip": false,
566
+ "normalized": false,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": true
570
+ },
571
+ "77024": {
572
+ "content": "<|reserved_special_token_63|>",
573
+ "lstrip": false,
574
+ "normalized": false,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": true
578
+ },
579
+ "77025": {
580
+ "content": "<|reserved_special_token_64|>",
581
+ "lstrip": false,
582
+ "normalized": false,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": true
586
+ },
587
+ "77026": {
588
+ "content": "<|reserved_special_token_65|>",
589
+ "lstrip": false,
590
+ "normalized": false,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": true
594
+ },
595
+ "77027": {
596
+ "content": "<|reserved_special_token_66|>",
597
+ "lstrip": false,
598
+ "normalized": false,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": true
602
+ },
603
+ "77028": {
604
+ "content": "<|reserved_special_token_67|>",
605
+ "lstrip": false,
606
+ "normalized": false,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": true
610
+ },
611
+ "77029": {
612
+ "content": "<|reserved_special_token_68|>",
613
+ "lstrip": false,
614
+ "normalized": false,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": true
618
+ },
619
+ "77030": {
620
+ "content": "<|reserved_special_token_69|>",
621
+ "lstrip": false,
622
+ "normalized": false,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": true
626
+ },
627
+ "77031": {
628
+ "content": "<|reserved_special_token_70|>",
629
+ "lstrip": false,
630
+ "normalized": false,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": true
634
+ },
635
+ "77032": {
636
+ "content": "<|reserved_special_token_71|>",
637
+ "lstrip": false,
638
+ "normalized": false,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": true
642
+ },
643
+ "77033": {
644
+ "content": "<|reserved_special_token_72|>",
645
+ "lstrip": false,
646
+ "normalized": false,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": true
650
+ },
651
+ "77034": {
652
+ "content": "<|reserved_special_token_73|>",
653
+ "lstrip": false,
654
+ "normalized": false,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": true
658
+ },
659
+ "77035": {
660
+ "content": "<|reserved_special_token_74|>",
661
+ "lstrip": false,
662
+ "normalized": false,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": true
666
+ },
667
+ "77036": {
668
+ "content": "<|reserved_special_token_75|>",
669
+ "lstrip": false,
670
+ "normalized": false,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": true
674
+ },
675
+ "77037": {
676
+ "content": "<|reserved_special_token_76|>",
677
+ "lstrip": false,
678
+ "normalized": false,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": true
682
+ },
683
+ "77038": {
684
+ "content": "<|reserved_special_token_77|>",
685
+ "lstrip": false,
686
+ "normalized": false,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": true
690
+ },
691
+ "77039": {
692
+ "content": "<|reserved_special_token_78|>",
693
+ "lstrip": false,
694
+ "normalized": false,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": true
698
+ },
699
+ "77040": {
700
+ "content": "<|reserved_special_token_79|>",
701
+ "lstrip": false,
702
+ "normalized": false,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": true
706
+ },
707
+ "77041": {
708
+ "content": "<|reserved_special_token_80|>",
709
+ "lstrip": false,
710
+ "normalized": false,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": true
714
+ },
715
+ "77042": {
716
+ "content": "<|reserved_special_token_81|>",
717
+ "lstrip": false,
718
+ "normalized": false,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": true
722
+ },
723
+ "77043": {
724
+ "content": "<|reserved_special_token_82|>",
725
+ "lstrip": false,
726
+ "normalized": false,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": true
730
+ },
731
+ "77044": {
732
+ "content": "<|reserved_special_token_83|>",
733
+ "lstrip": false,
734
+ "normalized": false,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": true
738
+ },
739
+ "77045": {
740
+ "content": "<|reserved_special_token_84|>",
741
+ "lstrip": false,
742
+ "normalized": false,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": true
746
+ },
747
+ "77046": {
748
+ "content": "<|reserved_special_token_85|>",
749
+ "lstrip": false,
750
+ "normalized": false,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": true
754
+ },
755
+ "77047": {
756
+ "content": "<|reserved_special_token_86|>",
757
+ "lstrip": false,
758
+ "normalized": false,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": true
762
+ },
763
+ "77048": {
764
+ "content": "<|reserved_special_token_87|>",
765
+ "lstrip": false,
766
+ "normalized": false,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": true
770
+ },
771
+ "77049": {
772
+ "content": "<|reserved_special_token_88|>",
773
+ "lstrip": false,
774
+ "normalized": false,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": true
778
+ },
779
+ "77050": {
780
+ "content": "<|reserved_special_token_89|>",
781
+ "lstrip": false,
782
+ "normalized": false,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": true
786
+ },
787
+ "77051": {
788
+ "content": "<|reserved_special_token_90|>",
789
+ "lstrip": false,
790
+ "normalized": false,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": true
794
+ },
795
+ "77052": {
796
+ "content": "<|reserved_special_token_91|>",
797
+ "lstrip": false,
798
+ "normalized": false,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": true
802
+ },
803
+ "77053": {
804
+ "content": "<|reserved_special_token_92|>",
805
+ "lstrip": false,
806
+ "normalized": false,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": true
810
+ },
811
+ "77054": {
812
+ "content": "<|reserved_special_token_93|>",
813
+ "lstrip": false,
814
+ "normalized": false,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": true
818
+ },
819
+ "77055": {
820
+ "content": "<|reserved_special_token_94|>",
821
+ "lstrip": false,
822
+ "normalized": false,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": true
826
+ },
827
+ "77056": {
828
+ "content": "<|reserved_special_token_95|>",
829
+ "lstrip": false,
830
+ "normalized": false,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": true
834
+ },
835
+ "77057": {
836
+ "content": "<|reserved_special_token_96|>",
837
+ "lstrip": false,
838
+ "normalized": false,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": true
842
+ },
843
+ "77058": {
844
+ "content": "<|reserved_special_token_97|>",
845
+ "lstrip": false,
846
+ "normalized": false,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": true
850
+ },
851
+ "77059": {
852
+ "content": "<|reserved_special_token_98|>",
853
+ "lstrip": false,
854
+ "normalized": false,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": true
858
+ },
859
+ "77060": {
860
+ "content": "<|reserved_special_token_99|>",
861
+ "lstrip": false,
862
+ "normalized": false,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": true
866
+ },
867
+ "77061": {
868
+ "content": "<|reserved_special_token_100|>",
869
+ "lstrip": false,
870
+ "normalized": false,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": true
874
+ },
875
+ "77062": {
876
+ "content": "<|reserved_special_token_101|>",
877
+ "lstrip": false,
878
+ "normalized": false,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": true
882
+ },
883
+ "77063": {
884
+ "content": "<|reserved_special_token_102|>",
885
+ "lstrip": false,
886
+ "normalized": false,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": true
890
+ },
891
+ "77064": {
892
+ "content": "<|reserved_special_token_103|>",
893
+ "lstrip": false,
894
+ "normalized": false,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": true
898
+ },
899
+ "77065": {
900
+ "content": "<|reserved_special_token_104|>",
901
+ "lstrip": false,
902
+ "normalized": false,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": true
906
+ },
907
+ "77066": {
908
+ "content": "<|reserved_special_token_105|>",
909
+ "lstrip": false,
910
+ "normalized": false,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": true
914
+ },
915
+ "77067": {
916
+ "content": "<|reserved_special_token_106|>",
917
+ "lstrip": false,
918
+ "normalized": false,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": true
922
+ },
923
+ "77068": {
924
+ "content": "<|reserved_special_token_107|>",
925
+ "lstrip": false,
926
+ "normalized": false,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": true
930
+ },
931
+ "77069": {
932
+ "content": "<|reserved_special_token_108|>",
933
+ "lstrip": false,
934
+ "normalized": false,
935
+ "rstrip": false,
936
+ "single_word": false,
937
+ "special": true
938
+ },
939
+ "77070": {
940
+ "content": "<|reserved_special_token_109|>",
941
+ "lstrip": false,
942
+ "normalized": false,
943
+ "rstrip": false,
944
+ "single_word": false,
945
+ "special": true
946
+ },
947
+ "77071": {
948
+ "content": "<|reserved_special_token_110|>",
949
+ "lstrip": false,
950
+ "normalized": false,
951
+ "rstrip": false,
952
+ "single_word": false,
953
+ "special": true
954
+ },
955
+ "77072": {
956
+ "content": "<|reserved_special_token_111|>",
957
+ "lstrip": false,
958
+ "normalized": false,
959
+ "rstrip": false,
960
+ "single_word": false,
961
+ "special": true
962
+ },
963
+ "77073": {
964
+ "content": "<|reserved_special_token_112|>",
965
+ "lstrip": false,
966
+ "normalized": false,
967
+ "rstrip": false,
968
+ "single_word": false,
969
+ "special": true
970
+ },
971
+ "77074": {
972
+ "content": "<|reserved_special_token_113|>",
973
+ "lstrip": false,
974
+ "normalized": false,
975
+ "rstrip": false,
976
+ "single_word": false,
977
+ "special": true
978
+ },
979
+ "77075": {
980
+ "content": "<|reserved_special_token_114|>",
981
+ "lstrip": false,
982
+ "normalized": false,
983
+ "rstrip": false,
984
+ "single_word": false,
985
+ "special": true
986
+ },
987
+ "77076": {
988
+ "content": "<|reserved_special_token_115|>",
989
+ "lstrip": false,
990
+ "normalized": false,
991
+ "rstrip": false,
992
+ "single_word": false,
993
+ "special": true
994
+ },
995
+ "77077": {
996
+ "content": "<|reserved_special_token_116|>",
997
+ "lstrip": false,
998
+ "normalized": false,
999
+ "rstrip": false,
1000
+ "single_word": false,
1001
+ "special": true
1002
+ },
1003
+ "77078": {
1004
+ "content": "<|reserved_special_token_117|>",
1005
+ "lstrip": false,
1006
+ "normalized": false,
1007
+ "rstrip": false,
1008
+ "single_word": false,
1009
+ "special": true
1010
+ },
1011
+ "77079": {
1012
+ "content": "<|reserved_special_token_118|>",
1013
+ "lstrip": false,
1014
+ "normalized": false,
1015
+ "rstrip": false,
1016
+ "single_word": false,
1017
+ "special": true
1018
+ },
1019
+ "77080": {
1020
+ "content": "<|reserved_special_token_119|>",
1021
+ "lstrip": false,
1022
+ "normalized": false,
1023
+ "rstrip": false,
1024
+ "single_word": false,
1025
+ "special": true
1026
+ },
1027
+ "77081": {
1028
+ "content": "<|reserved_special_token_120|>",
1029
+ "lstrip": false,
1030
+ "normalized": false,
1031
+ "rstrip": false,
1032
+ "single_word": false,
1033
+ "special": true
1034
+ },
1035
+ "77082": {
1036
+ "content": "<|reserved_special_token_121|>",
1037
+ "lstrip": false,
1038
+ "normalized": false,
1039
+ "rstrip": false,
1040
+ "single_word": false,
1041
+ "special": true
1042
+ },
1043
+ "77083": {
1044
+ "content": "<|reserved_special_token_122|>",
1045
+ "lstrip": false,
1046
+ "normalized": false,
1047
+ "rstrip": false,
1048
+ "single_word": false,
1049
+ "special": true
1050
+ },
1051
+ "77084": {
1052
+ "content": "<|reserved_special_token_123|>",
1053
+ "lstrip": false,
1054
+ "normalized": false,
1055
+ "rstrip": false,
1056
+ "single_word": false,
1057
+ "special": true
1058
+ },
1059
+ "77085": {
1060
+ "content": "<|reserved_special_token_124|>",
1061
+ "lstrip": false,
1062
+ "normalized": false,
1063
+ "rstrip": false,
1064
+ "single_word": false,
1065
+ "special": true
1066
+ },
1067
+ "77086": {
1068
+ "content": "<|reserved_special_token_125|>",
1069
+ "lstrip": false,
1070
+ "normalized": false,
1071
+ "rstrip": false,
1072
+ "single_word": false,
1073
+ "special": true
1074
+ },
1075
+ "77087": {
1076
+ "content": "<|reserved_special_token_126|>",
1077
+ "lstrip": false,
1078
+ "normalized": false,
1079
+ "rstrip": false,
1080
+ "single_word": false,
1081
+ "special": true
1082
+ },
1083
+ "77088": {
1084
+ "content": "<|reserved_special_token_127|>",
1085
+ "lstrip": false,
1086
+ "normalized": false,
1087
+ "rstrip": false,
1088
+ "single_word": false,
1089
+ "special": true
1090
+ },
1091
+ "77089": {
1092
+ "content": "<|reserved_special_token_128|>",
1093
+ "lstrip": false,
1094
+ "normalized": false,
1095
+ "rstrip": false,
1096
+ "single_word": false,
1097
+ "special": true
1098
+ },
1099
+ "77090": {
1100
+ "content": "<|reserved_special_token_129|>",
1101
+ "lstrip": false,
1102
+ "normalized": false,
1103
+ "rstrip": false,
1104
+ "single_word": false,
1105
+ "special": true
1106
+ },
1107
+ "77091": {
1108
+ "content": "<|reserved_special_token_130|>",
1109
+ "lstrip": false,
1110
+ "normalized": false,
1111
+ "rstrip": false,
1112
+ "single_word": false,
1113
+ "special": true
1114
+ },
1115
+ "77092": {
1116
+ "content": "<|reserved_special_token_131|>",
1117
+ "lstrip": false,
1118
+ "normalized": false,
1119
+ "rstrip": false,
1120
+ "single_word": false,
1121
+ "special": true
1122
+ },
1123
+ "77093": {
1124
+ "content": "<|reserved_special_token_132|>",
1125
+ "lstrip": false,
1126
+ "normalized": false,
1127
+ "rstrip": false,
1128
+ "single_word": false,
1129
+ "special": true
1130
+ },
1131
+ "77094": {
1132
+ "content": "<|reserved_special_token_133|>",
1133
+ "lstrip": false,
1134
+ "normalized": false,
1135
+ "rstrip": false,
1136
+ "single_word": false,
1137
+ "special": true
1138
+ },
1139
+ "77095": {
1140
+ "content": "<|reserved_special_token_134|>",
1141
+ "lstrip": false,
1142
+ "normalized": false,
1143
+ "rstrip": false,
1144
+ "single_word": false,
1145
+ "special": true
1146
+ },
1147
+ "77096": {
1148
+ "content": "<|reserved_special_token_135|>",
1149
+ "lstrip": false,
1150
+ "normalized": false,
1151
+ "rstrip": false,
1152
+ "single_word": false,
1153
+ "special": true
1154
+ },
1155
+ "77097": {
1156
+ "content": "<|reserved_special_token_136|>",
1157
+ "lstrip": false,
1158
+ "normalized": false,
1159
+ "rstrip": false,
1160
+ "single_word": false,
1161
+ "special": true
1162
+ },
1163
+ "77098": {
1164
+ "content": "<|reserved_special_token_137|>",
1165
+ "lstrip": false,
1166
+ "normalized": false,
1167
+ "rstrip": false,
1168
+ "single_word": false,
1169
+ "special": true
1170
+ },
1171
+ "77099": {
1172
+ "content": "<|reserved_special_token_138|>",
1173
+ "lstrip": false,
1174
+ "normalized": false,
1175
+ "rstrip": false,
1176
+ "single_word": false,
1177
+ "special": true
1178
+ },
1179
+ "77100": {
1180
+ "content": "<|reserved_special_token_139|>",
1181
+ "lstrip": false,
1182
+ "normalized": false,
1183
+ "rstrip": false,
1184
+ "single_word": false,
1185
+ "special": true
1186
+ },
1187
+ "77101": {
1188
+ "content": "<|reserved_special_token_140|>",
1189
+ "lstrip": false,
1190
+ "normalized": false,
1191
+ "rstrip": false,
1192
+ "single_word": false,
1193
+ "special": true
1194
+ },
1195
+ "77102": {
1196
+ "content": "<|reserved_special_token_141|>",
1197
+ "lstrip": false,
1198
+ "normalized": false,
1199
+ "rstrip": false,
1200
+ "single_word": false,
1201
+ "special": true
1202
+ },
1203
+ "77103": {
1204
+ "content": "<|reserved_special_token_142|>",
1205
+ "lstrip": false,
1206
+ "normalized": false,
1207
+ "rstrip": false,
1208
+ "single_word": false,
1209
+ "special": true
1210
+ },
1211
+ "77104": {
1212
+ "content": "<|reserved_special_token_143|>",
1213
+ "lstrip": false,
1214
+ "normalized": false,
1215
+ "rstrip": false,
1216
+ "single_word": false,
1217
+ "special": true
1218
+ },
1219
+ "77105": {
1220
+ "content": "<|reserved_special_token_144|>",
1221
+ "lstrip": false,
1222
+ "normalized": false,
1223
+ "rstrip": false,
1224
+ "single_word": false,
1225
+ "special": true
1226
+ },
1227
+ "77106": {
1228
+ "content": "<|reserved_special_token_145|>",
1229
+ "lstrip": false,
1230
+ "normalized": false,
1231
+ "rstrip": false,
1232
+ "single_word": false,
1233
+ "special": true
1234
+ },
1235
+ "77107": {
1236
+ "content": "<|reserved_special_token_146|>",
1237
+ "lstrip": false,
1238
+ "normalized": false,
1239
+ "rstrip": false,
1240
+ "single_word": false,
1241
+ "special": true
1242
+ },
1243
+ "77108": {
1244
+ "content": "<|reserved_special_token_147|>",
1245
+ "lstrip": false,
1246
+ "normalized": false,
1247
+ "rstrip": false,
1248
+ "single_word": false,
1249
+ "special": true
1250
+ },
1251
+ "77109": {
1252
+ "content": "<|reserved_special_token_148|>",
1253
+ "lstrip": false,
1254
+ "normalized": false,
1255
+ "rstrip": false,
1256
+ "single_word": false,
1257
+ "special": true
1258
+ },
1259
+ "77110": {
1260
+ "content": "<|reserved_special_token_149|>",
1261
+ "lstrip": false,
1262
+ "normalized": false,
1263
+ "rstrip": false,
1264
+ "single_word": false,
1265
+ "special": true
1266
+ },
1267
+ "77111": {
1268
+ "content": "<|reserved_special_token_150|>",
1269
+ "lstrip": false,
1270
+ "normalized": false,
1271
+ "rstrip": false,
1272
+ "single_word": false,
1273
+ "special": true
1274
+ },
1275
+ "77112": {
1276
+ "content": "<|reserved_special_token_151|>",
1277
+ "lstrip": false,
1278
+ "normalized": false,
1279
+ "rstrip": false,
1280
+ "single_word": false,
1281
+ "special": true
1282
+ },
1283
+ "77113": {
1284
+ "content": "<|reserved_special_token_152|>",
1285
+ "lstrip": false,
1286
+ "normalized": false,
1287
+ "rstrip": false,
1288
+ "single_word": false,
1289
+ "special": true
1290
+ },
1291
+ "77114": {
1292
+ "content": "<|reserved_special_token_153|>",
1293
+ "lstrip": false,
1294
+ "normalized": false,
1295
+ "rstrip": false,
1296
+ "single_word": false,
1297
+ "special": true
1298
+ },
1299
+ "77115": {
1300
+ "content": "<|reserved_special_token_154|>",
1301
+ "lstrip": false,
1302
+ "normalized": false,
1303
+ "rstrip": false,
1304
+ "single_word": false,
1305
+ "special": true
1306
+ },
1307
+ "77116": {
1308
+ "content": "<|reserved_special_token_155|>",
1309
+ "lstrip": false,
1310
+ "normalized": false,
1311
+ "rstrip": false,
1312
+ "single_word": false,
1313
+ "special": true
1314
+ },
1315
+ "77117": {
1316
+ "content": "<|reserved_special_token_156|>",
1317
+ "lstrip": false,
1318
+ "normalized": false,
1319
+ "rstrip": false,
1320
+ "single_word": false,
1321
+ "special": true
1322
+ },
1323
+ "77118": {
1324
+ "content": "<|reserved_special_token_157|>",
1325
+ "lstrip": false,
1326
+ "normalized": false,
1327
+ "rstrip": false,
1328
+ "single_word": false,
1329
+ "special": true
1330
+ },
1331
+ "77119": {
1332
+ "content": "<|reserved_special_token_158|>",
1333
+ "lstrip": false,
1334
+ "normalized": false,
1335
+ "rstrip": false,
1336
+ "single_word": false,
1337
+ "special": true
1338
+ },
1339
+ "77120": {
1340
+ "content": "<|reserved_special_token_159|>",
1341
+ "lstrip": false,
1342
+ "normalized": false,
1343
+ "rstrip": false,
1344
+ "single_word": false,
1345
+ "special": true
1346
+ },
1347
+ "77121": {
1348
+ "content": "<|reserved_special_token_160|>",
1349
+ "lstrip": false,
1350
+ "normalized": false,
1351
+ "rstrip": false,
1352
+ "single_word": false,
1353
+ "special": true
1354
+ },
1355
+ "77122": {
1356
+ "content": "<|reserved_special_token_161|>",
1357
+ "lstrip": false,
1358
+ "normalized": false,
1359
+ "rstrip": false,
1360
+ "single_word": false,
1361
+ "special": true
1362
+ },
1363
+ "77123": {
1364
+ "content": "<|reserved_special_token_162|>",
1365
+ "lstrip": false,
1366
+ "normalized": false,
1367
+ "rstrip": false,
1368
+ "single_word": false,
1369
+ "special": true
1370
+ },
1371
+ "77124": {
1372
+ "content": "<|reserved_special_token_163|>",
1373
+ "lstrip": false,
1374
+ "normalized": false,
1375
+ "rstrip": false,
1376
+ "single_word": false,
1377
+ "special": true
1378
+ },
1379
+ "77125": {
1380
+ "content": "<|reserved_special_token_164|>",
1381
+ "lstrip": false,
1382
+ "normalized": false,
1383
+ "rstrip": false,
1384
+ "single_word": false,
1385
+ "special": true
1386
+ },
1387
+ "77126": {
1388
+ "content": "<|reserved_special_token_165|>",
1389
+ "lstrip": false,
1390
+ "normalized": false,
1391
+ "rstrip": false,
1392
+ "single_word": false,
1393
+ "special": true
1394
+ },
1395
+ "77127": {
1396
+ "content": "<|reserved_special_token_166|>",
1397
+ "lstrip": false,
1398
+ "normalized": false,
1399
+ "rstrip": false,
1400
+ "single_word": false,
1401
+ "special": true
1402
+ },
1403
+ "77128": {
1404
+ "content": "<|reserved_special_token_167|>",
1405
+ "lstrip": false,
1406
+ "normalized": false,
1407
+ "rstrip": false,
1408
+ "single_word": false,
1409
+ "special": true
1410
+ },
1411
+ "77129": {
1412
+ "content": "<|reserved_special_token_168|>",
1413
+ "lstrip": false,
1414
+ "normalized": false,
1415
+ "rstrip": false,
1416
+ "single_word": false,
1417
+ "special": true
1418
+ },
1419
+ "77130": {
1420
+ "content": "<|reserved_special_token_169|>",
1421
+ "lstrip": false,
1422
+ "normalized": false,
1423
+ "rstrip": false,
1424
+ "single_word": false,
1425
+ "special": true
1426
+ },
1427
+ "77131": {
1428
+ "content": "<|reserved_special_token_170|>",
1429
+ "lstrip": false,
1430
+ "normalized": false,
1431
+ "rstrip": false,
1432
+ "single_word": false,
1433
+ "special": true
1434
+ },
1435
+ "77132": {
1436
+ "content": "<|reserved_special_token_171|>",
1437
+ "lstrip": false,
1438
+ "normalized": false,
1439
+ "rstrip": false,
1440
+ "single_word": false,
1441
+ "special": true
1442
+ },
1443
+ "77133": {
1444
+ "content": "<|reserved_special_token_172|>",
1445
+ "lstrip": false,
1446
+ "normalized": false,
1447
+ "rstrip": false,
1448
+ "single_word": false,
1449
+ "special": true
1450
+ },
1451
+ "77134": {
1452
+ "content": "<|reserved_special_token_173|>",
1453
+ "lstrip": false,
1454
+ "normalized": false,
1455
+ "rstrip": false,
1456
+ "single_word": false,
1457
+ "special": true
1458
+ },
1459
+ "77135": {
1460
+ "content": "<|reserved_special_token_174|>",
1461
+ "lstrip": false,
1462
+ "normalized": false,
1463
+ "rstrip": false,
1464
+ "single_word": false,
1465
+ "special": true
1466
+ },
1467
+ "77136": {
1468
+ "content": "<|reserved_special_token_175|>",
1469
+ "lstrip": false,
1470
+ "normalized": false,
1471
+ "rstrip": false,
1472
+ "single_word": false,
1473
+ "special": true
1474
+ },
1475
+ "77137": {
1476
+ "content": "<|reserved_special_token_176|>",
1477
+ "lstrip": false,
1478
+ "normalized": false,
1479
+ "rstrip": false,
1480
+ "single_word": false,
1481
+ "special": true
1482
+ },
1483
+ "77138": {
1484
+ "content": "<|reserved_special_token_177|>",
1485
+ "lstrip": false,
1486
+ "normalized": false,
1487
+ "rstrip": false,
1488
+ "single_word": false,
1489
+ "special": true
1490
+ },
1491
+ "77139": {
1492
+ "content": "<|reserved_special_token_178|>",
1493
+ "lstrip": false,
1494
+ "normalized": false,
1495
+ "rstrip": false,
1496
+ "single_word": false,
1497
+ "special": true
1498
+ },
1499
+ "77140": {
1500
+ "content": "<|reserved_special_token_179|>",
1501
+ "lstrip": false,
1502
+ "normalized": false,
1503
+ "rstrip": false,
1504
+ "single_word": false,
1505
+ "special": true
1506
+ },
1507
+ "77141": {
1508
+ "content": "<|reserved_special_token_180|>",
1509
+ "lstrip": false,
1510
+ "normalized": false,
1511
+ "rstrip": false,
1512
+ "single_word": false,
1513
+ "special": true
1514
+ },
1515
+ "77142": {
1516
+ "content": "<|reserved_special_token_181|>",
1517
+ "lstrip": false,
1518
+ "normalized": false,
1519
+ "rstrip": false,
1520
+ "single_word": false,
1521
+ "special": true
1522
+ },
1523
+ "77143": {
1524
+ "content": "<|reserved_special_token_182|>",
1525
+ "lstrip": false,
1526
+ "normalized": false,
1527
+ "rstrip": false,
1528
+ "single_word": false,
1529
+ "special": true
1530
+ },
1531
+ "77144": {
1532
+ "content": "<|reserved_special_token_183|>",
1533
+ "lstrip": false,
1534
+ "normalized": false,
1535
+ "rstrip": false,
1536
+ "single_word": false,
1537
+ "special": true
1538
+ },
1539
+ "77145": {
1540
+ "content": "<|reserved_special_token_184|>",
1541
+ "lstrip": false,
1542
+ "normalized": false,
1543
+ "rstrip": false,
1544
+ "single_word": false,
1545
+ "special": true
1546
+ },
1547
+ "77146": {
1548
+ "content": "<|reserved_special_token_185|>",
1549
+ "lstrip": false,
1550
+ "normalized": false,
1551
+ "rstrip": false,
1552
+ "single_word": false,
1553
+ "special": true
1554
+ },
1555
+ "77147": {
1556
+ "content": "<|reserved_special_token_186|>",
1557
+ "lstrip": false,
1558
+ "normalized": false,
1559
+ "rstrip": false,
1560
+ "single_word": false,
1561
+ "special": true
1562
+ },
1563
+ "77148": {
1564
+ "content": "<|reserved_special_token_187|>",
1565
+ "lstrip": false,
1566
+ "normalized": false,
1567
+ "rstrip": false,
1568
+ "single_word": false,
1569
+ "special": true
1570
+ },
1571
+ "77149": {
1572
+ "content": "<|reserved_special_token_188|>",
1573
+ "lstrip": false,
1574
+ "normalized": false,
1575
+ "rstrip": false,
1576
+ "single_word": false,
1577
+ "special": true
1578
+ },
1579
+ "77150": {
1580
+ "content": "<|reserved_special_token_189|>",
1581
+ "lstrip": false,
1582
+ "normalized": false,
1583
+ "rstrip": false,
1584
+ "single_word": false,
1585
+ "special": true
1586
+ },
1587
+ "77151": {
1588
+ "content": "<|reserved_special_token_190|>",
1589
+ "lstrip": false,
1590
+ "normalized": false,
1591
+ "rstrip": false,
1592
+ "single_word": false,
1593
+ "special": true
1594
+ },
1595
+ "77152": {
1596
+ "content": "<|reserved_special_token_191|>",
1597
+ "lstrip": false,
1598
+ "normalized": false,
1599
+ "rstrip": false,
1600
+ "single_word": false,
1601
+ "special": true
1602
+ },
1603
+ "77153": {
1604
+ "content": "<|reserved_special_token_192|>",
1605
+ "lstrip": false,
1606
+ "normalized": false,
1607
+ "rstrip": false,
1608
+ "single_word": false,
1609
+ "special": true
1610
+ },
1611
+ "77154": {
1612
+ "content": "<|reserved_special_token_193|>",
1613
+ "lstrip": false,
1614
+ "normalized": false,
1615
+ "rstrip": false,
1616
+ "single_word": false,
1617
+ "special": true
1618
+ },
1619
+ "77155": {
1620
+ "content": "<|reserved_special_token_194|>",
1621
+ "lstrip": false,
1622
+ "normalized": false,
1623
+ "rstrip": false,
1624
+ "single_word": false,
1625
+ "special": true
1626
+ },
1627
+ "77156": {
1628
+ "content": "<|reserved_special_token_195|>",
1629
+ "lstrip": false,
1630
+ "normalized": false,
1631
+ "rstrip": false,
1632
+ "single_word": false,
1633
+ "special": true
1634
+ },
1635
+ "77157": {
1636
+ "content": "<|reserved_special_token_196|>",
1637
+ "lstrip": false,
1638
+ "normalized": false,
1639
+ "rstrip": false,
1640
+ "single_word": false,
1641
+ "special": true
1642
+ },
1643
+ "77158": {
1644
+ "content": "<|reserved_special_token_197|>",
1645
+ "lstrip": false,
1646
+ "normalized": false,
1647
+ "rstrip": false,
1648
+ "single_word": false,
1649
+ "special": true
1650
+ },
1651
+ "77159": {
1652
+ "content": "<|reserved_special_token_198|>",
1653
+ "lstrip": false,
1654
+ "normalized": false,
1655
+ "rstrip": false,
1656
+ "single_word": false,
1657
+ "special": true
1658
+ },
1659
+ "77160": {
1660
+ "content": "<|reserved_special_token_199|>",
1661
+ "lstrip": false,
1662
+ "normalized": false,
1663
+ "rstrip": false,
1664
+ "single_word": false,
1665
+ "special": true
1666
+ },
1667
+ "77161": {
1668
+ "content": "<|reserved_special_token_200|>",
1669
+ "lstrip": false,
1670
+ "normalized": false,
1671
+ "rstrip": false,
1672
+ "single_word": false,
1673
+ "special": true
1674
+ },
1675
+ "77162": {
1676
+ "content": "<|reserved_special_token_201|>",
1677
+ "lstrip": false,
1678
+ "normalized": false,
1679
+ "rstrip": false,
1680
+ "single_word": false,
1681
+ "special": true
1682
+ },
1683
+ "77163": {
1684
+ "content": "<|reserved_special_token_202|>",
1685
+ "lstrip": false,
1686
+ "normalized": false,
1687
+ "rstrip": false,
1688
+ "single_word": false,
1689
+ "special": true
1690
+ },
1691
+ "77164": {
1692
+ "content": "<|reserved_special_token_203|>",
1693
+ "lstrip": false,
1694
+ "normalized": false,
1695
+ "rstrip": false,
1696
+ "single_word": false,
1697
+ "special": true
1698
+ },
1699
+ "77165": {
1700
+ "content": "<|reserved_special_token_204|>",
1701
+ "lstrip": false,
1702
+ "normalized": false,
1703
+ "rstrip": false,
1704
+ "single_word": false,
1705
+ "special": true
1706
+ },
1707
+ "77166": {
1708
+ "content": "<|reserved_special_token_205|>",
1709
+ "lstrip": false,
1710
+ "normalized": false,
1711
+ "rstrip": false,
1712
+ "single_word": false,
1713
+ "special": true
1714
+ },
1715
+ "77167": {
1716
+ "content": "<|reserved_special_token_206|>",
1717
+ "lstrip": false,
1718
+ "normalized": false,
1719
+ "rstrip": false,
1720
+ "single_word": false,
1721
+ "special": true
1722
+ },
1723
+ "77168": {
1724
+ "content": "<|reserved_special_token_207|>",
1725
+ "lstrip": false,
1726
+ "normalized": false,
1727
+ "rstrip": false,
1728
+ "single_word": false,
1729
+ "special": true
1730
+ },
1731
+ "77169": {
1732
+ "content": "<|reserved_special_token_208|>",
1733
+ "lstrip": false,
1734
+ "normalized": false,
1735
+ "rstrip": false,
1736
+ "single_word": false,
1737
+ "special": true
1738
+ },
1739
+ "77170": {
1740
+ "content": "<|reserved_special_token_209|>",
1741
+ "lstrip": false,
1742
+ "normalized": false,
1743
+ "rstrip": false,
1744
+ "single_word": false,
1745
+ "special": true
1746
+ },
1747
+ "77171": {
1748
+ "content": "<|reserved_special_token_210|>",
1749
+ "lstrip": false,
1750
+ "normalized": false,
1751
+ "rstrip": false,
1752
+ "single_word": false,
1753
+ "special": true
1754
+ },
1755
+ "77172": {
1756
+ "content": "<|reserved_special_token_211|>",
1757
+ "lstrip": false,
1758
+ "normalized": false,
1759
+ "rstrip": false,
1760
+ "single_word": false,
1761
+ "special": true
1762
+ },
1763
+ "77173": {
1764
+ "content": "<|reserved_special_token_212|>",
1765
+ "lstrip": false,
1766
+ "normalized": false,
1767
+ "rstrip": false,
1768
+ "single_word": false,
1769
+ "special": true
1770
+ },
1771
+ "77174": {
1772
+ "content": "<|reserved_special_token_213|>",
1773
+ "lstrip": false,
1774
+ "normalized": false,
1775
+ "rstrip": false,
1776
+ "single_word": false,
1777
+ "special": true
1778
+ },
1779
+ "77175": {
1780
+ "content": "<|reserved_special_token_214|>",
1781
+ "lstrip": false,
1782
+ "normalized": false,
1783
+ "rstrip": false,
1784
+ "single_word": false,
1785
+ "special": true
1786
+ },
1787
+ "77176": {
1788
+ "content": "<|reserved_special_token_215|>",
1789
+ "lstrip": false,
1790
+ "normalized": false,
1791
+ "rstrip": false,
1792
+ "single_word": false,
1793
+ "special": true
1794
+ },
1795
+ "77177": {
1796
+ "content": "<|reserved_special_token_216|>",
1797
+ "lstrip": false,
1798
+ "normalized": false,
1799
+ "rstrip": false,
1800
+ "single_word": false,
1801
+ "special": true
1802
+ },
1803
+ "77178": {
1804
+ "content": "<|reserved_special_token_217|>",
1805
+ "lstrip": false,
1806
+ "normalized": false,
1807
+ "rstrip": false,
1808
+ "single_word": false,
1809
+ "special": true
1810
+ },
1811
+ "77179": {
1812
+ "content": "<|reserved_special_token_218|>",
1813
+ "lstrip": false,
1814
+ "normalized": false,
1815
+ "rstrip": false,
1816
+ "single_word": false,
1817
+ "special": true
1818
+ },
1819
+ "77180": {
1820
+ "content": "<|reserved_special_token_219|>",
1821
+ "lstrip": false,
1822
+ "normalized": false,
1823
+ "rstrip": false,
1824
+ "single_word": false,
1825
+ "special": true
1826
+ },
1827
+ "77181": {
1828
+ "content": "<|reserved_special_token_220|>",
1829
+ "lstrip": false,
1830
+ "normalized": false,
1831
+ "rstrip": false,
1832
+ "single_word": false,
1833
+ "special": true
1834
+ },
1835
+ "77182": {
1836
+ "content": "<|reserved_special_token_221|>",
1837
+ "lstrip": false,
1838
+ "normalized": false,
1839
+ "rstrip": false,
1840
+ "single_word": false,
1841
+ "special": true
1842
+ },
1843
+ "77183": {
1844
+ "content": "<|reserved_special_token_222|>",
1845
+ "lstrip": false,
1846
+ "normalized": false,
1847
+ "rstrip": false,
1848
+ "single_word": false,
1849
+ "special": true
1850
+ },
1851
+ "77184": {
1852
+ "content": "<|reserved_special_token_223|>",
1853
+ "lstrip": false,
1854
+ "normalized": false,
1855
+ "rstrip": false,
1856
+ "single_word": false,
1857
+ "special": true
1858
+ },
1859
+ "77185": {
1860
+ "content": "<|reserved_special_token_224|>",
1861
+ "lstrip": false,
1862
+ "normalized": false,
1863
+ "rstrip": false,
1864
+ "single_word": false,
1865
+ "special": true
1866
+ },
1867
+ "77186": {
1868
+ "content": "<|reserved_special_token_225|>",
1869
+ "lstrip": false,
1870
+ "normalized": false,
1871
+ "rstrip": false,
1872
+ "single_word": false,
1873
+ "special": true
1874
+ },
1875
+ "77187": {
1876
+ "content": "<|reserved_special_token_226|>",
1877
+ "lstrip": false,
1878
+ "normalized": false,
1879
+ "rstrip": false,
1880
+ "single_word": false,
1881
+ "special": true
1882
+ },
1883
+ "77188": {
1884
+ "content": "<|reserved_special_token_227|>",
1885
+ "lstrip": false,
1886
+ "normalized": false,
1887
+ "rstrip": false,
1888
+ "single_word": false,
1889
+ "special": true
1890
+ },
1891
+ "77189": {
1892
+ "content": "<|reserved_special_token_228|>",
1893
+ "lstrip": false,
1894
+ "normalized": false,
1895
+ "rstrip": false,
1896
+ "single_word": false,
1897
+ "special": true
1898
+ },
1899
+ "77190": {
1900
+ "content": "<|reserved_special_token_229|>",
1901
+ "lstrip": false,
1902
+ "normalized": false,
1903
+ "rstrip": false,
1904
+ "single_word": false,
1905
+ "special": true
1906
+ },
1907
+ "77191": {
1908
+ "content": "<|reserved_special_token_230|>",
1909
+ "lstrip": false,
1910
+ "normalized": false,
1911
+ "rstrip": false,
1912
+ "single_word": false,
1913
+ "special": true
1914
+ },
1915
+ "77192": {
1916
+ "content": "<|reserved_special_token_231|>",
1917
+ "lstrip": false,
1918
+ "normalized": false,
1919
+ "rstrip": false,
1920
+ "single_word": false,
1921
+ "special": true
1922
+ },
1923
+ "77193": {
1924
+ "content": "<|reserved_special_token_232|>",
1925
+ "lstrip": false,
1926
+ "normalized": false,
1927
+ "rstrip": false,
1928
+ "single_word": false,
1929
+ "special": true
1930
+ },
1931
+ "77194": {
1932
+ "content": "<|reserved_special_token_233|>",
1933
+ "lstrip": false,
1934
+ "normalized": false,
1935
+ "rstrip": false,
1936
+ "single_word": false,
1937
+ "special": true
1938
+ },
1939
+ "77195": {
1940
+ "content": "<|reserved_special_token_234|>",
1941
+ "lstrip": false,
1942
+ "normalized": false,
1943
+ "rstrip": false,
1944
+ "single_word": false,
1945
+ "special": true
1946
+ },
1947
+ "77196": {
1948
+ "content": "<|reserved_special_token_235|>",
1949
+ "lstrip": false,
1950
+ "normalized": false,
1951
+ "rstrip": false,
1952
+ "single_word": false,
1953
+ "special": true
1954
+ },
1955
+ "77197": {
1956
+ "content": "<|reserved_special_token_236|>",
1957
+ "lstrip": false,
1958
+ "normalized": false,
1959
+ "rstrip": false,
1960
+ "single_word": false,
1961
+ "special": true
1962
+ },
1963
+ "77198": {
1964
+ "content": "<|reserved_special_token_237|>",
1965
+ "lstrip": false,
1966
+ "normalized": false,
1967
+ "rstrip": false,
1968
+ "single_word": false,
1969
+ "special": true
1970
+ },
1971
+ "77199": {
1972
+ "content": "<|reserved_special_token_238|>",
1973
+ "lstrip": false,
1974
+ "normalized": false,
1975
+ "rstrip": false,
1976
+ "single_word": false,
1977
+ "special": true
1978
+ },
1979
+ "77200": {
1980
+ "content": "<|reserved_special_token_239|>",
1981
+ "lstrip": false,
1982
+ "normalized": false,
1983
+ "rstrip": false,
1984
+ "single_word": false,
1985
+ "special": true
1986
+ },
1987
+ "77201": {
1988
+ "content": "<|reserved_special_token_240|>",
1989
+ "lstrip": false,
1990
+ "normalized": false,
1991
+ "rstrip": false,
1992
+ "single_word": false,
1993
+ "special": true
1994
+ },
1995
+ "77202": {
1996
+ "content": "<|reserved_special_token_241|>",
1997
+ "lstrip": false,
1998
+ "normalized": false,
1999
+ "rstrip": false,
2000
+ "single_word": false,
2001
+ "special": true
2002
+ },
2003
+ "77203": {
2004
+ "content": "<|reserved_special_token_242|>",
2005
+ "lstrip": false,
2006
+ "normalized": false,
2007
+ "rstrip": false,
2008
+ "single_word": false,
2009
+ "special": true
2010
+ },
2011
+ "77204": {
2012
+ "content": "<|reserved_special_token_243|>",
2013
+ "lstrip": false,
2014
+ "normalized": false,
2015
+ "rstrip": false,
2016
+ "single_word": false,
2017
+ "special": true
2018
+ },
2019
+ "77205": {
2020
+ "content": "<|reserved_special_token_244|>",
2021
+ "lstrip": false,
2022
+ "normalized": false,
2023
+ "rstrip": false,
2024
+ "single_word": false,
2025
+ "special": true
2026
+ },
2027
+ "77206": {
2028
+ "content": "<|reserved_special_token_245|>",
2029
+ "lstrip": false,
2030
+ "normalized": false,
2031
+ "rstrip": false,
2032
+ "single_word": false,
2033
+ "special": true
2034
+ },
2035
+ "77207": {
2036
+ "content": "<|reserved_special_token_246|>",
2037
+ "lstrip": false,
2038
+ "normalized": false,
2039
+ "rstrip": false,
2040
+ "single_word": false,
2041
+ "special": true
2042
+ },
2043
+ "77208": {
2044
+ "content": "<|reserved_special_token_247|>",
2045
+ "lstrip": false,
2046
+ "normalized": false,
2047
+ "rstrip": false,
2048
+ "single_word": false,
2049
+ "special": true
2050
+ }
2051
+ },
2052
+ "bos_token": "<|begin_of_text|>",
2053
+ "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' }}",
2054
+ "clean_up_tokenization_spaces": true,
2055
+ "eos_token": "<|eot_id|>",
2056
+ "model_input_names": [
2057
+ "input_ids",
2058
+ "attention_mask"
2059
+ ],
2060
+ "model_max_length": 131072,
2061
+ "pad_token": "<|finetune_right_pad_id|>",
2062
+ "tokenizer_class": "PreTrainedTokenizerFast"
2063
+ }