hrezaei commited on
Commit
4701b4e
·
verified ·
1 Parent(s): a59f1f4

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model.checkpoint filter=lfs diff=lfs merge=lfs -text
37
+ optimizer.checkpoint filter=lfs diff=lfs merge=lfs -text
config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "T5LaAdapterForConditionalGeneration"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "t5la_adapter.T5LaAdapterConfig",
7
+ "AutoModel": "t5la_adapter.T5LaAdapterForConditionalGeneration",
8
+ "AutoModelForSeq2SeqLM": "t5la_adapter.T5LaAdapterForConditionalGeneration",
9
+ "AutoTokenizer": [
10
+ "transformers.T5TokenizerFast",
11
+ "transformers.T5Tokenizer"
12
+ ]
13
+ },
14
+ "classifier_dropout": 0.0,
15
+ "d_ff": 2816,
16
+ "d_kv": 64,
17
+ "d_model": 1024,
18
+ "decoder_start_token_id": 0,
19
+ "dense_act_fn": "gelu_new",
20
+ "dropout_rate": 0.1,
21
+ "dtype": "float32",
22
+ "eos_token_id": 1,
23
+ "feed_forward_proj": "gated-gelu",
24
+ "freeze_base": false,
25
+ "initializer_factor": 1.0,
26
+ "is_encoder_decoder": true,
27
+ "is_gated_act": true,
28
+ "layer_norm_epsilon": 1e-06,
29
+ "lookahead_size": 1,
30
+ "lookahead_type": "la",
31
+ "model_type": "t5la_adapter",
32
+ "n_positions": 512,
33
+ "num_decoder_layers": 24,
34
+ "num_heads": 16,
35
+ "num_layers": 24,
36
+ "output_past": true,
37
+ "pad_token_id": 0,
38
+ "relative_attention_max_distance": 128,
39
+ "relative_attention_num_buckets": 32,
40
+ "tie_word_embeddings": false,
41
+ "transformers_version": "4.57.1",
42
+ "use_cache": true,
43
+ "vocab_size": 32128
44
+ }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "decoder_start_token_id": 0,
4
+ "eos_token_id": [
5
+ 1
6
+ ],
7
+ "pad_token_id": 0,
8
+ "transformers_version": "4.57.1"
9
+ }
model.checkpoint ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb47bdb518f8581cd8c4ff83e7f72bef2db7c6b402740abf6ec58da747558e4c
3
+ size 3272850975
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfa7d178719f9de1110174076bd2e9cd7f84fc9b5f172fe8981c440fcbfa9f9d
3
+ size 3264265200
optimizer.checkpoint ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16de7f63a83e5da21e6a7452790271076a309841ae59072cae6cda4b8600b710
3
+ size 6545679226
special_tokens_map.json ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<extra_id_0>",
4
+ "<extra_id_1>",
5
+ "<extra_id_2>",
6
+ "<extra_id_3>",
7
+ "<extra_id_4>",
8
+ "<extra_id_5>",
9
+ "<extra_id_6>",
10
+ "<extra_id_7>",
11
+ "<extra_id_8>",
12
+ "<extra_id_9>",
13
+ "<extra_id_10>",
14
+ "<extra_id_11>",
15
+ "<extra_id_12>",
16
+ "<extra_id_13>",
17
+ "<extra_id_14>",
18
+ "<extra_id_15>",
19
+ "<extra_id_16>",
20
+ "<extra_id_17>",
21
+ "<extra_id_18>",
22
+ "<extra_id_19>",
23
+ "<extra_id_20>",
24
+ "<extra_id_21>",
25
+ "<extra_id_22>",
26
+ "<extra_id_23>",
27
+ "<extra_id_24>",
28
+ "<extra_id_25>",
29
+ "<extra_id_26>",
30
+ "<extra_id_27>",
31
+ "<extra_id_28>",
32
+ "<extra_id_29>",
33
+ "<extra_id_30>",
34
+ "<extra_id_31>",
35
+ "<extra_id_32>",
36
+ "<extra_id_33>",
37
+ "<extra_id_34>",
38
+ "<extra_id_35>",
39
+ "<extra_id_36>",
40
+ "<extra_id_37>",
41
+ "<extra_id_38>",
42
+ "<extra_id_39>",
43
+ "<extra_id_40>",
44
+ "<extra_id_41>",
45
+ "<extra_id_42>",
46
+ "<extra_id_43>",
47
+ "<extra_id_44>",
48
+ "<extra_id_45>",
49
+ "<extra_id_46>",
50
+ "<extra_id_47>",
51
+ "<extra_id_48>",
52
+ "<extra_id_49>",
53
+ "<extra_id_50>",
54
+ "<extra_id_51>",
55
+ "<extra_id_52>",
56
+ "<extra_id_53>",
57
+ "<extra_id_54>",
58
+ "<extra_id_55>",
59
+ "<extra_id_56>",
60
+ "<extra_id_57>",
61
+ "<extra_id_58>",
62
+ "<extra_id_59>",
63
+ "<extra_id_60>",
64
+ "<extra_id_61>",
65
+ "<extra_id_62>",
66
+ "<extra_id_63>",
67
+ "<extra_id_64>",
68
+ "<extra_id_65>",
69
+ "<extra_id_66>",
70
+ "<extra_id_67>",
71
+ "<extra_id_68>",
72
+ "<extra_id_69>",
73
+ "<extra_id_70>",
74
+ "<extra_id_71>",
75
+ "<extra_id_72>",
76
+ "<extra_id_73>",
77
+ "<extra_id_74>",
78
+ "<extra_id_75>",
79
+ "<extra_id_76>",
80
+ "<extra_id_77>",
81
+ "<extra_id_78>",
82
+ "<extra_id_79>",
83
+ "<extra_id_80>",
84
+ "<extra_id_81>",
85
+ "<extra_id_82>",
86
+ "<extra_id_83>",
87
+ "<extra_id_84>",
88
+ "<extra_id_85>",
89
+ "<extra_id_86>",
90
+ "<extra_id_87>",
91
+ "<extra_id_88>",
92
+ "<extra_id_89>",
93
+ "<extra_id_90>",
94
+ "<extra_id_91>",
95
+ "<extra_id_92>",
96
+ "<extra_id_93>",
97
+ "<extra_id_94>",
98
+ "<extra_id_95>",
99
+ "<extra_id_96>",
100
+ "<extra_id_97>",
101
+ "<extra_id_98>",
102
+ "<extra_id_99>"
103
+ ],
104
+ "eos_token": {
105
+ "content": "</s>",
106
+ "lstrip": false,
107
+ "normalized": false,
108
+ "rstrip": false,
109
+ "single_word": false
110
+ },
111
+ "pad_token": {
112
+ "content": "<pad>",
113
+ "lstrip": false,
114
+ "normalized": false,
115
+ "rstrip": false,
116
+ "single_word": false
117
+ },
118
+ "unk_token": {
119
+ "content": "<unk>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false
124
+ }
125
+ }
spiece.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d60acb128cf7b7f2536e8f38a5b18a05535c9e14c7a355904270e15b0945ea86
3
+ size 791656
t5la_adapter.py ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import warnings
2
+ from dataclasses import dataclass
3
+ from typing import Optional, Union
4
+
5
+ import torch
6
+ import torch.nn as nn
7
+ from torch.nn import CrossEntropyLoss
8
+ from transformers import T5ForConditionalGeneration, T5Config, Cache
9
+ from transformers.modeling_outputs import Seq2SeqLMOutput, BaseModelOutput
10
+
11
+
12
+ class T5LaAdapterConfig(T5Config):
13
+ model_type = "t5la_adapter"
14
+ keys_to_ignore_at_inference = ["past_key_values"]
15
+ attribute_map = {
16
+ "hidden_size": "d_model",
17
+ "num_attention_heads": "num_heads",
18
+ "num_hidden_layers": "num_layers",
19
+ "head_dim": "d_kv",
20
+ }
21
+ auto_map = {
22
+ "AutoConfig": "t5la_adapter.T5LaAdapterConfig",
23
+ "AutoModel": "t5la_adapter.T5LaAdapterForConditionalGeneration",
24
+ "AutoModelForSeq2SeqLM": "t5la_adapter.T5LaAdapterForConditionalGeneration",
25
+ "AutoTokenizer": [
26
+ "transformers.T5TokenizerFast",
27
+ "transformers.T5Tokenizer"
28
+ ]
29
+ }
30
+
31
+ def __init__(
32
+ self,
33
+ is_encoder_decoder=True,
34
+ pad_token_id=0,
35
+ eos_token_id=1,
36
+ lookahead_type="la",
37
+ lookahead_size=0,
38
+ freeze_base=True,
39
+ **kwargs,
40
+ ):
41
+ self.lookahead_type = lookahead_type
42
+ self.lookahead_size = lookahead_size
43
+ self.freeze_base = freeze_base
44
+ super().__init__(
45
+ pad_token_id=pad_token_id,
46
+ eos_token_id=eos_token_id,
47
+ is_encoder_decoder=is_encoder_decoder,
48
+ **kwargs,
49
+ )
50
+ self.auto_map = {
51
+ "AutoConfig": "t5la_adapter.T5LaAdapterConfig",
52
+ "AutoModel": "t5la_adapter.T5LaAdapterForConditionalGeneration",
53
+ "AutoModelForSeq2SeqLM": "t5la_adapter.T5LaAdapterForConditionalGeneration",
54
+ "AutoTokenizer": [
55
+ "transformers.T5TokenizerFast",
56
+ "transformers.T5Tokenizer"
57
+ ]
58
+ }
59
+
60
+ @dataclass
61
+ class Seq2SeqLMOutputLA(Seq2SeqLMOutput):
62
+ lookahead_logits: torch.FloatTensor = None
63
+ lookahead_loss: Optional[torch.FloatTensor] = None
64
+ base_loss: Optional[torch.FloatTensor] = None
65
+ decoder_last_hidden_state: Optional[tuple[torch.FloatTensor, ...]] = None
66
+
67
+
68
+ class LookAheadHeads(nn.Module):
69
+ def __init__(self, config: T5LaAdapterConfig, k: int) -> None:
70
+ super().__init__()
71
+ self.k = k
72
+ self.heads = nn.ModuleList(
73
+ [
74
+ # K heads for LA positions:
75
+ nn.Linear(config.d_model, config.vocab_size, bias=False)
76
+ for _ in range(self.k)
77
+ ]
78
+ )
79
+
80
+ def forward(self, x):
81
+ # ModuleList can act as an iterable, or be indexed using ints
82
+ # Apply each head to the shared features
83
+ logits = [head(x) for head in self.heads]
84
+
85
+ # Stack logits along a new dimension to create a tensor of shape [batch_size, num_heads, output_size]
86
+ if self.k > 0:
87
+ logits = torch.stack(logits, dim=1)
88
+ else:
89
+ logits = logits[0]
90
+ return logits
91
+
92
+
93
+ class T5LaAdapterForConditionalGeneration(T5ForConditionalGeneration):
94
+ config_class = T5LaAdapterConfig
95
+ def __init__(self, config: T5LaAdapterConfig):
96
+ super().__init__(config)
97
+ if config.lookahead_type == "la":
98
+ self.la_heads = LookAheadHeads(config, config.lookahead_size)
99
+ elif config.lookahead_type in ["laa", "laa2"]:
100
+ self.la_heads = LookAheadHeads(config, 1)
101
+
102
+ # Freeze all parameters except the new head
103
+ if config.freeze_base:
104
+ for param in self.parameters():
105
+ param.requires_grad = False
106
+ for param in self.la_heads.parameters():
107
+ param.requires_grad = True # unfreeze the extra head
108
+
109
+ def freeze_base(self):
110
+ # Freeze all parameters except the new head
111
+ for param in self.parameters():
112
+ param.requires_grad = False
113
+ for param in self.la_heads.parameters():
114
+ param.requires_grad = True # unfreeze the extra head
115
+
116
+ def forward(
117
+ self,
118
+ input_ids: Optional[torch.LongTensor] = None,
119
+ attention_mask: Optional[torch.FloatTensor] = None,
120
+ decoder_input_ids: Optional[torch.LongTensor] = None,
121
+ decoder_attention_mask: Optional[torch.BoolTensor] = None,
122
+ head_mask: Optional[torch.FloatTensor] = None,
123
+ decoder_head_mask: Optional[torch.FloatTensor] = None,
124
+ cross_attn_head_mask: Optional[torch.Tensor] = None,
125
+ encoder_outputs: Optional[tuple[tuple[torch.Tensor]]] = None,
126
+ past_key_values: Optional[Cache] = None,
127
+ inputs_embeds: Optional[torch.FloatTensor] = None,
128
+ decoder_inputs_embeds: Optional[torch.FloatTensor] = None,
129
+ labels: Optional[torch.LongTensor] = None,
130
+ use_cache: Optional[bool] = None,
131
+ output_attentions: Optional[bool] = None,
132
+ output_hidden_states: Optional[bool] = None,
133
+ return_dict: Optional[bool] = None,
134
+ cache_position: Optional[torch.LongTensor] = None,
135
+ lookahead_targets: Optional[torch.LongTensor] = None,
136
+ ) -> Union[tuple[torch.FloatTensor], Seq2SeqLMOutputLA]:
137
+ r"""
138
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
139
+ Indices of input sequence tokens in the vocabulary. T5LA is a model with relative position embeddings so you
140
+ should be able to pad the inputs on both the right and the left.
141
+
142
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
143
+ [`PreTrainedTokenizer.__call__`] for detail.
144
+
145
+ [What are input IDs?](../glossary#input-ids)
146
+
147
+ To know more on how to prepare `input_ids` for pretraining take a look a [T5LA Training](./t5la#training).
148
+ decoder_input_ids (`torch.LongTensor` of shape `(batch_size, target_sequence_length)`, *optional*):
149
+ Indices of decoder input sequence tokens in the vocabulary.
150
+
151
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
152
+ [`PreTrainedTokenizer.__call__`] for details.
153
+
154
+ [What are decoder input IDs?](../glossary#decoder-input-ids)
155
+
156
+ T5LA uses the `pad_token_id` as the starting token for `decoder_input_ids` generation. If `past_key_values`
157
+ is used, optionally only the last `decoder_input_ids` have to be input (see `past_key_values`).
158
+
159
+ To know more on how to prepare `decoder_input_ids` for pretraining take a look at [T5LA
160
+ Training](./t5la#training).
161
+ decoder_attention_mask (`torch.BoolTensor` of shape `(batch_size, target_sequence_length)`, *optional*):
162
+ Default behavior: generate a tensor that ignores pad tokens in `decoder_input_ids`. Causal mask will also
163
+ be used by default.
164
+ decoder_head_mask (`torch.FloatTensor` of shape `(num_heads,)` or `(num_layers, num_heads)`, *optional*):
165
+ Mask to nullify selected heads of the self-attention modules in the decoder. Mask values selected in `[0,
166
+ 1]`:
167
+
168
+ - 1 indicates the head is **not masked**,
169
+ - 0 indicates the head is **masked**.
170
+ cross_attn_head_mask (`torch.Tensor` of shape `(num_heads,)` or `(num_layers, num_heads)`, *optional*):
171
+ Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in
172
+ `[0, 1]`:
173
+
174
+ - 1 indicates the head is **not masked**,
175
+ - 0 indicates the head is **masked**.
176
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
177
+ Labels for computing the sequence classification/regression loss. Indices should be in `[-100, 0, ...,
178
+ config.vocab_size - 1]`. All labels set to `-100` are ignored (masked), the loss is only computed for
179
+ labels in `[0, ..., config.vocab_size]`
180
+ lookahead_targets (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
181
+ Labels for computing the loss of the LA heads or positions (models of type la, laa, and laa2 have
182
+ LA heads and lae has LA positions)
183
+
184
+ Examples:
185
+
186
+ ```python
187
+ >>> from transformers import AutoTokenizer
188
+
189
+ >>> tokenizer = AutoTokenizer.from_pretrained("google-t5/t5-small")
190
+ >>> config = T5LaAdapterConfig.from_pretrained("google-t5/t5-small", lookahead_size=2)
191
+ >>> model = T5LaAdapterForConditionalGeneration.from_pretrained("google-t5/t5-small", config=config)
192
+
193
+ >>> # training
194
+ >>> input_ids = tokenizer("The <extra_id_0> walks in <extra_id_1> park", return_tensors="pt").input_ids
195
+ >>> labels = tokenizer("<extra_id_0> cute dog <extra_id_1> the <extra_id_2>", return_tensors="pt").input_ids
196
+ >>> outputs = model(input_ids=input_ids, labels=labels)
197
+ >>> loss = outputs.loss
198
+ >>> logits = outputs.logits
199
+
200
+ >>> # inference
201
+ >>> input_ids = tokenizer(
202
+ ... "summarize: studies have shown that owning a dog is good for you", return_tensors="pt"
203
+ ... ).input_ids # Batch size 1
204
+ >>> outputs = model.generate(input_ids)
205
+ >>> print(tokenizer.decode(outputs[0], skip_special_tokens=True))
206
+ >>> # studies have shown that owning a dog is good for you.
207
+ ```"""
208
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
209
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
210
+
211
+ # FutureWarning: head_mask was separated into two input args - head_mask, decoder_head_mask
212
+ if head_mask is not None and decoder_head_mask is None:
213
+ if self.config.num_layers == self.config.num_decoder_layers:
214
+ warnings.warn(__HEAD_MASK_WARNING_MSG, FutureWarning)
215
+ decoder_head_mask = head_mask
216
+
217
+ # Encode if needed (training, first prediction pass)
218
+ if encoder_outputs is None:
219
+ # Convert encoder inputs in embeddings if needed
220
+ encoder_outputs = self.encoder(
221
+ input_ids=input_ids,
222
+ attention_mask=attention_mask,
223
+ inputs_embeds=inputs_embeds,
224
+ head_mask=head_mask,
225
+ output_attentions=output_attentions,
226
+ output_hidden_states=output_hidden_states,
227
+ return_dict=return_dict,
228
+ )
229
+ elif return_dict and not isinstance(encoder_outputs, BaseModelOutput):
230
+ encoder_outputs = BaseModelOutput(
231
+ last_hidden_state=encoder_outputs[0],
232
+ hidden_states=encoder_outputs[1] if len(encoder_outputs) > 1 else None,
233
+ attentions=encoder_outputs[2] if len(encoder_outputs) > 2 else None,
234
+ )
235
+
236
+ hidden_states = encoder_outputs[0]
237
+
238
+ if self.model_parallel:
239
+ torch.cuda.set_device(self.decoder.first_device)
240
+
241
+ if labels is not None and decoder_input_ids is None and decoder_inputs_embeds is None:
242
+ # get decoder inputs from shifting lm labels to the right
243
+ decoder_input_ids = self._shift_right(labels)
244
+
245
+ if self.config.lookahead_type == "lae":
246
+ # Extend decoder input with lookahead_size extra positions filled by zero as especial tokens:
247
+ zeros_to_add = torch.zeros(
248
+ decoder_input_ids.shape[0],
249
+ self.config.lookahead_size,
250
+ device=decoder_input_ids.device,
251
+ dtype=decoder_input_ids.dtype,
252
+ )
253
+ decoder_input_ids = torch.cat((decoder_input_ids, zeros_to_add), dim=1)
254
+ if decoder_attention_mask is not None:
255
+ ones_to_add = torch.ones(
256
+ decoder_attention_mask.shape[0],
257
+ self.config.lookahead_size,
258
+ device=decoder_attention_mask.device,
259
+ dtype=decoder_attention_mask.dtype,
260
+ )
261
+ decoder_attention_mask = torch.cat((decoder_attention_mask, ones_to_add), dim=1)
262
+ # Set device for model parallelism
263
+ if self.model_parallel:
264
+ torch.cuda.set_device(self.decoder.first_device)
265
+ hidden_states = hidden_states.to(self.decoder.first_device)
266
+ if decoder_input_ids is not None:
267
+ decoder_input_ids = decoder_input_ids.to(self.decoder.first_device)
268
+ if attention_mask is not None:
269
+ attention_mask = attention_mask.to(self.decoder.first_device)
270
+ if decoder_attention_mask is not None:
271
+ decoder_attention_mask = decoder_attention_mask.to(self.decoder.first_device)
272
+
273
+ # Decode
274
+ decoder_outputs = self.decoder(
275
+ input_ids=decoder_input_ids,
276
+ attention_mask=decoder_attention_mask,
277
+ inputs_embeds=decoder_inputs_embeds,
278
+ past_key_values=past_key_values,
279
+ encoder_hidden_states=hidden_states,
280
+ encoder_attention_mask=attention_mask,
281
+ head_mask=decoder_head_mask,
282
+ cross_attn_head_mask=cross_attn_head_mask,
283
+ use_cache=use_cache,
284
+ output_attentions=output_attentions,
285
+ output_hidden_states=output_hidden_states,
286
+ return_dict=return_dict,
287
+ cache_position=cache_position,
288
+ )
289
+
290
+ sequence_output = decoder_outputs[0]
291
+
292
+ # Set device for model parallelism
293
+ if self.model_parallel:
294
+ torch.cuda.set_device(self.encoder.first_device)
295
+ self.lm_head = self.lm_head.to(self.encoder.first_device)
296
+ sequence_output = sequence_output.to(self.lm_head.weight.device)
297
+
298
+ if self.config.tie_word_embeddings:
299
+ # Rescale output before projecting on vocab
300
+ # See https://github.com/tensorflow/mesh/blob/fa19d69eafc9a482aff0b59ddd96b025c0cb207d/mesh_tensorflow/transformer/transformer.py#L586
301
+ sequence_output = sequence_output * (self.model_dim**-0.5)
302
+
303
+ lm_logits = self.lm_head(sequence_output)
304
+
305
+ lookahead_logits = None
306
+ if self.config.lookahead_type == "la":
307
+ lookahead_logits = self.la_heads(sequence_output)
308
+ elif self.config.lookahead_type == "laa":
309
+ la_input = torch.repeat_interleave(hidden_states[:, [-1]], self.config.lookahead_size, dim=1)
310
+ lookahead_logits = self.la_heads(la_input)
311
+ elif self.config.lookahead_type == "laa2":
312
+ lookahead_logits = self.la_heads(hidden_states[:, -self.config.lookahead_size :])
313
+ elif self.config.lookahead_type == "lae":
314
+ lookahead_logits = lm_logits[:, -self.config.lookahead_size :].contiguous()
315
+ lm_logits = lm_logits[:, : -self.config.lookahead_size].contiguous()
316
+
317
+ lookahead_loss = None
318
+ loss = None
319
+ base_loss = None
320
+ if labels is not None:
321
+ loss_fct = CrossEntropyLoss(ignore_index=-100)
322
+ # move labels to correct device to enable PP
323
+ labels = labels.to(lm_logits.device)
324
+ loss = loss_fct(lm_logits.view(-1, lm_logits.size(-1)), labels.view(-1))
325
+ base_loss = loss.clone()
326
+ # TODO(thom): Add z_loss https://github.com/tensorflow/mesh/blob/fa19d69eafc9a482aff0b59ddd96b025c0cb207d/mesh_tensorflow/layers.py#L666
327
+ if self.config.lookahead_size > 0 and lookahead_targets is not None:
328
+ lookahead_loss = loss_fct(
329
+ lookahead_logits.reshape(-1, lookahead_logits.size(-1)),
330
+ lookahead_targets.view(-1),
331
+ # vocab_size=self.config.vocab_size,
332
+ )
333
+ if self.config.lookahead_type == "la":
334
+ # If we simply add, the loss will be larger than a non-LA T5 model because
335
+ # in a normal T5, the number of tokens is much lower:
336
+ loss = (loss + lookahead_loss) / (1 + self.config.lookahead_size)
337
+ else:
338
+ loss = (loss * lm_logits.shape[1] + lookahead_loss * self.config.lookahead_size) / (
339
+ lm_logits.shape[1] + self.config.lookahead_size
340
+ )
341
+
342
+ if not return_dict:
343
+ output = (lm_logits,) + decoder_outputs[1:] + encoder_outputs
344
+ return ((loss,) + output) if loss is not None else output
345
+
346
+ return Seq2SeqLMOutputLA(
347
+ loss=loss,
348
+ base_loss=base_loss,
349
+ logits=lm_logits,
350
+ past_key_values=decoder_outputs.past_key_values,
351
+ decoder_hidden_states=decoder_outputs.hidden_states,
352
+ decoder_last_hidden_state=decoder_outputs.last_hidden_state,
353
+ decoder_attentions=decoder_outputs.attentions,
354
+ cross_attentions=decoder_outputs.cross_attentions,
355
+ encoder_last_hidden_state=encoder_outputs.last_hidden_state,
356
+ encoder_hidden_states=encoder_outputs.hidden_states,
357
+ encoder_attentions=encoder_outputs.attentions,
358
+ lookahead_logits=lookahead_logits,
359
+ lookahead_loss=lookahead_loss,
360
+ )
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,941 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": null,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<pad>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "</s>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "<unk>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "32000": {
29
+ "content": "<extra_id_99>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "32001": {
37
+ "content": "<extra_id_98>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "32002": {
45
+ "content": "<extra_id_97>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "32003": {
53
+ "content": "<extra_id_96>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "32004": {
61
+ "content": "<extra_id_95>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "32005": {
69
+ "content": "<extra_id_94>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "32006": {
77
+ "content": "<extra_id_93>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "32007": {
85
+ "content": "<extra_id_92>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "32008": {
93
+ "content": "<extra_id_91>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "32009": {
101
+ "content": "<extra_id_90>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "32010": {
109
+ "content": "<extra_id_89>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "32011": {
117
+ "content": "<extra_id_88>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "32012": {
125
+ "content": "<extra_id_87>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "32013": {
133
+ "content": "<extra_id_86>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ },
140
+ "32014": {
141
+ "content": "<extra_id_85>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": true
147
+ },
148
+ "32015": {
149
+ "content": "<extra_id_84>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": true
155
+ },
156
+ "32016": {
157
+ "content": "<extra_id_83>",
158
+ "lstrip": false,
159
+ "normalized": false,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": true
163
+ },
164
+ "32017": {
165
+ "content": "<extra_id_82>",
166
+ "lstrip": false,
167
+ "normalized": false,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": true
171
+ },
172
+ "32018": {
173
+ "content": "<extra_id_81>",
174
+ "lstrip": false,
175
+ "normalized": false,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": true
179
+ },
180
+ "32019": {
181
+ "content": "<extra_id_80>",
182
+ "lstrip": false,
183
+ "normalized": false,
184
+ "rstrip": false,
185
+ "single_word": false,
186
+ "special": true
187
+ },
188
+ "32020": {
189
+ "content": "<extra_id_79>",
190
+ "lstrip": false,
191
+ "normalized": false,
192
+ "rstrip": false,
193
+ "single_word": false,
194
+ "special": true
195
+ },
196
+ "32021": {
197
+ "content": "<extra_id_78>",
198
+ "lstrip": false,
199
+ "normalized": false,
200
+ "rstrip": false,
201
+ "single_word": false,
202
+ "special": true
203
+ },
204
+ "32022": {
205
+ "content": "<extra_id_77>",
206
+ "lstrip": false,
207
+ "normalized": false,
208
+ "rstrip": false,
209
+ "single_word": false,
210
+ "special": true
211
+ },
212
+ "32023": {
213
+ "content": "<extra_id_76>",
214
+ "lstrip": false,
215
+ "normalized": false,
216
+ "rstrip": false,
217
+ "single_word": false,
218
+ "special": true
219
+ },
220
+ "32024": {
221
+ "content": "<extra_id_75>",
222
+ "lstrip": false,
223
+ "normalized": false,
224
+ "rstrip": false,
225
+ "single_word": false,
226
+ "special": true
227
+ },
228
+ "32025": {
229
+ "content": "<extra_id_74>",
230
+ "lstrip": false,
231
+ "normalized": false,
232
+ "rstrip": false,
233
+ "single_word": false,
234
+ "special": true
235
+ },
236
+ "32026": {
237
+ "content": "<extra_id_73>",
238
+ "lstrip": false,
239
+ "normalized": false,
240
+ "rstrip": false,
241
+ "single_word": false,
242
+ "special": true
243
+ },
244
+ "32027": {
245
+ "content": "<extra_id_72>",
246
+ "lstrip": false,
247
+ "normalized": false,
248
+ "rstrip": false,
249
+ "single_word": false,
250
+ "special": true
251
+ },
252
+ "32028": {
253
+ "content": "<extra_id_71>",
254
+ "lstrip": false,
255
+ "normalized": false,
256
+ "rstrip": false,
257
+ "single_word": false,
258
+ "special": true
259
+ },
260
+ "32029": {
261
+ "content": "<extra_id_70>",
262
+ "lstrip": false,
263
+ "normalized": false,
264
+ "rstrip": false,
265
+ "single_word": false,
266
+ "special": true
267
+ },
268
+ "32030": {
269
+ "content": "<extra_id_69>",
270
+ "lstrip": false,
271
+ "normalized": false,
272
+ "rstrip": false,
273
+ "single_word": false,
274
+ "special": true
275
+ },
276
+ "32031": {
277
+ "content": "<extra_id_68>",
278
+ "lstrip": false,
279
+ "normalized": false,
280
+ "rstrip": false,
281
+ "single_word": false,
282
+ "special": true
283
+ },
284
+ "32032": {
285
+ "content": "<extra_id_67>",
286
+ "lstrip": false,
287
+ "normalized": false,
288
+ "rstrip": false,
289
+ "single_word": false,
290
+ "special": true
291
+ },
292
+ "32033": {
293
+ "content": "<extra_id_66>",
294
+ "lstrip": false,
295
+ "normalized": false,
296
+ "rstrip": false,
297
+ "single_word": false,
298
+ "special": true
299
+ },
300
+ "32034": {
301
+ "content": "<extra_id_65>",
302
+ "lstrip": false,
303
+ "normalized": false,
304
+ "rstrip": false,
305
+ "single_word": false,
306
+ "special": true
307
+ },
308
+ "32035": {
309
+ "content": "<extra_id_64>",
310
+ "lstrip": false,
311
+ "normalized": false,
312
+ "rstrip": false,
313
+ "single_word": false,
314
+ "special": true
315
+ },
316
+ "32036": {
317
+ "content": "<extra_id_63>",
318
+ "lstrip": false,
319
+ "normalized": false,
320
+ "rstrip": false,
321
+ "single_word": false,
322
+ "special": true
323
+ },
324
+ "32037": {
325
+ "content": "<extra_id_62>",
326
+ "lstrip": false,
327
+ "normalized": false,
328
+ "rstrip": false,
329
+ "single_word": false,
330
+ "special": true
331
+ },
332
+ "32038": {
333
+ "content": "<extra_id_61>",
334
+ "lstrip": false,
335
+ "normalized": false,
336
+ "rstrip": false,
337
+ "single_word": false,
338
+ "special": true
339
+ },
340
+ "32039": {
341
+ "content": "<extra_id_60>",
342
+ "lstrip": false,
343
+ "normalized": false,
344
+ "rstrip": false,
345
+ "single_word": false,
346
+ "special": true
347
+ },
348
+ "32040": {
349
+ "content": "<extra_id_59>",
350
+ "lstrip": false,
351
+ "normalized": false,
352
+ "rstrip": false,
353
+ "single_word": false,
354
+ "special": true
355
+ },
356
+ "32041": {
357
+ "content": "<extra_id_58>",
358
+ "lstrip": false,
359
+ "normalized": false,
360
+ "rstrip": false,
361
+ "single_word": false,
362
+ "special": true
363
+ },
364
+ "32042": {
365
+ "content": "<extra_id_57>",
366
+ "lstrip": false,
367
+ "normalized": false,
368
+ "rstrip": false,
369
+ "single_word": false,
370
+ "special": true
371
+ },
372
+ "32043": {
373
+ "content": "<extra_id_56>",
374
+ "lstrip": false,
375
+ "normalized": false,
376
+ "rstrip": false,
377
+ "single_word": false,
378
+ "special": true
379
+ },
380
+ "32044": {
381
+ "content": "<extra_id_55>",
382
+ "lstrip": false,
383
+ "normalized": false,
384
+ "rstrip": false,
385
+ "single_word": false,
386
+ "special": true
387
+ },
388
+ "32045": {
389
+ "content": "<extra_id_54>",
390
+ "lstrip": false,
391
+ "normalized": false,
392
+ "rstrip": false,
393
+ "single_word": false,
394
+ "special": true
395
+ },
396
+ "32046": {
397
+ "content": "<extra_id_53>",
398
+ "lstrip": false,
399
+ "normalized": false,
400
+ "rstrip": false,
401
+ "single_word": false,
402
+ "special": true
403
+ },
404
+ "32047": {
405
+ "content": "<extra_id_52>",
406
+ "lstrip": false,
407
+ "normalized": false,
408
+ "rstrip": false,
409
+ "single_word": false,
410
+ "special": true
411
+ },
412
+ "32048": {
413
+ "content": "<extra_id_51>",
414
+ "lstrip": false,
415
+ "normalized": false,
416
+ "rstrip": false,
417
+ "single_word": false,
418
+ "special": true
419
+ },
420
+ "32049": {
421
+ "content": "<extra_id_50>",
422
+ "lstrip": false,
423
+ "normalized": false,
424
+ "rstrip": false,
425
+ "single_word": false,
426
+ "special": true
427
+ },
428
+ "32050": {
429
+ "content": "<extra_id_49>",
430
+ "lstrip": false,
431
+ "normalized": false,
432
+ "rstrip": false,
433
+ "single_word": false,
434
+ "special": true
435
+ },
436
+ "32051": {
437
+ "content": "<extra_id_48>",
438
+ "lstrip": false,
439
+ "normalized": false,
440
+ "rstrip": false,
441
+ "single_word": false,
442
+ "special": true
443
+ },
444
+ "32052": {
445
+ "content": "<extra_id_47>",
446
+ "lstrip": false,
447
+ "normalized": false,
448
+ "rstrip": false,
449
+ "single_word": false,
450
+ "special": true
451
+ },
452
+ "32053": {
453
+ "content": "<extra_id_46>",
454
+ "lstrip": false,
455
+ "normalized": false,
456
+ "rstrip": false,
457
+ "single_word": false,
458
+ "special": true
459
+ },
460
+ "32054": {
461
+ "content": "<extra_id_45>",
462
+ "lstrip": false,
463
+ "normalized": false,
464
+ "rstrip": false,
465
+ "single_word": false,
466
+ "special": true
467
+ },
468
+ "32055": {
469
+ "content": "<extra_id_44>",
470
+ "lstrip": false,
471
+ "normalized": false,
472
+ "rstrip": false,
473
+ "single_word": false,
474
+ "special": true
475
+ },
476
+ "32056": {
477
+ "content": "<extra_id_43>",
478
+ "lstrip": false,
479
+ "normalized": false,
480
+ "rstrip": false,
481
+ "single_word": false,
482
+ "special": true
483
+ },
484
+ "32057": {
485
+ "content": "<extra_id_42>",
486
+ "lstrip": false,
487
+ "normalized": false,
488
+ "rstrip": false,
489
+ "single_word": false,
490
+ "special": true
491
+ },
492
+ "32058": {
493
+ "content": "<extra_id_41>",
494
+ "lstrip": false,
495
+ "normalized": false,
496
+ "rstrip": false,
497
+ "single_word": false,
498
+ "special": true
499
+ },
500
+ "32059": {
501
+ "content": "<extra_id_40>",
502
+ "lstrip": false,
503
+ "normalized": false,
504
+ "rstrip": false,
505
+ "single_word": false,
506
+ "special": true
507
+ },
508
+ "32060": {
509
+ "content": "<extra_id_39>",
510
+ "lstrip": false,
511
+ "normalized": false,
512
+ "rstrip": false,
513
+ "single_word": false,
514
+ "special": true
515
+ },
516
+ "32061": {
517
+ "content": "<extra_id_38>",
518
+ "lstrip": false,
519
+ "normalized": false,
520
+ "rstrip": false,
521
+ "single_word": false,
522
+ "special": true
523
+ },
524
+ "32062": {
525
+ "content": "<extra_id_37>",
526
+ "lstrip": false,
527
+ "normalized": false,
528
+ "rstrip": false,
529
+ "single_word": false,
530
+ "special": true
531
+ },
532
+ "32063": {
533
+ "content": "<extra_id_36>",
534
+ "lstrip": false,
535
+ "normalized": false,
536
+ "rstrip": false,
537
+ "single_word": false,
538
+ "special": true
539
+ },
540
+ "32064": {
541
+ "content": "<extra_id_35>",
542
+ "lstrip": false,
543
+ "normalized": false,
544
+ "rstrip": false,
545
+ "single_word": false,
546
+ "special": true
547
+ },
548
+ "32065": {
549
+ "content": "<extra_id_34>",
550
+ "lstrip": false,
551
+ "normalized": false,
552
+ "rstrip": false,
553
+ "single_word": false,
554
+ "special": true
555
+ },
556
+ "32066": {
557
+ "content": "<extra_id_33>",
558
+ "lstrip": false,
559
+ "normalized": false,
560
+ "rstrip": false,
561
+ "single_word": false,
562
+ "special": true
563
+ },
564
+ "32067": {
565
+ "content": "<extra_id_32>",
566
+ "lstrip": false,
567
+ "normalized": false,
568
+ "rstrip": false,
569
+ "single_word": false,
570
+ "special": true
571
+ },
572
+ "32068": {
573
+ "content": "<extra_id_31>",
574
+ "lstrip": false,
575
+ "normalized": false,
576
+ "rstrip": false,
577
+ "single_word": false,
578
+ "special": true
579
+ },
580
+ "32069": {
581
+ "content": "<extra_id_30>",
582
+ "lstrip": false,
583
+ "normalized": false,
584
+ "rstrip": false,
585
+ "single_word": false,
586
+ "special": true
587
+ },
588
+ "32070": {
589
+ "content": "<extra_id_29>",
590
+ "lstrip": false,
591
+ "normalized": false,
592
+ "rstrip": false,
593
+ "single_word": false,
594
+ "special": true
595
+ },
596
+ "32071": {
597
+ "content": "<extra_id_28>",
598
+ "lstrip": false,
599
+ "normalized": false,
600
+ "rstrip": false,
601
+ "single_word": false,
602
+ "special": true
603
+ },
604
+ "32072": {
605
+ "content": "<extra_id_27>",
606
+ "lstrip": false,
607
+ "normalized": false,
608
+ "rstrip": false,
609
+ "single_word": false,
610
+ "special": true
611
+ },
612
+ "32073": {
613
+ "content": "<extra_id_26>",
614
+ "lstrip": false,
615
+ "normalized": false,
616
+ "rstrip": false,
617
+ "single_word": false,
618
+ "special": true
619
+ },
620
+ "32074": {
621
+ "content": "<extra_id_25>",
622
+ "lstrip": false,
623
+ "normalized": false,
624
+ "rstrip": false,
625
+ "single_word": false,
626
+ "special": true
627
+ },
628
+ "32075": {
629
+ "content": "<extra_id_24>",
630
+ "lstrip": false,
631
+ "normalized": false,
632
+ "rstrip": false,
633
+ "single_word": false,
634
+ "special": true
635
+ },
636
+ "32076": {
637
+ "content": "<extra_id_23>",
638
+ "lstrip": false,
639
+ "normalized": false,
640
+ "rstrip": false,
641
+ "single_word": false,
642
+ "special": true
643
+ },
644
+ "32077": {
645
+ "content": "<extra_id_22>",
646
+ "lstrip": false,
647
+ "normalized": false,
648
+ "rstrip": false,
649
+ "single_word": false,
650
+ "special": true
651
+ },
652
+ "32078": {
653
+ "content": "<extra_id_21>",
654
+ "lstrip": false,
655
+ "normalized": false,
656
+ "rstrip": false,
657
+ "single_word": false,
658
+ "special": true
659
+ },
660
+ "32079": {
661
+ "content": "<extra_id_20>",
662
+ "lstrip": false,
663
+ "normalized": false,
664
+ "rstrip": false,
665
+ "single_word": false,
666
+ "special": true
667
+ },
668
+ "32080": {
669
+ "content": "<extra_id_19>",
670
+ "lstrip": false,
671
+ "normalized": false,
672
+ "rstrip": false,
673
+ "single_word": false,
674
+ "special": true
675
+ },
676
+ "32081": {
677
+ "content": "<extra_id_18>",
678
+ "lstrip": false,
679
+ "normalized": false,
680
+ "rstrip": false,
681
+ "single_word": false,
682
+ "special": true
683
+ },
684
+ "32082": {
685
+ "content": "<extra_id_17>",
686
+ "lstrip": false,
687
+ "normalized": false,
688
+ "rstrip": false,
689
+ "single_word": false,
690
+ "special": true
691
+ },
692
+ "32083": {
693
+ "content": "<extra_id_16>",
694
+ "lstrip": false,
695
+ "normalized": false,
696
+ "rstrip": false,
697
+ "single_word": false,
698
+ "special": true
699
+ },
700
+ "32084": {
701
+ "content": "<extra_id_15>",
702
+ "lstrip": false,
703
+ "normalized": false,
704
+ "rstrip": false,
705
+ "single_word": false,
706
+ "special": true
707
+ },
708
+ "32085": {
709
+ "content": "<extra_id_14>",
710
+ "lstrip": false,
711
+ "normalized": false,
712
+ "rstrip": false,
713
+ "single_word": false,
714
+ "special": true
715
+ },
716
+ "32086": {
717
+ "content": "<extra_id_13>",
718
+ "lstrip": false,
719
+ "normalized": false,
720
+ "rstrip": false,
721
+ "single_word": false,
722
+ "special": true
723
+ },
724
+ "32087": {
725
+ "content": "<extra_id_12>",
726
+ "lstrip": false,
727
+ "normalized": false,
728
+ "rstrip": false,
729
+ "single_word": false,
730
+ "special": true
731
+ },
732
+ "32088": {
733
+ "content": "<extra_id_11>",
734
+ "lstrip": false,
735
+ "normalized": false,
736
+ "rstrip": false,
737
+ "single_word": false,
738
+ "special": true
739
+ },
740
+ "32089": {
741
+ "content": "<extra_id_10>",
742
+ "lstrip": false,
743
+ "normalized": false,
744
+ "rstrip": false,
745
+ "single_word": false,
746
+ "special": true
747
+ },
748
+ "32090": {
749
+ "content": "<extra_id_9>",
750
+ "lstrip": false,
751
+ "normalized": false,
752
+ "rstrip": false,
753
+ "single_word": false,
754
+ "special": true
755
+ },
756
+ "32091": {
757
+ "content": "<extra_id_8>",
758
+ "lstrip": false,
759
+ "normalized": false,
760
+ "rstrip": false,
761
+ "single_word": false,
762
+ "special": true
763
+ },
764
+ "32092": {
765
+ "content": "<extra_id_7>",
766
+ "lstrip": false,
767
+ "normalized": false,
768
+ "rstrip": false,
769
+ "single_word": false,
770
+ "special": true
771
+ },
772
+ "32093": {
773
+ "content": "<extra_id_6>",
774
+ "lstrip": false,
775
+ "normalized": false,
776
+ "rstrip": false,
777
+ "single_word": false,
778
+ "special": true
779
+ },
780
+ "32094": {
781
+ "content": "<extra_id_5>",
782
+ "lstrip": false,
783
+ "normalized": false,
784
+ "rstrip": false,
785
+ "single_word": false,
786
+ "special": true
787
+ },
788
+ "32095": {
789
+ "content": "<extra_id_4>",
790
+ "lstrip": false,
791
+ "normalized": false,
792
+ "rstrip": false,
793
+ "single_word": false,
794
+ "special": true
795
+ },
796
+ "32096": {
797
+ "content": "<extra_id_3>",
798
+ "lstrip": false,
799
+ "normalized": false,
800
+ "rstrip": false,
801
+ "single_word": false,
802
+ "special": true
803
+ },
804
+ "32097": {
805
+ "content": "<extra_id_2>",
806
+ "lstrip": false,
807
+ "normalized": false,
808
+ "rstrip": false,
809
+ "single_word": false,
810
+ "special": true
811
+ },
812
+ "32098": {
813
+ "content": "<extra_id_1>",
814
+ "lstrip": false,
815
+ "normalized": false,
816
+ "rstrip": false,
817
+ "single_word": false,
818
+ "special": true
819
+ },
820
+ "32099": {
821
+ "content": "<extra_id_0>",
822
+ "lstrip": false,
823
+ "normalized": false,
824
+ "rstrip": false,
825
+ "single_word": false,
826
+ "special": true
827
+ }
828
+ },
829
+ "additional_special_tokens": [
830
+ "<extra_id_0>",
831
+ "<extra_id_1>",
832
+ "<extra_id_2>",
833
+ "<extra_id_3>",
834
+ "<extra_id_4>",
835
+ "<extra_id_5>",
836
+ "<extra_id_6>",
837
+ "<extra_id_7>",
838
+ "<extra_id_8>",
839
+ "<extra_id_9>",
840
+ "<extra_id_10>",
841
+ "<extra_id_11>",
842
+ "<extra_id_12>",
843
+ "<extra_id_13>",
844
+ "<extra_id_14>",
845
+ "<extra_id_15>",
846
+ "<extra_id_16>",
847
+ "<extra_id_17>",
848
+ "<extra_id_18>",
849
+ "<extra_id_19>",
850
+ "<extra_id_20>",
851
+ "<extra_id_21>",
852
+ "<extra_id_22>",
853
+ "<extra_id_23>",
854
+ "<extra_id_24>",
855
+ "<extra_id_25>",
856
+ "<extra_id_26>",
857
+ "<extra_id_27>",
858
+ "<extra_id_28>",
859
+ "<extra_id_29>",
860
+ "<extra_id_30>",
861
+ "<extra_id_31>",
862
+ "<extra_id_32>",
863
+ "<extra_id_33>",
864
+ "<extra_id_34>",
865
+ "<extra_id_35>",
866
+ "<extra_id_36>",
867
+ "<extra_id_37>",
868
+ "<extra_id_38>",
869
+ "<extra_id_39>",
870
+ "<extra_id_40>",
871
+ "<extra_id_41>",
872
+ "<extra_id_42>",
873
+ "<extra_id_43>",
874
+ "<extra_id_44>",
875
+ "<extra_id_45>",
876
+ "<extra_id_46>",
877
+ "<extra_id_47>",
878
+ "<extra_id_48>",
879
+ "<extra_id_49>",
880
+ "<extra_id_50>",
881
+ "<extra_id_51>",
882
+ "<extra_id_52>",
883
+ "<extra_id_53>",
884
+ "<extra_id_54>",
885
+ "<extra_id_55>",
886
+ "<extra_id_56>",
887
+ "<extra_id_57>",
888
+ "<extra_id_58>",
889
+ "<extra_id_59>",
890
+ "<extra_id_60>",
891
+ "<extra_id_61>",
892
+ "<extra_id_62>",
893
+ "<extra_id_63>",
894
+ "<extra_id_64>",
895
+ "<extra_id_65>",
896
+ "<extra_id_66>",
897
+ "<extra_id_67>",
898
+ "<extra_id_68>",
899
+ "<extra_id_69>",
900
+ "<extra_id_70>",
901
+ "<extra_id_71>",
902
+ "<extra_id_72>",
903
+ "<extra_id_73>",
904
+ "<extra_id_74>",
905
+ "<extra_id_75>",
906
+ "<extra_id_76>",
907
+ "<extra_id_77>",
908
+ "<extra_id_78>",
909
+ "<extra_id_79>",
910
+ "<extra_id_80>",
911
+ "<extra_id_81>",
912
+ "<extra_id_82>",
913
+ "<extra_id_83>",
914
+ "<extra_id_84>",
915
+ "<extra_id_85>",
916
+ "<extra_id_86>",
917
+ "<extra_id_87>",
918
+ "<extra_id_88>",
919
+ "<extra_id_89>",
920
+ "<extra_id_90>",
921
+ "<extra_id_91>",
922
+ "<extra_id_92>",
923
+ "<extra_id_93>",
924
+ "<extra_id_94>",
925
+ "<extra_id_95>",
926
+ "<extra_id_96>",
927
+ "<extra_id_97>",
928
+ "<extra_id_98>",
929
+ "<extra_id_99>"
930
+ ],
931
+ "clean_up_tokenization_spaces": false,
932
+ "eos_token": "</s>",
933
+ "extra_ids": 100,
934
+ "extra_special_tokens": {},
935
+ "freeze_base": false,
936
+ "model_max_length": 512,
937
+ "pad_token": "<pad>",
938
+ "sp_model_kwargs": {},
939
+ "tokenizer_class": "T5Tokenizer",
940
+ "unk_token": "<unk>"
941
+ }