itsabhishek19 commited on
Commit
6358e2d
·
verified ·
1 Parent(s): 5fdf5b8

Upload 29 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
added_tokens.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</box>": 151651,
3
+ "</image>": 151647,
4
+ "</image_id>": 151659,
5
+ "</point>": 151655,
6
+ "</quad>": 151653,
7
+ "</ref>": 151649,
8
+ "</slice>": 151657,
9
+ "<box>": 151650,
10
+ "<image>": 151646,
11
+ "<image_id>": 151658,
12
+ "<point>": 151654,
13
+ "<quad>": 151652,
14
+ "<ref>": 151648,
15
+ "<slice>": 151656,
16
+ "<|endoftext|>": 151643,
17
+ "<|im_end|>": 151645,
18
+ "<|im_start|>": 151644,
19
+ "<|reserved_special_token_0|>": 151660,
20
+ "<|reserved_special_token_1|>": 151661,
21
+ "<|reserved_special_token_2|>": 151662,
22
+ "<|reserved_special_token_3|>": 151663,
23
+ "<|reserved_special_token_4|>": 151664,
24
+ "<|reserved_special_token_5|>": 151665
25
+ }
chat_template.jinja ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system
2
+ You are a helpful assistant.<|im_end|>
3
+ ' }}{% endif %}{{'<|im_start|>' + message['role'] + '
4
+ ' + message['content'] + '<|im_end|>' + '
5
+ '}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
6
+ ' }}{% endif %}
config.json ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MiniCPMV"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_minicpm.MiniCPMVConfig",
8
+ "AutoModel": "modeling_minicpmv.MiniCPMV",
9
+ "AutoModelForCausalLM": "modeling_minicpmv.MiniCPMV"
10
+ },
11
+ "batch_vision_input": true,
12
+ "bos_token_id": 151643,
13
+ "drop_vision_last_layer": false,
14
+ "eos_token_id": 151645,
15
+ "hidden_act": "silu",
16
+ "hidden_size": 3584,
17
+ "image_size": 448,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 18944,
20
+ "layer_types": [
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention"
49
+ ],
50
+ "max_position_embeddings": 32768,
51
+ "max_window_layers": 28,
52
+ "model_type": "minicpmv",
53
+ "num_attention_heads": 28,
54
+ "num_hidden_layers": 28,
55
+ "num_key_value_heads": 4,
56
+ "patch_size": 14,
57
+ "query_num": 64,
58
+ "rms_norm_eps": 1e-06,
59
+ "rope_scaling": null,
60
+ "rope_theta": 1000000.0,
61
+ "slice_config": {
62
+ "max_slice_nums": 9,
63
+ "model_type": "minicpmv",
64
+ "patch_size": 14,
65
+ "scale_resolution": 448
66
+ },
67
+ "slice_mode": true,
68
+ "sliding_window": null,
69
+ "tie_word_embeddings": false,
70
+ "torch_dtype": "bfloat16",
71
+ "transformers_version": "4.53.3",
72
+ "use_cache": true,
73
+ "use_image_id": true,
74
+ "use_sliding_window": false,
75
+ "version": 2.6,
76
+ "vision_batch_size": 16,
77
+ "vision_config": {
78
+ "attention_dropout": 0.0,
79
+ "hidden_act": "gelu_pytorch_tanh",
80
+ "hidden_size": 1152,
81
+ "image_size": 980,
82
+ "intermediate_size": 4304,
83
+ "layer_norm_eps": 1e-06,
84
+ "model_type": "siglip_vision_model",
85
+ "num_attention_heads": 16,
86
+ "num_channels": 3,
87
+ "num_hidden_layers": 27,
88
+ "patch_size": 14
89
+ },
90
+ "vocab_size": 151666
91
+ }
configuration_minicpm.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ """ MiniCPMV model configuration"""
3
+
4
+ import os
5
+ from typing import Union
6
+
7
+ from transformers.utils import logging
8
+ from transformers import Qwen2Config, PretrainedConfig
9
+ from .modeling_navit_siglip import SiglipVisionConfig
10
+
11
+ logger = logging.get_logger(__name__)
12
+
13
+
14
+ class MiniCPMVSliceConfig(PretrainedConfig):
15
+ model_type = "minicpmv"
16
+
17
+ def __init__(
18
+ self,
19
+ patch_size=14,
20
+ max_slice_nums=9,
21
+ scale_resolution=448,
22
+ **kwargs,
23
+ ):
24
+ super().__init__(**kwargs)
25
+ self.patch_size = patch_size
26
+ self.max_slice_nums = max_slice_nums
27
+ self.scale_resolution = scale_resolution
28
+
29
+ @classmethod
30
+ def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig":
31
+ cls._set_token_in_kwargs(kwargs)
32
+
33
+ config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
34
+
35
+ if config_dict.get("model_type") == "minicpmv":
36
+ config_dict = config_dict["slice_config"]
37
+
38
+ if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type:
39
+ logger.warning(
40
+ f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
41
+ f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
42
+ )
43
+
44
+ return cls.from_dict(config_dict, **kwargs)
45
+
46
+
47
+
48
+ class MiniCPMVConfig(Qwen2Config):
49
+ model_type = "minicpmv"
50
+ keys_to_ignore_at_inference = ["past_key_values"]
51
+
52
+ default_vision_config = {
53
+ "hidden_size": 1152,
54
+ "image_size": 980,
55
+ "intermediate_size": 4304,
56
+ "model_type": "siglip",
57
+ "num_attention_heads": 16,
58
+ "num_hidden_layers": 27,
59
+ "patch_size": 14,
60
+ }
61
+
62
+ def __init__(
63
+ self,
64
+ use_cache=True,
65
+ query_num=64,
66
+ image_size=448,
67
+ drop_vision_last_layer=True,
68
+ batch_vision_input=True,
69
+ slice_config=None,
70
+ vision_config=None,
71
+ use_image_id=True,
72
+ vision_batch_size=16,
73
+ **kwargs,
74
+ ):
75
+ self.use_cache = use_cache
76
+ self.query_num = query_num
77
+ self.image_size = image_size
78
+ self.drop_vision_last_layer = drop_vision_last_layer
79
+ self.batch_vision_input = batch_vision_input
80
+ self.use_image_id = use_image_id
81
+ self.vision_batch_size = vision_batch_size
82
+
83
+ if slice_config is None:
84
+ self.slice_config = MiniCPMVSliceConfig(max_slice_nums=1)
85
+ else:
86
+ self.slice_config = MiniCPMVSliceConfig(**slice_config)
87
+ self.slice_mode = True
88
+
89
+ # same as HuggingFaceM4/siglip-so400m-14-980-flash-attn2-navit add tgt_sizes
90
+ if vision_config is None:
91
+ self.vision_config = SiglipVisionConfig(**self.default_vision_config)
92
+ logger.info("vision_config is None, using default vision config")
93
+ elif isinstance(vision_config, dict):
94
+ self.vision_config = SiglipVisionConfig(**vision_config)
95
+ elif isinstance(vision_config, SiglipVisionConfig):
96
+ self.vision_config = vision_config
97
+
98
+ self.patch_size = self.vision_config.patch_size
99
+
100
+ super().__init__(**kwargs)
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 151643,
4
+ "eos_token_id": 151645,
5
+ "transformers_version": "4.53.3"
6
+ }
image_processing_minicpmv.py ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Union, Dict, Any, List
2
+
3
+ import torch
4
+ import math
5
+ import PIL.Image
6
+ import PIL.ImageSequence
7
+ import numpy as np
8
+ import PIL
9
+ from PIL import Image
10
+
11
+ from transformers.utils import TensorType, requires_backends, is_torch_dtype, is_torch_device
12
+ from transformers.image_processing_utils import BaseImageProcessor, BatchFeature
13
+ from transformers import AutoImageProcessor
14
+ from transformers.image_transforms import to_channel_dimension_format
15
+ from transformers.image_utils import (
16
+ ImageInput,
17
+ make_list_of_images,
18
+ valid_images,
19
+ is_torch_tensor,
20
+ is_batched,
21
+ to_numpy_array,
22
+ infer_channel_dimension_format,
23
+ ChannelDimension
24
+ )
25
+
26
+
27
+ def recursive_converter(converter, value):
28
+ if isinstance(value, list):
29
+ new_value = []
30
+ for v in value:
31
+ new_value += [recursive_converter(converter, v)]
32
+ return new_value
33
+ else:
34
+ return converter(value)
35
+
36
+
37
+ class MiniCPMVBatchFeature(BatchFeature):
38
+ r"""
39
+ Extend from BatchFeature for supporting various image size
40
+ """
41
+ def __init__(self, data: Optional[Dict[str, Any]] = None, tensor_type: Union[None, str, TensorType] = None):
42
+ super().__init__(data)
43
+ self.convert_to_tensors(tensor_type=tensor_type)
44
+
45
+ def convert_to_tensors(self, tensor_type: Optional[Union[str, TensorType]] = None):
46
+ if tensor_type is None:
47
+ return self
48
+
49
+ is_tensor, as_tensor = self._get_is_as_tensor_fns(tensor_type)
50
+
51
+ def converter(value):
52
+ try:
53
+ if not is_tensor(value):
54
+ tensor = as_tensor(value)
55
+ return tensor
56
+ except: # noqa E722
57
+ if key == "overflowing_values":
58
+ raise ValueError("Unable to create tensor returning overflowing values of different lengths. ")
59
+ raise ValueError(
60
+ "Unable to create tensor, you should probably activate padding "
61
+ "with 'padding=True' to have batched tensors with the same length."
62
+ )
63
+
64
+
65
+ for key, value in self.items():
66
+ self[key] = recursive_converter(converter, value)
67
+ return self
68
+
69
+ def to(self, *args, **kwargs) -> "MiniCPMVBatchFeature":
70
+ requires_backends(self, ["torch"])
71
+ import torch
72
+
73
+ def cast_tensor(v):
74
+ # check if v is a floating point
75
+ if torch.is_floating_point(v):
76
+ # cast and send to device
77
+ return v.to(*args, **kwargs)
78
+ elif device is not None:
79
+ return v.to(device=device)
80
+ else:
81
+ return v
82
+
83
+ new_data = {}
84
+ device = kwargs.get("device")
85
+ # Check if the args are a device or a dtype
86
+ if device is None and len(args) > 0:
87
+ # device should be always the first argument
88
+ arg = args[0]
89
+ if is_torch_dtype(arg):
90
+ # The first argument is a dtype
91
+ pass
92
+ elif isinstance(arg, str) or is_torch_device(arg) or isinstance(arg, int):
93
+ device = arg
94
+ else:
95
+ # it's something else
96
+ raise ValueError(f"Attempting to cast a BatchFeature to type {str(arg)}. This is not supported.")
97
+ # We cast only floating point tensors to avoid issues with tokenizers casting `LongTensor` to `FloatTensor`
98
+ for k, v in self.items():
99
+ new_data[k] = recursive_converter(cast_tensor, v)
100
+ self.data = new_data
101
+ return self
102
+
103
+
104
+ class MiniCPMVImageProcessor(BaseImageProcessor):
105
+ model_input_names = ["pixel_values"]
106
+
107
+ def __init__(
108
+ self,
109
+ max_slice_nums=9,
110
+ scale_resolution=448,
111
+ patch_size=14,
112
+ **kwargs):
113
+ super().__init__(**kwargs)
114
+ self.max_slice_nums = max_slice_nums
115
+ self.scale_resolution = scale_resolution
116
+ self.patch_size = patch_size
117
+ self.use_image_id = kwargs.pop("use_image_id", False)
118
+ self.image_feature_size = kwargs.pop("image_feature_size", 64)
119
+ self.im_start_token = kwargs.pop("im_start", "<image>")
120
+ self.im_end_token = kwargs.pop("im_end", "</image>")
121
+ self.slice_start_token = kwargs.pop("slice_start", "<slice>")
122
+ self.slice_end_token = kwargs.pop("slice_end", "</slice>")
123
+ self.unk_token = kwargs.pop("unk", "<unk>")
124
+ self.im_id_start = kwargs.pop("im_id_start", "<image_id>")
125
+ self.im_id_end = kwargs.pop("im_id_end", "</image_id>")
126
+ self.slice_mode = kwargs.pop("slice_mode", True)
127
+ self.mean = np.array(kwargs.pop("norm_mean", [0.5, 0.5, 0.5]))
128
+ self.std = np.array(kwargs.pop("norm_std", [0.5, 0.5, 0.5]))
129
+ self.version = kwargs.pop("version", 2.0)
130
+
131
+ def ensure_divide(self, length, patch_size):
132
+ return max(round(length / patch_size) * patch_size, patch_size)
133
+
134
+ def find_best_resize(self,
135
+ original_size,
136
+ scale_resolution,
137
+ patch_size,
138
+ allow_upscale=False):
139
+ width, height = original_size
140
+ if (width * height >
141
+ scale_resolution * scale_resolution) or allow_upscale:
142
+ r = width / height
143
+ height = int(scale_resolution / math.sqrt(r))
144
+ width = int(height * r)
145
+ best_width = self.ensure_divide(width, patch_size)
146
+ best_height = self.ensure_divide(height, patch_size)
147
+ return (best_width, best_height)
148
+
149
+ def get_refine_size(self,
150
+ original_size,
151
+ grid,
152
+ scale_resolution,
153
+ patch_size,
154
+ allow_upscale=False):
155
+ width, height = original_size
156
+ grid_x, grid_y = grid
157
+
158
+ refine_width = self.ensure_divide(width, grid_x)
159
+ refine_height = self.ensure_divide(height, grid_y)
160
+
161
+ grid_width = refine_width / grid_x
162
+ grid_height = refine_height / grid_y
163
+
164
+ best_grid_size = self.find_best_resize((grid_width, grid_height),
165
+ scale_resolution,
166
+ patch_size,
167
+ allow_upscale=allow_upscale)
168
+ refine_size = (best_grid_size[0] * grid_x, best_grid_size[1] * grid_y)
169
+ return refine_size
170
+
171
+ def split_to_patches(self, image, grid):
172
+ patches = []
173
+ width, height = image.size
174
+ grid_x = int(width / grid[0])
175
+ grid_y = int(height / grid[1])
176
+ for i in range(0, height, grid_y):
177
+ images = []
178
+ for j in range(0, width, grid_x):
179
+ box = (j, i, j + grid_x, i + grid_y)
180
+ patch = image.crop(box)
181
+ images.append(patch)
182
+ patches.append(images)
183
+ return patches
184
+
185
+ def slice_image(
186
+ self, image, max_slice_nums=9, scale_resolution=448, patch_size=14, never_split=False
187
+ ):
188
+ original_size = image.size
189
+ source_image = None
190
+ best_grid = self.get_sliced_grid(original_size, max_slice_nums, never_split)
191
+ patches = []
192
+
193
+ if best_grid is None:
194
+ # dont need to slice, upsample
195
+ best_size = self.find_best_resize(
196
+ original_size, scale_resolution, patch_size, allow_upscale=True
197
+ )
198
+ source_image = image.resize(best_size, resample=Image.Resampling.BICUBIC)
199
+ else:
200
+ # source image, down-sampling and ensure divided by patch_size
201
+ best_resize = self.find_best_resize(original_size, scale_resolution, patch_size)
202
+ source_image = image.copy().resize(best_resize, resample=Image.Resampling.BICUBIC)
203
+ refine_size = self.get_refine_size(
204
+ original_size, best_grid, scale_resolution, patch_size, allow_upscale=True
205
+ )
206
+ refine_image = image.resize(refine_size, resample=Image.Resampling.BICUBIC)
207
+ patches = self.split_to_patches(refine_image, best_grid)
208
+
209
+ return source_image, patches, best_grid
210
+
211
+ def get_grid_placeholder(self, grid):
212
+ if grid is None:
213
+ return ""
214
+ slice_image_placeholder = (
215
+ self.slice_start_token
216
+ + self.unk_token * self.image_feature_size
217
+ + self.slice_end_token
218
+ )
219
+
220
+ cols = grid[0]
221
+ rows = grid[1]
222
+ slices = []
223
+ for i in range(rows):
224
+ lines = []
225
+ for j in range(cols):
226
+ lines.append(slice_image_placeholder)
227
+ slices.append("".join(lines))
228
+
229
+ slice_placeholder = "\n".join(slices)
230
+ return slice_placeholder
231
+
232
+ def get_image_id_placeholder(self, idx=0):
233
+ return f"{self.im_id_start}{idx}{self.im_id_end}"
234
+
235
+ def get_sliced_images(self, image, max_slice_nums=None):
236
+ slice_images = []
237
+
238
+ if not self.slice_mode:
239
+ return [image]
240
+
241
+ max_slice_nums = self.max_slice_nums if max_slice_nums is None else int(max_slice_nums)
242
+ assert max_slice_nums > 0
243
+ source_image, patches, sliced_grid = self.slice_image(
244
+ image,
245
+ max_slice_nums, # default: 9
246
+ self.scale_resolution, # default: 448
247
+ self.patch_size # default: 14
248
+ )
249
+
250
+ slice_images.append(source_image)
251
+ if len(patches) > 0:
252
+ for i in range(len(patches)):
253
+ for j in range(len(patches[0])):
254
+ slice_images.append(patches[i][j])
255
+ return slice_images
256
+
257
+ def get_sliced_grid(self, image_size, max_slice_nums, nerver_split=False):
258
+ original_width, original_height = image_size
259
+ log_ratio = math.log(original_width / original_height)
260
+ ratio = original_width * original_height / (self.scale_resolution * self.scale_resolution)
261
+ multiple = min(math.ceil(ratio), max_slice_nums)
262
+ if multiple <= 1 or nerver_split:
263
+ return None
264
+ candidate_split_grids_nums = []
265
+ for i in [multiple - 1, multiple, multiple + 1]:
266
+ if i == 1 or i > max_slice_nums:
267
+ continue
268
+ candidate_split_grids_nums.append(i)
269
+
270
+ candidate_grids = []
271
+ for split_grids_nums in candidate_split_grids_nums:
272
+ m = 1
273
+ while m <= split_grids_nums:
274
+ if split_grids_nums % m == 0:
275
+ candidate_grids.append([m, split_grids_nums // m])
276
+ m += 1
277
+
278
+ best_grid = [1, 1]
279
+ min_error = float("inf")
280
+ for grid in candidate_grids:
281
+ error = abs(log_ratio - math.log(grid[0] / grid[1]))
282
+ if error < min_error:
283
+ best_grid = grid
284
+ min_error = error
285
+
286
+ return best_grid
287
+
288
+ def get_slice_image_placeholder(self, image_size, image_idx=0, max_slice_nums=None, use_image_id=None):
289
+ max_slice_nums = self.max_slice_nums if max_slice_nums is None else int(max_slice_nums)
290
+ assert max_slice_nums > 0
291
+ grid = self.get_sliced_grid(image_size=image_size, max_slice_nums=max_slice_nums)
292
+
293
+ image_placeholder = (
294
+ self.im_start_token
295
+ + self.unk_token * self.image_feature_size
296
+ + self.im_end_token
297
+ )
298
+ use_image_id = self.use_image_id if use_image_id is None else bool(use_image_id)
299
+ if use_image_id:
300
+ final_placeholder = self.get_image_id_placeholder(image_idx) + image_placeholder
301
+ else:
302
+ final_placeholder = image_placeholder
303
+
304
+ if self.slice_mode:
305
+ final_placeholder = final_placeholder + self.get_grid_placeholder(grid=grid)
306
+ return final_placeholder
307
+
308
+ def to_pil_image(self, image, rescale=None) -> PIL.Image.Image:
309
+ """
310
+ Converts `image` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
311
+ needed.
312
+
313
+ Args:
314
+ image (`PIL.Image.Image` or `numpy.ndarray` or `torch.Tensor`):
315
+ The image to convert to the PIL Image format.
316
+ rescale (`bool`, *optional*):
317
+ Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will
318
+ default to `True` if the image type is a floating type, `False` otherwise.
319
+ """
320
+ if isinstance(image, PIL.Image.Image):
321
+ return image
322
+ if is_torch_tensor(image):
323
+ image = image.numpy()
324
+
325
+ if isinstance(image, np.ndarray):
326
+ if rescale is None:
327
+ # rescale default to the array being of floating type.
328
+ rescale = isinstance(image.flat[0], np.floating)
329
+ # If the channel as been moved to first dim, we put it back at the end.
330
+ if image.ndim == 3 and image.shape[0] in [1, 3]:
331
+ image = image.transpose(1, 2, 0)
332
+ if rescale:
333
+ image = image * 255
334
+ image = image.astype(np.uint8)
335
+ return PIL.Image.fromarray(image)
336
+ return image
337
+
338
+ def reshape_by_patch(self, image):
339
+ """
340
+ :param image: shape [3, H, W]
341
+ :param patch_size:
342
+ :return: [3, patch_size, HW/patch_size]
343
+ """
344
+ image = torch.from_numpy(image)
345
+ patch_size = self.patch_size
346
+ patches = torch.nn.functional.unfold(
347
+ image,
348
+ (patch_size, patch_size),
349
+ stride=(patch_size, patch_size)
350
+ )
351
+
352
+ patches = patches.reshape(image.size(0), patch_size, patch_size, -1)
353
+ patches = patches.permute(0, 1, 3, 2).reshape(image.size(0), patch_size, -1)
354
+ return patches.numpy()
355
+
356
+ def preprocess(
357
+ self,
358
+ images: Union[Image.Image, List[Image.Image], List[List[Image.Image]]],
359
+ do_pad: Optional[bool] = True, # TODO: add pad for MiniCPM-Llama3-V-2_5
360
+ max_slice_nums: int = None,
361
+ return_tensors: Optional[Union[str, TensorType]] = None,
362
+ **kwargs
363
+ ) -> MiniCPMVBatchFeature:
364
+ if isinstance(images, Image.Image):
365
+ images_list = [[images]]
366
+ elif isinstance(images[0], Image.Image):
367
+ images_list = [images]
368
+ else:
369
+ images_list = images
370
+
371
+ new_images_list = []
372
+ image_sizes_list = []
373
+ tgt_sizes_list = []
374
+
375
+ for _images in images_list:
376
+ if _images is None or len(_images) == 0:
377
+ new_images_list.append([])
378
+ image_sizes_list.append([])
379
+ tgt_sizes_list.append([])
380
+ continue
381
+ if not valid_images(_images):
382
+ raise ValueError(
383
+ "Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
384
+ "torch.Tensor, tf.Tensor or jax.ndarray."
385
+ )
386
+
387
+ _images = [self.to_pil_image(image).convert("RGB") for image in _images]
388
+ input_data_format = infer_channel_dimension_format(np.array(_images[0]))
389
+
390
+ new_images = []
391
+ image_sizes = [image.size for image in _images]
392
+ tgt_sizes = []
393
+ for image in _images:
394
+ image_patches = self.get_sliced_images(image, max_slice_nums)
395
+ image_patches = [to_numpy_array(image).astype(np.float32) / 255 for image in image_patches]
396
+ image_patches = [
397
+ self.normalize(image=image, mean=self.mean, std=self.std, input_data_format=input_data_format)
398
+ for image in image_patches
399
+ ]
400
+ image_patches = [
401
+ to_channel_dimension_format(image, ChannelDimension.FIRST, input_channel_dim=input_data_format)
402
+ for image in image_patches
403
+ ]
404
+ for slice_image in image_patches:
405
+ new_images.append(self.reshape_by_patch(slice_image))
406
+ tgt_sizes.append(np.array((slice_image.shape[1] // self.patch_size, slice_image.shape[2] // self.patch_size)))
407
+
408
+ if tgt_sizes:
409
+ tgt_sizes = np.vstack(tgt_sizes)
410
+
411
+ new_images_list.append(new_images)
412
+ image_sizes_list.append(image_sizes)
413
+ tgt_sizes_list.append(tgt_sizes)
414
+ return MiniCPMVBatchFeature(
415
+ data={"pixel_values": new_images_list, "image_sizes": image_sizes_list, "tgt_sizes": tgt_sizes_list}, tensor_type=return_tensors
416
+ )
417
+
418
+ AutoImageProcessor.register("MiniCPMVImageProcessor", MiniCPMVImageProcessor)
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
modeling_navit_siglip.py ADDED
@@ -0,0 +1,938 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 Google AI and The HuggingFace Team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """ PyTorch Siglip model. """
16
+ # Copied from HuggingFaceM4/siglip-so400m-14-980-flash-attn2-navit and add tgt_sizes
17
+
18
+
19
+ import os
20
+ import math
21
+ import warnings
22
+ from dataclasses import dataclass
23
+ from typing import Any, Optional, Tuple, Union
24
+
25
+ import numpy as np
26
+ import torch
27
+ import torch.nn.functional as F
28
+ import torch.utils.checkpoint
29
+ from torch import nn
30
+ from torch.nn.init import _calculate_fan_in_and_fan_out
31
+
32
+ from transformers.activations import ACT2FN
33
+ from transformers.modeling_attn_mask_utils import _prepare_4d_attention_mask
34
+ from transformers.modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
35
+ from transformers.modeling_utils import PreTrainedModel
36
+ from transformers.configuration_utils import PretrainedConfig
37
+ from transformers.utils import (
38
+ ModelOutput,
39
+ add_start_docstrings,
40
+ add_start_docstrings_to_model_forward,
41
+ is_flash_attn_2_available,
42
+ logging,
43
+ replace_return_docstrings,
44
+ )
45
+ from transformers.utils import logging
46
+
47
+ logger = logging.get_logger(__name__)
48
+
49
+ class SiglipVisionConfig(PretrainedConfig):
50
+ r"""
51
+ This is the configuration class to store the configuration of a [`SiglipVisionModel`]. It is used to instantiate a
52
+ Siglip vision encoder according to the specified arguments, defining the model architecture. Instantiating a
53
+ configuration with the defaults will yield a similar configuration to that of the vision encoder of the Siglip
54
+ [google/siglip-base-patch16-224](https://huggingface.co/google/siglip-base-patch16-224) architecture.
55
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
56
+ documentation from [`PretrainedConfig`] for more information.
57
+ Args:
58
+ hidden_size (`int`, *optional*, defaults to 768):
59
+ Dimensionality of the encoder layers and the pooler layer.
60
+ intermediate_size (`int`, *optional*, defaults to 3072):
61
+ Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
62
+ num_hidden_layers (`int`, *optional*, defaults to 12):
63
+ Number of hidden layers in the Transformer encoder.
64
+ num_attention_heads (`int`, *optional*, defaults to 12):
65
+ Number of attention heads for each attention layer in the Transformer encoder.
66
+ num_channels (`int`, *optional*, defaults to 3):
67
+ Number of channels in the input images.
68
+ image_size (`int`, *optional*, defaults to 224):
69
+ The size (resolution) of each image.
70
+ patch_size (`int`, *optional*, defaults to 16):
71
+ The size (resolution) of each patch.
72
+ hidden_act (`str` or `function`, *optional*, defaults to `"gelu_pytorch_tanh"`):
73
+ The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
74
+ `"relu"`, `"selu"` and `"gelu_new"` ``"quick_gelu"` are supported.
75
+ layer_norm_eps (`float`, *optional*, defaults to 1e-06):
76
+ The epsilon used by the layer normalization layers.
77
+ attention_dropout (`float`, *optional*, defaults to 0.0):
78
+ The dropout ratio for the attention probabilities.
79
+ Example:
80
+ ```python
81
+ >>> from transformers import SiglipVisionConfig, SiglipVisionModel
82
+ >>> # Initializing a SiglipVisionConfig with google/siglip-base-patch16-224 style configuration
83
+ >>> configuration = SiglipVisionConfig()
84
+ >>> # Initializing a SiglipVisionModel (with random weights) from the google/siglip-base-patch16-224 style configuration
85
+ >>> model = SiglipVisionModel(configuration)
86
+ >>> # Accessing the model configuration
87
+ >>> configuration = model.config
88
+ ```"""
89
+
90
+ model_type = "siglip_vision_model"
91
+
92
+ def __init__(
93
+ self,
94
+ hidden_size=768,
95
+ intermediate_size=3072,
96
+ num_hidden_layers=12,
97
+ num_attention_heads=12,
98
+ num_channels=3,
99
+ image_size=224,
100
+ patch_size=16,
101
+ hidden_act="gelu_pytorch_tanh",
102
+ layer_norm_eps=1e-6,
103
+ attention_dropout=0.0,
104
+ **kwargs,
105
+ ):
106
+ super().__init__(**kwargs)
107
+
108
+ self.hidden_size = hidden_size
109
+ self.intermediate_size = intermediate_size
110
+ self.num_hidden_layers = num_hidden_layers
111
+ self.num_attention_heads = num_attention_heads
112
+ self.num_channels = num_channels
113
+ self.patch_size = patch_size
114
+ self.image_size = image_size
115
+ self.attention_dropout = attention_dropout
116
+ self.layer_norm_eps = layer_norm_eps
117
+ self.hidden_act = hidden_act
118
+
119
+ @classmethod
120
+ def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig":
121
+ cls._set_token_in_kwargs(kwargs)
122
+
123
+ config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
124
+
125
+ # get the vision config dict if we are loading from SiglipConfig
126
+ if config_dict.get("model_type") == "siglip":
127
+ config_dict = config_dict["vision_config"]
128
+
129
+ if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type:
130
+ logger.warning(
131
+ f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
132
+ f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
133
+ )
134
+
135
+ return cls.from_dict(config_dict, **kwargs)
136
+
137
+
138
+ _CHECKPOINT_FOR_DOC = "google/siglip-base-patch16-224"
139
+
140
+ SIGLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
141
+ "google/siglip-base-patch16-224",
142
+ # See all SigLIP models at https://huggingface.co/models?filter=siglip
143
+ ]
144
+
145
+ if is_flash_attn_2_available():
146
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
147
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
148
+
149
+
150
+ # Copied from transformers.models.llama.modeling_llama._get_unpad_data
151
+ def _get_unpad_data(attention_mask):
152
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
153
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
154
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
155
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
156
+ return (
157
+ indices,
158
+ cu_seqlens,
159
+ max_seqlen_in_batch,
160
+ )
161
+
162
+
163
+ def _trunc_normal_(tensor, mean, std, a, b):
164
+ # Cut & paste from PyTorch official master until it's in a few official releases - RW
165
+ # Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf
166
+ def norm_cdf(x):
167
+ # Computes standard normal cumulative distribution function
168
+ return (1.0 + math.erf(x / math.sqrt(2.0))) / 2.0
169
+
170
+ if (mean < a - 2 * std) or (mean > b + 2 * std):
171
+ warnings.warn(
172
+ "mean is more than 2 std from [a, b] in nn.init.trunc_normal_. "
173
+ "The distribution of values may be incorrect.",
174
+ stacklevel=2,
175
+ )
176
+
177
+ # Values are generated by using a truncated uniform distribution and
178
+ # then using the inverse CDF for the normal distribution.
179
+ # Get upper and lower cdf values
180
+ l = norm_cdf((a - mean) / std)
181
+ u = norm_cdf((b - mean) / std)
182
+
183
+ # Uniformly fill tensor with values from [l, u], then translate to
184
+ # [2l-1, 2u-1].
185
+ tensor.uniform_(2 * l - 1, 2 * u - 1)
186
+
187
+ # Use inverse cdf transform for normal distribution to get truncated
188
+ # standard normal
189
+ if tensor.dtype in [torch.float16, torch.bfloat16]:
190
+ # The `erfinv_` op is not (yet?) defined in float16+cpu, bfloat16+gpu
191
+ og_dtype = tensor.dtype
192
+ tensor = tensor.to(torch.float32)
193
+ tensor.erfinv_()
194
+ tensor = tensor.to(og_dtype)
195
+ else:
196
+ tensor.erfinv_()
197
+
198
+ # Transform to proper mean, std
199
+ tensor.mul_(std * math.sqrt(2.0))
200
+ tensor.add_(mean)
201
+
202
+ # Clamp to ensure it's in the proper range
203
+ if tensor.dtype == torch.float16:
204
+ # The `clamp_` op is not (yet?) defined in float16+cpu
205
+ tensor = tensor.to(torch.float32)
206
+ tensor.clamp_(min=a, max=b)
207
+ tensor = tensor.to(torch.float16)
208
+ else:
209
+ tensor.clamp_(min=a, max=b)
210
+
211
+
212
+ def trunc_normal_tf_(
213
+ tensor: torch.Tensor, mean: float = 0.0, std: float = 1.0, a: float = -2.0, b: float = 2.0
214
+ ) -> torch.Tensor:
215
+ """Fills the input Tensor with values drawn from a truncated
216
+ normal distribution. The values are effectively drawn from the
217
+ normal distribution :math:`\\mathcal{N}(\text{mean}, \text{std}^2)`
218
+ with values outside :math:`[a, b]` redrawn until they are within
219
+ the bounds. The method used for generating the random values works
220
+ best when :math:`a \\leq \text{mean} \\leq b`.
221
+ NOTE: this 'tf' variant behaves closer to Tensorflow / JAX impl where the
222
+ bounds [a, b] are applied when sampling the normal distribution with mean=0, std=1.0
223
+ and the result is subsquently scaled and shifted by the mean and std args.
224
+ Args:
225
+ tensor: an n-dimensional `torch.Tensor`
226
+ mean: the mean of the normal distribution
227
+ std: the standard deviation of the normal distribution
228
+ a: the minimum cutoff value
229
+ b: the maximum cutoff value
230
+ """
231
+ with torch.no_grad():
232
+ _trunc_normal_(tensor, 0, 1.0, a, b)
233
+ tensor.mul_(std).add_(mean)
234
+
235
+
236
+ def variance_scaling_(tensor, scale=1.0, mode="fan_in", distribution="normal"):
237
+ fan_in, fan_out = _calculate_fan_in_and_fan_out(tensor)
238
+ if mode == "fan_in":
239
+ denom = fan_in
240
+ elif mode == "fan_out":
241
+ denom = fan_out
242
+ elif mode == "fan_avg":
243
+ denom = (fan_in + fan_out) / 2
244
+
245
+ variance = scale / denom
246
+
247
+ if distribution == "truncated_normal":
248
+ # constant is stddev of standard normal truncated to (-2, 2)
249
+ trunc_normal_tf_(tensor, std=math.sqrt(variance) / 0.87962566103423978)
250
+ elif distribution == "normal":
251
+ with torch.no_grad():
252
+ tensor.normal_(std=math.sqrt(variance))
253
+ elif distribution == "uniform":
254
+ bound = math.sqrt(3 * variance)
255
+ with torch.no_grad():
256
+ tensor.uniform_(-bound, bound)
257
+ else:
258
+ raise ValueError(f"invalid distribution {distribution}")
259
+
260
+
261
+ def lecun_normal_(tensor):
262
+ variance_scaling_(tensor, mode="fan_in", distribution="truncated_normal")
263
+
264
+
265
+ def default_flax_embed_init(tensor):
266
+ variance_scaling_(tensor, mode="fan_in", distribution="normal")
267
+
268
+
269
+ @dataclass
270
+ # Copied from transformers.models.clip.modeling_clip.CLIPVisionModelOutput with CLIP->Siglip
271
+ class SiglipVisionModelOutput(ModelOutput):
272
+ """
273
+ Base class for vision model's outputs that also contains image embeddings of the pooling of the last hidden states.
274
+ Args:
275
+ image_embeds (`torch.FloatTensor` of shape `(batch_size, output_dim)` *optional* returned when model is initialized with `with_projection=True`):
276
+ The image embeddings obtained by applying the projection layer to the pooler_output.
277
+ last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
278
+ Sequence of hidden-states at the output of the last layer of the model.
279
+ hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
280
+ Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
281
+ one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
282
+ Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
283
+ attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
284
+ Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
285
+ sequence_length)`.
286
+ Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
287
+ heads.
288
+ """
289
+
290
+ image_embeds: Optional[torch.FloatTensor] = None
291
+ last_hidden_state: torch.FloatTensor = None
292
+ hidden_states: Optional[Tuple[torch.FloatTensor]] = None
293
+ attentions: Optional[Tuple[torch.FloatTensor]] = None
294
+
295
+
296
+ class SiglipVisionEmbeddings(nn.Module):
297
+ def __init__(self, config: SiglipVisionConfig):
298
+ super().__init__()
299
+ self.config = config
300
+ self.embed_dim = config.hidden_size
301
+ self.image_size = config.image_size
302
+ self.patch_size = config.patch_size
303
+
304
+ self.patch_embedding = nn.Conv2d(
305
+ in_channels=config.num_channels,
306
+ out_channels=self.embed_dim,
307
+ kernel_size=self.patch_size,
308
+ stride=self.patch_size,
309
+ padding="valid",
310
+ )
311
+
312
+ self.num_patches_per_side = self.image_size // self.patch_size
313
+ self.num_patches = self.num_patches_per_side**2
314
+ self.num_positions = self.num_patches
315
+ self.position_embedding = nn.Embedding(self.num_positions, self.embed_dim)
316
+
317
+ def forward(self, pixel_values: torch.FloatTensor, patch_attention_mask: torch.BoolTensor, tgt_sizes: Optional[torch.IntTensor]=None) -> torch.Tensor:
318
+ batch_size = pixel_values.size(0)
319
+
320
+ patch_embeds = self.patch_embedding(pixel_values)
321
+ embeddings = patch_embeds.flatten(2).transpose(1, 2)
322
+
323
+ max_im_h, max_im_w = pixel_values.size(2), pixel_values.size(3)
324
+ max_nb_patches_h, max_nb_patches_w = max_im_h // self.patch_size, max_im_w // self.patch_size
325
+ boundaries = torch.arange(1 / self.num_patches_per_side, 1.0, 1 / self.num_patches_per_side)
326
+ position_ids = torch.full(
327
+ size=(
328
+ batch_size,
329
+ max_nb_patches_h * max_nb_patches_w,
330
+ ),
331
+ fill_value=0,
332
+ )
333
+
334
+ for batch_idx, p_attn_mask in enumerate(patch_attention_mask):
335
+ if tgt_sizes is not None:
336
+ nb_patches_h = tgt_sizes[batch_idx][0]
337
+ nb_patches_w = tgt_sizes[batch_idx][1]
338
+ else:
339
+ nb_patches_h = p_attn_mask[:, 0].sum()
340
+ nb_patches_w = p_attn_mask[0].sum()
341
+
342
+ fractional_coords_h = torch.arange(0, 1 - 1e-6, 1 / nb_patches_h)
343
+ fractional_coords_w = torch.arange(0, 1 - 1e-6, 1 / nb_patches_w)
344
+
345
+ bucket_coords_h = torch.bucketize(fractional_coords_h, boundaries, right=True)
346
+ bucket_coords_w = torch.bucketize(fractional_coords_w, boundaries, right=True)
347
+
348
+ pos_ids = (bucket_coords_h[:, None] * self.num_patches_per_side + bucket_coords_w).flatten()
349
+ position_ids[batch_idx][p_attn_mask.view(-1).cpu()] = pos_ids
350
+
351
+ position_ids = position_ids.to(self.position_embedding.weight.device)
352
+
353
+ embeddings = embeddings + self.position_embedding(position_ids)
354
+ return embeddings
355
+
356
+
357
+ class SiglipAttention(nn.Module):
358
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
359
+
360
+ # Copied from transformers.models.clip.modeling_clip.CLIPAttention.__init__
361
+ def __init__(self, config):
362
+ super().__init__()
363
+ self.config = config
364
+ self.embed_dim = config.hidden_size
365
+ self.num_heads = config.num_attention_heads
366
+ self.head_dim = self.embed_dim // self.num_heads
367
+ if self.head_dim * self.num_heads != self.embed_dim:
368
+ raise ValueError(
369
+ f"embed_dim must be divisible by num_heads (got `embed_dim`: {self.embed_dim} and `num_heads`:"
370
+ f" {self.num_heads})."
371
+ )
372
+ self.scale = self.head_dim**-0.5
373
+ self.dropout = config.attention_dropout
374
+
375
+ self.k_proj = nn.Linear(self.embed_dim, self.embed_dim)
376
+ self.v_proj = nn.Linear(self.embed_dim, self.embed_dim)
377
+ self.q_proj = nn.Linear(self.embed_dim, self.embed_dim)
378
+ self.out_proj = nn.Linear(self.embed_dim, self.embed_dim)
379
+
380
+ def forward(
381
+ self,
382
+ hidden_states: torch.Tensor,
383
+ attention_mask: Optional[torch.Tensor] = None,
384
+ output_attentions: Optional[bool] = False,
385
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
386
+ """Input shape: Batch x Time x Channel"""
387
+
388
+ batch_size, q_len, _ = hidden_states.size()
389
+
390
+ query_states = self.q_proj(hidden_states)
391
+ key_states = self.k_proj(hidden_states)
392
+ value_states = self.v_proj(hidden_states)
393
+
394
+ query_states = query_states.view(batch_size, q_len, self.num_heads, self.head_dim).transpose(1, 2)
395
+ key_states = key_states.view(batch_size, q_len, self.num_heads, self.head_dim).transpose(1, 2)
396
+ value_states = value_states.view(batch_size, q_len, self.num_heads, self.head_dim).transpose(1, 2)
397
+
398
+ k_v_seq_len = key_states.shape[-2]
399
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) * self.scale
400
+
401
+ if attn_weights.size() != (batch_size, self.num_heads, q_len, k_v_seq_len):
402
+ raise ValueError(
403
+ f"Attention weights should be of size {(batch_size, self.num_heads, q_len, k_v_seq_len)}, but is"
404
+ f" {attn_weights.size()}"
405
+ )
406
+
407
+ if attention_mask is not None:
408
+ if attention_mask.size() != (batch_size, 1, q_len, k_v_seq_len):
409
+ raise ValueError(
410
+ f"Attention mask should be of size {(batch_size, 1, q_len, k_v_seq_len)}, but is {attention_mask.size()}"
411
+ )
412
+ attn_weights = attn_weights + attention_mask
413
+
414
+ # upcast attention to fp32
415
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
416
+ attn_weights = nn.functional.dropout(attn_weights, p=self.dropout, training=self.training)
417
+ attn_output = torch.matmul(attn_weights, value_states)
418
+
419
+ if attn_output.size() != (batch_size, self.num_heads, q_len, self.head_dim):
420
+ raise ValueError(
421
+ f"`attn_output` should be of size {(batch_size, self.num_heads, q_len, self.head_dim)}, but is"
422
+ f" {attn_output.size()}"
423
+ )
424
+
425
+ attn_output = attn_output.transpose(1, 2).contiguous()
426
+ attn_output = attn_output.reshape(batch_size, q_len, self.embed_dim)
427
+
428
+ attn_output = self.out_proj(attn_output)
429
+
430
+ return attn_output, attn_weights
431
+
432
+
433
+ class SiglipFlashAttention2(SiglipAttention):
434
+ """
435
+ Llama flash attention module. This module inherits from `LlamaAttention` as the weights of the module stays
436
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
437
+ flash attention and deal with padding tokens in case the input contains any of them.
438
+ """
439
+
440
+ def __init__(self, *args, **kwargs):
441
+ super().__init__(*args, **kwargs)
442
+ self.is_causal = False # Hack to make sure we don't use a causal mask
443
+
444
+ def forward(
445
+ self,
446
+ hidden_states: torch.Tensor,
447
+ attention_mask: Optional[torch.LongTensor] = None,
448
+ position_ids: Optional[torch.LongTensor] = None,
449
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
450
+ output_attentions: bool = False,
451
+ use_cache: bool = False,
452
+ **kwargs,
453
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
454
+ output_attentions = False
455
+
456
+ bsz, q_len, _ = hidden_states.size()
457
+
458
+ query_states = self.q_proj(hidden_states)
459
+ key_states = self.k_proj(hidden_states)
460
+ value_states = self.v_proj(hidden_states)
461
+
462
+ # Flash attention requires the input to have the shape
463
+ # batch_size x seq_length x head_dim x hidden_dim
464
+ # therefore we just need to keep the original shape
465
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
466
+ key_states = key_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
467
+ value_states = value_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
468
+
469
+ kv_seq_len = key_states.shape[-2]
470
+ if past_key_value is not None:
471
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
472
+ # cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
473
+ # query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
474
+
475
+ # if past_key_value is not None:
476
+ # cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
477
+ # key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
478
+
479
+ # TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
480
+ # to be able to avoid many of these transpose/reshape/view.
481
+ query_states = query_states.transpose(1, 2)
482
+ key_states = key_states.transpose(1, 2)
483
+ value_states = value_states.transpose(1, 2)
484
+
485
+ dropout_rate = self.dropout if self.training else 0.0
486
+
487
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
488
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
489
+ # cast them back in the correct dtype just to be sure everything works as expected.
490
+ # This might slowdown training & inference so it is recommended to not cast the LayerNorms
491
+ # in fp32. (LlamaRMSNorm handles it correctly)
492
+
493
+ input_dtype = query_states.dtype
494
+ if input_dtype == torch.float32:
495
+ if torch.is_autocast_enabled():
496
+ target_dtype = torch.get_autocast_gpu_dtype()
497
+ # Handle the case where the model is quantized
498
+ elif hasattr(self.config, "_pre_quantization_dtype"):
499
+ target_dtype = self.config._pre_quantization_dtype
500
+ else:
501
+ target_dtype = self.q_proj.weight.dtype
502
+
503
+ logger.warning_once(
504
+ "The input hidden states seems to be silently casted in float32, this might be related to the fact"
505
+ " you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
506
+ f" {target_dtype}."
507
+ )
508
+
509
+ query_states = query_states.to(target_dtype)
510
+ key_states = key_states.to(target_dtype)
511
+ value_states = value_states.to(target_dtype)
512
+
513
+ attn_output = self._flash_attention_forward(
514
+ query_states, key_states, value_states, attention_mask, q_len, dropout=dropout_rate
515
+ )
516
+
517
+ attn_output = attn_output.reshape(bsz, q_len, self.embed_dim).contiguous()
518
+ attn_output = self.out_proj(attn_output)
519
+
520
+ if not output_attentions:
521
+ attn_weights = None
522
+
523
+ return attn_output, attn_weights
524
+
525
+ def _flash_attention_forward(
526
+ self, query_states, key_states, value_states, attention_mask, query_length, dropout=0.0, softmax_scale=None
527
+ ):
528
+ """
529
+ Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
530
+ first unpad the input, then computes the attention scores and pad the final attention scores.
531
+ Args:
532
+ query_states (`torch.Tensor`):
533
+ Input query states to be passed to Flash Attention API
534
+ key_states (`torch.Tensor`):
535
+ Input key states to be passed to Flash Attention API
536
+ value_states (`torch.Tensor`):
537
+ Input value states to be passed to Flash Attention API
538
+ attention_mask (`torch.Tensor`):
539
+ The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
540
+ position of padding tokens and 1 for the position of non-padding tokens.
541
+ dropout (`int`, *optional*):
542
+ Attention dropout
543
+ softmax_scale (`float`, *optional*):
544
+ The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
545
+ """
546
+
547
+ # TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in LlamaFlashAttention2 __init__.
548
+ causal = self.is_causal and query_length != 1
549
+
550
+ # Contains at least one padding token in the sequence
551
+ if attention_mask is not None:
552
+ batch_size = query_states.shape[0]
553
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
554
+ query_states, key_states, value_states, attention_mask, query_length
555
+ )
556
+
557
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
558
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
559
+
560
+ attn_output_unpad = flash_attn_varlen_func(
561
+ query_states,
562
+ key_states,
563
+ value_states,
564
+ cu_seqlens_q=cu_seqlens_q,
565
+ cu_seqlens_k=cu_seqlens_k,
566
+ max_seqlen_q=max_seqlen_in_batch_q,
567
+ max_seqlen_k=max_seqlen_in_batch_k,
568
+ dropout_p=dropout,
569
+ softmax_scale=softmax_scale,
570
+ causal=causal,
571
+ )
572
+
573
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
574
+ else:
575
+ attn_output = flash_attn_func(
576
+ query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal
577
+ )
578
+
579
+ return attn_output
580
+
581
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
582
+ indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
583
+ batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape
584
+
585
+ key_layer = index_first_axis(
586
+ key_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
587
+ )
588
+ value_layer = index_first_axis(
589
+ value_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
590
+ )
591
+ if query_length == kv_seq_len:
592
+ query_layer = index_first_axis(
593
+ query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
594
+ )
595
+ cu_seqlens_q = cu_seqlens_k
596
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
597
+ indices_q = indices_k
598
+ elif query_length == 1:
599
+ max_seqlen_in_batch_q = 1
600
+ cu_seqlens_q = torch.arange(
601
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
602
+ ) # There is a memcpy here, that is very bad.
603
+ indices_q = cu_seqlens_q[:-1]
604
+ query_layer = query_layer.squeeze(1)
605
+ else:
606
+ # The -q_len: slice assumes left padding.
607
+ attention_mask = attention_mask[:, -query_length:]
608
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
609
+
610
+ return (
611
+ query_layer,
612
+ key_layer,
613
+ value_layer,
614
+ indices_q,
615
+ (cu_seqlens_q, cu_seqlens_k),
616
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
617
+ )
618
+
619
+
620
+ # Copied from transformers.models.clip.modeling_clip.CLIPMLP with CLIP->Siglip
621
+ class SiglipMLP(nn.Module):
622
+ def __init__(self, config):
623
+ super().__init__()
624
+ self.config = config
625
+ self.activation_fn = ACT2FN[config.hidden_act]
626
+ self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
627
+ self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size)
628
+
629
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
630
+ hidden_states = self.fc1(hidden_states)
631
+ hidden_states = self.activation_fn(hidden_states)
632
+ hidden_states = self.fc2(hidden_states)
633
+ return hidden_states
634
+
635
+
636
+ # Copied from transformers.models.clip.modeling_clip.CLIPEncoderLayer with CLIP->Siglip
637
+ class SiglipEncoderLayer(nn.Module):
638
+ def __init__(self, config: SiglipVisionConfig):
639
+ super().__init__()
640
+ self.embed_dim = config.hidden_size
641
+ self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
642
+ self.self_attn = (
643
+ SiglipAttention(config)
644
+ if not self._use_flash_attention_2
645
+ else SiglipFlashAttention2(config)
646
+ )
647
+ self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps)
648
+ self.mlp = SiglipMLP(config)
649
+ self.layer_norm2 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps)
650
+
651
+ def forward(
652
+ self,
653
+ hidden_states: torch.Tensor,
654
+ attention_mask: torch.Tensor,
655
+ output_attentions: Optional[bool] = False,
656
+ ) -> Tuple[torch.FloatTensor]:
657
+ """
658
+ Args:
659
+ hidden_states (`torch.FloatTensor`):
660
+ Input to the layer of shape `(batch, seq_len, embed_dim)`.
661
+ attention_mask (`torch.FloatTensor`):
662
+ Attention mask of shape `(batch, 1, q_len, k_v_seq_len)` where padding elements are indicated by very large negative values.
663
+ output_attentions (`bool`, *optional*, defaults to `False`):
664
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
665
+ returned tensors for more detail.
666
+ """
667
+ residual = hidden_states
668
+
669
+ hidden_states = self.layer_norm1(hidden_states)
670
+ hidden_states, attn_weights = self.self_attn(
671
+ hidden_states=hidden_states,
672
+ attention_mask=attention_mask,
673
+ output_attentions=output_attentions,
674
+ )
675
+ hidden_states = residual + hidden_states
676
+
677
+ residual = hidden_states
678
+ hidden_states = self.layer_norm2(hidden_states)
679
+ hidden_states = self.mlp(hidden_states)
680
+ hidden_states = residual + hidden_states
681
+
682
+ outputs = (hidden_states,)
683
+
684
+ if output_attentions:
685
+ outputs += (attn_weights,)
686
+
687
+ return outputs
688
+
689
+
690
+ class SiglipPreTrainedModel(PreTrainedModel):
691
+ """
692
+ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
693
+ models.
694
+ """
695
+
696
+ config_class = SiglipVisionConfig
697
+ base_model_prefix = "siglip"
698
+ supports_gradient_checkpointing = True
699
+
700
+ def _init_weights(self, module):
701
+ """Initialize the weights"""
702
+
703
+ if isinstance(module, SiglipVisionEmbeddings):
704
+ width = self.config.hidden_size
705
+ nn.init.normal_(module.position_embedding.weight, std=1 / np.sqrt(width))
706
+ elif isinstance(module, nn.Embedding):
707
+ default_flax_embed_init(module.weight)
708
+ elif isinstance(module, SiglipAttention):
709
+ nn.init.normal_(module.q_proj.weight)
710
+ nn.init.normal_(module.k_proj.weight)
711
+ nn.init.normal_(module.v_proj.weight)
712
+ nn.init.normal_(module.out_proj.weight)
713
+ nn.init.zeros_(module.q_proj.bias)
714
+ nn.init.zeros_(module.k_proj.bias)
715
+ nn.init.zeros_(module.v_proj.bias)
716
+ nn.init.zeros_(module.out_proj.bias)
717
+ elif isinstance(module, SiglipMLP):
718
+ nn.init.normal_(module.fc1.weight)
719
+ nn.init.normal_(module.fc2.weight)
720
+ nn.init.normal_(module.fc1.bias, std=1e-6)
721
+ nn.init.normal_(module.fc2.bias, std=1e-6)
722
+ elif isinstance(module, (nn.Linear, nn.Conv2d)):
723
+ lecun_normal_(module.weight)
724
+ if module.bias is not None:
725
+ nn.init.zeros_(module.bias)
726
+ elif isinstance(module, nn.LayerNorm):
727
+ module.bias.data.zero_()
728
+ module.weight.data.fill_(1.0)
729
+
730
+
731
+ SIGLIP_START_DOCSTRING = r"""
732
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
733
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
734
+ etc.)
735
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
736
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
737
+ and behavior.
738
+ Parameters:
739
+ config ([`SiglipVisionConfig`]): Model configuration class with all the parameters of the model.
740
+ Initializing with a config file does not load the weights associated with the model, only the
741
+ configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
742
+ """
743
+
744
+
745
+ SIGLIP_VISION_INPUTS_DOCSTRING = r"""
746
+ Args:
747
+ pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):
748
+ Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
749
+ [`AutoImageProcessor`]. See [`CLIPImageProcessor.__call__`] for details.
750
+ output_attentions (`bool`, *optional*):
751
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
752
+ tensors for more detail.
753
+ output_hidden_states (`bool`, *optional*):
754
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
755
+ more detail.
756
+ return_dict (`bool`, *optional*):
757
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
758
+ """
759
+
760
+
761
+ # Copied from transformers.models.clip.modeling_clip.CLIPEncoder with CLIP->Siglip
762
+ class SiglipEncoder(nn.Module):
763
+ """
764
+ Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
765
+ [`SiglipEncoderLayer`].
766
+ Args:
767
+ config: SiglipConfig
768
+ """
769
+
770
+ def __init__(self, config: SiglipVisionConfig):
771
+ super().__init__()
772
+ self.config = config
773
+ self.layers = nn.ModuleList([SiglipEncoderLayer(config) for _ in range(config.num_hidden_layers)])
774
+ self.gradient_checkpointing = False
775
+
776
+ # Ignore copy
777
+ def forward(
778
+ self,
779
+ inputs_embeds,
780
+ attention_mask: Optional[torch.Tensor] = None,
781
+ output_attentions: Optional[bool] = None,
782
+ output_hidden_states: Optional[bool] = None,
783
+ return_dict: Optional[bool] = None,
784
+ ) -> Union[Tuple, BaseModelOutput]:
785
+ r"""
786
+ Args:
787
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
788
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation.
789
+ This is useful if you want more control over how to convert `input_ids` indices into associated vectors
790
+ than the model's internal embedding lookup matrix.
791
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
792
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
793
+ - 1 for tokens that are **not masked**,
794
+ - 0 for tokens that are **masked**.
795
+ [What are attention masks?](../glossary#attention-mask)
796
+ output_attentions (`bool`, *optional*):
797
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
798
+ returned tensors for more detail.
799
+ output_hidden_states (`bool`, *optional*):
800
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
801
+ for more detail.
802
+ return_dict (`bool`, *optional*):
803
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
804
+ """
805
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
806
+ output_hidden_states = (
807
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
808
+ )
809
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
810
+
811
+ encoder_states = () if output_hidden_states else None
812
+ all_attentions = () if output_attentions else None
813
+
814
+ hidden_states = inputs_embeds
815
+ for encoder_layer in self.layers:
816
+ if output_hidden_states:
817
+ encoder_states = encoder_states + (hidden_states,)
818
+ if self.gradient_checkpointing and self.training:
819
+ layer_outputs = self._gradient_checkpointing_func(
820
+ encoder_layer.__call__,
821
+ hidden_states,
822
+ attention_mask,
823
+ output_attentions,
824
+ )
825
+ else:
826
+ layer_outputs = encoder_layer(
827
+ hidden_states,
828
+ attention_mask,
829
+ output_attentions=output_attentions,
830
+ )
831
+
832
+ hidden_states = layer_outputs[0]
833
+
834
+ if output_attentions:
835
+ all_attentions = all_attentions + (layer_outputs[1],)
836
+
837
+ if output_hidden_states:
838
+ encoder_states = encoder_states + (hidden_states,)
839
+
840
+ if not return_dict:
841
+ return tuple(v for v in [hidden_states, encoder_states, all_attentions] if v is not None)
842
+ return BaseModelOutput(
843
+ last_hidden_state=hidden_states, hidden_states=encoder_states, attentions=all_attentions
844
+ )
845
+
846
+ @add_start_docstrings(
847
+ """The vision model from SigLIP without any head or projection on top.""",
848
+ SIGLIP_START_DOCSTRING
849
+ )
850
+ class SiglipVisionTransformer(SiglipPreTrainedModel):
851
+ config_class = SiglipVisionConfig
852
+ main_input_name = "pixel_values"
853
+ _supports_flash_attn_2 = True
854
+ _no_split_modules = []
855
+
856
+ def __init__(self, config: SiglipVisionConfig):
857
+ super().__init__(config)
858
+ self.config = config
859
+ embed_dim = config.hidden_size
860
+
861
+ self.embeddings = SiglipVisionEmbeddings(config)
862
+ self.encoder = SiglipEncoder(config)
863
+ self.post_layernorm = nn.LayerNorm(embed_dim, eps=config.layer_norm_eps)
864
+ self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
865
+
866
+ # Initialize weights and apply final processing
867
+ self.post_init()
868
+
869
+ def get_input_embeddings(self) -> nn.Module:
870
+ return self.embeddings.patch_embedding
871
+
872
+ @add_start_docstrings_to_model_forward(SIGLIP_VISION_INPUTS_DOCSTRING)
873
+ @replace_return_docstrings(output_type=BaseModelOutputWithPooling, config_class=SiglipVisionConfig)
874
+ def forward(
875
+ self,
876
+ pixel_values,
877
+ patch_attention_mask: Optional[torch.BoolTensor] = None,
878
+ tgt_sizes: Optional[torch.IntTensor] = None,
879
+ output_attentions: Optional[bool] = None,
880
+ output_hidden_states: Optional[bool] = None,
881
+ return_dict: Optional[bool] = None,
882
+ ) -> Union[Tuple, BaseModelOutputWithPooling]:
883
+ r"""
884
+ Returns:
885
+ """
886
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
887
+ output_hidden_states = (
888
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
889
+ )
890
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
891
+
892
+ batch_size = pixel_values.size(0)
893
+ if patch_attention_mask is None:
894
+ patch_attention_mask = torch.ones(
895
+ size=(
896
+ batch_size,
897
+ pixel_values.size(2) // self.config.patch_size,
898
+ pixel_values.size(3) // self.config.patch_size,
899
+ ),
900
+ dtype=torch.bool,
901
+ device=pixel_values.device,
902
+ )
903
+
904
+ hidden_states = self.embeddings(pixel_values=pixel_values, patch_attention_mask=patch_attention_mask, tgt_sizes=tgt_sizes)
905
+
906
+ patch_attention_mask = patch_attention_mask.view(batch_size, -1)
907
+ # The call to `_upad_input` in `_flash_attention_forward` is expensive
908
+ # So when the `patch_attention_mask` is full of 1s (i.e. attending to the whole sequence),
909
+ # avoiding passing the attention_mask, which is equivalent to attending to the full sequence
910
+ if not torch.any(~patch_attention_mask):
911
+ attention_mask=None
912
+ else:
913
+ attention_mask = (
914
+ _prepare_4d_attention_mask(patch_attention_mask, hidden_states.dtype)
915
+ if not self._use_flash_attention_2
916
+ else patch_attention_mask
917
+ )
918
+
919
+ encoder_outputs = self.encoder(
920
+ inputs_embeds=hidden_states,
921
+ attention_mask=attention_mask,
922
+ output_attentions=output_attentions,
923
+ output_hidden_states=output_hidden_states,
924
+ return_dict=return_dict,
925
+ )
926
+
927
+ last_hidden_state = encoder_outputs[0]
928
+ last_hidden_state = self.post_layernorm(last_hidden_state)
929
+
930
+ if not return_dict:
931
+ return (last_hidden_state, None) + encoder_outputs[1:]
932
+
933
+ return BaseModelOutputWithPooling(
934
+ last_hidden_state=last_hidden_state,
935
+ pooler_output=None,
936
+ hidden_states=encoder_outputs.hidden_states,
937
+ attentions=encoder_outputs.attentions,
938
+ )
openvino_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dtype": "int4",
3
+ "input_info": null,
4
+ "optimum_version": "2.1.0",
5
+ "output_attentions": false,
6
+ "quantization_config": {
7
+ "dataset": null,
8
+ "default_config": {
9
+ "quant_method": "default"
10
+ },
11
+ "ignored_scope": null,
12
+ "num_samples": null,
13
+ "processor": "openbmb/MiniCPM-V-2_6",
14
+ "quantization_configs": {
15
+ "lm_model": {
16
+ "all_layers": null,
17
+ "backup_precision": null,
18
+ "bits": 4,
19
+ "dataset": null,
20
+ "dtype": "int4",
21
+ "gptq": null,
22
+ "group_size": 128,
23
+ "group_size_fallback": null,
24
+ "ignored_scope": null,
25
+ "lora_correction": null,
26
+ "num_samples": null,
27
+ "processor": "openbmb/MiniCPM-V-2_6",
28
+ "quant_method": "default",
29
+ "ratio": 1.0,
30
+ "scale_estimation": null,
31
+ "sensitivity_metric": null,
32
+ "statistics_path": null,
33
+ "sym": false,
34
+ "tokenizer": "openbmb/MiniCPM-V-2_6"
35
+ }
36
+ },
37
+ "tokenizer": "openbmb/MiniCPM-V-2_6"
38
+ },
39
+ "save_onnx_model": false,
40
+ "transformers_version": "4.53.3"
41
+ }
openvino_detokenizer.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac385c728a001ae9702edc5792ba172cce1a77baa7831a501a822e4b152188a7
3
+ size 2189697
openvino_detokenizer.xml ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <net name="detokenizer" version="11">
3
+ <layers>
4
+ <layer id="0" name="Parameter_126966" type="Parameter" version="opset1">
5
+ <data shape="?,?" element_type="i64" />
6
+ <output>
7
+ <port id="0" precision="I64" names="Parameter_126966">
8
+ <dim>-1</dim>
9
+ <dim>-1</dim>
10
+ </port>
11
+ </output>
12
+ </layer>
13
+ <layer id="1" name="Convert_127165" type="Convert" version="opset1">
14
+ <data destination_type="i32" />
15
+ <input>
16
+ <port id="0" precision="I64">
17
+ <dim>-1</dim>
18
+ <dim>-1</dim>
19
+ </port>
20
+ </input>
21
+ <output>
22
+ <port id="1" precision="I32">
23
+ <dim>-1</dim>
24
+ <dim>-1</dim>
25
+ </port>
26
+ </output>
27
+ </layer>
28
+ <layer id="2" name="Constant_126968" type="Const" version="opset1">
29
+ <data element_type="i32" shape="151666" offset="0" size="606664" />
30
+ <output>
31
+ <port id="0" precision="I32">
32
+ <dim>151666</dim>
33
+ </port>
34
+ </output>
35
+ </layer>
36
+ <layer id="3" name="Constant_126970" type="Const" version="opset1">
37
+ <data element_type="i32" shape="151666" offset="606664" size="606664" />
38
+ <output>
39
+ <port id="0" precision="I32">
40
+ <dim>151666</dim>
41
+ </port>
42
+ </output>
43
+ </layer>
44
+ <layer id="4" name="Constant_126972" type="Const" version="opset1">
45
+ <data element_type="u8" shape="976273" offset="1213328" size="976273" />
46
+ <output>
47
+ <port id="0" precision="U8">
48
+ <dim>976273</dim>
49
+ </port>
50
+ </output>
51
+ </layer>
52
+ <layer id="5" name="Slice_126977" type="Const" version="opset1">
53
+ <data element_type="i32" shape="24" offset="2189601" size="96" />
54
+ <output>
55
+ <port id="0" precision="I32">
56
+ <dim>24</dim>
57
+ </port>
58
+ </output>
59
+ </layer>
60
+ <layer id="6" name="VocabDecoder_126979" type="VocabDecoder" version="extension">
61
+ <data skip_tokens="" />
62
+ <input>
63
+ <port id="0" precision="I32">
64
+ <dim>-1</dim>
65
+ <dim>-1</dim>
66
+ </port>
67
+ <port id="1" precision="I32">
68
+ <dim>151666</dim>
69
+ </port>
70
+ <port id="2" precision="I32">
71
+ <dim>151666</dim>
72
+ </port>
73
+ <port id="3" precision="U8">
74
+ <dim>976273</dim>
75
+ </port>
76
+ <port id="4" precision="I32">
77
+ <dim>24</dim>
78
+ </port>
79
+ </input>
80
+ <output>
81
+ <port id="5" precision="I32">
82
+ <dim>-1</dim>
83
+ </port>
84
+ <port id="6" precision="I32">
85
+ <dim>-1</dim>
86
+ </port>
87
+ <port id="7" precision="I32">
88
+ <dim>-1</dim>
89
+ </port>
90
+ <port id="8" precision="I32">
91
+ <dim>-1</dim>
92
+ </port>
93
+ <port id="9" precision="U8">
94
+ <dim>-1</dim>
95
+ </port>
96
+ </output>
97
+ </layer>
98
+ <layer id="7" name="FuzeRagged_126980" type="FuzeRagged" version="extension">
99
+ <input>
100
+ <port id="0" precision="I32">
101
+ <dim>-1</dim>
102
+ </port>
103
+ <port id="1" precision="I32">
104
+ <dim>-1</dim>
105
+ </port>
106
+ <port id="2" precision="I32">
107
+ <dim>-1</dim>
108
+ </port>
109
+ <port id="3" precision="I32">
110
+ <dim>-1</dim>
111
+ </port>
112
+ </input>
113
+ <output>
114
+ <port id="4" precision="I32">
115
+ <dim>-1</dim>
116
+ </port>
117
+ <port id="5" precision="I32">
118
+ <dim>-1</dim>
119
+ </port>
120
+ </output>
121
+ </layer>
122
+ <layer id="8" name="UTF8Validate_126981" type="UTF8Validate" version="extension">
123
+ <data replace_mode="true" />
124
+ <input>
125
+ <port id="0" precision="I32">
126
+ <dim>-1</dim>
127
+ </port>
128
+ <port id="1" precision="I32">
129
+ <dim>-1</dim>
130
+ </port>
131
+ <port id="2" precision="U8">
132
+ <dim>-1</dim>
133
+ </port>
134
+ </input>
135
+ <output>
136
+ <port id="3" precision="I32">
137
+ <dim>-1</dim>
138
+ </port>
139
+ <port id="4" precision="I32">
140
+ <dim>-1</dim>
141
+ </port>
142
+ <port id="5" precision="U8">
143
+ <dim>-1</dim>
144
+ </port>
145
+ </output>
146
+ </layer>
147
+ <layer id="9" name="StringTensorPack_126982" type="StringTensorPack" version="opset15">
148
+ <input>
149
+ <port id="0" precision="I32">
150
+ <dim>-1</dim>
151
+ </port>
152
+ <port id="1" precision="I32">
153
+ <dim>-1</dim>
154
+ </port>
155
+ <port id="2" precision="U8">
156
+ <dim>-1</dim>
157
+ </port>
158
+ </input>
159
+ <output>
160
+ <port id="3" precision="STRING" names="Result_126983,string_output">
161
+ <dim>-1</dim>
162
+ </port>
163
+ </output>
164
+ </layer>
165
+ <layer id="10" name="Result_126983" type="Result" version="opset1" output_names="Result_126983,string_output">
166
+ <input>
167
+ <port id="0" precision="STRING">
168
+ <dim>-1</dim>
169
+ </port>
170
+ </input>
171
+ </layer>
172
+ </layers>
173
+ <edges>
174
+ <edge from-layer="0" from-port="0" to-layer="1" to-port="0" />
175
+ <edge from-layer="1" from-port="1" to-layer="6" to-port="0" />
176
+ <edge from-layer="2" from-port="0" to-layer="6" to-port="1" />
177
+ <edge from-layer="3" from-port="0" to-layer="6" to-port="2" />
178
+ <edge from-layer="4" from-port="0" to-layer="6" to-port="3" />
179
+ <edge from-layer="5" from-port="0" to-layer="6" to-port="4" />
180
+ <edge from-layer="6" from-port="5" to-layer="7" to-port="0" />
181
+ <edge from-layer="6" from-port="6" to-layer="7" to-port="1" />
182
+ <edge from-layer="6" from-port="7" to-layer="7" to-port="2" />
183
+ <edge from-layer="6" from-port="8" to-layer="7" to-port="3" />
184
+ <edge from-layer="6" from-port="9" to-layer="8" to-port="2" />
185
+ <edge from-layer="7" from-port="4" to-layer="8" to-port="0" />
186
+ <edge from-layer="7" from-port="5" to-layer="8" to-port="1" />
187
+ <edge from-layer="8" from-port="3" to-layer="9" to-port="0" />
188
+ <edge from-layer="8" from-port="4" to-layer="9" to-port="1" />
189
+ <edge from-layer="8" from-port="5" to-layer="9" to-port="2" />
190
+ <edge from-layer="9" from-port="3" to-layer="10" to-port="0" />
191
+ </edges>
192
+ <rt_info>
193
+ <add_attention_mask value="True" />
194
+ <add_prefix_space />
195
+ <add_special_tokens value="True" />
196
+ <bos_token_id value="151644" />
197
+ <chat_template value="{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '&lt;|im_start|>system&#10;You are a helpful assistant.&lt;|im_end|>&#10;' }}{% endif %}{{'&lt;|im_start|>' + message['role'] + '&#10;' + message['content'] + '&lt;|im_end|>' + '&#10;'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|>assistant&#10;' }}{% endif %}" />
198
+ <clean_up_tokenization_spaces />
199
+ <detokenizer_input_type value="i64" />
200
+ <eos_token_id value="151645" />
201
+ <handle_special_tokens_with_re />
202
+ <max_length />
203
+ <number_of_inputs value="1" />
204
+ <openvino_tokenizers_version value="2026.0.0.0-632-47cea02a2d4" />
205
+ <openvino_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
206
+ <original_post_processor_template value="{&quot;type&quot;: &quot;ByteLevel&quot;, &quot;add_prefix_space&quot;: false, &quot;trim_offsets&quot;: false, &quot;use_regex&quot;: false}" />
207
+ <original_tokenizer_class value="&lt;class 'transformers_modules.openbmb.MiniCPM-V-2_6.6c04d9e3022bcff6e6738dfb1fc19a5cfd2a855f.tokenization_minicpmv_fast.MiniCPMVTokenizerFast'>" />
208
+ <pad_token_id value="151643" />
209
+ <processed_post_processor_template value="{&quot;single&quot;: {&quot;ids&quot;: [-1], &quot;type_ids&quot;: [0]}, &quot;pair&quot;: {&quot;ids&quot;: [-1, -2], &quot;type_ids&quot;: [0, 0]}}" />
210
+ <skip_special_tokens value="True" />
211
+ <streaming_detokenizer value="False" />
212
+ <tokenizer_output_type value="i64" />
213
+ <tokenizers_version value="0.21.4" />
214
+ <transformers_version value="4.53.3" />
215
+ <use_max_padding value="False" />
216
+ <use_sentencepiece_backend value="False" />
217
+ <utf8_replace_mode value="replace" />
218
+ <with_detokenizer value="True" />
219
+ </rt_info>
220
+ </net>
openvino_language_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97b0235d92ba01ba2935ba9ef4309b3cc4a32e7f557050a9285a9b7d8931dff7
3
+ size 3935193003
openvino_language_model.xml ADDED
The diff for this file is too large to render. See raw diff
 
