ahmed-masry commited on
Commit
97333aa
1 Parent(s): ed86f73

Upload LlavaT5ForConditionalGeneration

Browse files
chartinstruct_flant5_modeling.py ADDED
@@ -0,0 +1,863 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Optional, Tuple, Union
2
+ from dataclasses import dataclass
3
+ import copy, os
4
+ import torch
5
+ import torch.nn as nn
6
+ from torch.nn import CrossEntropyLoss
7
+ from transformers import AutoConfig, AutoModelForSeq2SeqLM, \
8
+ T5Config, T5Model, T5ForConditionalGeneration
9
+
10
+ from transformers.models.t5.modeling_t5 import T5Stack
11
+ from transformers.modeling_outputs import CausalLMOutputWithPast, Seq2SeqLMOutput, BaseModelOutput
12
+ from transformers.utils import ModelOutput
13
+ from transformers import DonutSwinModel, DonutImageProcessor, DonutSwinConfig
14
+
15
+ from abc import ABC, abstractmethod
16
+ import re
17
+
18
+ # Model Constants
19
+ IGNORE_INDEX = -100
20
+ IMAGE_TOKEN_INDEX = -200
21
+ DEFAULT_IMAGE_TOKEN = "<image>"
22
+ DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
23
+ DEFAULT_IM_START_TOKEN = "<im_start>"
24
+ DEFAULT_IM_END_TOKEN = "<im_end>"
25
+
26
+ class UniChartVisionTower(nn.Module):
27
+ def __init__(self, vision_tower, args, delay_load=False):
28
+ super().__init__()
29
+
30
+ self.is_loaded = False
31
+
32
+ self.vision_tower_name = vision_tower
33
+ self.select_layer = args.mm_vision_select_layer
34
+ self.select_feature = getattr(args, 'mm_vision_select_feature', 'patch')
35
+
36
+ if not delay_load:
37
+ self.load_model()
38
+ else:
39
+ self.cfg_only = DonutSwinConfig.from_pretrained(self.vision_tower_name)
40
+
41
+ def load_model(self):
42
+ self.image_processor = DonutImageProcessor.from_pretrained(self.vision_tower_name)
43
+ self.vision_tower = DonutSwinModel.from_pretrained(self.vision_tower_name)
44
+
45
+ # Changed. Check for this variable. It's false by default.
46
+ if not self.tune_vision_encoder:
47
+ self.vision_tower.requires_grad_(False)
48
+
49
+ self.is_loaded = True
50
+
51
+ def feature_select(self, image_forward_outs):
52
+ image_features = image_forward_outs.hidden_states[self.select_layer]
53
+ if self.select_feature == 'patch':
54
+ image_features = image_features[:, 1:]
55
+ elif self.select_feature == 'cls_patch':
56
+ image_features = image_features
57
+ else:
58
+ raise ValueError(f'Unexpected select feature: {self.select_feature}')
59
+ return image_features
60
+
61
+ @torch.no_grad()
62
+ def forward(self, images):
63
+ if type(images) is list:
64
+ image_features = []
65
+ for image in images:
66
+ image_forward_out = self.vision_tower(image.to(device=self.device, dtype=self.dtype).unsqueeze(0), output_hidden_states=True)
67
+ image_feature = self.feature_select(image_forward_out).to(image.dtype)
68
+ image_features.append(image_feature)
69
+ else:
70
+ image_forward_outs = self.vision_tower(images.to(device=self.device, dtype=self.dtype), output_hidden_states=True)
71
+ image_features = self.feature_select(image_forward_outs).to(images.dtype)
72
+
73
+ return image_features
74
+
75
+ @property
76
+ def dummy_feature(self):
77
+ return torch.zeros(1, self.hidden_size, device=self.device, dtype=self.dtype)
78
+
79
+ @property
80
+ def dtype(self):
81
+ return self.vision_tower.dtype
82
+
83
+ @property
84
+ def device(self):
85
+ return self.vision_tower.device
86
+
87
+ @property
88
+ def config(self):
89
+ if self.is_loaded:
90
+ return self.vision_tower.config
91
+ else:
92
+ return self.cfg_only
93
+
94
+ @property
95
+ def hidden_size(self):
96
+ return self.config.hidden_size
97
+
98
+ @property
99
+ def num_patches(self):
100
+ return (self.config.image_size // self.config.patch_size) ** 2
101
+
102
+ def build_vision_tower(vision_tower_cfg, **kwargs):
103
+ vision_tower = getattr(vision_tower_cfg, 'mm_vision_tower', getattr(vision_tower_cfg, 'vision_tower', None))
104
+ is_absolute_path_exists = os.path.exists(vision_tower)
105
+ if is_absolute_path_exists:
106
+ if 'unichart' in vision_tower:
107
+ return UniChartVisionTower(vision_tower, args=vision_tower_cfg, **kwargs)
108
+
109
+ raise ValueError(f'Unknown vision tower: {vision_tower}')
110
+
111
+ def build_vision_projector(config, delay_load=False, **kwargs):
112
+ projector_type = getattr(config, 'mm_projector_type', 'mlp3x_gelu')
113
+
114
+ if projector_type == 'linear':
115
+ return nn.Linear(config.mm_hidden_size, config.hidden_size)
116
+
117
+ mlp_gelu_match = re.match(r'^mlp(\d+)x_gelu$', projector_type)
118
+ if mlp_gelu_match:
119
+ mlp_depth = int(mlp_gelu_match.group(1))
120
+ modules = [nn.Linear(config.mm_hidden_size, config.hidden_size)]
121
+ for _ in range(1, mlp_depth):
122
+ modules.append(nn.GELU())
123
+ modules.append(nn.Linear(config.hidden_size, config.hidden_size))
124
+ return nn.Sequential(*modules)
125
+
126
+ raise ValueError(f'Unknown projector type: {projector_type}')
127
+
128
+ # Copyright 2023 Haotian Liu
129
+ #
130
+ # Licensed under the Apache License, Version 2.0 (the "License");
131
+ # you may not use this file except in compliance with the License.
132
+ # You may obtain a copy of the License at
133
+ #
134
+ # http://www.apache.org/licenses/LICENSE-2.0
135
+ #
136
+ # Unless required by applicable law or agreed to in writing, software
137
+ # distributed under the License is distributed on an "AS IS" BASIS,
138
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139
+ # See the License for the specific language governing permissions and
140
+ # limitations under the License.
141
+
142
+
143
+ class LlavaMetaModel:
144
+
145
+ def __init__(self, config): #, embed_tokens):
146
+ super(LlavaMetaModel, self).__init__(config) #, embed_tokens)
147
+ if hasattr(config, "mm_vision_tower"):
148
+ self.vision_tower = build_vision_tower(config, delay_load=True)
149
+ self.mm_projector = build_vision_projector(self.config) #nn.Linear(config.mm_hidden_size, config.hidden_size)
150
+
151
+ def get_vision_tower(self):
152
+ vision_tower = getattr(self, 'vision_tower', None)
153
+ if type(vision_tower) is list:
154
+ vision_tower = vision_tower[0]
155
+ return vision_tower
156
+
157
+ def initialize_vision_modules(self, model_args, fsdp=None):
158
+ vision_tower = model_args.vision_tower
159
+ mm_vision_select_layer = model_args.mm_vision_select_layer
160
+ mm_vision_select_feature = model_args.mm_vision_select_feature
161
+ pretrain_mm_mlp_adapter = model_args.pretrain_mm_mlp_adapter
162
+
163
+ self.config.mm_vision_tower = vision_tower
164
+
165
+ vision_tower = build_vision_tower(model_args)
166
+
167
+ if fsdp is not None and len(fsdp) > 0:
168
+ self.vision_tower = [vision_tower]
169
+ else:
170
+ self.vision_tower = vision_tower
171
+
172
+ self.config.use_mm_proj = True
173
+ self.config.mm_projector_type = getattr(model_args, 'mm_projector_type', 'linear')
174
+ self.config.mm_hidden_size = vision_tower.hidden_size
175
+ self.config.mm_vision_select_layer = mm_vision_select_layer
176
+ self.config.mm_vision_select_feature = mm_vision_select_feature
177
+
178
+ if not hasattr(self, 'mm_projector'):
179
+ self.mm_projector = build_vision_projector(self.config) #nn.Linear(self.config.mm_hidden_size, self.config.hidden_size)
180
+
181
+ if pretrain_mm_mlp_adapter is not None:
182
+ mm_projector_weights = torch.load(pretrain_mm_mlp_adapter, map_location='cpu')
183
+ def get_w(weights, keyword):
184
+ return {k.split(keyword + '.')[1]: v for k, v in weights.items() if keyword in k}
185
+
186
+ self.mm_projector.load_state_dict(get_w(mm_projector_weights, 'mm_projector'))
187
+
188
+
189
+ class LlavaMetaForCausalLM(ABC):
190
+
191
+ @abstractmethod
192
+ def get_model(self):
193
+ pass
194
+
195
+ def get_vision_tower(self):
196
+ return self.get_model().get_vision_tower()
197
+
198
+ def encode_images(self, images):
199
+ image_features = self.get_model().get_vision_tower()(images)
200
+ image_features = self.get_model().mm_projector(image_features)
201
+ return image_features
202
+
203
+ def prepare_inputs_labels_for_multimodal(
204
+ self, input_ids, attention_mask, past_key_values, labels, images
205
+ ):
206
+ vision_tower = self.get_vision_tower()
207
+ if vision_tower is None or images is None or input_ids.shape[1] == 1:
208
+ if past_key_values is not None and vision_tower is not None and images is not None and input_ids.shape[1] == 1:
209
+ attention_mask = torch.ones((attention_mask.shape[0], past_key_values[-1][-1].shape[-2] + 1), dtype=attention_mask.dtype, device=attention_mask.device)
210
+ return input_ids, attention_mask, past_key_values, None, labels
211
+
212
+ if type(images) is list or images.ndim == 5:
213
+ concat_images = torch.cat([image for image in images], dim=0)
214
+ image_features = self.encode_images(concat_images)
215
+ split_sizes = [image.shape[0] for image in images]
216
+ image_features = torch.split(image_features, split_sizes, dim=0)
217
+ image_features = [x.flatten(0, 1) for x in image_features]
218
+ else:
219
+ image_features = self.encode_images(images)
220
+
221
+ new_input_embeds = []
222
+ new_labels = [] if labels is not None else None
223
+ cur_image_idx = 0
224
+ for batch_idx, cur_input_ids in enumerate(input_ids):
225
+ if (cur_input_ids == IMAGE_TOKEN_INDEX).sum() == 0:
226
+ # multimodal LLM, but the current sample is not multimodal
227
+ cur_input_embeds = self.get_model().embed_tokens(cur_input_ids)
228
+ cur_input_embeds = cur_input_embeds + (0. * self.get_model().mm_projector(vision_tower.dummy_feature)).sum()
229
+ new_input_embeds.append(cur_input_embeds)
230
+ if labels is not None:
231
+ new_labels.append(labels[batch_idx])
232
+ cur_image_idx += 1
233
+ continue
234
+ image_token_indices = torch.where(cur_input_ids == IMAGE_TOKEN_INDEX)[0]
235
+ cur_new_input_embeds = []
236
+ if labels is not None:
237
+ cur_labels = labels[batch_idx]
238
+ cur_new_labels = []
239
+ assert cur_labels.shape == cur_input_ids.shape
240
+ while image_token_indices.numel() > 0:
241
+ cur_image_features = image_features[cur_image_idx]
242
+ image_token_start = image_token_indices[0]
243
+ if getattr(self.config, 'tune_mm_mlp_adapter', False) and getattr(self.config, 'mm_use_im_start_end', False):
244
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids[:image_token_start-1]).detach())
245
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids[image_token_start-1:image_token_start]))
246
+ cur_new_input_embeds.append(cur_image_features)
247
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids[image_token_start+1:image_token_start+2]))
248
+ if labels is not None:
249
+ cur_new_labels.append(cur_labels[:image_token_start])
250
+ cur_new_labels.append(torch.full((cur_image_features.shape[0],), IGNORE_INDEX, device=labels.device, dtype=labels.dtype))
251
+ cur_new_labels.append(cur_labels[image_token_start:image_token_start+1])
252
+ cur_labels = cur_labels[image_token_start+2:]
253
+ else:
254
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids[:image_token_start]))
255
+ cur_new_input_embeds.append(cur_image_features)
256
+ if labels is not None:
257
+ cur_new_labels.append(cur_labels[:image_token_start])
258
+ cur_new_labels.append(torch.full((cur_image_features.shape[0],), IGNORE_INDEX, device=labels.device, dtype=labels.dtype))
259
+ cur_labels = cur_labels[image_token_start+1:]
260
+ cur_image_idx += 1
261
+ if getattr(self.config, 'tune_mm_mlp_adapter', False) and getattr(self.config, 'mm_use_im_start_end', False):
262
+ cur_input_ids = cur_input_ids[image_token_start+2:]
263
+ else:
264
+ cur_input_ids = cur_input_ids[image_token_start+1:]
265
+ image_token_indices = torch.where(cur_input_ids == IMAGE_TOKEN_INDEX)[0]
266
+ if cur_input_ids.numel() > 0:
267
+ if getattr(self.config, 'tune_mm_mlp_adapter', False) and getattr(self.config, 'mm_use_im_start_end', False):
268
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids).detach())
269
+ else:
270
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids))
271
+ if labels is not None:
272
+ cur_new_labels.append(cur_labels)
273
+ cur_new_input_embeds = [x.to(device=self.device) for x in cur_new_input_embeds]
274
+ cur_new_input_embeds = torch.cat(cur_new_input_embeds, dim=0)
275
+ new_input_embeds.append(cur_new_input_embeds)
276
+ if labels is not None:
277
+ cur_new_labels = torch.cat(cur_new_labels, dim=0)
278
+ new_labels.append(cur_new_labels)
279
+
280
+ if any(x.shape != new_input_embeds[0].shape for x in new_input_embeds):
281
+ max_len = max(x.shape[0] for x in new_input_embeds)
282
+
283
+ new_input_embeds_align = []
284
+ for cur_new_embed in new_input_embeds:
285
+ cur_new_embed = torch.cat((cur_new_embed, torch.zeros((max_len - cur_new_embed.shape[0], cur_new_embed.shape[1]), dtype=cur_new_embed.dtype, device=cur_new_embed.device)), dim=0)
286
+ new_input_embeds_align.append(cur_new_embed)
287
+ new_input_embeds = torch.stack(new_input_embeds_align, dim=0)
288
+
289
+ if labels is not None:
290
+ new_labels_align = []
291
+ _new_labels = new_labels
292
+ for cur_new_label in new_labels:
293
+ cur_new_label = torch.cat((cur_new_label, torch.full((max_len - cur_new_label.shape[0],), IGNORE_INDEX, dtype=cur_new_label.dtype, device=cur_new_label.device)), dim=0)
294
+ new_labels_align.append(cur_new_label)
295
+ new_labels = torch.stack(new_labels_align, dim=0)
296
+
297
+ if attention_mask is not None:
298
+ new_attention_mask = []
299
+ for cur_attention_mask, cur_new_labels, cur_new_labels_align in zip(attention_mask, _new_labels, new_labels):
300
+ new_attn_mask_pad_left = torch.full((cur_new_labels.shape[0] - labels.shape[1],), True, dtype=attention_mask.dtype, device=attention_mask.device)
301
+ new_attn_mask_pad_right = torch.full((cur_new_labels_align.shape[0] - cur_new_labels.shape[0],), False, dtype=attention_mask.dtype, device=attention_mask.device)
302
+ cur_new_attention_mask = torch.cat((new_attn_mask_pad_left, cur_attention_mask, new_attn_mask_pad_right), dim=0)
303
+ new_attention_mask.append(cur_new_attention_mask)
304
+ attention_mask = torch.stack(new_attention_mask, dim=0)
305
+ assert attention_mask.shape == new_labels.shape
306
+ else:
307
+ new_input_embeds = torch.stack(new_input_embeds, dim=0)
308
+ if labels is not None:
309
+ new_labels = torch.stack(new_labels, dim=0)
310
+
311
+ if attention_mask is not None:
312
+ new_attn_mask_pad_left = torch.full((attention_mask.shape[0], new_input_embeds.shape[1] - input_ids.shape[1]), True, dtype=attention_mask.dtype, device=attention_mask.device)
313
+ attention_mask = torch.cat((new_attn_mask_pad_left, attention_mask), dim=1)
314
+ assert attention_mask.shape == new_input_embeds.shape[:2]
315
+
316
+ return None, attention_mask, past_key_values, new_input_embeds, new_labels
317
+
318
+ def initialize_vision_tokenizer(self, model_args, tokenizer):
319
+ if model_args.mm_use_im_patch_token:
320
+ tokenizer.add_tokens([DEFAULT_IMAGE_PATCH_TOKEN], special_tokens=True)
321
+ self.resize_token_embeddings(len(tokenizer))
322
+
323
+ if model_args.mm_use_im_start_end:
324
+ num_new_tokens = tokenizer.add_tokens([DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN], special_tokens=True)
325
+ self.resize_token_embeddings(len(tokenizer))
326
+
327
+ if num_new_tokens > 0:
328
+ input_embeddings = self.get_input_embeddings().weight.data
329
+ output_embeddings = self.get_output_embeddings().weight.data
330
+
331
+ input_embeddings_avg = input_embeddings[:-num_new_tokens].mean(
332
+ dim=0, keepdim=True)
333
+ output_embeddings_avg = output_embeddings[:-num_new_tokens].mean(
334
+ dim=0, keepdim=True)
335
+
336
+ input_embeddings[-num_new_tokens:] = input_embeddings_avg
337
+ output_embeddings[-num_new_tokens:] = output_embeddings_avg
338
+
339
+ if model_args.tune_mm_mlp_adapter:
340
+ for p in self.get_input_embeddings().parameters():
341
+ p.requires_grad = True
342
+ for p in self.get_output_embeddings().parameters():
343
+ p.requires_grad = False
344
+
345
+ if model_args.pretrain_mm_mlp_adapter:
346
+ mm_projector_weights = torch.load(model_args.pretrain_mm_mlp_adapter, map_location='cpu')
347
+ embed_tokens_weight = mm_projector_weights['model.embed_tokens.weight']
348
+ assert num_new_tokens == 2
349
+ if input_embeddings.shape == embed_tokens_weight.shape:
350
+ input_embeddings[-num_new_tokens:] = embed_tokens_weight[-num_new_tokens:]
351
+ elif embed_tokens_weight.shape[0] == num_new_tokens:
352
+ input_embeddings[-num_new_tokens:] = embed_tokens_weight
353
+ else:
354
+ raise ValueError(f"Unexpected embed_tokens_weight shape. Pretrained: {embed_tokens_weight.shape}. Current: {input_embeddings.shape}. Numer of new tokens: {num_new_tokens}.")
355
+ elif model_args.mm_use_im_patch_token:
356
+ if model_args.tune_mm_mlp_adapter:
357
+ for p in self.get_input_embeddings().parameters():
358
+ p.requires_grad = False
359
+ for p in self.get_output_embeddings().parameters():
360
+ p.requires_grad = False
361
+
362
+
363
+
364
+ class LlavaMetaForConditionalGeneration(ABC):
365
+
366
+ def get_vision_tower(self):
367
+ return self.get_encoder().get_vision_tower()
368
+
369
+ def encode_images(self, images):
370
+ image_features = self.get_encoder().get_vision_tower()(images)
371
+ image_features = self.get_encoder().mm_projector(image_features)
372
+ return image_features
373
+
374
+ def prepare_inputs_labels_for_multimodal(
375
+ self, input_ids, attention_mask, labels, images
376
+ ):
377
+ vision_tower = self.get_vision_tower()
378
+ if vision_tower is None or images is None or input_ids.shape[1] == 1:
379
+ return input_ids, attention_mask, None
380
+
381
+ if type(images) is list or images.ndim == 5:
382
+ concat_images = torch.cat([image for image in images], dim=0)
383
+ image_features = self.encode_images(concat_images)
384
+ split_sizes = [image.shape[0] for image in images]
385
+ image_features = torch.split(image_features, split_sizes, dim=0)
386
+ image_features = [x.flatten(0, 1) for x in image_features]
387
+ else:
388
+ image_features = self.encode_images(images)
389
+
390
+ # TODO: double check.
391
+ if labels is None:
392
+ labels = torch.full_like(input_ids, IGNORE_INDEX)
393
+ ######
394
+
395
+ new_input_embeds = []
396
+ new_labels = [] if labels is not None else None
397
+ cur_image_idx = 0
398
+ for batch_idx, cur_input_ids in enumerate(input_ids):
399
+ if (cur_input_ids == IMAGE_TOKEN_INDEX).sum() == 0:
400
+ # multimodal LLM, but the current sample is not multimodal
401
+ cur_input_embeds = self.get_encoder().embed_tokens(cur_input_ids)
402
+ cur_input_embeds = cur_input_embeds + (0. * self.get_encoder().mm_projector(vision_tower.dummy_feature)).sum()
403
+ new_input_embeds.append(cur_input_embeds)
404
+ if labels is not None:
405
+ new_labels.append(labels[batch_idx])
406
+ cur_image_idx += 1
407
+ continue
408
+ image_token_indices = torch.where(cur_input_ids == IMAGE_TOKEN_INDEX)[0]
409
+ cur_new_input_embeds = []
410
+ if labels is not None:
411
+ cur_labels = labels[batch_idx]
412
+ cur_new_labels = []
413
+ assert cur_labels.shape == cur_input_ids.shape
414
+ while image_token_indices.numel() > 0:
415
+ cur_image_features = image_features[cur_image_idx]
416
+ image_token_start = image_token_indices[0]
417
+ if getattr(self.config, 'tune_mm_mlp_adapter', False) and getattr(self.config, 'mm_use_im_start_end', False):
418
+ cur_new_input_embeds.append(self.get_encoder().embed_tokens(cur_input_ids[:image_token_start-1]).detach())
419
+ cur_new_input_embeds.append(self.get_encoder().embed_tokens(cur_input_ids[image_token_start-1:image_token_start]))
420
+ cur_new_input_embeds.append(cur_image_features)
421
+ cur_new_input_embeds.append(self.get_encoder().embed_tokens(cur_input_ids[image_token_start+1:image_token_start+2]))
422
+ if labels is not None:
423
+ cur_new_labels.append(cur_labels[:image_token_start])
424
+ cur_new_labels.append(torch.full((cur_image_features.shape[0],), IGNORE_INDEX, device=labels.device, dtype=labels.dtype))
425
+ cur_new_labels.append(cur_labels[image_token_start:image_token_start+1])
426
+ cur_labels = cur_labels[image_token_start+2:]
427
+ else:
428
+ cur_new_input_embeds.append(self.get_encoder().embed_tokens(cur_input_ids[:image_token_start]))
429
+ cur_new_input_embeds.append(cur_image_features)
430
+ if labels is not None:
431
+ cur_new_labels.append(cur_labels[:image_token_start])
432
+ cur_new_labels.append(torch.full((cur_image_features.shape[0],), IGNORE_INDEX, device=labels.device, dtype=labels.dtype))
433
+ cur_labels = cur_labels[image_token_start+1:]
434
+ cur_image_idx += 1
435
+ if getattr(self.config, 'tune_mm_mlp_adapter', False) and getattr(self.config, 'mm_use_im_start_end', False):
436
+ cur_input_ids = cur_input_ids[image_token_start+2:]
437
+ else:
438
+ cur_input_ids = cur_input_ids[image_token_start+1:]
439
+ image_token_indices = torch.where(cur_input_ids == IMAGE_TOKEN_INDEX)[0]
440
+ if cur_input_ids.numel() > 0:
441
+ if getattr(self.config, 'tune_mm_mlp_adapter', False) and getattr(self.config, 'mm_use_im_start_end', False):
442
+ cur_new_input_embeds.append(self.get_encoder().embed_tokens(cur_input_ids).detach())
443
+ else:
444
+ cur_new_input_embeds.append(self.get_encoder().embed_tokens(cur_input_ids))
445
+ if labels is not None:
446
+ cur_new_labels.append(cur_labels)
447
+ cur_new_input_embeds = [x.to(device=self.device) for x in cur_new_input_embeds]
448
+ cur_new_input_embeds = torch.cat(cur_new_input_embeds, dim=0)
449
+ new_input_embeds.append(cur_new_input_embeds)
450
+ if labels is not None:
451
+ cur_new_labels = torch.cat(cur_new_labels, dim=0)
452
+ new_labels.append(cur_new_labels)
453
+
454
+ if any(x.shape != new_input_embeds[0].shape for x in new_input_embeds):
455
+ max_len = max(x.shape[0] for x in new_input_embeds)
456
+
457
+ new_input_embeds_align = []
458
+ for cur_new_embed in new_input_embeds:
459
+ cur_new_embed = torch.cat((cur_new_embed, torch.zeros((max_len - cur_new_embed.shape[0], cur_new_embed.shape[1]), dtype=cur_new_embed.dtype, device=cur_new_embed.device)), dim=0)
460
+ new_input_embeds_align.append(cur_new_embed)
461
+ new_input_embeds = torch.stack(new_input_embeds_align, dim=0)
462
+
463
+ if labels is not None:
464
+ new_labels_align = []
465
+ _new_labels = new_labels
466
+ for cur_new_label in new_labels:
467
+ cur_new_label = torch.cat((cur_new_label, torch.full((max_len - cur_new_label.shape[0],), IGNORE_INDEX, dtype=cur_new_label.dtype, device=cur_new_label.device)), dim=0)
468
+ new_labels_align.append(cur_new_label)
469
+ new_labels = torch.stack(new_labels_align, dim=0)
470
+
471
+ if attention_mask is not None:
472
+ new_attention_mask = []
473
+ for cur_attention_mask, cur_new_labels, cur_new_labels_align in zip(attention_mask, _new_labels, new_labels):
474
+ new_attn_mask_pad_left = torch.full((cur_new_labels.shape[0] - labels.shape[1],), True, dtype=attention_mask.dtype, device=attention_mask.device)
475
+ new_attn_mask_pad_right = torch.full((cur_new_labels_align.shape[0] - cur_new_labels.shape[0],), False, dtype=attention_mask.dtype, device=attention_mask.device)
476
+ cur_new_attention_mask = torch.cat((new_attn_mask_pad_left, cur_attention_mask, new_attn_mask_pad_right), dim=0)
477
+ new_attention_mask.append(cur_new_attention_mask)
478
+ attention_mask = torch.stack(new_attention_mask, dim=0)
479
+ assert attention_mask.shape == new_labels.shape
480
+ else:
481
+ new_input_embeds = torch.stack(new_input_embeds, dim=0)
482
+ if labels is not None:
483
+ new_labels = torch.stack(new_labels, dim=0)
484
+
485
+ if attention_mask is not None:
486
+ new_attn_mask_pad_left = torch.full((attention_mask.shape[0], new_input_embeds.shape[1] - input_ids.shape[1]), True, dtype=attention_mask.dtype, device=attention_mask.device)
487
+ attention_mask = torch.cat((new_attn_mask_pad_left, attention_mask), dim=1)
488
+ assert attention_mask.shape == new_input_embeds.shape[:2]
489
+
490
+ return None, attention_mask, new_input_embeds, new_labels
491
+
492
+ def initialize_vision_tokenizer(self, model_args, tokenizer):
493
+ if model_args.mm_use_im_patch_token:
494
+ tokenizer.add_tokens([DEFAULT_IMAGE_PATCH_TOKEN], special_tokens=True)
495
+ self.resize_token_embeddings(len(tokenizer))
496
+
497
+ if model_args.mm_use_im_start_end:
498
+ num_new_tokens = tokenizer.add_tokens([DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN], special_tokens=True)
499
+ self.resize_token_embeddings(len(tokenizer))
500
+
501
+ if num_new_tokens > 0:
502
+ input_embeddings = self.get_input_embeddings().weight.data
503
+ output_embeddings = self.get_output_embeddings().weight.data
504
+
505
+ input_embeddings_avg = input_embeddings[:-num_new_tokens].mean(
506
+ dim=0, keepdim=True)
507
+ output_embeddings_avg = output_embeddings[:-num_new_tokens].mean(
508
+ dim=0, keepdim=True)
509
+
510
+ input_embeddings[-num_new_tokens:] = input_embeddings_avg
511
+ output_embeddings[-num_new_tokens:] = output_embeddings_avg
512
+
513
+ if model_args.tune_mm_mlp_adapter:
514
+ for p in self.get_input_embeddings().parameters():
515
+ p.requires_grad = True
516
+ for p in self.get_output_embeddings().parameters():
517
+ p.requires_grad = False
518
+
519
+ if model_args.pretrain_mm_mlp_adapter:
520
+ mm_projector_weights = torch.load(model_args.pretrain_mm_mlp_adapter, map_location='cpu')
521
+ embed_tokens_weight = mm_projector_weights['model.embed_tokens.weight']
522
+ assert num_new_tokens == 2
523
+ if input_embeddings.shape == embed_tokens_weight.shape:
524
+ input_embeddings[-num_new_tokens:] = embed_tokens_weight[-num_new_tokens:]
525
+ elif embed_tokens_weight.shape[0] == num_new_tokens:
526
+ input_embeddings[-num_new_tokens:] = embed_tokens_weight
527
+ else:
528
+ raise ValueError(f"Unexpected embed_tokens_weight shape. Pretrained: {embed_tokens_weight.shape}. Current: {input_embeddings.shape}. Numer of new tokens: {num_new_tokens}.")
529
+ elif model_args.mm_use_im_patch_token:
530
+ if model_args.tune_mm_mlp_adapter:
531
+ for p in self.get_input_embeddings().parameters():
532
+ p.requires_grad = False
533
+ for p in self.get_output_embeddings().parameters():
534
+ p.requires_grad = False
535
+
536
+ class LlavaMetaT5Model:
537
+
538
+ def __init__(self, config, embed_tokens):
539
+ super(LlavaMetaT5Model, self).__init__(config, embed_tokens)
540
+ if hasattr(config, "mm_vision_tower"):
541
+ self.vision_tower = build_vision_tower(config, delay_load=True)
542
+ self.mm_projector = nn.Linear(config.mm_hidden_size, config.hidden_size)
543
+
544
+ def get_vision_tower(self):
545
+ vision_tower = getattr(self, 'vision_tower', None)
546
+ if type(vision_tower) is list:
547
+ vision_tower = vision_tower[0]
548
+ return vision_tower
549
+
550
+ def initialize_vision_modules(self, model_args, fsdp=None):
551
+ vision_tower = model_args.vision_tower
552
+ mm_vision_select_layer = model_args.mm_vision_select_layer
553
+ mm_vision_select_feature = model_args.mm_vision_select_feature
554
+ pretrain_mm_mlp_adapter = model_args.pretrain_mm_mlp_adapter
555
+
556
+ self.config.mm_vision_tower = vision_tower
557
+
558
+ vision_tower = build_vision_tower(model_args)
559
+
560
+ if fsdp is not None and len(fsdp) > 0:
561
+ self.vision_tower = [vision_tower]
562
+ else:
563
+ self.vision_tower = vision_tower
564
+
565
+ self.config.use_mm_proj = True
566
+ self.config.mm_projector_type = getattr(model_args, 'mm_projector_type', 'linear')
567
+ self.config.mm_hidden_size = vision_tower.hidden_size
568
+ self.config.mm_vision_select_layer = mm_vision_select_layer
569
+ self.config.mm_vision_select_feature = mm_vision_select_feature
570
+
571
+ if not hasattr(self, 'mm_projector'):
572
+ self.mm_projector = build_vision_projector(self.config) #nn.Linear(self.config.mm_hidden_size, self.config.hidden_size)
573
+
574
+ if pretrain_mm_mlp_adapter is not None:
575
+ mm_projector_weights = torch.load(pretrain_mm_mlp_adapter, map_location='cpu')
576
+ def get_w(weights, keyword):
577
+ return {k.split(keyword + '.')[1]: v for k, v in weights.items() if keyword in k}
578
+
579
+ self.mm_projector.load_state_dict(get_w(mm_projector_weights, 'mm_projector'))
580
+
581
+
582
+
583
+ # Copyright 2023 Haotian Liu
584
+ #
585
+ # Licensed under the Apache License, Version 2.0 (the "License");
586
+ # you may not use this file except in compliance with the License.
587
+ # You may obtain a copy of the License at
588
+ #
589
+ # http://www.apache.org/licenses/LICENSE-2.0
590
+ #
591
+ # Unless required by applicable law or agreed to in writing, software
592
+ # distributed under the License is distributed on an "AS IS" BASIS,
593
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
594
+ # See the License for the specific language governing permissions and
595
+ # limitations under the License.
596
+
597
+
598
+
599
+ @dataclass
600
+ class BaseModelOutputWithPastAndCrossAttentionsWithAttentionMask(ModelOutput):
601
+ """
602
+ Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).
603
+
604
+ Args:
605
+ last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
606
+ Sequence of hidden-states at the output of the last layer of the model.
607
+
608
+ If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
609
+ hidden_size)` is output.
610
+ past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
611
+ Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
612
+ `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and optionally if
613
+ `config.is_encoder_decoder=True` 2 additional tensors of shape `(batch_size, num_heads,
614
+ encoder_sequence_length, embed_size_per_head)`.
615
+
616
+ Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
617
+ `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values`
618
+ input) to speed up sequential decoding.
619
+ hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
620
+ Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
621
+ one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
622
+
623
+ Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
624
+ attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
625
+ Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
626
+ sequence_length)`.
627
+
628
+ Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
629
+ heads.
630
+ cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`):
631
+ Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
632
+ sequence_length)`.
633
+
634
+ Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
635
+ weighted average in the cross-attention heads.
636
+ """
637
+
638
+ last_hidden_state: torch.FloatTensor = None
639
+ past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
640
+ hidden_states: Optional[Tuple[torch.FloatTensor]] = None
641
+ attentions: Optional[Tuple[torch.FloatTensor]] = None
642
+ cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
643
+ attention_mask: Optional[torch.LongTensor] = None
644
+
645
+ class LlavaT5Config(T5Config):
646
+ model_type = "llava_t5"
647
+
648
+ class LlavaT5Stack(LlavaMetaT5Model, T5Stack):
649
+ config_class = LlavaT5Config
650
+
651
+ def __init__(self, config: T5Config, embed_tokens=None):
652
+ super(LlavaT5Stack, self).__init__(config, embed_tokens)
653
+
654
+
655
+ class LlavaT5ForConditionalGeneration(T5ForConditionalGeneration, LlavaMetaForConditionalGeneration):
656
+ config_class = LlavaT5Config
657
+
658
+ def __init__(self, config):
659
+ super(T5ForConditionalGeneration, self).__init__(config)
660
+
661
+ self.model_dim = config.d_model
662
+
663
+ self.shared = nn.Embedding(config.vocab_size, config.d_model)
664
+
665
+ encoder_config = copy.deepcopy(config)
666
+ encoder_config.is_decoder = False
667
+ encoder_config.use_cache = False
668
+ encoder_config.is_encoder_decoder = False
669
+ self.encoder = LlavaT5Stack(encoder_config, self.shared)
670
+
671
+ decoder_config = copy.deepcopy(config)
672
+ decoder_config.is_decoder = True
673
+ decoder_config.is_encoder_decoder = False
674
+ decoder_config.num_layers = config.num_decoder_layers
675
+ self.decoder = T5Stack(decoder_config, self.shared)
676
+
677
+ self.lm_head = nn.Linear(config.d_model, config.vocab_size, bias=False)
678
+
679
+ # Initialize weights and apply final processing
680
+ self.post_init()
681
+
682
+ # Model parallel
683
+ self.model_parallel = False
684
+ self.device_map = None
685
+
686
+ def get_model(self):
687
+ return self.encoder
688
+ def get_encoder(self):
689
+ return self.encoder
690
+ def get_decoder(self):
691
+ return self.decoder
692
+
693
+ def forward(
694
+ self,
695
+ input_ids: torch.LongTensor = None,
696
+ attention_mask: Optional[torch.Tensor] = None,
697
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
698
+ inputs_embeds: Optional[torch.FloatTensor] = None,
699
+ labels: Optional[torch.LongTensor] = None,
700
+ use_cache: Optional[bool] = None,
701
+ output_attentions: Optional[bool] = None,
702
+ output_hidden_states: Optional[bool] = None,
703
+ images: Optional[torch.FloatTensor] = None,
704
+ return_dict: Optional[bool] = None,
705
+
706
+ decoder_input_ids: Optional[torch.LongTensor] = None,
707
+ decoder_attention_mask: Optional[torch.BoolTensor] = None,
708
+ head_mask: Optional[torch.FloatTensor] = None,
709
+ decoder_head_mask: Optional[torch.FloatTensor] = None,
710
+ cross_attn_head_mask: Optional[torch.Tensor] = None,
711
+ encoder_outputs: Optional[Tuple[Tuple[torch.Tensor]]] = None,
712
+ decoder_inputs_embeds: Optional[torch.FloatTensor] = None,
713
+
714
+ ) -> Union[Tuple, Seq2SeqLMOutput]:
715
+
716
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
717
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
718
+
719
+
720
+ # FutureWarning: head_mask was separated into two input args - head_mask, decoder_head_mask
721
+ if head_mask is not None and decoder_head_mask is None:
722
+ if self.config.num_layers == self.config.num_decoder_layers:
723
+ #warnings.warn(__HEAD_MASK_WARNING_MSG, FutureWarning)
724
+ decoder_head_mask = head_mask
725
+
726
+ # Encode if needed (training, first prediction pass)
727
+ if encoder_outputs is None:
728
+ input_ids, attention_mask, inputs_embeds, _ = self.prepare_inputs_labels_for_multimodal(input_ids,
729
+ attention_mask,
730
+ None, # Important: keep it None
731
+ images
732
+ )
733
+ # Convert encoder inputs in embeddings if needed
734
+ encoder_outputs = self.encoder(
735
+ input_ids=input_ids,
736
+ attention_mask=attention_mask,
737
+ inputs_embeds=inputs_embeds,
738
+ head_mask=head_mask,
739
+ output_attentions=output_attentions,
740
+ output_hidden_states=output_hidden_states,
741
+ return_dict=return_dict,
742
+ )
743
+ elif return_dict and not isinstance(encoder_outputs, BaseModelOutput):
744
+ encoder_outputs = BaseModelOutput(
745
+ last_hidden_state=encoder_outputs[0],
746
+ hidden_states=encoder_outputs[1] if len(encoder_outputs) > 1 else None,
747
+ attentions=encoder_outputs[2] if len(encoder_outputs) > 2 else None,
748
+ )
749
+
750
+ hidden_states = encoder_outputs[0]
751
+
752
+ if self.model_parallel:
753
+ torch.cuda.set_device(self.decoder.first_device)
754
+
755
+ if labels is not None and decoder_input_ids is None and decoder_inputs_embeds is None:
756
+ # get decoder inputs from shifting lm labels to the right
757
+ decoder_input_ids = self._shift_right(labels)
758
+
759
+ # Set device for model parallelism
760
+ if self.model_parallel:
761
+ torch.cuda.set_device(self.decoder.first_device)
762
+ hidden_states = hidden_states.to(self.decoder.first_device)
763
+ if decoder_input_ids is not None:
764
+ decoder_input_ids = decoder_input_ids.to(self.decoder.first_device)
765
+ if attention_mask is not None:
766
+ attention_mask = attention_mask.to(self.decoder.first_device)
767
+ if decoder_attention_mask is not None:
768
+ decoder_attention_mask = decoder_attention_mask.to(self.decoder.first_device)
769
+
770
+
771
+ # Decode
772
+ decoder_outputs = self.decoder(
773
+ input_ids=decoder_input_ids,
774
+ attention_mask=decoder_attention_mask,
775
+ inputs_embeds=decoder_inputs_embeds,
776
+ past_key_values=past_key_values,
777
+ encoder_hidden_states=hidden_states,
778
+ encoder_attention_mask=attention_mask,
779
+ head_mask=decoder_head_mask,
780
+ cross_attn_head_mask=cross_attn_head_mask,
781
+ use_cache=use_cache,
782
+ output_attentions=output_attentions,
783
+ output_hidden_states=output_hidden_states,
784
+ return_dict=return_dict,
785
+ )
786
+ sequence_output = decoder_outputs[0]
787
+
788
+ # Set device for model parallelism
789
+ if self.model_parallel:
790
+ torch.cuda.set_device(self.encoder.first_device)
791
+ self.lm_head = self.lm_head.to(self.encoder.first_device)
792
+ sequence_output = sequence_output.to(self.lm_head.weight.device)
793
+
794
+ if self.config.tie_word_embeddings:
795
+ # Rescale output before projecting on vocab
796
+ # See https://github.com/tensorflow/mesh/blob/fa19d69eafc9a482aff0b59ddd96b025c0cb207d/mesh_tensorflow/transformer/transformer.py#L586
797
+ sequence_output = sequence_output * (self.model_dim**-0.5)
798
+
799
+ lm_logits = self.lm_head(sequence_output)
800
+
801
+ loss = None
802
+ if labels is not None:
803
+ loss_fct = CrossEntropyLoss(ignore_index=-100)
804
+ # move labels to correct device to enable PP
805
+ labels = labels.to(lm_logits.device)
806
+ loss = loss_fct(lm_logits.view(-1, lm_logits.size(-1)), labels.view(-1))
807
+ # TODO(thom): Add z_loss https://github.com/tensorflow/mesh/blob/fa19d69eafc9a482aff0b59ddd96b025c0cb207d/mesh_tensorflow/layers.py#L666
808
+
809
+ if not return_dict:
810
+ output = (lm_logits,) + decoder_outputs[1:] + encoder_outputs
811
+ return ((loss,) + output) if loss is not None else output
812
+
813
+ return Seq2SeqLMOutput(
814
+ loss=loss,
815
+ logits=lm_logits,
816
+ past_key_values=decoder_outputs.past_key_values,
817
+ decoder_hidden_states=decoder_outputs.hidden_states,
818
+ decoder_attentions=decoder_outputs.attentions,
819
+ cross_attentions=decoder_outputs.cross_attentions,
820
+ encoder_last_hidden_state=encoder_outputs.last_hidden_state,
821
+ encoder_hidden_states=encoder_outputs.hidden_states,
822
+ encoder_attentions=encoder_outputs.attentions,
823
+ )
824
+
825
+ def prepare_inputs_for_generation(
826
+ self,
827
+ input_ids,
828
+ past_key_values=None,
829
+ attention_mask=None,
830
+ head_mask=None,
831
+ decoder_head_mask=None,
832
+ decoder_attention_mask=None,
833
+ cross_attn_head_mask=None,
834
+ use_cache=None,
835
+ encoder_outputs=None,
836
+ **kwargs,
837
+ ):
838
+ # cut decoder_input_ids if past_key_values is used
839
+ if past_key_values is not None:
840
+ past_length = past_key_values[0][0].shape[2]
841
+
842
+ # Some generation methods already pass only the last input ID
843
+ if input_ids.shape[1] > past_length:
844
+ remove_prefix_length = past_length
845
+ else:
846
+ # Default to old behavior: keep only final ID
847
+ remove_prefix_length = input_ids.shape[1] - 1
848
+
849
+ input_ids = input_ids[:, remove_prefix_length:]
850
+
851
+ return {
852
+ "decoder_input_ids": input_ids,
853
+ "past_key_values": past_key_values,
854
+ "encoder_outputs": encoder_outputs,
855
+ "attention_mask": attention_mask,
856
+ "head_mask": head_mask,
857
+ "decoder_head_mask": decoder_head_mask,
858
+ "decoder_attention_mask": decoder_attention_mask,
859
+ "cross_attn_head_mask": cross_attn_head_mask,
860
+ "use_cache": use_cache,
861
+ "images": kwargs.get("images", None),
862
+ }
863
+
config.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/content/flant5",
3
+ "architectures": [
4
+ "LlavaT5ForConditionalGeneration"
5
+ ],
6
+ "auto_map": {
7
+ "AutoConfig": "chartinstruct_flant5_modeling.LlavaT5Config",
8
+ "AutoModelForSeq2SeqLM": "chartinstruct_flant5_modeling.LlavaT5ForConditionalGeneration"
9
+ },
10
+ "classifier_dropout": 0.0,
11
+ "d_ff": 5120,
12
+ "d_kv": 64,
13
+ "d_model": 2048,
14
+ "decoder_start_token_id": 0,
15
+ "dense_act_fn": "gelu_new",
16
+ "dropout_rate": 0.1,
17
+ "eos_token_id": 1,
18
+ "feed_forward_proj": "gated-gelu",
19
+ "freeze_mm_mlp_adapter": false,
20
+ "image_aspect_ratio": "square",
21
+ "image_grid_pinpoints": null,
22
+ "initializer_factor": 1.0,
23
+ "is_encoder_decoder": true,
24
+ "is_gated_act": true,
25
+ "layer_norm_epsilon": 1e-06,
26
+ "mm_hidden_size": 1024,
27
+ "mm_use_im_patch_token": false,
28
+ "mm_use_im_start_end": false,
29
+ "mm_vision_select_feature": "patch",
30
+ "mm_vision_select_layer": -1,
31
+ "mm_vision_tower": "/content/unichart-encoder-512",
32
+ "model_type": "llava_t5",
33
+ "n_positions": 512,
34
+ "num_decoder_layers": 24,
35
+ "num_heads": 32,
36
+ "num_layers": 24,
37
+ "output_past": true,
38
+ "pad_token_id": 0,
39
+ "relative_attention_max_distance": 128,
40
+ "relative_attention_num_buckets": 32,
41
+ "task_specific_params": {
42
+ "summarization": {
43
+ "early_stopping": true,
44
+ "length_penalty": 2.0,
45
+ "max_length": 200,
46
+ "min_length": 30,
47
+ "no_repeat_ngram_size": 3,
48
+ "num_beams": 4,
49
+ "prefix": "summarize: "
50
+ },
51
+ "translation_en_to_de": {
52
+ "early_stopping": true,
53
+ "max_length": 300,
54
+ "num_beams": 4,
55
+ "prefix": "translate English to German: "
56
+ },
57
+ "translation_en_to_fr": {
58
+ "early_stopping": true,
59
+ "max_length": 300,
60
+ "num_beams": 4,
61
+ "prefix": "translate English to French: "
62
+ },
63
+ "translation_en_to_ro": {
64
+ "early_stopping": true,
65
+ "max_length": 300,
66
+ "num_beams": 4,
67
+ "prefix": "translate English to Romanian: "
68
+ }
69
+ },
70
+ "tie_word_embeddings": false,
71
+ "torch_dtype": "float32",
72
+ "transformers_version": "4.41.2",
73
+ "tune_mm_mlp_adapter": false,
74
+ "use_cache": false,
75
+ "use_mm_proj": true,
76
+ "vocab_size": 32128
77
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "decoder_start_token_id": 0,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.41.2"
7
+ }
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:719f6af29df4fe3cae844752de131258afdebe6bad05a513533d654a7f3a2ad9
3
+ size 4986432872
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71428b8d193b4234668328861cd30d0abd6ce25bccdaa12de5ce0aa90fde81e9
3
+ size 4991730200
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0059c19a7881bdff91877bedc0b46cd6d2cc6ee1b3ab6ea0581fa41604e6aaa
3
+ size 1429331352
model.safetensors.index.json ADDED
@@ -0,0 +1,567 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 11407425536
4
+ },
5
+ "weight_map": {
6
+ "decoder.block.0.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
7
+ "decoder.block.0.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
8
+ "decoder.block.0.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
9
+ "decoder.block.0.layer.0.SelfAttention.relative_attention_bias.weight": "model-00001-of-00003.safetensors",
10
+ "decoder.block.0.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
11
+ "decoder.block.0.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
12
+ "decoder.block.0.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
13
+ "decoder.block.0.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
14
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": "model-00001-of-00003.safetensors",
15
+ "decoder.block.0.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
16
+ "decoder.block.0.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
17
+ "decoder.block.0.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
18
+ "decoder.block.0.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
19
+ "decoder.block.0.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
20
+ "decoder.block.0.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
21
+ "decoder.block.1.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
22
+ "decoder.block.1.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
23
+ "decoder.block.1.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
24
+ "decoder.block.1.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
25
+ "decoder.block.1.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
26
+ "decoder.block.1.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
27
+ "decoder.block.1.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
28
+ "decoder.block.1.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
29
+ "decoder.block.1.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
30
+ "decoder.block.1.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
31
+ "decoder.block.1.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
32
+ "decoder.block.1.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
33
+ "decoder.block.1.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
34
+ "decoder.block.1.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
35
+ "decoder.block.10.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
36
+ "decoder.block.10.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
37
+ "decoder.block.10.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
38
+ "decoder.block.10.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
39
+ "decoder.block.10.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
40
+ "decoder.block.10.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
41
+ "decoder.block.10.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
42
+ "decoder.block.10.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
43
+ "decoder.block.10.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
44
+ "decoder.block.10.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
45
+ "decoder.block.10.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
46
+ "decoder.block.10.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
47
+ "decoder.block.10.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
48
+ "decoder.block.10.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
49
+ "decoder.block.11.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
50
+ "decoder.block.11.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
51
+ "decoder.block.11.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
52
+ "decoder.block.11.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
53
+ "decoder.block.11.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
54
+ "decoder.block.11.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
55
+ "decoder.block.11.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
56
+ "decoder.block.11.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
57
+ "decoder.block.11.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
58
+ "decoder.block.11.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
59
+ "decoder.block.11.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
60
+ "decoder.block.11.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
61
+ "decoder.block.11.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
62
+ "decoder.block.11.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
63
+ "decoder.block.12.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
64
+ "decoder.block.12.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
65
+ "decoder.block.12.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
66
+ "decoder.block.12.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
67
+ "decoder.block.12.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
68
+ "decoder.block.12.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
69
+ "decoder.block.12.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
70
+ "decoder.block.12.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
71
+ "decoder.block.12.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
72
+ "decoder.block.12.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
73
+ "decoder.block.12.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
74
+ "decoder.block.12.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
75
+ "decoder.block.12.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
76
+ "decoder.block.12.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
77
+ "decoder.block.13.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
78
+ "decoder.block.13.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
79
+ "decoder.block.13.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
80
+ "decoder.block.13.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
81
+ "decoder.block.13.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
82
+ "decoder.block.13.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
83
+ "decoder.block.13.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
84
+ "decoder.block.13.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
85
+ "decoder.block.13.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
86
+ "decoder.block.13.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
87
+ "decoder.block.13.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
88
+ "decoder.block.13.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
89
+ "decoder.block.13.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
90
+ "decoder.block.13.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
91
+ "decoder.block.14.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
92
+ "decoder.block.14.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
93
+ "decoder.block.14.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
94
+ "decoder.block.14.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
95
+ "decoder.block.14.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
96
+ "decoder.block.14.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
97
+ "decoder.block.14.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
98
+ "decoder.block.14.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
99
+ "decoder.block.14.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
100
+ "decoder.block.14.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
101
+ "decoder.block.14.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
102
+ "decoder.block.14.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
103
+ "decoder.block.14.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
104
+ "decoder.block.14.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
105
+ "decoder.block.15.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
106
+ "decoder.block.15.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
107
+ "decoder.block.15.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
108
+ "decoder.block.15.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
109
+ "decoder.block.15.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
110
+ "decoder.block.15.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
111
+ "decoder.block.15.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
112
+ "decoder.block.15.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
113
+ "decoder.block.15.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
114
+ "decoder.block.15.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
115
+ "decoder.block.15.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
116
+ "decoder.block.15.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
117
+ "decoder.block.15.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
118
+ "decoder.block.15.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
119
+ "decoder.block.16.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
120
+ "decoder.block.16.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
121
+ "decoder.block.16.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
122
+ "decoder.block.16.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
123
+ "decoder.block.16.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
124
+ "decoder.block.16.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
125
+ "decoder.block.16.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
126
+ "decoder.block.16.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
127
+ "decoder.block.16.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
128
+ "decoder.block.16.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
129
+ "decoder.block.16.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
130
+ "decoder.block.16.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
131
+ "decoder.block.16.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
132
+ "decoder.block.16.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
133
+ "decoder.block.17.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
134
+ "decoder.block.17.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
135
+ "decoder.block.17.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
136
+ "decoder.block.17.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
137
+ "decoder.block.17.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
138
+ "decoder.block.17.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
139
+ "decoder.block.17.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
140
+ "decoder.block.17.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
141
+ "decoder.block.17.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
142
+ "decoder.block.17.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
143
+ "decoder.block.17.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
144
+ "decoder.block.17.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
145
+ "decoder.block.17.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
146
+ "decoder.block.17.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
147
+ "decoder.block.18.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
148
+ "decoder.block.18.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
149
+ "decoder.block.18.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
150
+ "decoder.block.18.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
151
+ "decoder.block.18.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
152
+ "decoder.block.18.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
153
+ "decoder.block.18.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
154
+ "decoder.block.18.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
155
+ "decoder.block.18.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
156
+ "decoder.block.18.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
157
+ "decoder.block.18.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
158
+ "decoder.block.18.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
159
+ "decoder.block.18.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
160
+ "decoder.block.18.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
161
+ "decoder.block.19.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
162
+ "decoder.block.19.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
163
+ "decoder.block.19.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
164
+ "decoder.block.19.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
165
+ "decoder.block.19.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
166
+ "decoder.block.19.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
167
+ "decoder.block.19.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
168
+ "decoder.block.19.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
169
+ "decoder.block.19.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
170
+ "decoder.block.19.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
171
+ "decoder.block.19.layer.2.DenseReluDense.wi_0.weight": "model-00003-of-00003.safetensors",
172
+ "decoder.block.19.layer.2.DenseReluDense.wi_1.weight": "model-00003-of-00003.safetensors",
173
+ "decoder.block.19.layer.2.DenseReluDense.wo.weight": "model-00003-of-00003.safetensors",
174
+ "decoder.block.19.layer.2.layer_norm.weight": "model-00003-of-00003.safetensors",
175
+ "decoder.block.2.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
176
+ "decoder.block.2.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
177
+ "decoder.block.2.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
178
+ "decoder.block.2.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
179
+ "decoder.block.2.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
180
+ "decoder.block.2.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
181
+ "decoder.block.2.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
182
+ "decoder.block.2.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
183
+ "decoder.block.2.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
184
+ "decoder.block.2.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
185
+ "decoder.block.2.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
186
+ "decoder.block.2.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
187
+ "decoder.block.2.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
188
+ "decoder.block.2.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
189
+ "decoder.block.20.layer.0.SelfAttention.k.weight": "model-00003-of-00003.safetensors",
190
+ "decoder.block.20.layer.0.SelfAttention.o.weight": "model-00003-of-00003.safetensors",
191
+ "decoder.block.20.layer.0.SelfAttention.q.weight": "model-00003-of-00003.safetensors",
192
+ "decoder.block.20.layer.0.SelfAttention.v.weight": "model-00003-of-00003.safetensors",
193
+ "decoder.block.20.layer.0.layer_norm.weight": "model-00003-of-00003.safetensors",
194
+ "decoder.block.20.layer.1.EncDecAttention.k.weight": "model-00003-of-00003.safetensors",
195
+ "decoder.block.20.layer.1.EncDecAttention.o.weight": "model-00003-of-00003.safetensors",
196
+ "decoder.block.20.layer.1.EncDecAttention.q.weight": "model-00003-of-00003.safetensors",
197
+ "decoder.block.20.layer.1.EncDecAttention.v.weight": "model-00003-of-00003.safetensors",
198
+ "decoder.block.20.layer.1.layer_norm.weight": "model-00003-of-00003.safetensors",
199
+ "decoder.block.20.layer.2.DenseReluDense.wi_0.weight": "model-00003-of-00003.safetensors",
200
+ "decoder.block.20.layer.2.DenseReluDense.wi_1.weight": "model-00003-of-00003.safetensors",
201
+ "decoder.block.20.layer.2.DenseReluDense.wo.weight": "model-00003-of-00003.safetensors",
202
+ "decoder.block.20.layer.2.layer_norm.weight": "model-00003-of-00003.safetensors",
203
+ "decoder.block.21.layer.0.SelfAttention.k.weight": "model-00003-of-00003.safetensors",
204
+ "decoder.block.21.layer.0.SelfAttention.o.weight": "model-00003-of-00003.safetensors",
205
+ "decoder.block.21.layer.0.SelfAttention.q.weight": "model-00003-of-00003.safetensors",
206
+ "decoder.block.21.layer.0.SelfAttention.v.weight": "model-00003-of-00003.safetensors",
207
+ "decoder.block.21.layer.0.layer_norm.weight": "model-00003-of-00003.safetensors",
208
+ "decoder.block.21.layer.1.EncDecAttention.k.weight": "model-00003-of-00003.safetensors",
209
+ "decoder.block.21.layer.1.EncDecAttention.o.weight": "model-00003-of-00003.safetensors",
210
+ "decoder.block.21.layer.1.EncDecAttention.q.weight": "model-00003-of-00003.safetensors",
211
+ "decoder.block.21.layer.1.EncDecAttention.v.weight": "model-00003-of-00003.safetensors",
212
+ "decoder.block.21.layer.1.layer_norm.weight": "model-00003-of-00003.safetensors",
213
+ "decoder.block.21.layer.2.DenseReluDense.wi_0.weight": "model-00003-of-00003.safetensors",
214
+ "decoder.block.21.layer.2.DenseReluDense.wi_1.weight": "model-00003-of-00003.safetensors",
215
+ "decoder.block.21.layer.2.DenseReluDense.wo.weight": "model-00003-of-00003.safetensors",
216
+ "decoder.block.21.layer.2.layer_norm.weight": "model-00003-of-00003.safetensors",
217
+ "decoder.block.22.layer.0.SelfAttention.k.weight": "model-00003-of-00003.safetensors",
218
+ "decoder.block.22.layer.0.SelfAttention.o.weight": "model-00003-of-00003.safetensors",
219
+ "decoder.block.22.layer.0.SelfAttention.q.weight": "model-00003-of-00003.safetensors",
220
+ "decoder.block.22.layer.0.SelfAttention.v.weight": "model-00003-of-00003.safetensors",
221
+ "decoder.block.22.layer.0.layer_norm.weight": "model-00003-of-00003.safetensors",
222
+ "decoder.block.22.layer.1.EncDecAttention.k.weight": "model-00003-of-00003.safetensors",
223
+ "decoder.block.22.layer.1.EncDecAttention.o.weight": "model-00003-of-00003.safetensors",
224
+ "decoder.block.22.layer.1.EncDecAttention.q.weight": "model-00003-of-00003.safetensors",
225
+ "decoder.block.22.layer.1.EncDecAttention.v.weight": "model-00003-of-00003.safetensors",
226
+ "decoder.block.22.layer.1.layer_norm.weight": "model-00003-of-00003.safetensors",
227
+ "decoder.block.22.layer.2.DenseReluDense.wi_0.weight": "model-00003-of-00003.safetensors",
228
+ "decoder.block.22.layer.2.DenseReluDense.wi_1.weight": "model-00003-of-00003.safetensors",
229
+ "decoder.block.22.layer.2.DenseReluDense.wo.weight": "model-00003-of-00003.safetensors",
230
+ "decoder.block.22.layer.2.layer_norm.weight": "model-00003-of-00003.safetensors",
231
+ "decoder.block.23.layer.0.SelfAttention.k.weight": "model-00003-of-00003.safetensors",
232
+ "decoder.block.23.layer.0.SelfAttention.o.weight": "model-00003-of-00003.safetensors",
233
+ "decoder.block.23.layer.0.SelfAttention.q.weight": "model-00003-of-00003.safetensors",
234
+ "decoder.block.23.layer.0.SelfAttention.v.weight": "model-00003-of-00003.safetensors",
235
+ "decoder.block.23.layer.0.layer_norm.weight": "model-00003-of-00003.safetensors",
236
+ "decoder.block.23.layer.1.EncDecAttention.k.weight": "model-00003-of-00003.safetensors",
237
+ "decoder.block.23.layer.1.EncDecAttention.o.weight": "model-00003-of-00003.safetensors",
238
+ "decoder.block.23.layer.1.EncDecAttention.q.weight": "model-00003-of-00003.safetensors",
239
+ "decoder.block.23.layer.1.EncDecAttention.v.weight": "model-00003-of-00003.safetensors",
240
+ "decoder.block.23.layer.1.layer_norm.weight": "model-00003-of-00003.safetensors",
241
+ "decoder.block.23.layer.2.DenseReluDense.wi_0.weight": "model-00003-of-00003.safetensors",
242
+ "decoder.block.23.layer.2.DenseReluDense.wi_1.weight": "model-00003-of-00003.safetensors",
243
+ "decoder.block.23.layer.2.DenseReluDense.wo.weight": "model-00003-of-00003.safetensors",
244
+ "decoder.block.23.layer.2.layer_norm.weight": "model-00003-of-00003.safetensors",
245
+ "decoder.block.3.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
246
+ "decoder.block.3.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
247
+ "decoder.block.3.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
248
+ "decoder.block.3.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
249
+ "decoder.block.3.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
250
+ "decoder.block.3.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
251
+ "decoder.block.3.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
252
+ "decoder.block.3.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
253
+ "decoder.block.3.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
254
+ "decoder.block.3.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
255
+ "decoder.block.3.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
256
+ "decoder.block.3.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
257
+ "decoder.block.3.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
258
+ "decoder.block.3.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
259
+ "decoder.block.4.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
260
+ "decoder.block.4.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
261
+ "decoder.block.4.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
262
+ "decoder.block.4.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
263
+ "decoder.block.4.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
264
+ "decoder.block.4.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
265
+ "decoder.block.4.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
266
+ "decoder.block.4.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
267
+ "decoder.block.4.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
268
+ "decoder.block.4.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
269
+ "decoder.block.4.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
270
+ "decoder.block.4.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
271
+ "decoder.block.4.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
272
+ "decoder.block.4.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
273
+ "decoder.block.5.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
274
+ "decoder.block.5.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
275
+ "decoder.block.5.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
276
+ "decoder.block.5.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
277
+ "decoder.block.5.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
278
+ "decoder.block.5.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
279
+ "decoder.block.5.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
280
+ "decoder.block.5.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
281
+ "decoder.block.5.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
282
+ "decoder.block.5.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
283
+ "decoder.block.5.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
284
+ "decoder.block.5.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
285
+ "decoder.block.5.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
286
+ "decoder.block.5.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
287
+ "decoder.block.6.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
288
+ "decoder.block.6.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
289
+ "decoder.block.6.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
290
+ "decoder.block.6.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
291
+ "decoder.block.6.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
292
+ "decoder.block.6.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
293
+ "decoder.block.6.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
294
+ "decoder.block.6.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
295
+ "decoder.block.6.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
296
+ "decoder.block.6.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
297
+ "decoder.block.6.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
298
+ "decoder.block.6.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
299
+ "decoder.block.6.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
300
+ "decoder.block.6.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
301
+ "decoder.block.7.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
302
+ "decoder.block.7.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
303
+ "decoder.block.7.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
304
+ "decoder.block.7.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
305
+ "decoder.block.7.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
306
+ "decoder.block.7.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
307
+ "decoder.block.7.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
308
+ "decoder.block.7.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
309
+ "decoder.block.7.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
310
+ "decoder.block.7.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
311
+ "decoder.block.7.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
312
+ "decoder.block.7.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
313
+ "decoder.block.7.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
314
+ "decoder.block.7.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
315
+ "decoder.block.8.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
316
+ "decoder.block.8.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
317
+ "decoder.block.8.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
318
+ "decoder.block.8.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
319
+ "decoder.block.8.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
320
+ "decoder.block.8.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
321
+ "decoder.block.8.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
322
+ "decoder.block.8.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
323
+ "decoder.block.8.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
324
+ "decoder.block.8.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
325
+ "decoder.block.8.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
326
+ "decoder.block.8.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
327
+ "decoder.block.8.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
328
+ "decoder.block.8.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
329
+ "decoder.block.9.layer.0.SelfAttention.k.weight": "model-00002-of-00003.safetensors",
330
+ "decoder.block.9.layer.0.SelfAttention.o.weight": "model-00002-of-00003.safetensors",
331
+ "decoder.block.9.layer.0.SelfAttention.q.weight": "model-00002-of-00003.safetensors",
332
+ "decoder.block.9.layer.0.SelfAttention.v.weight": "model-00002-of-00003.safetensors",
333
+ "decoder.block.9.layer.0.layer_norm.weight": "model-00002-of-00003.safetensors",
334
+ "decoder.block.9.layer.1.EncDecAttention.k.weight": "model-00002-of-00003.safetensors",
335
+ "decoder.block.9.layer.1.EncDecAttention.o.weight": "model-00002-of-00003.safetensors",
336
+ "decoder.block.9.layer.1.EncDecAttention.q.weight": "model-00002-of-00003.safetensors",
337
+ "decoder.block.9.layer.1.EncDecAttention.v.weight": "model-00002-of-00003.safetensors",
338
+ "decoder.block.9.layer.1.layer_norm.weight": "model-00002-of-00003.safetensors",
339
+ "decoder.block.9.layer.2.DenseReluDense.wi_0.weight": "model-00002-of-00003.safetensors",
340
+ "decoder.block.9.layer.2.DenseReluDense.wi_1.weight": "model-00002-of-00003.safetensors",
341
+ "decoder.block.9.layer.2.DenseReluDense.wo.weight": "model-00002-of-00003.safetensors",
342
+ "decoder.block.9.layer.2.layer_norm.weight": "model-00002-of-00003.safetensors",
343
+ "decoder.final_layer_norm.weight": "model-00003-of-00003.safetensors",
344
+ "encoder.block.0.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
345
+ "encoder.block.0.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
346
+ "encoder.block.0.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
347
+ "encoder.block.0.layer.0.SelfAttention.relative_attention_bias.weight": "model-00001-of-00003.safetensors",
348
+ "encoder.block.0.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
349
+ "encoder.block.0.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
350
+ "encoder.block.0.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
351
+ "encoder.block.0.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
352
+ "encoder.block.0.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
353
+ "encoder.block.0.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
354
+ "encoder.block.1.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
355
+ "encoder.block.1.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
356
+ "encoder.block.1.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
357
+ "encoder.block.1.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
358
+ "encoder.block.1.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
359
+ "encoder.block.1.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
360
+ "encoder.block.1.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
361
+ "encoder.block.1.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
362
+ "encoder.block.1.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
363
+ "encoder.block.10.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
364
+ "encoder.block.10.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
365
+ "encoder.block.10.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
366
+ "encoder.block.10.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
367
+ "encoder.block.10.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
368
+ "encoder.block.10.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
369
+ "encoder.block.10.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
370
+ "encoder.block.10.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
371
+ "encoder.block.10.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
372
+ "encoder.block.11.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
373
+ "encoder.block.11.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
374
+ "encoder.block.11.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
375
+ "encoder.block.11.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
376
+ "encoder.block.11.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
377
+ "encoder.block.11.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
378
+ "encoder.block.11.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
379
+ "encoder.block.11.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
380
+ "encoder.block.11.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
381
+ "encoder.block.12.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
382
+ "encoder.block.12.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
383
+ "encoder.block.12.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
384
+ "encoder.block.12.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
385
+ "encoder.block.12.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
386
+ "encoder.block.12.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
387
+ "encoder.block.12.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
388
+ "encoder.block.12.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
389
+ "encoder.block.12.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
390
+ "encoder.block.13.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
391
+ "encoder.block.13.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
392
+ "encoder.block.13.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
393
+ "encoder.block.13.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
394
+ "encoder.block.13.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
395
+ "encoder.block.13.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
396
+ "encoder.block.13.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
397
+ "encoder.block.13.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
398
+ "encoder.block.13.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
399
+ "encoder.block.14.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
400
+ "encoder.block.14.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
401
+ "encoder.block.14.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
402
+ "encoder.block.14.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
403
+ "encoder.block.14.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
404
+ "encoder.block.14.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
405
+ "encoder.block.14.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
406
+ "encoder.block.14.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
407
+ "encoder.block.14.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
408
+ "encoder.block.15.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
409
+ "encoder.block.15.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
410
+ "encoder.block.15.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
411
+ "encoder.block.15.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
412
+ "encoder.block.15.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
413
+ "encoder.block.15.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
414
+ "encoder.block.15.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
415
+ "encoder.block.15.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
416
+ "encoder.block.15.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
417
+ "encoder.block.16.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
418
+ "encoder.block.16.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
419
+ "encoder.block.16.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
420
+ "encoder.block.16.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
421
+ "encoder.block.16.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
422
+ "encoder.block.16.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
423
+ "encoder.block.16.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
424
+ "encoder.block.16.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
425
+ "encoder.block.16.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
426
+ "encoder.block.17.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
427
+ "encoder.block.17.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
428
+ "encoder.block.17.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
429
+ "encoder.block.17.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
430
+ "encoder.block.17.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
431
+ "encoder.block.17.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
432
+ "encoder.block.17.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
433
+ "encoder.block.17.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
434
+ "encoder.block.17.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
435
+ "encoder.block.18.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
436
+ "encoder.block.18.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
437
+ "encoder.block.18.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
438
+ "encoder.block.18.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
439
+ "encoder.block.18.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
440
+ "encoder.block.18.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
441
+ "encoder.block.18.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
442
+ "encoder.block.18.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
443
+ "encoder.block.18.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
444
+ "encoder.block.19.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
445
+ "encoder.block.19.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
446
+ "encoder.block.19.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
447
+ "encoder.block.19.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
448
+ "encoder.block.19.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
449
+ "encoder.block.19.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
450
+ "encoder.block.19.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
451
+ "encoder.block.19.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
452
+ "encoder.block.19.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
453
+ "encoder.block.2.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
454
+ "encoder.block.2.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
455
+ "encoder.block.2.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
456
+ "encoder.block.2.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
457
+ "encoder.block.2.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
458
+ "encoder.block.2.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
459
+ "encoder.block.2.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
460
+ "encoder.block.2.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
461
+ "encoder.block.2.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
462
+ "encoder.block.20.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
463
+ "encoder.block.20.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
464
+ "encoder.block.20.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
465
+ "encoder.block.20.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
466
+ "encoder.block.20.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
467
+ "encoder.block.20.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
468
+ "encoder.block.20.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
469
+ "encoder.block.20.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
470
+ "encoder.block.20.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
471
+ "encoder.block.21.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
472
+ "encoder.block.21.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
473
+ "encoder.block.21.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
474
+ "encoder.block.21.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
475
+ "encoder.block.21.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
476
+ "encoder.block.21.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
477
+ "encoder.block.21.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
478
+ "encoder.block.21.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
479
+ "encoder.block.21.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
480
+ "encoder.block.22.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
481
+ "encoder.block.22.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
482
+ "encoder.block.22.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
483
+ "encoder.block.22.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
484
+ "encoder.block.22.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
485
+ "encoder.block.22.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
486
+ "encoder.block.22.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
487
+ "encoder.block.22.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
488
+ "encoder.block.22.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
489
+ "encoder.block.23.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
490
+ "encoder.block.23.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
491
+ "encoder.block.23.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
492
+ "encoder.block.23.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
493
+ "encoder.block.23.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
494
+ "encoder.block.23.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
495
+ "encoder.block.23.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
496
+ "encoder.block.23.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
497
+ "encoder.block.23.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
498
+ "encoder.block.3.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
499
+ "encoder.block.3.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
500
+ "encoder.block.3.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
501
+ "encoder.block.3.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
502
+ "encoder.block.3.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
503
+ "encoder.block.3.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
504
+ "encoder.block.3.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
505
+ "encoder.block.3.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
506
+ "encoder.block.3.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
507
+ "encoder.block.4.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
508
+ "encoder.block.4.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
509
+ "encoder.block.4.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
510
+ "encoder.block.4.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
511
+ "encoder.block.4.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
512
+ "encoder.block.4.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
513
+ "encoder.block.4.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
514
+ "encoder.block.4.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
515
+ "encoder.block.4.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
516
+ "encoder.block.5.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
517
+ "encoder.block.5.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
518
+ "encoder.block.5.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
519
+ "encoder.block.5.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
520
+ "encoder.block.5.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
521
+ "encoder.block.5.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
522
+ "encoder.block.5.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
523
+ "encoder.block.5.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
524
+ "encoder.block.5.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
525
+ "encoder.block.6.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
526
+ "encoder.block.6.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
527
+ "encoder.block.6.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
528
+ "encoder.block.6.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
529
+ "encoder.block.6.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
530
+ "encoder.block.6.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
531
+ "encoder.block.6.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
532
+ "encoder.block.6.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
533
+ "encoder.block.6.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
534
+ "encoder.block.7.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
535
+ "encoder.block.7.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
536
+ "encoder.block.7.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
537
+ "encoder.block.7.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
538
+ "encoder.block.7.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
539
+ "encoder.block.7.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
540
+ "encoder.block.7.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
541
+ "encoder.block.7.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
542
+ "encoder.block.7.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
543
+ "encoder.block.8.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
544
+ "encoder.block.8.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
545
+ "encoder.block.8.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
546
+ "encoder.block.8.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
547
+ "encoder.block.8.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
548
+ "encoder.block.8.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
549
+ "encoder.block.8.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
550
+ "encoder.block.8.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
551
+ "encoder.block.8.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
552
+ "encoder.block.9.layer.0.SelfAttention.k.weight": "model-00001-of-00003.safetensors",
553
+ "encoder.block.9.layer.0.SelfAttention.o.weight": "model-00001-of-00003.safetensors",
554
+ "encoder.block.9.layer.0.SelfAttention.q.weight": "model-00001-of-00003.safetensors",
555
+ "encoder.block.9.layer.0.SelfAttention.v.weight": "model-00001-of-00003.safetensors",
556
+ "encoder.block.9.layer.0.layer_norm.weight": "model-00001-of-00003.safetensors",
557
+ "encoder.block.9.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00003.safetensors",
558
+ "encoder.block.9.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00003.safetensors",
559
+ "encoder.block.9.layer.1.DenseReluDense.wo.weight": "model-00001-of-00003.safetensors",
560
+ "encoder.block.9.layer.1.layer_norm.weight": "model-00001-of-00003.safetensors",
561
+ "encoder.final_layer_norm.weight": "model-00001-of-00003.safetensors",
562
+ "encoder.mm_projector.bias": "model-00001-of-00003.safetensors",
563
+ "encoder.mm_projector.weight": "model-00001-of-00003.safetensors",
564
+ "lm_head.weight": "model-00003-of-00003.safetensors",
565
+ "shared.weight": "model-00001-of-00003.safetensors"
566
+ }
567
+ }