openvino_resampler_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b98176a4e02e50478e4924b245b0d754a2000fc78b1677d11c40e4626e0afdc8
3
+ size 69429468
openvino_resampler_model.xml ADDED
@@ -0,0 +1,1733 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <net name="Model0" version="11">
3
+ <layers>
4
+ <layer id="0" name="image_feature" type="Parameter" version="opset1">
5
+ <data shape="?,?,?" element_type="f32" />
6
+ <output>
7
+ <port id="0" precision="FP32" names="image_feature">
8
+ <dim>-1</dim>
9
+ <dim>-1</dim>
10
+ <dim>-1</dim>
11
+ </port>
12
+ </output>
13
+ </layer>
14
+ <layer id="1" name="pos_embed" type="Parameter" version="opset1">
15
+ <data shape="?,?,?" element_type="f32" />
16
+ <output>
17
+ <port id="0" precision="FP32" names="pos_embed">
18
+ <dim>-1</dim>
19
+ <dim>-1</dim>
20
+ <dim>-1</dim>
21
+ </port>
22
+ </output>
23
+ </layer>
24
+ <layer id="2" name="key_padding_mask" type="Parameter" version="opset1">
25
+ <data shape="?,?" element_type="f32" />
26
+ <output>
27
+ <port id="0" precision="FP32" names="key_padding_mask">
28
+ <dim>-1</dim>
29
+ <dim>-1</dim>
30
+ </port>
31
+ </output>
32
+ </layer>
33
+ <layer id="3" name="Constant_9686" type="Const" version="opset1">
34
+ <data element_type="i64" shape="4" offset="0" size="32" />
35
+ <output>
36
+ <port id="0" precision="I64">
37
+ <dim>4</dim>
38
+ </port>
39
+ </output>
40
+ </layer>
41
+ <layer id="4" name="__module.attn/aten::view/Reshape_1" type="Reshape" version="opset1">
42
+ <data special_zero="true" />
43
+ <input>
44
+ <port id="0" precision="FP32">
45
+ <dim>-1</dim>
46
+ <dim>-1</dim>
47
+ </port>
48
+ <port id="1" precision="I64">
49
+ <dim>4</dim>
50
+ </port>
51
+ </input>
52
+ <output>
53
+ <port id="2" precision="FP32" names="111">
54
+ <dim>-1</dim>
55
+ <dim>1</dim>
56
+ <dim>1</dim>
57
+ <dim>-1</dim>
58
+ </port>
59
+ </output>
60
+ </layer>
61
+ <layer id="5" name="__module.attn/aten::expand/Abs" type="Const" version="opset1">
62
+ <data element_type="i64" shape="4" offset="32" size="32" />
63
+ <output>
64
+ <port id="0" precision="I64">
65
+ <dim>4</dim>
66
+ </port>
67
+ </output>
68
+ </layer>
69
+ <layer id="6" name="__module.attn/aten::expand/Broadcast" type="Broadcast" version="opset3">
70
+ <data mode="bidirectional" />
71
+ <input>
72
+ <port id="0" precision="FP32">
73
+ <dim>-1</dim>
74
+ <dim>1</dim>
75
+ <dim>1</dim>
76
+ <dim>-1</dim>
77
+ </port>
78
+ <port id="1" precision="I64">
79
+ <dim>4</dim>
80
+ </port>
81
+ </input>
82
+ <output>
83
+ <port id="2" precision="FP32" names="113">
84
+ <dim>-1</dim>
85
+ <dim>28</dim>
86
+ <dim>1</dim>
87
+ <dim>-1</dim>
88
+ </port>
89
+ </output>
90
+ </layer>
91
+ <layer id="7" name="ShapeOf_9654" type="ShapeOf" version="opset3">
92
+ <data output_type="i64" />
93
+ <input>
94
+ <port id="0" precision="FP32">
95
+ <dim>-1</dim>
96
+ <dim>-1</dim>
97
+ <dim>-1</dim>
98
+ </port>
99
+ </input>
100
+ <output>
101
+ <port id="1" precision="I64">
102
+ <dim>3</dim>
103
+ </port>
104
+ </output>
105
+ </layer>
106
+ <layer id="8" name="Constant_9655" type="Const" version="opset1">
107
+ <data element_type="i64" shape="1" offset="64" size="8" />
108
+ <output>
109
+ <port id="0" precision="I64">
110
+ <dim>1</dim>
111
+ </port>
112
+ </output>
113
+ </layer>
114
+ <layer id="9" name="Constant_9656" type="Const" version="opset1">
115
+ <data element_type="i64" shape="" offset="64" size="8" />
116
+ <output>
117
+ <port id="0" precision="I64" />
118
+ </output>
119
+ </layer>
120
+ <layer id="10" name="Gather_9657" type="Gather" version="opset8">
121
+ <data batch_dims="0" />
122
+ <input>
123
+ <port id="0" precision="I64">
124
+ <dim>3</dim>
125
+ </port>
126
+ <port id="1" precision="I64">
127
+ <dim>1</dim>
128
+ </port>
129
+ <port id="2" precision="I64" />
130
+ </input>
131
+ <output>
132
+ <port id="3" precision="I64" names="12,14,73">
133
+ <dim>1</dim>
134
+ </port>
135
+ </output>
136
+ </layer>
137
+ <layer id="11" name="Constant_7566" type="Const" version="opset1">
138
+ <data element_type="i64" shape="1" offset="72" size="8" />
139
+ <output>
140
+ <port id="0" precision="I64">
141
+ <dim>1</dim>
142
+ </port>
143
+ </output>
144
+ </layer>
145
+ <layer id="12" name="__module.attn/aten::mul/Multiply" type="Multiply" version="opset1">
146
+ <data auto_broadcast="numpy" />
147
+ <input>
148
+ <port id="0" precision="I64">
149
+ <dim>1</dim>
150
+ </port>
151
+ <port id="1" precision="I64">
152
+ <dim>1</dim>
153
+ </port>
154
+ </input>
155
+ <output>
156
+ <port id="2" precision="I64" names="104,105,114,115,92,93,98,99">
157
+ <dim>1</dim>
158
+ </port>
159
+ </output>
160
+ </layer>
161
+ <layer id="13" name="Constant_326" type="Const" version="opset1">
162
+ <data element_type="i64" shape="1" offset="80" size="8" />
163
+ <output>
164
+ <port id="0" precision="I64">
165
+ <dim>1</dim>
166
+ </port>
167
+ </output>
168
+ </layer>
169
+ <layer id="14" name="Constant_9665" type="Const" version="opset1">
170
+ <data element_type="i64" shape="1" offset="80" size="8" />
171
+ <output>
172
+ <port id="0" precision="I64">
173
+ <dim>1</dim>
174
+ </port>
175
+ </output>
176
+ </layer>
177
+ <layer id="15" name="Constant_9666" type="Const" version="opset1">
178
+ <data element_type="i64" shape="" offset="64" size="8" />
179
+ <output>
180
+ <port id="0" precision="I64" />
181
+ </output>
182
+ </layer>
183
+ <layer id="16" name="Gather_9667" type="Gather" version="opset8">
184
+ <data batch_dims="0" />
185
+ <input>
186
+ <port id="0" precision="I64">
187
+ <dim>3</dim>
188
+ </port>
189
+ <port id="1" precision="I64">
190
+ <dim>1</dim>
191
+ </port>
192
+ <port id="2" precision="I64" />
193
+ </input>
194
+ <output>
195
+ <port id="3" precision="I64" names="103,109,97">
196
+ <dim>1</dim>
197
+ </port>
198
+ </output>
199
+ </layer>
200
+ <layer id="17" name="__module.attn/prim::ListConstruct_2" type="Concat" version="opset1">
201
+ <data axis="0" />
202
+ <input>
203
+ <port id="0" precision="I64">
204
+ <dim>1</dim>
205
+ </port>
206
+ <port id="1" precision="I64">
207
+ <dim>1</dim>
208
+ </port>
209
+ <port id="2" precision="I64">
210
+ <dim>1</dim>
211
+ </port>
212
+ </input>
213
+ <output>
214
+ <port id="3" precision="I64">
215
+ <dim>3</dim>
216
+ </port>
217
+ </output>
218
+ </layer>
219
+ <layer id="18" name="__module.attn/aten::reshape/Reshape" type="Reshape" version="opset1">
220
+ <data special_zero="false" />
221
+ <input>
222
+ <port id="0" precision="FP32">
223
+ <dim>-1</dim>
224
+ <dim>28</dim>
225
+ <dim>1</dim>
226
+ <dim>-1</dim>
227
+ </port>
228
+ <port id="1" precision="I64">
229
+ <dim>3</dim>
230
+ </port>
231
+ </input>
232
+ <output>
233
+ <port id="2" precision="FP32" names="117,key_padding_mask_1">
234
+ <dim>-1</dim>
235
+ <dim>1</dim>
236
+ <dim>-1</dim>
237
+ </port>
238
+ </output>
239
+ </layer>
240
+ <layer id="19" name="aten::unsqueeze/Unsqueeze" type="Const" version="opset1">
241
+ <data element_type="f32" shape="64, 1, 3584" offset="88" size="917504" />
242
+ <output>
243
+ <port id="0" precision="FP32" names="24">
244
+ <dim>64</dim>
245
+ <dim>1</dim>
246
+ <dim>3584</dim>
247
+ </port>
248
+ </output>
249
+ </layer>
250
+ <layer id="20" name="Constant_891" type="Const" version="opset1">
251
+ <data element_type="i64" shape="1" offset="80" size="8" />
252
+ <output>
253
+ <port id="0" precision="I64">
254
+ <dim>1</dim>
255
+ </port>
256
+ </output>
257
+ </layer>
258
+ <layer id="21" name="Constant_898" type="Const" version="opset1">
259
+ <data element_type="i64" shape="1" offset="80" size="8" />
260
+ <output>
261
+ <port id="0" precision="I64">
262
+ <dim>1</dim>
263
+ </port>
264
+ </output>
265
+ </layer>
266
+ <layer id="22" name="prim::ListConstruct/Concat" type="Concat" version="opset1">
267
+ <data axis="0" />
268
+ <input>
269
+ <port id="0" precision="I64">
270
+ <dim>1</dim>
271
+ </port>
272
+ <port id="1" precision="I64">
273
+ <dim>1</dim>
274
+ </port>
275
+ <port id="2" precision="I64">
276
+ <dim>1</dim>
277
+ </port>
278
+ </input>
279
+ <output>
280
+ <port id="3" precision="I64" names="27">
281
+ <dim>3</dim>
282
+ </port>
283
+ </output>
284
+ </layer>
285
+ <layer id="23" name="aten::repeat/Tile" type="Tile" version="opset1">
286
+ <input>
287
+ <port id="0" precision="FP32">
288
+ <dim>64</dim>
289
+ <dim>1</dim>
290
+ <dim>3584</dim>
291
+ </port>
292
+ <port id="1" precision="I64">
293
+ <dim>3</dim>
294
+ </port>
295
+ </input>
296
+ <output>
297
+ <port id="2" precision="FP32" names="28,query.1">
298
+ <dim>64</dim>
299
+ <dim>-1</dim>
300
+ <dim>3584</dim>
301
+ </port>
302
+ </output>
303
+ </layer>
304
+ <layer id="24" name="__module.attn/prim::ListUnpack/VariadicSplit.0" type="Const" version="opset1">
305
+ <data element_type="i8" shape="3584, 3584" offset="917592" size="12845056" />
306
+ <output>
307
+ <port id="0" precision="I8">
308
+ <dim>3584</dim>
309
+ <dim>3584</dim>
310
+ </port>
311
+ </output>
312
+ </layer>
313
+ <layer id="25" name="Convert_1993077" type="Convert" version="opset1">
314
+ <data destination_type="f16" />
315
+ <input>
316
+ <port id="0" precision="I8">
317
+ <dim>3584</dim>
318
+ <dim>3584</dim>
319
+ </port>
320
+ </input>
321
+ <output>
322
+ <port id="1" precision="FP16">
323
+ <dim>3584</dim>
324
+ <dim>3584</dim>
325
+ </port>
326
+ </output>
327
+ </layer>
328
+ <layer id="26" name="__module.attn/prim::ListUnpack/VariadicSplit.0/scale" type="Const" version="opset1">
329
+ <data element_type="f16" shape="3584, 1" offset="13762648" size="7168" />
330
+ <output>
331
+ <port id="0" precision="FP16">
332
+ <dim>3584</dim>
333
+ <dim>1</dim>
334
+ </port>
335
+ </output>
336
+ </layer>
337
+ <layer id="27" name="__module.attn/prim::ListUnpack/VariadicSplit.0/fq_weights_1" type="Multiply" version="opset1">
338
+ <data auto_broadcast="numpy" />
339
+ <input>
340
+ <port id="0" precision="FP16">
341
+ <dim>3584</dim>
342
+ <dim>3584</dim>
343
+ </port>
344
+ <port id="1" precision="FP16">
345
+ <dim>3584</dim>
346
+ <dim>1</dim>
347
+ </port>
348
+ </input>
349
+ <output>
350
+ <port id="2" precision="FP16">
351
+ <dim>3584</dim>
352
+ <dim>3584</dim>
353
+ </port>
354
+ </output>
355
+ </layer>
356
+ <layer id="28" name="__module.attn/prim::ListUnpack/VariadicSplit.0/fq_weights_1/convert" type="Convert" version="opset1">
357
+ <data destination_type="f32" />
358
+ <input>
359
+ <port id="0" precision="FP16">
360
+ <dim>3584</dim>
361
+ <dim>3584</dim>
362
+ </port>
363
+ </input>
364
+ <output>
365
+ <port id="1" precision="FP32">
366
+ <dim>3584</dim>
367
+ <dim>3584</dim>
368
+ </port>
369
+ </output>
370
+ </layer>
371
+ <layer id="29" name="__module.attn/aten::linear/MatMul_1" type="MatMul" version="opset1">
372
+ <data transpose_a="false" transpose_b="true" />
373
+ <input>
374
+ <port id="0" precision="FP32">
375
+ <dim>64</dim>
376
+ <dim>-1</dim>
377
+ <dim>3584</dim>
378
+ </port>
379
+ <port id="1" precision="FP32">
380
+ <dim>3584</dim>
381
+ <dim>3584</dim>
382
+ </port>
383
+ </input>
384
+ <output>
385
+ <port id="2" precision="FP32">
386
+ <dim>64</dim>
387
+ <dim>-1</dim>
388
+ <dim>3584</dim>
389
+ </port>
390
+ </output>
391
+ </layer>
392
+ <layer id="30" name="Constant_9232" type="Const" version="opset1">
393
+ <data element_type="f32" shape="1, 1, 3584" offset="13769816" size="14336" />
394
+ <output>
395
+ <port id="0" precision="FP32">
396
+ <dim>1</dim>
397
+ <dim>1</dim>
398
+ <dim>3584</dim>
399
+ </port>
400
+ </output>
401
+ </layer>
402
+ <layer id="31" name="__module.attn/aten::linear/Add_1" type="Add" version="opset1">
403
+ <data auto_broadcast="numpy" />
404
+ <input>
405
+ <port id="0" precision="FP32">
406
+ <dim>64</dim>
407
+ <dim>-1</dim>
408
+ <dim>3584</dim>
409
+ </port>
410
+ <port id="1" precision="FP32">
411
+ <dim>1</dim>
412
+ <dim>1</dim>
413
+ <dim>3584</dim>
414
+ </port>
415
+ </input>
416
+ <output>
417
+ <port id="2" precision="FP32" names="89,q.3">
418
+ <dim>64</dim>
419
+ <dim>-1</dim>
420
+ <dim>3584</dim>
421
+ </port>
422
+ </output>
423
+ </layer>
424
+ <layer id="32" name="Constant_9687" type="Const" version="opset1">
425
+ <data element_type="i64" shape="3" offset="13784152" size="24" />
426
+ <output>
427
+ <port id="0" precision="I64">
428
+ <dim>3</dim>
429
+ </port>
430
+ </output>
431
+ </layer>
432
+ <layer id="33" name="__module.attn/aten::view/Reshape_2" type="Reshape" version="opset1">
433
+ <data special_zero="true" />
434
+ <input>
435
+ <port id="0" precision="FP32">
436
+ <dim>64</dim>
437
+ <dim>-1</dim>
438
+ <dim>3584</dim>
439
+ </port>
440
+ <port id="1" precision="I64">
441
+ <dim>3</dim>
442
+ </port>
443
+ </input>
444
+ <output>
445
+ <port id="2" precision="FP32" names="95">
446
+ <dim>64</dim>
447
+ <dim>-1</dim>
448
+ <dim>128</dim>
449
+ </port>
450
+ </output>
451
+ </layer>
452
+ <layer id="34" name="__module.attn/aten::transpose/Constant_1" type="Const" version="opset1">
453
+ <data element_type="i32" shape="3" offset="13784176" size="12" />
454
+ <output>
455
+ <port id="0" precision="I32">
456
+ <dim>3</dim>
457
+ </port>
458
+ </output>
459
+ </layer>
460
+ <layer id="35" name="__module.attn/aten::transpose/Transpose_1" type="Transpose" version="opset1">
461
+ <input>
462
+ <port id="0" precision="FP32">
463
+ <dim>64</dim>
464
+ <dim>-1</dim>
465
+ <dim>128</dim>
466
+ </port>
467
+ <port id="1" precision="I32">
468
+ <dim>3</dim>
469
+ </port>
470
+ </input>
471
+ <output>
472
+ <port id="2" precision="FP32" names="96,q">
473
+ <dim>-1</dim>
474
+ <dim>64</dim>
475
+ <dim>128</dim>
476
+ </port>
477
+ </output>
478
+ </layer>
479
+ <layer id="36" name="Constant_9233" type="Const" version="opset1">
480
+ <data element_type="f32" shape="1, 1, 1" offset="13784188" size="4" />
481
+ <output>
482
+ <port id="0" precision="FP32">
483
+ <dim>1</dim>
484
+ <dim>1</dim>
485
+ <dim>1</dim>
486
+ </port>
487
+ </output>
488
+ </layer>
489
+ <layer id="37" name="__module.attn/aten::div/Divide_1" type="Divide" version="opset1">
490
+ <data auto_broadcast="numpy" m_pythondiv="true" />
491
+ <input>
492
+ <port id="0" precision="FP32">
493
+ <dim>-1</dim>
494
+ <dim>64</dim>
495
+ <dim>128</dim>
496
+ </port>
497
+ <port id="1" precision="FP32">
498
+ <dim>1</dim>
499
+ <dim>1</dim>
500
+ <dim>1</dim>
501
+ </port>
502
+ </input>
503
+ <output>
504
+ <port id="2" precision="FP32" names="118,q_scaled">
505
+ <dim>-1</dim>
506
+ <dim>64</dim>
507
+ <dim>128</dim>
508
+ </port>
509
+ </output>
510
+ </layer>
511
+ <layer id="38" name="self.kv_proj.weight" type="Const" version="opset1">
512
+ <data element_type="i8" shape="3584, 1152" offset="13784192" size="4128768" />
513
+ <output>
514
+ <port id="0" precision="I8">
515
+ <dim>3584</dim>
516
+ <dim>1152</dim>
517
+ </port>
518
+ </output>
519
+ </layer>
520
+ <layer id="39" name="Convert_2008158" type="Convert" version="opset1">
521
+ <data destination_type="f16" />
522
+ <input>
523
+ <port id="0" precision="I8">
524
+ <dim>3584</dim>
525
+ <dim>1152</dim>
526
+ </port>
527
+ </input>
528
+ <output>
529
+ <port id="1" precision="FP16">
530
+ <dim>3584</dim>
531
+ <dim>1152</dim>
532
+ </port>
533
+ </output>
534
+ </layer>
535
+ <layer id="40" name="self.kv_proj.weight/scale" type="Const" version="opset1">
536
+ <data element_type="f16" shape="3584, 1" offset="17912960" size="7168" />
537
+ <output>
538
+ <port id="0" precision="FP16">
539
+ <dim>3584</dim>
540
+ <dim>1</dim>
541
+ </port>
542
+ </output>
543
+ </layer>
544
+ <layer id="41" name="self.kv_proj.weight/fq_weights_1" type="Multiply" version="opset1">
545
+ <data auto_broadcast="numpy" />
546
+ <input>
547
+ <port id="0" precision="FP16">
548
+ <dim>3584</dim>
549
+ <dim>1152</dim>
550
+ </port>
551
+ <port id="1" precision="FP16">
552
+ <dim>3584</dim>
553
+ <dim>1</dim>
554
+ </port>
555
+ </input>
556
+ <output>
557
+ <port id="2" precision="FP16">
558
+ <dim>3584</dim>
559
+ <dim>1152</dim>
560
+ </port>
561
+ </output>
562
+ </layer>
563
+ <layer id="42" name="self.kv_proj.weight/fq_weights_1/convert" type="Convert" version="opset1">
564
+ <data destination_type="f32" />
565
+ <input>
566
+ <port id="0" precision="FP16">
567
+ <dim>3584</dim>
568
+ <dim>1152</dim>
569
+ </port>
570
+ </input>
571
+ <output>
572
+ <port id="1" precision="FP32">
573
+ <dim>3584</dim>
574
+ <dim>1152</dim>
575
+ </port>
576
+ </output>
577
+ </layer>
578
+ <layer id="43" name="__module.kv_proj/ov_ext::linear/MatMul" type="MatMul" version="opset1">
579
+ <data transpose_a="false" transpose_b="true" />
580
+ <input>
581
+ <port id="0" precision="FP32">
582
+ <dim>-1</dim>
583
+ <dim>-1</dim>
584
+ <dim>-1</dim>
585
+ </port>
586
+ <port id="1" precision="FP32">
587
+ <dim>3584</dim>
588
+ <dim>1152</dim>
589
+ </port>
590
+ </input>
591
+ <output>
592
+ <port id="2" precision="FP32" names="41,input.1">
593
+ <dim>-1</dim>
594
+ <dim>-1</dim>
595
+ <dim>3584</dim>
596
+ </port>
597
+ </output>
598
+ </layer>
599
+ <layer id="44" name="__module.ln_kv/aten::layer_norm/Multiply" type="Const" version="opset1">
600
+ <data element_type="i32" shape="1" offset="17920128" size="4" />
601
+ <output>
602
+ <port id="0" precision="I32">
603
+ <dim>1</dim>
604
+ </port>
605
+ </output>
606
+ </layer>
607
+ <layer id="45" name="__module.ln_kv/aten::layer_norm/MVN" type="MVN" version="opset6">
608
+ <data eps="9.9999999747524271e-07" normalize_variance="true" eps_mode="INSIDE_SQRT" />
609
+ <input>
610
+ <port id="0" precision="FP32">
611
+ <dim>-1</dim>
612
+ <dim>-1</dim>
613
+ <dim>3584</dim>
614
+ </port>
615
+ <port id="1" precision="I32">
616
+ <dim>1</dim>
617
+ </port>
618
+ </input>
619
+ <output>
620
+ <port id="2" precision="FP32">
621
+ <dim>-1</dim>
622
+ <dim>-1</dim>
623
+ <dim>3584</dim>
624
+ </port>
625
+ </output>
626
+ </layer>
627
+ <layer id="46" name="Constant_9229" type="Const" version="opset1">
628
+ <data element_type="f32" shape="1, 1, 3584" offset="17920132" size="14336" />
629
+ <output>
630
+ <port id="0" precision="FP32">
631
+ <dim>1</dim>
632
+ <dim>1</dim>
633
+ <dim>3584</dim>
634
+ </port>
635
+ </output>
636
+ </layer>
637
+ <layer id="47" name="__module.ln_kv/aten::layer_norm/Multiply_1" type="Multiply" version="opset1">
638
+ <data auto_broadcast="numpy" />
639
+ <input>
640
+ <port id="0" precision="FP32">
641
+ <dim>-1</dim>
642
+ <dim>-1</dim>
643
+ <dim>3584</dim>
644
+ </port>
645
+ <port id="1" precision="FP32">
646
+ <dim>1</dim>
647
+ <dim>1</dim>
648
+ <dim>3584</dim>
649
+ </port>
650
+ </input>
651
+ <output>
652
+ <port id="2" precision="FP32">
653
+ <dim>-1</dim>
654
+ <dim>-1</dim>
655
+ <dim>3584</dim>
656
+ </port>
657
+ </output>
658
+ </layer>
659
+ <layer id="48" name="Constant_9230" type="Const" version="opset1">
660
+ <data element_type="f32" shape="1, 1, 3584" offset="17934468" size="14336" />
661
+ <output>
662
+ <port id="0" precision="FP32">
663
+ <dim>1</dim>
664
+ <dim>1</dim>
665
+ <dim>3584</dim>
666
+ </port>
667
+ </output>
668
+ </layer>
669
+ <layer id="49" name="__module.ln_kv/aten::layer_norm/Add" type="Add" version="opset1">
670
+ <data auto_broadcast="numpy" />
671
+ <input>
672
+ <port id="0" precision="FP32">
673
+ <dim>-1</dim>
674
+ <dim>-1</dim>
675
+ <dim>3584</dim>
676
+ </port>
677
+ <port id="1" precision="FP32">
678
+ <dim>1</dim>
679
+ <dim>1</dim>
680
+ <dim>3584</dim>
681
+ </port>
682
+ </input>
683
+ <output>
684
+ <port id="2" precision="FP32" names="48">
685
+ <dim>-1</dim>
686
+ <dim>-1</dim>
687
+ <dim>3584</dim>
688
+ </port>
689
+ </output>
690
+ </layer>
691
+ <layer id="50" name="Constant_53" type="Const" version="opset1">
692
+ <data element_type="i64" shape="3" offset="17948804" size="24" />
693
+ <output>
694
+ <port id="0" precision="I64" names="20">
695
+ <dim>3</dim>
696
+ </port>
697
+ </output>
698
+ </layer>
699
+ <layer id="51" name="aten::permute/Transpose" type="Transpose" version="opset1">
700
+ <input>
701
+ <port id="0" precision="FP32">
702
+ <dim>-1</dim>
703
+ <dim>-1</dim>
704
+ <dim>3584</dim>
705
+ </port>
706
+ <port id="1" precision="I64">
707
+ <dim>3</dim>
708
+ </port>
709
+ </input>
710
+ <output>
711
+ <port id="2" precision="FP32" names="21,image_feature_1">
712
+ <dim>-1</dim>
713
+ <dim>-1</dim>
714
+ <dim>3584</dim>
715
+ </port>
716
+ </output>
717
+ </layer>
718
+ <layer id="52" name="aten::add/Add" type="Add" version="opset1">
719
+ <data auto_broadcast="numpy" />
720
+ <input>
721
+ <port id="0" precision="FP32">
722
+ <dim>-1</dim>
723
+ <dim>-1</dim>
724
+ <dim>3584</dim>
725
+ </port>
726
+ <port id="1" precision="FP32">
727
+ <dim>-1</dim>
728
+ <dim>-1</dim>
729
+ <dim>-1</dim>
730
+ </port>
731
+ </input>
732
+ <output>
733
+ <port id="2" precision="FP32" names="30,key">
734
+ <dim>-1</dim>
735
+ <dim>-1</dim>
736
+ <dim>3584</dim>
737
+ </port>
738
+ </output>
739
+ </layer>
740
+ <layer id="53" name="__module.attn/prim::ListUnpack/VariadicSplit.1" type="Const" version="opset1">
741
+ <data element_type="i8" shape="3584, 3584" offset="17948828" size="12845056" />
742
+ <output>
743
+ <port id="0" precision="I8">
744
+ <dim>3584</dim>
745
+ <dim>3584</dim>
746
+ </port>
747
+ </output>
748
+ </layer>
749
+ <layer id="54" name="Convert_1988050" type="Convert" version="opset1">
750
+ <data destination_type="f16" />
751
+ <input>
752
+ <port id="0" precision="I8">
753
+ <dim>3584</dim>
754
+ <dim>3584</dim>
755
+ </port>
756
+ </input>
757
+ <output>
758
+ <port id="1" precision="FP16">
759
+ <dim>3584</dim>
760
+ <dim>3584</dim>
761
+ </port>
762
+ </output>
763
+ </layer>
764
+ <layer id="55" name="__module.attn/prim::ListUnpack/VariadicSplit.1/scale" type="Const" version="opset1">
765
+ <data element_type="f16" shape="3584, 1" offset="30793884" size="7168" />
766
+ <output>
767
+ <port id="0" precision="FP16">
768
+ <dim>3584</dim>
769
+ <dim>1</dim>
770
+ </port>
771
+ </output>
772
+ </layer>
773
+ <layer id="56" name="__module.attn/prim::ListUnpack/VariadicSplit.1/fq_weights_1" type="Multiply" version="opset1">
774
+ <data auto_broadcast="numpy" />
775
+ <input>
776
+ <port id="0" precision="FP16">
777
+ <dim>3584</dim>
778
+ <dim>3584</dim>
779
+ </port>
780
+ <port id="1" precision="FP16">
781
+ <dim>3584</dim>
782
+ <dim>1</dim>
783
+ </port>
784
+ </input>
785
+ <output>
786
+ <port id="2" precision="FP16">
787
+ <dim>3584</dim>
788
+ <dim>3584</dim>
789
+ </port>
790
+ </output>
791
+ </layer>
792
+ <layer id="57" name="__module.attn/prim::ListUnpack/VariadicSplit.1/fq_weights_1/convert" type="Convert" version="opset1">
793
+ <data destination_type="f32" />
794
+ <input>
795
+ <port id="0" precision="FP16">
796
+ <dim>3584</dim>
797
+ <dim>3584</dim>
798
+ </port>
799
+ </input>
800
+ <output>
801
+ <port id="1" precision="FP32">
802
+ <dim>3584</dim>
803
+ <dim>3584</dim>
804
+ </port>
805
+ </output>
806
+ </layer>
807
+ <layer id="58" name="__module.attn/aten::linear/MatMul" type="MatMul" version="opset1">
808
+ <data transpose_a="false" transpose_b="true" />
809
+ <input>
810
+ <port id="0" precision="FP32">
811
+ <dim>-1</dim>
812
+ <dim>-1</dim>
813
+ <dim>3584</dim>
814
+ </port>
815
+ <port id="1" precision="FP32">
816
+ <dim>3584</dim>
817
+ <dim>3584</dim>
818
+ </port>
819
+ </input>
820
+ <output>
821
+ <port id="2" precision="FP32">
822
+ <dim>-1</dim>
823
+ <dim>-1</dim>
824
+ <dim>3584</dim>
825
+ </port>
826
+ </output>
827
+ </layer>
828
+ <layer id="59" name="Constant_9231" type="Const" version="opset1">
829
+ <data element_type="f32" shape="1, 1, 3584" offset="30801052" size="14336" />
830
+ <output>
831
+ <port id="0" precision="FP32">
832
+ <dim>1</dim>
833
+ <dim>1</dim>
834
+ <dim>3584</dim>
835
+ </port>
836
+ </output>
837
+ </layer>
838
+ <layer id="60" name="__module.attn/aten::linear/Add" type="Add" version="opset1">
839
+ <data auto_broadcast="numpy" />
840
+ <input>
841
+ <port id="0" precision="FP32">
842
+ <dim>-1</dim>
843
+ <dim>-1</dim>
844
+ <dim>3584</dim>
845
+ </port>
846
+ <port id="1" precision="FP32">
847
+ <dim>1</dim>
848
+ <dim>1</dim>
849
+ <dim>3584</dim>
850
+ </port>
851
+ </input>
852
+ <output>
853
+ <port id="2" precision="FP32" names="90,k.1">
854
+ <dim>-1</dim>
855
+ <dim>-1</dim>
856
+ <dim>3584</dim>
857
+ </port>
858
+ </output>
859
+ </layer>
860
+ <layer id="61" name="Constant_9688" type="Const" version="opset1">
861
+ <data element_type="i64" shape="3" offset="30815388" size="24" />
862
+ <output>
863
+ <port id="0" precision="I64">
864
+ <dim>3</dim>
865
+ </port>
866
+ </output>
867
+ </layer>
868
+ <layer id="62" name="__module.attn/aten::view/Reshape" type="Reshape" version="opset1">
869
+ <data special_zero="true" />
870
+ <input>
871
+ <port id="0" precision="FP32">
872
+ <dim>-1</dim>
873
+ <dim>-1</dim>
874
+ <dim>3584</dim>
875
+ </port>
876
+ <port id="1" precision="I64">
877
+ <dim>3</dim>
878
+ </port>
879
+ </input>
880
+ <output>
881
+ <port id="2" precision="FP32" names="101">
882
+ <dim>-1</dim>
883
+ <dim>-1</dim>
884
+ <dim>128</dim>
885
+ </port>
886
+ </output>
887
+ </layer>
888
+ <layer id="63" name="__module.attn/aten::transpose/Constant" type="Const" version="opset1">
889
+ <data element_type="i32" shape="3" offset="13784176" size="12" />
890
+ <output>
891
+ <port id="0" precision="I32">
892
+ <dim>3</dim>
893
+ </port>
894
+ </output>
895
+ </layer>
896
+ <layer id="64" name="__module.attn/aten::transpose/Transpose" type="Transpose" version="opset1">
897
+ <input>
898
+ <port id="0" precision="FP32">
899
+ <dim>-1</dim>
900
+ <dim>-1</dim>
901
+ <dim>128</dim>
902
+ </port>
903
+ <port id="1" precision="I32">
904
+ <dim>3</dim>
905
+ </port>
906
+ </input>
907
+ <output>
908
+ <port id="2" precision="FP32" names="102,k">
909
+ <dim>-1</dim>
910
+ <dim>-1</dim>
911
+ <dim>128</dim>
912
+ </port>
913
+ </output>
914
+ </layer>
915
+ <layer id="65" name="__module.attn/aten::baddbmm/MatMul" type="MatMul" version="opset1">
916
+ <data transpose_a="false" transpose_b="true" />
917
+ <input>
918
+ <port id="0" precision="FP32">
919
+ <dim>-1</dim>
920
+ <dim>64</dim>
921
+ <dim>128</dim>
922
+ </port>
923
+ <port id="1" precision="FP32">
924
+ <dim>-1</dim>
925
+ <dim>-1</dim>
926
+ <dim>128</dim>
927
+ </port>
928
+ </input>
929
+ <output>
930
+ <port id="2" precision="FP32">
931
+ <dim>-1</dim>
932
+ <dim>64</dim>
933
+ <dim>-1</dim>
934
+ </port>
935
+ </output>
936
+ </layer>
937
+ <layer id="66" name="__module.attn/aten::baddbmm/Add" type="Add" version="opset1">
938
+ <data auto_broadcast="numpy" />
939
+ <input>
940
+ <port id="0" precision="FP32">
941
+ <dim>-1</dim>
942
+ <dim>1</dim>
943
+ <dim>-1</dim>
944
+ </port>
945
+ <port id="1" precision="FP32">
946
+ <dim>-1</dim>
947
+ <dim>64</dim>
948
+ <dim>-1</dim>
949
+ </port>
950
+ </input>
951
+ <output>
952
+ <port id="2" precision="FP32" names="120,input.5">
953
+ <dim>-1</dim>
954
+ <dim>64</dim>
955
+ <dim>-1</dim>
956
+ </port>
957
+ </output>
958
+ </layer>
959
+ <layer id="67" name="__module.attn/aten::softmax/Softmax" type="SoftMax" version="opset8">
960
+ <data axis="-1" />
961
+ <input>
962
+ <port id="0" precision="FP32">
963
+ <dim>-1</dim>
964
+ <dim>64</dim>
965
+ <dim>-1</dim>
966
+ </port>
967
+ </input>
968
+ <output>
969
+ <port id="1" precision="FP32" names="121,attn_output_weights.1">
970
+ <dim>-1</dim>
971
+ <dim>64</dim>
972
+ <dim>-1</dim>
973
+ </port>
974
+ </output>
975
+ </layer>
976
+ <layer id="68" name="__module.attn/prim::ListUnpack/VariadicSplit.2" type="Const" version="opset1">
977
+ <data element_type="i8" shape="3584, 3584" offset="30815412" size="12845056" />
978
+ <output>
979
+ <port id="0" precision="I8">
980
+ <dim>3584</dim>
981
+ <dim>3584</dim>
982
+ </port>
983
+ </output>
984
+ </layer>
985
+ <layer id="69" name="Convert_1983023" type="Convert" version="opset1">
986
+ <data destination_type="f16" />
987
+ <input>
988
+ <port id="0" precision="I8">
989
+ <dim>3584</dim>
990
+ <dim>3584</dim>
991
+ </port>
992
+ </input>
993
+ <output>
994
+ <port id="1" precision="FP16">
995
+ <dim>3584</dim>
996
+ <dim>3584</dim>
997
+ </port>
998
+ </output>
999
+ </layer>
1000
+ <layer id="70" name="__module.attn/prim::ListUnpack/VariadicSplit.2/scale" type="Const" version="opset1">
1001
+ <data element_type="f16" shape="3584, 1" offset="43660468" size="7168" />
1002
+ <output>
1003
+ <port id="0" precision="FP16">
1004
+ <dim>3584</dim>
1005
+ <dim>1</dim>
1006
+ </port>
1007
+ </output>
1008
+ </layer>
1009
+ <layer id="71" name="__module.attn/prim::ListUnpack/VariadicSplit.2/fq_weights_1" type="Multiply" version="opset1">
1010
+ <data auto_broadcast="numpy" />
1011
+ <input>
1012
+ <port id="0" precision="FP16">
1013
+ <dim>3584</dim>
1014
+ <dim>3584</dim>
1015
+ </port>
1016
+ <port id="1" precision="FP16">
1017
+ <dim>3584</dim>
1018
+ <dim>1</dim>
1019
+ </port>
1020
+ </input>
1021
+ <output>
1022
+ <port id="2" precision="FP16">
1023
+ <dim>3584</dim>
1024
+ <dim>3584</dim>
1025
+ </port>
1026
+ </output>
1027
+ </layer>
1028
+ <layer id="72" name="__module.attn/prim::ListUnpack/VariadicSplit.2/fq_weights_1/convert" type="Convert" version="opset1">
1029
+ <data destination_type="f32" />
1030
+ <input>
1031
+ <port id="0" precision="FP16">
1032
+ <dim>3584</dim>
1033
+ <dim>3584</dim>
1034
+ </port>
1035
+ </input>
1036
+ <output>
1037
+ <port id="1" precision="FP32">
1038
+ <dim>3584</dim>
1039
+ <dim>3584</dim>
1040
+ </port>
1041
+ </output>
1042
+ </layer>
1043
+ <layer id="73" name="__module.attn/aten::linear/MatMul_2" type="MatMul" version="opset1">
1044
+ <data transpose_a="false" transpose_b="true" />
1045
+ <input>
1046
+ <port id="0" precision="FP32">
1047
+ <dim>-1</dim>
1048
+ <dim>-1</dim>
1049
+ <dim>3584</dim>
1050
+ </port>
1051
+ <port id="1" precision="FP32">
1052
+ <dim>3584</dim>
1053
+ <dim>3584</dim>
1054
+ </port>
1055
+ </input>
1056
+ <output>
1057
+ <port id="2" precision="FP32">
1058
+ <dim>-1</dim>
1059
+ <dim>-1</dim>
1060
+ <dim>3584</dim>
1061
+ </port>
1062
+ </output>
1063
+ </layer>
1064
+ <layer id="74" name="Constant_9234" type="Const" version="opset1">
1065
+ <data element_type="f32" shape="1, 1, 3584" offset="43667636" size="14336" />
1066
+ <output>
1067
+ <port id="0" precision="FP32">
1068
+ <dim>1</dim>
1069
+ <dim>1</dim>
1070
+ <dim>3584</dim>
1071
+ </port>
1072
+ </output>
1073
+ </layer>
1074
+ <layer id="75" name="__module.attn/aten::linear/Add_2" type="Add" version="opset1">
1075
+ <data auto_broadcast="numpy" />
1076
+ <input>
1077
+ <port id="0" precision="FP32">
1078
+ <dim>-1</dim>
1079
+ <dim>-1</dim>
1080
+ <dim>3584</dim>
1081
+ </port>
1082
+ <port id="1" precision="FP32">
1083
+ <dim>1</dim>
1084
+ <dim>1</dim>
1085
+ <dim>3584</dim>
1086
+ </port>
1087
+ </input>
1088
+ <output>
1089
+ <port id="2" precision="FP32" names="91,v.1">
1090
+ <dim>-1</dim>
1091
+ <dim>-1</dim>
1092
+ <dim>3584</dim>
1093
+ </port>
1094
+ </output>
1095
+ </layer>
1096
+ <layer id="76" name="Constant_9689" type="Const" version="opset1">
1097
+ <data element_type="i64" shape="3" offset="30815388" size="24" />
1098
+ <output>
1099
+ <port id="0" precision="I64">
1100
+ <dim>3</dim>
1101
+ </port>
1102
+ </output>
1103
+ </layer>
1104
+ <layer id="77" name="__module.attn/aten::view/Reshape_3" type="Reshape" version="opset1">
1105
+ <data special_zero="true" />
1106
+ <input>
1107
+ <port id="0" precision="FP32">
1108
+ <dim>-1</dim>
1109
+ <dim>-1</dim>
1110
+ <dim>3584</dim>
1111
+ </port>
1112
+ <port id="1" precision="I64">
1113
+ <dim>3</dim>
1114
+ </port>
1115
+ </input>
1116
+ <output>
1117
+ <port id="2" precision="FP32" names="107">
1118
+ <dim>-1</dim>
1119
+ <dim>-1</dim>
1120
+ <dim>128</dim>
1121
+ </port>
1122
+ </output>
1123
+ </layer>
1124
+ <layer id="78" name="__module.attn/aten::transpose/Constant_3" type="Const" version="opset1">
1125
+ <data element_type="i32" shape="3" offset="13784176" size="12" />
1126
+ <output>
1127
+ <port id="0" precision="I32">
1128
+ <dim>3</dim>
1129
+ </port>
1130
+ </output>
1131
+ </layer>
1132
+ <layer id="79" name="__module.attn/aten::transpose/Transpose_3" type="Transpose" version="opset1">
1133
+ <input>
1134
+ <port id="0" precision="FP32">
1135
+ <dim>-1</dim>
1136
+ <dim>-1</dim>
1137
+ <dim>128</dim>
1138
+ </port>
1139
+ <port id="1" precision="I32">
1140
+ <dim>3</dim>
1141
+ </port>
1142
+ </input>
1143
+ <output>
1144
+ <port id="2" precision="FP32" names="108,v">
1145
+ <dim>-1</dim>
1146
+ <dim>-1</dim>
1147
+ <dim>128</dim>
1148
+ </port>
1149
+ </output>
1150
+ </layer>
1151
+ <layer id="80" name="__module.attn/aten::bmm/MatMul" type="MatMul" version="opset1">
1152
+ <data transpose_a="false" transpose_b="false" />
1153
+ <input>
1154
+ <port id="0" precision="FP32">
1155
+ <dim>-1</dim>
1156
+ <dim>64</dim>
1157
+ <dim>-1</dim>
1158
+ </port>
1159
+ <port id="1" precision="FP32">
1160
+ <dim>-1</dim>
1161
+ <dim>-1</dim>
1162
+ <dim>128</dim>
1163
+ </port>
1164
+ </input>
1165
+ <output>
1166
+ <port id="2" precision="FP32" names="122,attn_output.1">
1167
+ <dim>-1</dim>
1168
+ <dim>64</dim>
1169
+ <dim>128</dim>
1170
+ </port>
1171
+ </output>
1172
+ </layer>
1173
+ <layer id="81" name="__module.attn/aten::transpose/Constant_4" type="Const" version="opset1">
1174
+ <data element_type="i32" shape="3" offset="13784176" size="12" />
1175
+ <output>
1176
+ <port id="0" precision="I32">
1177
+ <dim>3</dim>
1178
+ </port>
1179
+ </output>
1180
+ </layer>
1181
+ <layer id="82" name="__module.attn/aten::transpose/Transpose_4" type="Transpose" version="opset1">
1182
+ <input>
1183
+ <port id="0" precision="FP32">
1184
+ <dim>-1</dim>
1185
+ <dim>64</dim>
1186
+ <dim>128</dim>
1187
+ </port>
1188
+ <port id="1" precision="I32">
1189
+ <dim>3</dim>
1190
+ </port>
1191
+ </input>
1192
+ <output>
1193
+ <port id="2" precision="FP32" names="123">
1194
+ <dim>64</dim>
1195
+ <dim>-1</dim>
1196
+ <dim>128</dim>
1197
+ </port>
1198
+ </output>
1199
+ </layer>
1200
+ <layer id="83" name="Concat_4375" type="Const" version="opset1">
1201
+ <data element_type="i64" shape="2" offset="43681972" size="16" />
1202
+ <output>
1203
+ <port id="0" precision="I64">
1204
+ <dim>2</dim>
1205
+ </port>
1206
+ </output>
1207
+ </layer>
1208
+ <layer id="84" name="__module.attn/aten::view/Reshape_4" type="Reshape" version="opset1">
1209
+ <data special_zero="false" />
1210
+ <input>
1211
+ <port id="0" precision="FP32">
1212
+ <dim>64</dim>
1213
+ <dim>-1</dim>
1214
+ <dim>128</dim>
1215
+ </port>
1216
+ <port id="1" precision="I64">
1217
+ <dim>2</dim>
1218
+ </port>
1219
+ </input>
1220
+ <output>
1221
+ <port id="2" precision="FP32" names="128">
1222
+ <dim>-1</dim>
1223
+ <dim>3584</dim>
1224
+ </port>
1225
+ </output>
1226
+ </layer>
1227
+ <layer id="85" name="self.attn.out_proj.weight" type="Const" version="opset1">
1228
+ <data element_type="i8" shape="3584, 3584" offset="43681988" size="12845056" />
1229
+ <output>
1230
+ <port id="0" precision="I8">
1231
+ <dim>3584</dim>
1232
+ <dim>3584</dim>
1233
+ </port>
1234
+ </output>
1235
+ </layer>
1236
+ <layer id="86" name="Convert_1998104" type="Convert" version="opset1">
1237
+ <data destination_type="f16" />
1238
+ <input>
1239
+ <port id="0" precision="I8">
1240
+ <dim>3584</dim>
1241
+ <dim>3584</dim>
1242
+ </port>
1243
+ </input>
1244
+ <output>
1245
+ <port id="1" precision="FP16">
1246
+ <dim>3584</dim>
1247
+ <dim>3584</dim>
1248
+ </port>
1249
+ </output>
1250
+ </layer>
1251
+ <layer id="87" name="self.attn.out_proj.weight/scale" type="Const" version="opset1">
1252
+ <data element_type="f16" shape="3584, 1" offset="56527044" size="7168" />
1253
+ <output>
1254
+ <port id="0" precision="FP16">
1255
+ <dim>3584</dim>
1256
+ <dim>1</dim>
1257
+ </port>
1258
+ </output>
1259
+ </layer>
1260
+ <layer id="88" name="self.attn.out_proj.weight/fq_weights_1" type="Multiply" version="opset1">
1261
+ <data auto_broadcast="numpy" />
1262
+ <input>
1263
+ <port id="0" precision="FP16">
1264
+ <dim>3584</dim>
1265
+ <dim>3584</dim>
1266
+ </port>
1267
+ <port id="1" precision="FP16">
1268
+ <dim>3584</dim>
1269
+ <dim>1</dim>
1270
+ </port>
1271
+ </input>
1272
+ <output>
1273
+ <port id="2" precision="FP16">
1274
+ <dim>3584</dim>
1275
+ <dim>3584</dim>
1276
+ </port>
1277
+ </output>
1278
+ </layer>
1279
+ <layer id="89" name="self.attn.out_proj.weight/fq_weights_1/convert" type="Convert" version="opset1">
1280
+ <data destination_type="f32" />
1281
+ <input>
1282
+ <port id="0" precision="FP16">
1283
+ <dim>3584</dim>
1284
+ <dim>3584</dim>
1285
+ </port>
1286
+ </input>
1287
+ <output>
1288
+ <port id="1" precision="FP32">
1289
+ <dim>3584</dim>
1290
+ <dim>3584</dim>
1291
+ </port>
1292
+ </output>
1293
+ </layer>
1294
+ <layer id="90" name="__module.attn.out_proj/ov_ext::linear/MatMul" type="MatMul" version="opset1">
1295
+ <data transpose_a="false" transpose_b="true" />
1296
+ <input>
1297
+ <port id="0" precision="FP32">
1298
+ <dim>-1</dim>
1299
+ <dim>3584</dim>
1300
+ </port>
1301
+ <port id="1" precision="FP32">
1302
+ <dim>3584</dim>
1303
+ <dim>3584</dim>
1304
+ </port>
1305
+ </input>
1306
+ <output>
1307
+ <port id="2" precision="FP32">
1308
+ <dim>-1</dim>
1309
+ <dim>3584</dim>
1310
+ </port>
1311
+ </output>
1312
+ </layer>
1313
+ <layer id="91" name="Constant_9235" type="Const" version="opset1">
1314
+ <data element_type="f32" shape="1, 3584" offset="56534212" size="14336" />
1315
+ <output>
1316
+ <port id="0" precision="FP32">
1317
+ <dim>1</dim>
1318
+ <dim>3584</dim>
1319
+ </port>
1320
+ </output>
1321
+ </layer>
1322
+ <layer id="92" name="__module.attn.out_proj/ov_ext::linear/Add" type="Add" version="opset1">
1323
+ <data auto_broadcast="numpy" />
1324
+ <input>
1325
+ <port id="0" precision="FP32">
1326
+ <dim>-1</dim>
1327
+ <dim>3584</dim>
1328
+ </port>
1329
+ <port id="1" precision="FP32">
1330
+ <dim>1</dim>
1331
+ <dim>3584</dim>
1332
+ </port>
1333
+ </input>
1334
+ <output>
1335
+ <port id="2" precision="FP32" names="131,attn_output">
1336
+ <dim>-1</dim>
1337
+ <dim>3584</dim>
1338
+ </port>
1339
+ </output>
1340
+ </layer>
1341
+ <layer id="93" name="Constant_9690" type="Const" version="opset1">
1342
+ <data element_type="i64" shape="3" offset="56548548" size="24" />
1343
+ <output>
1344
+ <port id="0" precision="I64">
1345
+ <dim>3</dim>
1346
+ </port>
1347
+ </output>
1348
+ </layer>
1349
+ <layer id="94" name="__module.attn/aten::view/Reshape_5" type="Reshape" version="opset1">
1350
+ <data special_zero="true" />
1351
+ <input>
1352
+ <port id="0" precision="FP32">
1353
+ <dim>-1</dim>
1354
+ <dim>3584</dim>
1355
+ </port>
1356
+ <port id="1" precision="I64">
1357
+ <dim>3</dim>
1358
+ </port>
1359
+ </input>
1360
+ <output>
1361
+ <port id="2" precision="FP32" names="134,out">
1362
+ <dim>64</dim>
1363
+ <dim>-1</dim>
1364
+ <dim>3584</dim>
1365
+ </port>
1366
+ </output>
1367
+ </layer>
1368
+ <layer id="95" name="Constant_486" type="Const" version="opset1">
1369
+ <data element_type="i64" shape="3" offset="17948804" size="24" />
1370
+ <output>
1371
+ <port id="0" precision="I64" names="35">
1372
+ <dim>3</dim>
1373
+ </port>
1374
+ </output>
1375
+ </layer>
1376
+ <layer id="96" name="aten::permute/Transpose_1" type="Transpose" version="opset1">
1377
+ <input>
1378
+ <port id="0" precision="FP32">
1379
+ <dim>64</dim>
1380
+ <dim>-1</dim>
1381
+ <dim>3584</dim>
1382
+ </port>
1383
+ <port id="1" precision="I64">
1384
+ <dim>3</dim>
1385
+ </port>
1386
+ </input>
1387
+ <output>
1388
+ <port id="2" precision="FP32" names="36,input">
1389
+ <dim>-1</dim>
1390
+ <dim>64</dim>
1391
+ <dim>3584</dim>
1392
+ </port>
1393
+ </output>
1394
+ </layer>
1395
+ <layer id="97" name="__module.ln_post/aten::layer_norm/Multiply" type="Const" version="opset1">
1396
+ <data element_type="i32" shape="1" offset="17920128" size="4" />
1397
+ <output>
1398
+ <port id="0" precision="I32">
1399
+ <dim>1</dim>
1400
+ </port>
1401
+ </output>
1402
+ </layer>
1403
+ <layer id="98" name="__module.ln_post/aten::layer_norm/MVN" type="MVN" version="opset6">
1404
+ <data eps="9.9999999747524271e-07" normalize_variance="true" eps_mode="INSIDE_SQRT" />
1405
+ <input>
1406
+ <port id="0" precision="FP32">
1407
+ <dim>-1</dim>
1408
+ <dim>64</dim>
1409
+ <dim>3584</dim>
1410
+ </port>
1411
+ <port id="1" precision="I32">
1412
+ <dim>1</dim>
1413
+ </port>
1414
+ </input>
1415
+ <output>
1416
+ <port id="2" precision="FP32">
1417
+ <dim>-1</dim>
1418
+ <dim>64</dim>
1419
+ <dim>3584</dim>
1420
+ </port>
1421
+ </output>
1422
+ </layer>
1423
+ <layer id="99" name="Constant_9236" type="Const" version="opset1">
1424
+ <data element_type="f32" shape="1, 1, 3584" offset="56548572" size="14336" />
1425
+ <output>
1426
+ <port id="0" precision="FP32">
1427
+ <dim>1</dim>
1428
+ <dim>1</dim>
1429
+ <dim>3584</dim>
1430
+ </port>
1431
+ </output>
1432
+ </layer>
1433
+ <layer id="100" name="__module.ln_post/aten::layer_norm/Multiply_1" type="Multiply" version="opset1">
1434
+ <data auto_broadcast="numpy" />
1435
+ <input>
1436
+ <port id="0" precision="FP32">
1437
+ <dim>-1</dim>
1438
+ <dim>64</dim>
1439
+ <dim>3584</dim>
1440
+ </port>
1441
+ <port id="1" precision="FP32">
1442
+ <dim>1</dim>
1443
+ <dim>1</dim>
1444
+ <dim>3584</dim>
1445
+ </port>
1446
+ </input>
1447
+ <output>
1448
+ <port id="2" precision="FP32">
1449
+ <dim>-1</dim>
1450
+ <dim>64</dim>
1451
+ <dim>3584</dim>
1452
+ </port>
1453
+ </output>
1454
+ </layer>
1455
+ <layer id="101" name="Constant_9237" type="Const" version="opset1">
1456
+ <data element_type="f32" shape="1, 1, 3584" offset="56562908" size="14336" />
1457
+ <output>
1458
+ <port id="0" precision="FP32">
1459
+ <dim>1</dim>
1460
+ <dim>1</dim>
1461
+ <dim>3584</dim>
1462
+ </port>
1463
+ </output>
1464
+ </layer>
1465
+ <layer id="102" name="__module.ln_post/aten::layer_norm/Add" type="Add" version="opset1">
1466
+ <data auto_broadcast="numpy" />
1467
+ <input>
1468
+ <port id="0" precision="FP32">
1469
+ <dim>-1</dim>
1470
+ <dim>64</dim>
1471
+ <dim>3584</dim>
1472
+ </port>
1473
+ <port id="1" precision="FP32">
1474
+ <dim>1</dim>
1475
+ <dim>1</dim>
1476
+ <dim>3584</dim>
1477
+ </port>
1478
+ </input>
1479
+ <output>
1480
+ <port id="2" precision="FP32" names="141,x">
1481
+ <dim>-1</dim>
1482
+ <dim>64</dim>
1483
+ <dim>3584</dim>
1484
+ </port>
1485
+ </output>
1486
+ </layer>
1487
+ <layer id="103" name="Transpose_8047" type="Const" version="opset1">
1488
+ <data element_type="i8" shape="3584, 3584" offset="56577244" size="12845056" />
1489
+ <output>
1490
+ <port id="0" precision="I8">
1491
+ <dim>3584</dim>
1492
+ <dim>3584</dim>
1493
+ </port>
1494
+ </output>
1495
+ </layer>
1496
+ <layer id="104" name="Convert_2003131" type="Convert" version="opset1">
1497
+ <data destination_type="f16" />
1498
+ <input>
1499
+ <port id="0" precision="I8">
1500
+ <dim>3584</dim>
1501
+ <dim>3584</dim>
1502
+ </port>
1503
+ </input>
1504
+ <output>
1505
+ <port id="1" precision="FP16">
1506
+ <dim>3584</dim>
1507
+ <dim>3584</dim>
1508
+ </port>
1509
+ </output>
1510
+ </layer>
1511
+ <layer id="105" name="Transpose_8047/scale" type="Const" version="opset1">
1512
+ <data element_type="f16" shape="3584, 1" offset="69422300" size="7168" />
1513
+ <output>
1514
+ <port id="0" precision="FP16">
1515
+ <dim>3584</dim>
1516
+ <dim>1</dim>
1517
+ </port>
1518
+ </output>
1519
+ </layer>
1520
+ <layer id="106" name="Transpose_8047/fq_weights_1" type="Multiply" version="opset1">
1521
+ <data auto_broadcast="numpy" />
1522
+ <input>
1523
+ <port id="0" precision="FP16">
1524
+ <dim>3584</dim>
1525
+ <dim>3584</dim>
1526
+ </port>
1527
+ <port id="1" precision="FP16">
1528
+ <dim>3584</dim>
1529
+ <dim>1</dim>
1530
+ </port>
1531
+ </input>
1532
+ <output>
1533
+ <port id="2" precision="FP16">
1534
+ <dim>3584</dim>
1535
+ <dim>3584</dim>
1536
+ </port>
1537
+ </output>
1538
+ </layer>
1539
+ <layer id="107" name="Transpose_8047/fq_weights_1/convert" type="Convert" version="opset1">
1540
+ <data destination_type="f32" />
1541
+ <input>
1542
+ <port id="0" precision="FP16">
1543
+ <dim>3584</dim>
1544
+ <dim>3584</dim>
1545
+ </port>
1546
+ </input>
1547
+ <output>
1548
+ <port id="1" precision="FP32">
1549
+ <dim>3584</dim>
1550
+ <dim>3584</dim>
1551
+ </port>
1552
+ </output>
1553
+ </layer>
1554
+ <layer id="108" name="aten::matmul/MatMul" type="MatMul" version="opset1">
1555
+ <data transpose_a="false" transpose_b="true" />
1556
+ <input>
1557
+ <port id="0" precision="FP32">
1558
+ <dim>-1</dim>
1559
+ <dim>64</dim>
1560
+ <dim>3584</dim>
1561
+ </port>
1562
+ <port id="1" precision="FP32">
1563
+ <dim>3584</dim>
1564
+ <dim>3584</dim>
1565
+ </port>
1566
+ </input>
1567
+ <output>
1568
+ <port id="2" precision="FP32" names="last_hidden_state">
1569
+ <dim>-1</dim>
1570
+ <dim>64</dim>
1571
+ <dim>3584</dim>
1572
+ </port>
1573
+ </output>
1574
+ </layer>
1575
+ <layer id="109" name="Result_545" type="Result" version="opset1" output_names="last_hidden_state">
1576
+ <input>
1577
+ <port id="0" precision="FP32">
1578
+ <dim>-1</dim>
1579
+ <dim>64</dim>
1580
+ <dim>3584</dim>
1581
+ </port>
1582
+ </input>
1583
+ </layer>
1584
+ </layers>
1585
+ <edges>
1586
+ <edge from-layer="0" from-port="0" to-layer="7" to-port="0" />
1587
+ <edge from-layer="0" from-port="0" to-layer="43" to-port="0" />
1588
+ <edge from-layer="1" from-port="0" to-layer="52" to-port="1" />
1589
+ <edge from-layer="2" from-port="0" to-layer="4" to-port="0" />
1590
+ <edge from-layer="3" from-port="0" to-layer="4" to-port="1" />
1591
+ <edge from-layer="4" from-port="2" to-layer="6" to-port="0" />
1592
+ <edge from-layer="5" from-port="0" to-layer="6" to-port="1" />
1593
+ <edge from-layer="6" from-port="2" to-layer="18" to-port="0" />
1594
+ <edge from-layer="7" from-port="1" to-layer="10" to-port="0" />
1595
+ <edge from-layer="7" from-port="1" to-layer="16" to-port="0" />
1596
+ <edge from-layer="8" from-port="0" to-layer="10" to-port="1" />
1597
+ <edge from-layer="9" from-port="0" to-layer="10" to-port="2" />
1598
+ <edge from-layer="10" from-port="3" to-layer="12" to-port="0" />
1599
+ <edge from-layer="10" from-port="3" to-layer="22" to-port="1" />
1600
+ <edge from-layer="11" from-port="0" to-layer="12" to-port="1" />
1601
+ <edge from-layer="12" from-port="2" to-layer="17" to-port="0" />
1602
+ <edge from-layer="13" from-port="0" to-layer="17" to-port="1" />
1603
+ <edge from-layer="14" from-port="0" to-layer="16" to-port="1" />
1604
+ <edge from-layer="15" from-port="0" to-layer="16" to-port="2" />
1605
+ <edge from-layer="16" from-port="3" to-layer="17" to-port="2" />
1606
+ <edge from-layer="17" from-port="3" to-layer="18" to-port="1" />
1607
+ <edge from-layer="18" from-port="2" to-layer="66" to-port="0" />
1608
+ <edge from-layer="19" from-port="0" to-layer="23" to-port="0" />
1609
+ <edge from-layer="20" from-port="0" to-layer="22" to-port="0" />
1610
+ <edge from-layer="21" from-port="0" to-layer="22" to-port="2" />
1611
+ <edge from-layer="22" from-port="3" to-layer="23" to-port="1" />
1612
+ <edge from-layer="23" from-port="2" to-layer="29" to-port="0" />
1613
+ <edge from-layer="24" from-port="0" to-layer="25" to-port="0" />
1614
+ <edge from-layer="25" from-port="1" to-layer="27" to-port="0" />
1615
+ <edge from-layer="26" from-port="0" to-layer="27" to-port="1" />
1616
+ <edge from-layer="27" from-port="2" to-layer="28" to-port="0" />
1617
+ <edge from-layer="28" from-port="1" to-layer="29" to-port="1" />
1618
+ <edge from-layer="29" from-port="2" to-layer="31" to-port="0" />
1619
+ <edge from-layer="30" from-port="0" to-layer="31" to-port="1" />
1620
+ <edge from-layer="31" from-port="2" to-layer="33" to-port="0" />
1621
+ <edge from-layer="32" from-port="0" to-layer="33" to-port="1" />
1622
+ <edge from-layer="33" from-port="2" to-layer="35" to-port="0" />
1623
+ <edge from-layer="34" from-port="0" to-layer="35" to-port="1" />
1624
+ <edge from-layer="35" from-port="2" to-layer="37" to-port="0" />
1625
+ <edge from-layer="36" from-port="0" to-layer="37" to-port="1" />
1626
+ <edge from-layer="37" from-port="2" to-layer="65" to-port="0" />
1627
+ <edge from-layer="38" from-port="0" to-layer="39" to-port="0" />
1628
+ <edge from-layer="39" from-port="1" to-layer="41" to-port="0" />
1629
+ <edge from-layer="40" from-port="0" to-layer="41" to-port="1" />
1630
+ <edge from-layer="41" from-port="2" to-layer="42" to-port="0" />
1631
+ <edge from-layer="42" from-port="1" to-layer="43" to-port="1" />
1632
+ <edge from-layer="43" from-port="2" to-layer="45" to-port="0" />
1633
+ <edge from-layer="44" from-port="0" to-layer="45" to-port="1" />
1634
+ <edge from-layer="45" from-port="2" to-layer="47" to-port="0" />
1635
+ <edge from-layer="46" from-port="0" to-layer="47" to-port="1" />
1636
+ <edge from-layer="47" from-port="2" to-layer="49" to-port="0" />
1637
+ <edge from-layer="48" from-port="0" to-layer="49" to-port="1" />
1638
+ <edge from-layer="49" from-port="2" to-layer="51" to-port="0" />
1639
+ <edge from-layer="50" from-port="0" to-layer="51" to-port="1" />
1640
+ <edge from-layer="51" from-port="2" to-layer="52" to-port="0" />
1641
+ <edge from-layer="51" from-port="2" to-layer="73" to-port="0" />
1642
+ <edge from-layer="52" from-port="2" to-layer="58" to-port="0" />
1643
+ <edge from-layer="53" from-port="0" to-layer="54" to-port="0" />
1644
+ <edge from-layer="54" from-port="1" to-layer="56" to-port="0" />
1645
+ <edge from-layer="55" from-port="0" to-layer="56" to-port="1" />
1646
+ <edge from-layer="56" from-port="2" to-layer="57" to-port="0" />
1647
+ <edge from-layer="57" from-port="1" to-layer="58" to-port="1" />
1648
+ <edge from-layer="58" from-port="2" to-layer="60" to-port="0" />
1649
+ <edge from-layer="59" from-port="0" to-layer="60" to-port="1" />
1650
+ <edge from-layer="60" from-port="2" to-layer="62" to-port="0" />
1651
+ <edge from-layer="61" from-port="0" to-layer="62" to-port="1" />
1652
+ <edge from-layer="62" from-port="2" to-layer="64" to-port="0" />
1653
+ <edge from-layer="63" from-port="0" to-layer="64" to-port="1" />
1654
+ <edge from-layer="64" from-port="2" to-layer="65" to-port="1" />
1655
+ <edge from-layer="65" from-port="2" to-layer="66" to-port="1" />
1656
+ <edge from-layer="66" from-port="2" to-layer="67" to-port="0" />
1657
+ <edge from-layer="67" from-port="1" to-layer="80" to-port="0" />
1658
+ <edge from-layer="68" from-port="0" to-layer="69" to-port="0" />
1659
+ <edge from-layer="69" from-port="1" to-layer="71" to-port="0" />
1660
+ <edge from-layer="70" from-port="0" to-layer="71" to-port="1" />
1661
+ <edge from-layer="71" from-port="2" to-layer="72" to-port="0" />
1662
+ <edge from-layer="72" from-port="1" to-layer="73" to-port="1" />
1663
+ <edge from-layer="73" from-port="2" to-layer="75" to-port="0" />
1664
+ <edge from-layer="74" from-port="0" to-layer="75" to-port="1" />
1665
+ <edge from-layer="75" from-port="2" to-layer="77" to-port="0" />
1666
+ <edge from-layer="76" from-port="0" to-layer="77" to-port="1" />
1667
+ <edge from-layer="77" from-port="2" to-layer="79" to-port="0" />
1668
+ <edge from-layer="78" from-port="0" to-layer="79" to-port="1" />
1669
+ <edge from-layer="79" from-port="2" to-layer="80" to-port="1" />
1670
+ <edge from-layer="80" from-port="2" to-layer="82" to-port="0" />
1671
+ <edge from-layer="81" from-port="0" to-layer="82" to-port="1" />
1672
+ <edge from-layer="82" from-port="2" to-layer="84" to-port="0" />
1673
+ <edge from-layer="83" from-port="0" to-layer="84" to-port="1" />
1674
+ <edge from-layer="84" from-port="2" to-layer="90" to-port="0" />
1675
+ <edge from-layer="85" from-port="0" to-layer="86" to-port="0" />
1676
+ <edge from-layer="86" from-port="1" to-layer="88" to-port="0" />
1677
+ <edge from-layer="87" from-port="0" to-layer="88" to-port="1" />
1678
+ <edge from-layer="88" from-port="2" to-layer="89" to-port="0" />
1679
+ <edge from-layer="89" from-port="1" to-layer="90" to-port="1" />
1680
+ <edge from-layer="90" from-port="2" to-layer="92" to-port="0" />
1681
+ <edge from-layer="91" from-port="0" to-layer="92" to-port="1" />
1682
+ <edge from-layer="92" from-port="2" to-layer="94" to-port="0" />
1683
+ <edge from-layer="93" from-port="0" to-layer="94" to-port="1" />
1684
+ <edge from-layer="94" from-port="2" to-layer="96" to-port="0" />
1685
+ <edge from-layer="95" from-port="0" to-layer="96" to-port="1" />
1686
+ <edge from-layer="96" from-port="2" to-layer="98" to-port="0" />
1687
+ <edge from-layer="97" from-port="0" to-layer="98" to-port="1" />
1688
+ <edge from-layer="98" from-port="2" to-layer="100" to-port="0" />
1689
+ <edge from-layer="99" from-port="0" to-layer="100" to-port="1" />
1690
+ <edge from-layer="100" from-port="2" to-layer="102" to-port="0" />
1691
+ <edge from-layer="101" from-port="0" to-layer="102" to-port="1" />
1692
+ <edge from-layer="102" from-port="2" to-layer="108" to-port="0" />
1693
+ <edge from-layer="103" from-port="0" to-layer="104" to-port="0" />
1694
+ <edge from-layer="104" from-port="1" to-layer="106" to-port="0" />
1695
+ <edge from-layer="105" from-port="0" to-layer="106" to-port="1" />
1696
+ <edge from-layer="106" from-port="2" to-layer="107" to-port="0" />
1697
+ <edge from-layer="107" from-port="1" to-layer="108" to-port="1" />
1698
+ <edge from-layer="108" from-port="2" to-layer="109" to-port="0" />
1699
+ </edges>
1700
+ <rt_info>
1701
+ <Runtime_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
1702
+ <conversion_parameters>
1703
+ <framework value="pytorch" />
1704
+ <is_python_object value="True" />
1705
+ </conversion_parameters>
1706
+ <nncf>
1707
+ <friendly_names_were_updated value="True" />
1708
+ <version value="3.0.0" />
1709
+ <weight_compression>
1710
+ <advanced_parameters value="{'statistics_path': None, 'lora_adapter_rank': 256, 'group_size_fallback_mode': 'error', 'min_adjusted_group_size': 32, 'awq_params': {'subset_size': 32, 'percent_to_apply': 0.002, 'alpha_min': 0.0, 'alpha_max': 1.0, 'steps': 100, 'prefer_data_aware_scaling': True}, 'scale_estimation_params': {'subset_size': 64, 'initial_steps': 5, 'scale_steps': 5, 'weight_penalty': -1.0}, 'gptq_params': {'damp_percent': 0.1, 'block_size': 128, 'subset_size': 128}, 'lora_correction_params': {'adapter_rank': 8, 'num_iterations': 3, 'apply_regularization': True, 'subset_size': 128, 'use_int8_adapters': True}, 'backend_params': {}, 'codebook': None, 'adaptive_codebook_params': {'value_type': 'f8e4m3', 'across_blocks': False, 'num_elements': 16}}" />
1711
+ <all_layers value="False" />
1712
+ <awq value="False" />
1713
+ <backup_mode value="int8_asym" />
1714
+ <compression_format value="dequantize" />
1715
+ <gptq value="False" />
1716
+ <group_size value="-1" />
1717
+ <ignored_scope value="[]" />
1718
+ <lora_correction value="False" />
1719
+ <mode value="int8_sym" />
1720
+ <ratio value="1.0" />
1721
+ <scale_estimation value="False" />
1722
+ <sensitivity_metric value="weight_quantization_error" />
1723
+ </weight_compression>
1724
+ </nncf>
1725
+ <optimum>
1726
+ <nncf_version value="3.0.0" />
1727
+ <optimum_intel_version value="1.27.0" />
1728
+ <optimum_version value="2.1.0" />
1729
+ <pytorch_version value="2.11.0" />
1730
+ <transformers_version value="4.53.3" />
1731
+ </optimum>
1732
+ </rt_info>
1733
+ </net>
openvino_text_embeddings_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05203a06ed0e763ac81a62e3ec3d8b681df37b6212f73fa814fd3479d9685e58
3
+ size 543874280
openvino_text_embeddings_model.xml ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <net name="Model9" version="11">
3
+ <layers>
4
+ <layer id="0" name="input" type="Parameter" version="opset1">
5
+ <data shape="?,?" element_type="i64" />
6
+ <output>
7
+ <port id="0" precision="I64" names="input">
8
+ <dim>-1</dim>
9
+ <dim>-1</dim>
10
+ </port>
11
+ </output>
12
+ </layer>
13
+ <layer id="1" name="self.weight" type="Const" version="opset1">
14
+ <data element_type="i8" shape="151666, 3584" offset="0" size="543570944" />
15
+ <output>
16
+ <port id="0" precision="I8">
17
+ <dim>151666</dim>
18
+ <dim>3584</dim>
19
+ </port>
20
+ </output>
21
+ </layer>
22
+ <layer id="2" name="Convert_1150972" type="Convert" version="opset1">
23
+ <data destination_type="f16" />
24
+ <input>
25
+ <port id="0" precision="I8">
26
+ <dim>151666</dim>
27
+ <dim>3584</dim>
28
+ </port>
29
+ </input>
30
+ <output>
31
+ <port id="1" precision="FP16">
32
+ <dim>151666</dim>
33
+ <dim>3584</dim>
34
+ </port>
35
+ </output>
36
+ </layer>
37
+ <layer id="3" name="self.weight/scale" type="Const" version="opset1">
38
+ <data element_type="f16" shape="151666, 1" offset="543570944" size="303332" />
39
+ <output>
40
+ <port id="0" precision="FP16">
41
+ <dim>151666</dim>
42
+ <dim>1</dim>
43
+ </port>
44
+ </output>
45
+ </layer>
46
+ <layer id="4" name="self.weight/fq_weights_0" type="Multiply" version="opset1">
47
+ <data auto_broadcast="numpy" />
48
+ <input>
49
+ <port id="0" precision="FP16">
50
+ <dim>151666</dim>
51
+ <dim>3584</dim>
52
+ </port>
53
+ <port id="1" precision="FP16">
54
+ <dim>151666</dim>
55
+ <dim>1</dim>
56
+ </port>
57
+ </input>
58
+ <output>
59
+ <port id="2" precision="FP16">
60
+ <dim>151666</dim>
61
+ <dim>3584</dim>
62
+ </port>
63
+ </output>
64
+ </layer>
65
+ <layer id="5" name="ov_ext::embedding/Convert" type="Convert" version="opset1">
66
+ <data destination_type="f32" />
67
+ <rt_info>
68
+ <attribute name="decompression" version="0" />
69
+ </rt_info>
70
+ <input>
71
+ <port id="0" precision="FP16">
72
+ <dim>151666</dim>
73
+ <dim>3584</dim>
74
+ </port>
75
+ </input>
76
+ <output>
77
+ <port id="1" precision="FP32">
78
+ <dim>151666</dim>
79
+ <dim>3584</dim>
80
+ </port>
81
+ </output>
82
+ </layer>
83
+ <layer id="6" name="ov_ext::embedding/Convert_1" type="Convert" version="opset1">
84
+ <data destination_type="i32" />
85
+ <input>
86
+ <port id="0" precision="I64">
87
+ <dim>-1</dim>
88
+ <dim>-1</dim>
89
+ </port>
90
+ </input>
91
+ <output>
92
+ <port id="1" precision="I32">
93
+ <dim>-1</dim>
94
+ <dim>-1</dim>
95
+ </port>
96
+ </output>
97
+ </layer>
98
+ <layer id="7" name="ov_ext::embedding/Constant" type="Const" version="opset1">
99
+ <data element_type="i32" shape="" offset="543874276" size="4" />
100
+ <output>
101
+ <port id="0" precision="I32" />
102
+ </output>
103
+ </layer>
104
+ <layer id="8" name="ov_ext::embedding/Gather" type="Gather" version="opset8">
105
+ <data batch_dims="0" />
106
+ <input>
107
+ <port id="0" precision="FP32">
108
+ <dim>151666</dim>
109
+ <dim>3584</dim>
110
+ </port>
111
+ <port id="1" precision="I32">
112
+ <dim>-1</dim>
113
+ <dim>-1</dim>
114
+ </port>
115
+ <port id="2" precision="I32" />
116
+ </input>
117
+ <output>
118
+ <port id="3" precision="FP32" names="inputs_embeds">
119
+ <dim>-1</dim>
120
+ <dim>-1</dim>
121
+ <dim>3584</dim>
122
+ </port>
123
+ </output>
124
+ </layer>
125
+ <layer id="9" name="Result_124398" type="Result" version="opset1" output_names="inputs_embeds">
126
+ <input>
127
+ <port id="0" precision="FP32">
128
+ <dim>-1</dim>
129
+ <dim>-1</dim>
130
+ <dim>3584</dim>
131
+ </port>
132
+ </input>
133
+ </layer>
134
+ </layers>
135
+ <edges>
136
+ <edge from-layer="0" from-port="0" to-layer="6" to-port="0" />
137
+ <edge from-layer="1" from-port="0" to-layer="2" to-port="0" />
138
+ <edge from-layer="2" from-port="1" to-layer="4" to-port="0" />
139
+ <edge from-layer="3" from-port="0" to-layer="4" to-port="1" />
140
+ <edge from-layer="4" from-port="2" to-layer="5" to-port="0" />
141
+ <edge from-layer="5" from-port="1" to-layer="8" to-port="0" />
142
+ <edge from-layer="6" from-port="1" to-layer="8" to-port="1" />
143
+ <edge from-layer="7" from-port="0" to-layer="8" to-port="2" />
144
+ <edge from-layer="8" from-port="3" to-layer="9" to-port="0" />
145
+ </edges>
146
+ <rt_info>
147
+ <Runtime_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
148
+ <conversion_parameters>
149
+ <framework value="pytorch" />
150
+ <is_python_object value="True" />
151
+ </conversion_parameters>
152
+ <nncf>
153
+ <friendly_names_were_updated value="True" />
154
+ <version value="3.0.0" />
155
+ <weight_compression>
156
+ <advanced_parameters value="{'statistics_path': None, 'lora_adapter_rank': 256, 'group_size_fallback_mode': 'error', 'min_adjusted_group_size': 32, 'awq_params': {'subset_size': 32, 'percent_to_apply': 0.002, 'alpha_min': 0.0, 'alpha_max': 1.0, 'steps': 100, 'prefer_data_aware_scaling': True}, 'scale_estimation_params': {'subset_size': 64, 'initial_steps': 5, 'scale_steps': 5, 'weight_penalty': -1.0}, 'gptq_params': {'damp_percent': 0.1, 'block_size': 128, 'subset_size': 128}, 'lora_correction_params': {'adapter_rank': 8, 'num_iterations': 3, 'apply_regularization': True, 'subset_size': 128, 'use_int8_adapters': True}, 'backend_params': {}, 'codebook': None, 'adaptive_codebook_params': {'value_type': 'f8e4m3', 'across_blocks': False, 'num_elements': 16}}" />
157
+ <all_layers value="False" />
158
+ <awq value="False" />
159
+ <backup_mode value="int8_asym" />
160
+ <compression_format value="dequantize" />
161
+ <gptq value="False" />
162
+ <group_size value="-1" />
163
+ <ignored_scope value="[]" />
164
+ <lora_correction value="False" />
165
+ <mode value="int8_sym" />
166
+ <ratio value="1.0" />
167
+ <scale_estimation value="False" />
168
+ <sensitivity_metric value="weight_quantization_error" />
169
+ </weight_compression>
170
+ </nncf>
171
+ <optimum>
172
+ <nncf_version value="3.0.0" />
173
+ <optimum_intel_version value="1.27.0" />
174
+ <optimum_version value="2.1.0" />
175
+ <pytorch_version value="2.11.0" />
176
+ <transformers_version value="4.53.3" />
177
+ </optimum>
178
+ </rt_info>
179
+ </net>
openvino_tokenizer.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5abec952803879f370a1216869d4752cba2c2f3b8e50edfb0924b09eef190679
3
+ size 5588665
openvino_tokenizer.xml ADDED
@@ -0,0 +1,771 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <net name="tokenizer" version="11">
3
+ <layers>
4
+ <layer id="0" name="Parameter_126838" type="Parameter" version="opset1">
5
+ <data shape="?" element_type="string" />
6
+ <output>
7
+ <port id="0" precision="STRING" names="Parameter_126838">
8
+ <dim>-1</dim>
9
+ </port>
10
+ </output>
11
+ </layer>
12
+ <layer id="1" name="Constant_126844" type="Const" version="opset1">
13
+ <data element_type="i64" shape="" offset="0" size="8" />
14
+ <output>
15
+ <port id="0" precision="I64" />
16
+ </output>
17
+ </layer>
18
+ <layer id="2" name="StringTensorUnpack_126839" type="StringTensorUnpack" version="opset15">
19
+ <input>
20
+ <port id="0" precision="STRING">
21
+ <dim>-1</dim>
22
+ </port>
23
+ </input>
24
+ <output>
25
+ <port id="1" precision="I32">
26
+ <dim>-1</dim>
27
+ </port>
28
+ <port id="2" precision="I32">
29
+ <dim>-1</dim>
30
+ </port>
31
+ <port id="3" precision="U8">
32
+ <dim>-1</dim>
33
+ </port>
34
+ </output>
35
+ </layer>
36
+ <layer id="3" name="ShapeOf_126840" type="ShapeOf" version="opset3">
37
+ <data output_type="i64" />
38
+ <input>
39
+ <port id="0" precision="I32">
40
+ <dim>-1</dim>
41
+ </port>
42
+ </input>
43
+ <output>
44
+ <port id="1" precision="I64">
45
+ <dim>1</dim>
46
+ </port>
47
+ </output>
48
+ </layer>
49
+ <layer id="4" name="Constant_126841" type="Const" version="opset1">
50
+ <data element_type="i64" shape="" offset="0" size="8" />
51
+ <output>
52
+ <port id="0" precision="I64" />
53
+ </output>
54
+ </layer>
55
+ <layer id="5" name="Constant_126842" type="Const" version="opset1">
56
+ <data element_type="i64" shape="" offset="0" size="8" />
57
+ <output>
58
+ <port id="0" precision="I64" />
59
+ </output>
60
+ </layer>
61
+ <layer id="6" name="Gather_126843" type="Gather" version="opset8">
62
+ <data batch_dims="0" />
63
+ <input>
64
+ <port id="0" precision="I64">
65
+ <dim>1</dim>
66
+ </port>
67
+ <port id="1" precision="I64" />
68
+ <port id="2" precision="I64" />
69
+ </input>
70
+ <output>
71
+ <port id="3" precision="I64" />
72
+ </output>
73
+ </layer>
74
+ <layer id="7" name="Constant_126845" type="Const" version="opset1">
75
+ <data element_type="i64" shape="" offset="8" size="8" />
76
+ <output>
77
+ <port id="0" precision="I64" />
78
+ </output>
79
+ </layer>
80
+ <layer id="8" name="Range_126846" type="Range" version="opset4">
81
+ <data output_type="i32" />
82
+ <input>
83
+ <port id="0" precision="I64" />
84
+ <port id="1" precision="I64" />
85
+ <port id="2" precision="I64" />
86
+ </input>
87
+ <output>
88
+ <port id="3" precision="I32">
89
+ <dim>-1</dim>
90
+ </port>
91
+ </output>
92
+ </layer>
93
+ <layer id="9" name="Constant_126847" type="Const" version="opset1">
94
+ <data element_type="i64" shape="" offset="8" size="8" />
95
+ <output>
96
+ <port id="0" precision="I64" />
97
+ </output>
98
+ </layer>
99
+ <layer id="10" name="Constant_126848" type="Const" version="opset1">
100
+ <data element_type="i64" shape="" offset="8" size="8" />
101
+ <output>
102
+ <port id="0" precision="I64" />
103
+ </output>
104
+ </layer>
105
+ <layer id="11" name="Add_126849" type="Add" version="opset1">
106
+ <data auto_broadcast="numpy" />
107
+ <input>
108
+ <port id="0" precision="I64" />
109
+ <port id="1" precision="I64" />
110
+ </input>
111
+ <output>
112
+ <port id="2" precision="I64" />
113
+ </output>
114
+ </layer>
115
+ <layer id="12" name="Constant_126850" type="Const" version="opset1">
116
+ <data element_type="i64" shape="" offset="8" size="8" />
117
+ <output>
118
+ <port id="0" precision="I64" />
119
+ </output>
120
+ </layer>
121
+ <layer id="13" name="Range_126851" type="Range" version="opset4">
122
+ <data output_type="i32" />
123
+ <input>
124
+ <port id="0" precision="I64" />
125
+ <port id="1" precision="I64" />
126
+ <port id="2" precision="I64" />
127
+ </input>
128
+ <output>
129
+ <port id="3" precision="I32">
130
+ <dim>-1</dim>
131
+ </port>
132
+ </output>
133
+ </layer>
134
+ <layer id="14" name="Constant_126915" type="Const" version="opset1">
135
+ <data element_type="u8" shape="407" offset="16" size="407" />
136
+ <output>
137
+ <port id="0" precision="U8">
138
+ <dim>407</dim>
139
+ </port>
140
+ </output>
141
+ </layer>
142
+ <layer id="15" name="SpecialTokensSplit_126916" type="SpecialTokensSplit" version="extension">
143
+ <input>
144
+ <port id="0" precision="I32">
145
+ <dim>-1</dim>
146
+ </port>
147
+ <port id="1" precision="I32">
148
+ <dim>-1</dim>
149
+ </port>
150
+ <port id="2" precision="I32">
151
+ <dim>-1</dim>
152
+ </port>
153
+ <port id="3" precision="I32">
154
+ <dim>-1</dim>
155
+ </port>
156
+ <port id="4" precision="U8">
157
+ <dim>-1</dim>
158
+ </port>
159
+ <port id="5" precision="U8">
160
+ <dim>407</dim>
161
+ </port>
162
+ </input>
163
+ <output>
164
+ <port id="6" precision="I32">
165
+ <dim>-1</dim>
166
+ </port>
167
+ <port id="7" precision="I32">
168
+ <dim>-1</dim>
169
+ </port>
170
+ <port id="8" precision="I32">
171
+ <dim>-1</dim>
172
+ </port>
173
+ <port id="9" precision="I32">
174
+ <dim>-1</dim>
175
+ </port>
176
+ <port id="10" precision="U8">
177
+ <dim>-1</dim>
178
+ </port>
179
+ <port id="11" precision="BOOL">
180
+ <dim>-1</dim>
181
+ </port>
182
+ </output>
183
+ </layer>
184
+ <layer id="16" name="CharsMapNormalization_126917" type="CharsMapNormalization" version="extension">
185
+ <data add_dummy_prefix="false" remove_extra_whitespaces="false" escape_whitespaces="false" normalization_form="nfc" case_fold="false" nmt="false" />
186
+ <input>
187
+ <port id="0" precision="I32">
188
+ <dim>-1</dim>
189
+ </port>
190
+ <port id="1" precision="I32">
191
+ <dim>-1</dim>
192
+ </port>
193
+ <port id="2" precision="U8">
194
+ <dim>-1</dim>
195
+ </port>
196
+ <port id="3" precision="BOOL">
197
+ <dim>-1</dim>
198
+ </port>
199
+ </input>
200
+ <output>
201
+ <port id="4" precision="I32">
202
+ <dim>-1</dim>
203
+ </port>
204
+ <port id="5" precision="I32">
205
+ <dim>-1</dim>
206
+ </port>
207
+ <port id="6" precision="U8">
208
+ <dim>-1</dim>
209
+ </port>
210
+ <port id="7" precision="BOOL">
211
+ <dim>-1</dim>
212
+ </port>
213
+ </output>
214
+ </layer>
215
+ <layer id="17" name="Constant_126919" type="Const" version="opset1">
216
+ <data element_type="u8" shape="110" offset="423" size="110" />
217
+ <output>
218
+ <port id="0" precision="U8">
219
+ <dim>110</dim>
220
+ </port>
221
+ </output>
222
+ </layer>
223
+ <layer id="18" name="RegexSplit_126920" type="RegexSplit" version="extension">
224
+ <data behaviour="isolate" invert="false" max_splits="-1" />
225
+ <input>
226
+ <port id="0" precision="I32">
227
+ <dim>-1</dim>
228
+ </port>
229
+ <port id="1" precision="I32">
230
+ <dim>-1</dim>
231
+ </port>
232
+ <port id="2" precision="I32">
233
+ <dim>-1</dim>
234
+ </port>
235
+ <port id="3" precision="I32">
236
+ <dim>-1</dim>
237
+ </port>
238
+ <port id="4" precision="U8">
239
+ <dim>-1</dim>
240
+ </port>
241
+ <port id="5" precision="BOOL">
242
+ <dim>-1</dim>
243
+ </port>
244
+ <port id="6" precision="U8">
245
+ <dim>110</dim>
246
+ </port>
247
+ </input>
248
+ <output>
249
+ <port id="7" precision="I32">
250
+ <dim>-1</dim>
251
+ </port>
252
+ <port id="8" precision="I32">
253
+ <dim>-1</dim>
254
+ </port>
255
+ <port id="9" precision="I32">
256
+ <dim>-1</dim>
257
+ </port>
258
+ <port id="10" precision="I32">
259
+ <dim>-1</dim>
260
+ </port>
261
+ <port id="11" precision="U8">
262
+ <dim>-1</dim>
263
+ </port>
264
+ <port id="12" precision="BOOL">
265
+ <dim>-1</dim>
266
+ </port>
267
+ </output>
268
+ </layer>
269
+ <layer id="19" name="Constant_126922" type="Const" version="opset1">
270
+ <data element_type="i32" shape="151666" offset="533" size="606664" />
271
+ <output>
272
+ <port id="0" precision="I32">
273
+ <dim>151666</dim>
274
+ </port>
275
+ </output>
276
+ </layer>
277
+ <layer id="20" name="Constant_126924" type="Const" version="opset1">
278
+ <data element_type="i32" shape="151666" offset="607197" size="606664" />
279
+ <output>
280
+ <port id="0" precision="I32">
281
+ <dim>151666</dim>
282
+ </port>
283
+ </output>
284
+ </layer>
285
+ <layer id="21" name="Constant_126926" type="Const" version="opset1">
286
+ <data element_type="u8" shape="976273" offset="1213861" size="976273" />
287
+ <output>
288
+ <port id="0" precision="U8">
289
+ <dim>976273</dim>
290
+ </port>
291
+ </output>
292
+ </layer>
293
+ <layer id="22" name="Constant_126934" type="Const" version="opset1">
294
+ <data element_type="i32" shape="151387" offset="2190134" size="605548" />
295
+ <output>
296
+ <port id="0" precision="I32">
297
+ <dim>151387</dim>
298
+ </port>
299
+ </output>
300
+ </layer>
301
+ <layer id="23" name="Constant_126936" type="Const" version="opset1">
302
+ <data element_type="i32" shape="151387" offset="2795682" size="605548" />
303
+ <output>
304
+ <port id="0" precision="I32">
305
+ <dim>151387</dim>
306
+ </port>
307
+ </output>
308
+ </layer>
309
+ <layer id="24" name="Constant_126938" type="Const" version="opset1">
310
+ <data element_type="u8" shape="491359" offset="3401230" size="491359" />
311
+ <output>
312
+ <port id="0" precision="U8">
313
+ <dim>491359</dim>
314
+ </port>
315
+ </output>
316
+ </layer>
317
+ <layer id="25" name="Constant_126940" type="Const" version="opset1">
318
+ <data element_type="i32" shape="151387" offset="3892589" size="605548" />
319
+ <output>
320
+ <port id="0" precision="I32">
321
+ <dim>151387</dim>
322
+ </port>
323
+ </output>
324
+ </layer>
325
+ <layer id="26" name="Constant_126942" type="Const" version="opset1">
326
+ <data element_type="i32" shape="151387" offset="4498137" size="605548" />
327
+ <output>
328
+ <port id="0" precision="I32">
329
+ <dim>151387</dim>
330
+ </port>
331
+ </output>
332
+ </layer>
333
+ <layer id="27" name="Constant_126944" type="Const" version="opset1">
334
+ <data element_type="u8" shape="484354" offset="5103685" size="484354" />
335
+ <output>
336
+ <port id="0" precision="U8">
337
+ <dim>484354</dim>
338
+ </port>
339
+ </output>
340
+ </layer>
341
+ <layer id="28" name="Constant_126928" type="Const" version="opset1">
342
+ <data element_type="i32" shape="24" offset="5588039" size="96" />
343
+ <output>
344
+ <port id="0" precision="I32">
345
+ <dim>24</dim>
346
+ </port>
347
+ </output>
348
+ </layer>
349
+ <layer id="29" name="Constant_126930" type="Const" version="opset1">
350
+ <data element_type="i32" shape="24" offset="5588135" size="96" />
351
+ <output>
352
+ <port id="0" precision="I32">
353
+ <dim>24</dim>
354
+ </port>
355
+ </output>
356
+ </layer>
357
+ <layer id="30" name="Constant_126932" type="Const" version="opset1">
358
+ <data element_type="u8" shape="309" offset="5588231" size="309" />
359
+ <output>
360
+ <port id="0" precision="U8">
361
+ <dim>309</dim>
362
+ </port>
363
+ </output>
364
+ </layer>
365
+ <layer id="31" name="Constant_126945" type="Const" version="opset1">
366
+ <data element_type="i32" shape="24" offset="5588540" size="96" />
367
+ <output>
368
+ <port id="0" precision="I32">
369
+ <dim>24</dim>
370
+ </port>
371
+ </output>
372
+ </layer>
373
+ <layer id="32" name="BPETokenizer_126946" type="BPETokenizer" version="extension">
374
+ <data unk_token="" fuse_unk="false" suffix_indicator="" end_suffix="" byte_fallback="false" cache_capacity="30328" />
375
+ <input>
376
+ <port id="0" precision="I32">
377
+ <dim>-1</dim>
378
+ </port>
379
+ <port id="1" precision="I32">
380
+ <dim>-1</dim>
381
+ </port>
382
+ <port id="2" precision="I32">
383
+ <dim>-1</dim>
384
+ </port>
385
+ <port id="3" precision="I32">
386
+ <dim>-1</dim>
387
+ </port>
388
+ <port id="4" precision="U8">
389
+ <dim>-1</dim>
390
+ </port>
391
+ <port id="5" precision="I32">
392
+ <dim>151666</dim>
393
+ </port>
394
+ <port id="6" precision="I32">
395
+ <dim>151666</dim>
396
+ </port>
397
+ <port id="7" precision="U8">
398
+ <dim>976273</dim>
399
+ </port>
400
+ <port id="8" precision="I32">
401
+ <dim>151387</dim>
402
+ </port>
403
+ <port id="9" precision="I32">
404
+ <dim>151387</dim>
405
+ </port>
406
+ <port id="10" precision="U8">
407
+ <dim>491359</dim>
408
+ </port>
409
+ <port id="11" precision="I32">
410
+ <dim>151387</dim>
411
+ </port>
412
+ <port id="12" precision="I32">
413
+ <dim>151387</dim>
414
+ </port>
415
+ <port id="13" precision="U8">
416
+ <dim>484354</dim>
417
+ </port>
418
+ <port id="14" precision="I32">
419
+ <dim>24</dim>
420
+ </port>
421
+ <port id="15" precision="I32">
422
+ <dim>24</dim>
423
+ </port>
424
+ <port id="16" precision="U8">
425
+ <dim>309</dim>
426
+ </port>
427
+ <port id="17" precision="I32">
428
+ <dim>24</dim>
429
+ </port>
430
+ </input>
431
+ <output>
432
+ <port id="18" precision="I32">
433
+ <dim>-1</dim>
434
+ </port>
435
+ <port id="19" precision="I32">
436
+ <dim>-1</dim>
437
+ </port>
438
+ <port id="20" precision="I32">
439
+ <dim>-1</dim>
440
+ </port>
441
+ </output>
442
+ </layer>
443
+ <layer id="33" name="Constant_126947" type="Const" version="opset1">
444
+ <data element_type="i32" shape="" offset="5588636" size="4" />
445
+ <output>
446
+ <port id="0" precision="I32" />
447
+ </output>
448
+ </layer>
449
+ <layer id="34" name="Constant_126949" type="Const" version="opset1">
450
+ <data element_type="u8" shape="4" offset="5588640" size="4" />
451
+ <output>
452
+ <port id="0" precision="U8">
453
+ <dim>4</dim>
454
+ </port>
455
+ </output>
456
+ </layer>
457
+ <layer id="35" name="Constant_126951" type="Const" version="opset1">
458
+ <data element_type="u8" shape="13" offset="5588644" size="13" />
459
+ <output>
460
+ <port id="0" precision="U8">
461
+ <dim>13</dim>
462
+ </port>
463
+ </output>
464
+ </layer>
465
+ <layer id="36" name="Truncate_126952" type="Truncate" version="extension">
466
+ <data m_num_inputs="1" />
467
+ <input>
468
+ <port id="0" precision="I32">
469
+ <dim>-1</dim>
470
+ </port>
471
+ <port id="1" precision="I32">
472
+ <dim>-1</dim>
473
+ </port>
474
+ <port id="2" precision="I32">
475
+ <dim>-1</dim>
476
+ </port>
477
+ <port id="3" precision="I32" />
478
+ <port id="4" precision="U8">
479
+ <dim>4</dim>
480
+ </port>
481
+ <port id="5" precision="U8">
482
+ <dim>13</dim>
483
+ </port>
484
+ </input>
485
+ <output>
486
+ <port id="6" precision="I32">
487
+ <dim>-1</dim>
488
+ </port>
489
+ <port id="7" precision="I32">
490
+ <dim>-1</dim>
491
+ </port>
492
+ <port id="8" precision="I32">
493
+ <dim>-1</dim>
494
+ </port>
495
+ </output>
496
+ </layer>
497
+ <layer id="37" name="Constant_126953" type="Const" version="opset1">
498
+ <data element_type="i32" shape="1" offset="5588657" size="4" />
499
+ <output>
500
+ <port id="0" precision="I32">
501
+ <dim>1</dim>
502
+ </port>
503
+ </output>
504
+ </layer>
505
+ <layer id="38" name="CombineSegments_126954" type="CombineSegments" version="extension">
506
+ <input>
507
+ <port id="0" precision="I32">
508
+ <dim>-1</dim>
509
+ </port>
510
+ <port id="1" precision="I32">
511
+ <dim>-1</dim>
512
+ </port>
513
+ <port id="2" precision="I32">
514
+ <dim>-1</dim>
515
+ </port>
516
+ <port id="3" precision="I32">
517
+ <dim>1</dim>
518
+ </port>
519
+ </input>
520
+ <output>
521
+ <port id="4" precision="I32">
522
+ <dim>-1</dim>
523
+ </port>
524
+ <port id="5" precision="I32">
525
+ <dim>-1</dim>
526
+ </port>
527
+ <port id="6" precision="I32">
528
+ <dim>-1</dim>
529
+ </port>
530
+ <port id="7" precision="I32">
531
+ <dim>-1</dim>
532
+ </port>
533
+ <port id="8" precision="I32">
534
+ <dim>-1</dim>
535
+ </port>
536
+ <port id="9" precision="I32">
537
+ <dim>-1</dim>
538
+ </port>
539
+ </output>
540
+ </layer>
541
+ <layer id="39" name="Subtract_126955" type="Subtract" version="opset1">
542
+ <data auto_broadcast="numpy" />
543
+ <input>
544
+ <port id="0" precision="I32">
545
+ <dim>-1</dim>
546
+ </port>
547
+ <port id="1" precision="I32">
548
+ <dim>-1</dim>
549
+ </port>
550
+ </input>
551
+ <output>
552
+ <port id="2" precision="I32">
553
+ <dim>-1</dim>
554
+ </port>
555
+ </output>
556
+ </layer>
557
+ <layer id="40" name="Constant_126956" type="Const" version="opset1">
558
+ <data element_type="i32" shape="" offset="5588657" size="4" />
559
+ <output>
560
+ <port id="0" precision="I32" />
561
+ </output>
562
+ </layer>
563
+ <layer id="41" name="ReduceMax_126957" type="ReduceMax" version="opset1">
564
+ <data keep_dims="false" />
565
+ <input>
566
+ <port id="0" precision="I32">
567
+ <dim>-1</dim>
568
+ </port>
569
+ <port id="1" precision="I32" />
570
+ </input>
571
+ <output>
572
+ <port id="2" precision="I32" />
573
+ </output>
574
+ </layer>
575
+ <layer id="42" name="Constant_126958" type="Const" version="opset1">
576
+ <data element_type="i32" shape="" offset="5588661" size="4" />
577
+ <output>
578
+ <port id="0" precision="I32" />
579
+ </output>
580
+ </layer>
581
+ <layer id="43" name="RaggedToDense_126959" type="RaggedToDense" version="extension">
582
+ <data pad_right="false" m_pad_max_length="false" />
583
+ <input>
584
+ <port id="0" precision="I32">
585
+ <dim>-1</dim>
586
+ </port>
587
+ <port id="1" precision="I32">
588
+ <dim>-1</dim>
589
+ </port>
590
+ <port id="2" precision="I32">
591
+ <dim>-1</dim>
592
+ </port>
593
+ <port id="3" precision="I32" />
594
+ <port id="4" precision="I32" />
595
+ </input>
596
+ <output>
597
+ <port id="5" precision="I32">
598
+ <dim>-1</dim>
599
+ <dim>-1</dim>
600
+ </port>
601
+ <port id="6" precision="BOOL">
602
+ <dim>-1</dim>
603
+ <dim>-1</dim>
604
+ </port>
605
+ </output>
606
+ </layer>
607
+ <layer id="44" name="Convert_126960" type="Convert" version="opset1">
608
+ <data destination_type="i32" />
609
+ <input>
610
+ <port id="0" precision="BOOL">
611
+ <dim>-1</dim>
612
+ <dim>-1</dim>
613
+ </port>
614
+ </input>
615
+ <output>
616
+ <port id="1" precision="I32">
617
+ <dim>-1</dim>
618
+ <dim>-1</dim>
619
+ </port>
620
+ </output>
621
+ </layer>
622
+ <layer id="45" name="Convert_126960.0" type="Convert" version="opset1">
623
+ <data destination_type="i64" />
624
+ <input>
625
+ <port id="0" precision="I32">
626
+ <dim>-1</dim>
627
+ <dim>-1</dim>
628
+ </port>
629
+ </input>
630
+ <output>
631
+ <port id="1" precision="I64" names="attention_mask">
632
+ <dim>-1</dim>
633
+ <dim>-1</dim>
634
+ </port>
635
+ </output>
636
+ </layer>
637
+ <layer id="46" name="RaggedToDense_126959.0" type="Convert" version="opset1">
638
+ <data destination_type="i64" />
639
+ <input>
640
+ <port id="0" precision="I32">
641
+ <dim>-1</dim>
642
+ <dim>-1</dim>
643
+ </port>
644
+ </input>
645
+ <output>
646
+ <port id="1" precision="I64" names="input_ids">
647
+ <dim>-1</dim>
648
+ <dim>-1</dim>
649
+ </port>
650
+ </output>
651
+ </layer>
652
+ <layer id="47" name="Result_126963" type="Result" version="opset1" output_names="input_ids">
653
+ <input>
654
+ <port id="0" precision="I64">
655
+ <dim>-1</dim>
656
+ <dim>-1</dim>
657
+ </port>
658
+ </input>
659
+ </layer>
660
+ <layer id="48" name="Result_126965" type="Result" version="opset1" output_names="attention_mask">
661
+ <input>
662
+ <port id="0" precision="I64">
663
+ <dim>-1</dim>
664
+ <dim>-1</dim>
665
+ </port>
666
+ </input>
667
+ </layer>
668
+ </layers>
669
+ <edges>
670
+ <edge from-layer="0" from-port="0" to-layer="2" to-port="0" />
671
+ <edge from-layer="1" from-port="0" to-layer="8" to-port="0" />
672
+ <edge from-layer="2" from-port="1" to-layer="3" to-port="0" />
673
+ <edge from-layer="2" from-port="1" to-layer="15" to-port="2" />
674
+ <edge from-layer="2" from-port="2" to-layer="15" to-port="3" />
675
+ <edge from-layer="2" from-port="3" to-layer="15" to-port="4" />
676
+ <edge from-layer="3" from-port="1" to-layer="6" to-port="0" />
677
+ <edge from-layer="4" from-port="0" to-layer="6" to-port="1" />
678
+ <edge from-layer="5" from-port="0" to-layer="6" to-port="2" />
679
+ <edge from-layer="6" from-port="3" to-layer="8" to-port="1" />
680
+ <edge from-layer="6" from-port="3" to-layer="11" to-port="0" />
681
+ <edge from-layer="7" from-port="0" to-layer="8" to-port="2" />
682
+ <edge from-layer="8" from-port="3" to-layer="15" to-port="0" />
683
+ <edge from-layer="9" from-port="0" to-layer="13" to-port="0" />
684
+ <edge from-layer="10" from-port="0" to-layer="11" to-port="1" />
685
+ <edge from-layer="11" from-port="2" to-layer="13" to-port="1" />
686
+ <edge from-layer="12" from-port="0" to-layer="13" to-port="2" />
687
+ <edge from-layer="13" from-port="3" to-layer="15" to-port="1" />
688
+ <edge from-layer="14" from-port="0" to-layer="15" to-port="5" />
689
+ <edge from-layer="15" from-port="8" to-layer="16" to-port="0" />
690
+ <edge from-layer="15" from-port="9" to-layer="16" to-port="1" />
691
+ <edge from-layer="15" from-port="10" to-layer="16" to-port="2" />
692
+ <edge from-layer="15" from-port="11" to-layer="16" to-port="3" />
693
+ <edge from-layer="15" from-port="6" to-layer="18" to-port="0" />
694
+ <edge from-layer="15" from-port="7" to-layer="18" to-port="1" />
695
+ <edge from-layer="16" from-port="4" to-layer="18" to-port="2" />
696
+ <edge from-layer="16" from-port="5" to-layer="18" to-port="3" />
697
+ <edge from-layer="16" from-port="6" to-layer="18" to-port="4" />
698
+ <edge from-layer="16" from-port="7" to-layer="18" to-port="5" />
699
+ <edge from-layer="17" from-port="0" to-layer="18" to-port="6" />
700
+ <edge from-layer="18" from-port="7" to-layer="32" to-port="0" />
701
+ <edge from-layer="18" from-port="8" to-layer="32" to-port="1" />
702
+ <edge from-layer="18" from-port="9" to-layer="32" to-port="2" />
703
+ <edge from-layer="18" from-port="10" to-layer="32" to-port="3" />
704
+ <edge from-layer="18" from-port="11" to-layer="32" to-port="4" />
705
+ <edge from-layer="19" from-port="0" to-layer="32" to-port="5" />
706
+ <edge from-layer="20" from-port="0" to-layer="32" to-port="6" />
707
+ <edge from-layer="21" from-port="0" to-layer="32" to-port="7" />
708
+ <edge from-layer="22" from-port="0" to-layer="32" to-port="8" />
709
+ <edge from-layer="23" from-port="0" to-layer="32" to-port="9" />
710
+ <edge from-layer="24" from-port="0" to-layer="32" to-port="10" />
711
+ <edge from-layer="25" from-port="0" to-layer="32" to-port="11" />
712
+ <edge from-layer="26" from-port="0" to-layer="32" to-port="12" />
713
+ <edge from-layer="27" from-port="0" to-layer="32" to-port="13" />
714
+ <edge from-layer="28" from-port="0" to-layer="32" to-port="14" />
715
+ <edge from-layer="29" from-port="0" to-layer="32" to-port="15" />
716
+ <edge from-layer="30" from-port="0" to-layer="32" to-port="16" />
717
+ <edge from-layer="31" from-port="0" to-layer="32" to-port="17" />
718
+ <edge from-layer="32" from-port="18" to-layer="36" to-port="0" />
719
+ <edge from-layer="32" from-port="19" to-layer="36" to-port="1" />
720
+ <edge from-layer="32" from-port="20" to-layer="36" to-port="2" />
721
+ <edge from-layer="33" from-port="0" to-layer="36" to-port="3" />
722
+ <edge from-layer="34" from-port="0" to-layer="36" to-port="4" />
723
+ <edge from-layer="35" from-port="0" to-layer="36" to-port="5" />
724
+ <edge from-layer="36" from-port="6" to-layer="38" to-port="0" />
725
+ <edge from-layer="36" from-port="7" to-layer="38" to-port="1" />
726
+ <edge from-layer="36" from-port="8" to-layer="38" to-port="2" />
727
+ <edge from-layer="37" from-port="0" to-layer="38" to-port="3" />
728
+ <edge from-layer="38" from-port="5" to-layer="39" to-port="0" />
729
+ <edge from-layer="38" from-port="4" to-layer="39" to-port="1" />
730
+ <edge from-layer="38" from-port="4" to-layer="43" to-port="0" />
731
+ <edge from-layer="38" from-port="5" to-layer="43" to-port="1" />
732
+ <edge from-layer="38" from-port="6" to-layer="43" to-port="2" />
733
+ <edge from-layer="39" from-port="2" to-layer="41" to-port="0" />
734
+ <edge from-layer="40" from-port="0" to-layer="41" to-port="1" />
735
+ <edge from-layer="41" from-port="2" to-layer="43" to-port="3" />
736
+ <edge from-layer="42" from-port="0" to-layer="43" to-port="4" />
737
+ <edge from-layer="43" from-port="6" to-layer="44" to-port="0" />
738
+ <edge from-layer="43" from-port="5" to-layer="46" to-port="0" />
739
+ <edge from-layer="44" from-port="1" to-layer="45" to-port="0" />
740
+ <edge from-layer="45" from-port="1" to-layer="48" to-port="0" />
741
+ <edge from-layer="46" from-port="1" to-layer="47" to-port="0" />
742
+ </edges>
743
+ <rt_info>
744
+ <add_attention_mask value="True" />
745
+ <add_prefix_space />
746
+ <add_special_tokens value="True" />
747
+ <bos_token_id value="151644" />
748
+ <chat_template value="{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '&lt;|im_start|>system&#10;You are a helpful assistant.&lt;|im_end|>&#10;' }}{% endif %}{{'&lt;|im_start|>' + message['role'] + '&#10;' + message['content'] + '&lt;|im_end|>' + '&#10;'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|>assistant&#10;' }}{% endif %}" />
749
+ <clean_up_tokenization_spaces />
750
+ <detokenizer_input_type value="i64" />
751
+ <eos_token_id value="151645" />
752
+ <handle_special_tokens_with_re />
753
+ <max_length />
754
+ <number_of_inputs value="1" />
755
+ <openvino_tokenizers_version value="2026.0.0.0-632-47cea02a2d4" />
756
+ <openvino_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
757
+ <original_post_processor_template value="{&quot;type&quot;: &quot;ByteLevel&quot;, &quot;add_prefix_space&quot;: false, &quot;trim_offsets&quot;: false, &quot;use_regex&quot;: false}" />
758
+ <original_tokenizer_class value="&lt;class 'transformers_modules.openbmb.MiniCPM-V-2_6.6c04d9e3022bcff6e6738dfb1fc19a5cfd2a855f.tokenization_minicpmv_fast.MiniCPMVTokenizerFast'>" />
759
+ <pad_token_id value="151643" />
760
+ <processed_post_processor_template value="{&quot;single&quot;: {&quot;ids&quot;: [-1], &quot;type_ids&quot;: [0]}, &quot;pair&quot;: {&quot;ids&quot;: [-1, -2], &quot;type_ids&quot;: [0, 0]}}" />
761
+ <skip_special_tokens value="True" />
762
+ <streaming_detokenizer value="False" />
763
+ <tokenizer_output_type value="i64" />
764
+ <tokenizers_version value="0.21.4" />
765
+ <transformers_version value="4.53.3" />
766
+ <use_max_padding value="False" />
767
+ <use_sentencepiece_backend value="False" />
768
+ <utf8_replace_mode value="replace" />
769
+ <with_detokenizer value="True" />
770
+ </rt_info>
771
+ </net>
openvino_vision_embeddings_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f41cb38674e7630d4a0914a72b9f3ad605d8c40c34ce736b78bb4d70c4477f7
3
+ size 419003300
openvino_vision_embeddings_model.xml ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoImageProcessor": "image_processing_minicpmv.MiniCPMVImageProcessor",
4
+ "AutoProcessor": "processing_minicpmv.MiniCPMVProcessor"
5
+ },
6
+ "im_end": "</image>",
7
+ "im_end_token": "</image>",
8
+ "im_id_end": "</image_id>",
9
+ "im_id_start": "<image_id>",
10
+ "im_start": "<image>",
11
+ "im_start_token": "<image>",
12
+ "image_feature_size": 64,
13
+ "image_processor_type": "MiniCPMVImageProcessor",
14
+ "max_slice_nums": 9,
15
+ "mean": [
16
+ 0.5,
17
+ 0.5,
18
+ 0.5
19
+ ],
20
+ "norm_mean": [
21
+ 0.5,
22
+ 0.5,
23
+ 0.5
24
+ ],
25
+ "norm_std": [
26
+ 0.5,
27
+ 0.5,
28
+ 0.5
29
+ ],
30
+ "patch_size": 14,
31
+ "processor_class": "MiniCPMVProcessor",
32
+ "scale_resolution": 448,
33
+ "slice_end": "</slice>",
34
+ "slice_end_token": "</slice>",
35
+ "slice_mode": true,
36
+ "slice_start": "<slice>",
37
+ "slice_start_token": "<slice>",
38
+ "std": [
39
+ 0.5,
40
+ 0.5,
41
+ 0.5
42
+ ],
43
+ "unk": "<unk>",
44
+ "unk_token": "<unk>",
45
+ "use_image_id": true,
46
+ "version": 2.6
47
+ }
processing_minicpmv.py ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 The HuggingFace Inc. team.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """
16
+ Processor class for MiniCPMV.
17
+ """
18
+
19
+ from typing import List, Optional, Union, Dict, Any
20
+ import torch
21
+ import re
22
+
23
+ from transformers.image_processing_utils import BatchFeature
24
+ from transformers.image_utils import ImageInput
25
+ from transformers.processing_utils import ProcessorMixin
26
+ from transformers.tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
27
+ from transformers.utils import TensorType, requires_backends, is_torch_dtype, is_torch_device
28
+
29
+ from .image_processing_minicpmv import MiniCPMVBatchFeature
30
+
31
+
32
+ class MiniCPMVProcessor(ProcessorMixin):
33
+ r"""
34
+ Constructs a MiniCPMV processor which wraps a MiniCPMV image processor and a MiniCPMV tokenizer into a single processor.
35
+
36
+ [`MiniCPMVProcessor`] offers all the functionalities of [`MiniCPMVImageProcessor`] and [`LlamaTokenizerWrapper`]. See the
37
+ [`~MiniCPMVProcessor.__call__`] and [`~MiniCPMVProcessor.decode`] for more information.
38
+
39
+ Args:
40
+ image_processor ([`MiniCPMVImageProcessor`], *optional*):
41
+ The image processor is a required input.
42
+ tokenizer ([`LlamaTokenizerWrapper`], *optional*):
43
+ The tokenizer is a required input.
44
+ """
45
+ attributes = ["image_processor", "tokenizer"]
46
+ image_processor_class = "AutoImageProcessor"
47
+ tokenizer_class = "AutoTokenizer"
48
+
49
+ def __init__(self, image_processor=None, tokenizer=None):
50
+ super().__init__(image_processor, tokenizer)
51
+ self.version = image_processor.version
52
+
53
+ def __call__(
54
+ self,
55
+ text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]],
56
+ images: ImageInput = None,
57
+ max_length: Optional[int] = None,
58
+ do_pad: Optional[bool] = True,
59
+ max_slice_nums: int = None,
60
+ use_image_id: bool = None,
61
+ return_tensors: Optional[Union[str, TensorType]] = TensorType.PYTORCH,
62
+ **kwargs
63
+ ) -> MiniCPMVBatchFeature:
64
+
65
+ if images is not None:
66
+ image_inputs = self.image_processor(images, do_pad=do_pad, max_slice_nums=max_slice_nums, return_tensors=return_tensors)
67
+ return self._convert_images_texts_to_inputs(image_inputs, text, max_slice_nums=max_slice_nums, use_image_id=use_image_id, max_length=max_length, **kwargs)
68
+
69
+ # Copied from transformers.models.clip.processing_clip.CLIPProcessor.batch_decode with CLIP->Llama
70
+ def batch_decode(self, *args, **kwargs):
71
+ """
72
+ This method forwards all its arguments to LlamaTokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
73
+ refer to the docstring of this method for more information.
74
+ """
75
+ output_ids = args[0]
76
+ result_text = []
77
+ for result in output_ids:
78
+ result = result[result != 0]
79
+ if result[0] == self.tokenizer.bos_id:
80
+ result = result[1:]
81
+ if result[-1] == self.tokenizer.eos_id:
82
+ result = result[:-1]
83
+ result_text.append(self.tokenizer.decode(result, *args[1:], **kwargs).strip())
84
+ return result_text
85
+ # return self.tokenizer.batch_decode(*args, **kwargs)
86
+
87
+ # Copied from transformers.models.clip.processing_clip.CLIPProcessor.decode with CLIP->Llama
88
+ def decode(self, *args, **kwargs):
89
+ """
90
+ This method forwards all its arguments to LlamaTokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
91
+ the docstring of this method for more information.
92
+ """
93
+ result = args[0]
94
+ result = result[result != 0]
95
+ if result[0] == self.tokenizer.bos_id:
96
+ result = result[1:]
97
+ if result[-1] == self.tokenizer.eos_id or (hasattr(self.tokenizer, "eot_id") and result[-1] == self.tokenizer.eot_id):
98
+ result = result[:-1]
99
+ return self.tokenizer.decode(result, *args[1:], **kwargs).strip()
100
+
101
+ def _convert(
102
+ self, input_str, max_inp_length: Optional[int] = None
103
+ ):
104
+ if self.version > 2.5 or not getattr(self.tokenizer, "add_bos_token", False):
105
+ input_ids = self.tokenizer.encode(input_str)
106
+ else:
107
+ input_ids = [self.tokenizer.bos_id] + self.tokenizer.encode(input_str)
108
+ if max_inp_length is not None:
109
+ input_ids = input_ids[:max_inp_length]
110
+ input_ids = torch.tensor(input_ids, dtype=torch.int32)
111
+
112
+ start_cond = (input_ids == self.tokenizer.im_start_id) | (input_ids == self.tokenizer.slice_start_id)
113
+ end_cond = (input_ids == self.tokenizer.im_end_id) | (input_ids == self.tokenizer.slice_end_id)
114
+
115
+ image_start_tokens = torch.where(start_cond)[0]
116
+ image_start_tokens += 1
117
+ image_end_tokens = torch.where(end_cond)[0]
118
+
119
+ valid_image_nums = max(len(image_start_tokens), len(image_end_tokens))
120
+
121
+ image_bounds = torch.hstack(
122
+ [
123
+ image_start_tokens[:valid_image_nums].unsqueeze(-1),
124
+ image_end_tokens[:valid_image_nums].unsqueeze(-1),
125
+ ]
126
+ )
127
+ return input_ids, image_bounds
128
+
129
+ def _convert_images_texts_to_inputs(
130
+ self,
131
+ images,
132
+ texts: Union[str, List[str]],
133
+ truncation=None,
134
+ max_length=None,
135
+ max_slice_nums=None,
136
+ use_image_id=None,
137
+ return_tensors=None,
138
+ **kwargs
139
+ ):
140
+ if images is None or not len(images):
141
+ model_inputs = self.tokenizer(texts, return_tensors=return_tensors, truncation=truncation, max_length=max_length, **kwargs)
142
+ return MiniCPMVBatchFeature(data={**model_inputs})
143
+
144
+ pattern = "(<image>./</image>)"
145
+ images, image_sizes, tgt_sizes = images["pixel_values"], images["image_sizes"], images["tgt_sizes"]
146
+
147
+ if isinstance(texts, str):
148
+ texts = [texts]
149
+ input_ids_list = []
150
+ image_bounds_list = []
151
+ for index, text in enumerate(texts):
152
+ image_tags = re.findall(pattern, text)
153
+ assert len(image_tags) == len(image_sizes[index])
154
+ text_chunks = text.split(pattern)
155
+ final_text = ""
156
+ for i in range(len(image_tags)):
157
+ final_text = final_text + text_chunks[i] + \
158
+ self.image_processor.get_slice_image_placeholder(
159
+ image_sizes[index][i],
160
+ i,
161
+ max_slice_nums,
162
+ use_image_id
163
+ )
164
+ final_text += text_chunks[-1]
165
+ input_ids, image_bounds = self._convert(final_text, max_length)
166
+ input_ids_list.append(input_ids)
167
+ image_bounds_list.append(image_bounds)
168
+ padded_input_ids, padding_lengths = self.pad(
169
+ input_ids_list,
170
+ padding_side="left"
171
+ )
172
+ for i, length in enumerate(padding_lengths):
173
+ image_bounds_list[i] = image_bounds_list[i] + length
174
+ attention_mask = padded_input_ids.ne(0)
175
+
176
+ return MiniCPMVBatchFeature(data={
177
+ "input_ids": padded_input_ids,
178
+ "attention_mask": attention_mask,
179
+ "pixel_values": images,
180
+ "image_sizes": image_sizes,
181
+ "image_bound": image_bounds_list,
182
+ "tgt_sizes": tgt_sizes
183
+ })
184
+
185
+ @property
186
+ # Copied from transformers.models.clip.processing_clip.CLIPProcessor.model_input_names
187
+ def model_input_names(self):
188
+ tokenizer_input_names = self.tokenizer.model_input_names
189
+ image_processor_input_names = self.image_processor.model_input_names
190
+ return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))
191
+
192
+
193
+ def pad(self, inputs, max_length=None, padding_value=0, padding_side="left"):
194
+ items = []
195
+ if isinstance(inputs[0], list):
196
+ assert isinstance(inputs[0][0], torch.Tensor)
197
+ for it in inputs:
198
+ for tr in it:
199
+ items.append(tr)
200
+ else:
201
+ assert isinstance(inputs[0], torch.Tensor)
202
+ items = inputs
203
+
204
+ batch_size = len(items)
205
+ shape = items[0].shape
206
+ dim = len(shape)
207
+ assert dim <= 2
208
+ if max_length is None:
209
+ max_length = 0
210
+ max_length = max(max_length, max(item.shape[-1] for item in items))
211
+ min_length = min(item.shape[-1] for item in items)
212
+ dtype = items[0].dtype
213
+
214
+ if dim == 0:
215
+ return torch.stack([item for item in items], dim=0), [0]
216
+ elif dim == 1:
217
+ if max_length == min_length:
218
+ return torch.stack([item for item in items], dim=0), [0] * batch_size
219
+ tensor = torch.zeros((batch_size, max_length), dtype=dtype) + padding_value
220
+ else:
221
+ tensor = (
222
+ torch.zeros((batch_size, max_length, shape[-1]), dtype=dtype)
223
+ + padding_value
224
+ )
225
+
226
+ padding_length = []
227
+ for i, item in enumerate(items):
228
+ if dim == 1:
229
+ if padding_side == "left":
230
+ tensor[i, -len(item) :] = item.clone()
231
+ else:
232
+ tensor[i, : len(item)] = item.clone()
233
+ elif dim == 2:
234
+ if padding_side == "left":
235
+ tensor[i, -len(item) :, :] = item.clone()
236
+ else:
237
+ tensor[i, : len(item), :] = item.clone()
238
+ padding_length.append(tensor.shape[-1] - len(item))
239
+
240
+ return tensor, padding_length
processor_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoProcessor": "processing_minicpmv.MiniCPMVProcessor"
4
+ },
5
+ "processor_class": "MiniCPMVProcessor"
6
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<image>",
4
+ "</image>",
5
+ "<ref>",
6
+ "</ref>",
7
+ "<box>",
8
+ "</box>",
9
+ "<quad>",
10
+ "</quad>",
11
+ "<point>",
12
+ "</point>",
13
+ "<slice>",
14
+ "</slice>",
15
+ "<image_id>",
16
+ "</image_id>",
17
+ "<|reserved_special_token_0|>",
18
+ "<|reserved_special_token_1|>",
19
+ "<|reserved_special_token_2|>",
20
+ "<|reserved_special_token_3|>",
21
+ "<|reserved_special_token_4|>",
22
+ "<|reserved_special_token_5|>"
23
+ ],
24
+ "bos_token": {
25
+ "content": "<|im_start|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ "eos_token": {
32
+ "content": "<|im_end|>",
33
+ "lstrip": false,
34
+ "normalized": false,
35
+ "rstrip": false,
36
+ "single_word": false
37
+ },
38
+ "pad_token": {
39
+ "content": "<|endoftext|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false
44
+ },
45
+ "unk_token": {
46
+ "content": "<unk>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false
51
+ }
52
+ }
tokenization_minicpmv_fast.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers.models.qwen2 import Qwen2TokenizerFast
2
+
3
+
4
+ class MiniCPMVTokenizerFast(Qwen2TokenizerFast):
5
+ def __init__(self, **kwargs):
6
+ super().__init__(**kwargs)
7
+ self.im_start = "<image>"
8
+ self.im_end = "</image>"
9
+ self.ref_start = "<ref>"
10
+ self.ref_end = "</ref>"
11
+ self.box_start = "<box>"
12
+ self.box_end = "</box>"
13
+ self.quad_start = "<quad>"
14
+ self.quad_end = "</quad>"
15
+ self.slice_start = "<slice>"
16
+ self.slice_end = "</slice>"
17
+ self.im_id_start = "<image_id>"
18
+ self.im_id_end = "</image_id>"
19
+
20
+ @property
21
+ def eos_id(self):
22
+ return self.eos_token_id
23
+
24
+ @property
25
+ def bos_id(self):
26
+ return self.bos_token_id
27
+
28
+ @property
29
+ def unk_id(self):
30
+ return self.unk_token_id
31
+
32
+ @property
33
+ def im_start_id(self):
34
+ return self.convert_tokens_to_ids(self.im_start)
35
+
36
+ @property
37
+ def im_end_id(self):
38
+ return self.convert_tokens_to_ids(self.im_end)
39
+
40
+ @property
41
+ def slice_start_id(self):
42
+ return self.convert_tokens_to_ids(self.slice_start)
43
+
44
+ @property
45
+ def slice_end_id(self):
46
+ return self.convert_tokens_to_ids(self.slice_end)
47
+
48
+ @property
49
+ def im_id_start_id(self):
50
+ return self.convert_tokens_to_ids(self.im_id_start)
51
+
52
+ @property
53
+ def im_id_end_id(self):
54
+ return self.convert_tokens_to_ids(self.im_id_end)
55
+
56
+ @property
57
+ def newline_id(self):
58
+ return self.convert_tokens_to_ids('\n')
59
+
60
+ @staticmethod
61
+ def escape(text: str) -> str:
62
+ return text
63
+
64
+ @staticmethod
65
+ def unescape(text: str) -> str:
66
+ return text
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9de76ce95f90e336b4d2b0ec11d37f3d5404f2dad0f7ac95298405474b2a3a90
3
+ size 11422257
tokenizer_config.json ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "128244": {
5
+ "content": "<unk>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "151643": {
13
+ "content": "<|endoftext|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "151644": {
21
+ "content": "<|im_start|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "151645": {
29
+ "content": "<|im_end|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "151646": {
37
+ "content": "<image>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "151647": {
45
+ "content": "</image>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "151648": {
53
+ "content": "<ref>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "151649": {
61
+ "content": "</ref>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "151650": {
69
+ "content": "<box>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "151651": {
77
+ "content": "</box>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "151652": {
85
+ "content": "<quad>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "151653": {
93
+ "content": "</quad>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "151654": {
101
+ "content": "<point>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "151655": {
109
+ "content": "</point>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "151656": {
117
+ "content": "<slice>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "151657": {
125
+ "content": "</slice>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "151658": {
133
+ "content": "<image_id>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ },
140
+ "151659": {
141
+ "content": "</image_id>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": true
147
+ },
148
+ "151660": {
149
+ "content": "<|reserved_special_token_0|>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": true
155
+ },
156
+ "151661": {
157
+ "content": "<|reserved_special_token_1|>",
158
+ "lstrip": false,
159
+ "normalized": false,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": true
163
+ },
164
+ "151662": {
165
+ "content": "<|reserved_special_token_2|>",
166
+ "lstrip": false,
167
+ "normalized": false,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": true
171
+ },
172
+ "151663": {
173
+ "content": "<|reserved_special_token_3|>",
174
+ "lstrip": false,
175
+ "normalized": false,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": true
179
+ },
180
+ "151664": {
181
+ "content": "<|reserved_special_token_4|>",
182
+ "lstrip": false,
183
+ "normalized": false,
184
+ "rstrip": false,
185
+ "single_word": false,
186
+ "special": true
187
+ },
188
+ "151665": {
189
+ "content": "<|reserved_special_token_5|>",
190
+ "lstrip": false,
191
+ "normalized": false,
192
+ "rstrip": false,
193
+ "single_word": false,
194
+ "special": true
195
+ }
196
+ },
197
+ "additional_special_tokens": [
198
+ "<image>",
199
+ "</image>",
200
+ "<ref>",
201
+ "</ref>",
202
+ "<box>",
203
+ "</box>",
204
+ "<quad>",
205
+ "</quad>",
206
+ "<point>",
207
+ "</point>",
208
+ "<slice>",
209
+ "</slice>",
210
+ "<image_id>",
211
+ "</image_id>",
212
+ "<|reserved_special_token_0|>",
213
+ "<|reserved_special_token_1|>",
214
+ "<|reserved_special_token_2|>",
215
+ "<|reserved_special_token_3|>",
216
+ "<|reserved_special_token_4|>",
217
+ "<|reserved_special_token_5|>"
218
+ ],
219
+ "auto_map": {
220
+ "AutoProcessor": "processing_minicpmv.MiniCPMVProcessor",
221
+ "AutoTokenizer": [
222
+ "tokenization_qwen2.Qwen2Tokenizer",
223
+ "tokenization_minicpmv_fast.MiniCPMVTokenizerFast"
224
+ ]
225
+ },
226
+ "bos_token": "<|im_start|>",
227
+ "clean_up_tokenization_spaces": false,
228
+ "eos_token": "<|im_end|>",
229
+ "errors": "replace",
230
+ "extra_special_tokens": {},
231
+ "model_max_length": 1000000000000000019884624838656,
232
+ "pad_token": "<|endoftext|>",
233
+ "processor_class": "MiniCPMVProcessor",
234
+ "split_special_tokens": false,
235
+ "tokenizer_class": "MiniCPMVTokenizer",
236
+ "unk_token": "<unk>"
237
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff