openvino-ci commited on
Commit
3f2d4cb
·
verified ·
1 Parent(s): 69c4bd3

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - multilingual
5
+ pipeline_tag: image-text-to-text
6
+ tags:
7
+ - nlp
8
+ - vision
9
+ - internvl
10
+ base_model:
11
+ - OpenGVLab/InternVL2-8B
12
+ base_model_relation: quantized
13
+ ---
14
+
15
+ # InternVL2-8B-int4-ov
16
+
17
+ * Model creator: [OpenGVLab](https://huggingface.co/OpenGVLab)
18
+ * Original model: [InternVL2-8B](https://huggingface.co/OpenGVLab/InternVL2-8B)
19
+
20
+ ## Description
21
+
22
+ This is [OpenGVLab/InternVL2-8B](https://huggingface.co/OpenGVLab/InternVL2-8B) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2025/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to INT4 using Activation Aware Quantization (AWQ) by [NNCF](https://github.com/openvinotoolkit/nncf).
23
+
24
+
25
+ ## Quantization Parameters
26
+
27
+ Weight compression was performed using `nncf.compress_weights` with the following parameters:
28
+
29
+ * mode: **INT4_ASYM**
30
+ * ratio: **1.0**
31
+ * group_size: **128**
32
+ * awq: **True**
33
+ * dataset: **[contextual](https://huggingface.co/datasets/ucla-contextual/contextual_test)**
34
+ * num_samples: **32**
35
+
36
+
37
+ ## Compatibility
38
+
39
+ The provided OpenVINO™ IR model is compatible with:
40
+
41
+ * OpenVINO version 2025.2.0 and higher
42
+ * Optimum Intel 1.26.0 and higher
43
+
44
+ ## Running Model Inference with [Optimum Intel](https://huggingface.co/docs/optimum/intel/index)
45
+
46
+ 1. Install packages required for using [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) integration with the OpenVINO backend:
47
+
48
+ ```
49
+ pip install --pre -U --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release openvino_tokenizers openvino
50
+
51
+ pip install git+https://github.com/huggingface/optimum-intel.git
52
+ ```
53
+
54
+ 2. Run model inference
55
+
56
+ ```
57
+ from PIL import Image
58
+ import requests
59
+ from optimum.intel.openvino import OVModelForVisualCausalLM
60
+ from transformers import AutoTokenizer, TextStreamer
61
+
62
+ model_id = "OpenVINO/InternVL2-8B-int4-ov"
63
+
64
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
65
+
66
+ ov_model = OVModelForVisualCausalLM.from_pretrained(model_id, trust_remote_code=True)
67
+ prompt = "What is unusual on this picture?"
68
+
69
+ url = "https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/d5fbbd1a-d484-415c-88cb-9986625b7b11"
70
+ image = Image.open(requests.get(url, stream=True).raw)
71
+
72
+ inputs = ov_model.preprocess_inputs(text=prompt, image=image, tokenizer=tokenizer, config=ov_model.config)
73
+
74
+ generation_args = {
75
+ "max_new_tokens": 100,
76
+ "streamer": TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
77
+ }
78
+
79
+ generate_ids = ov_model.generate(**inputs, **generation_args)
80
+
81
+ generate_ids = generate_ids[:, inputs['input_ids'].shape[1]:]
82
+ response = tokenizer.batch_decode(generate_ids, skip_special_tokens=True)[0]
83
+
84
+ ```
85
+
86
+ ## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
87
+
88
+ 1. Install packages required for using OpenVINO GenAI.
89
+ ```
90
+ pip install --pre -U --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release openvino openvino-tokenizers openvino-genai
91
+
92
+ pip install huggingface_hub
93
+ ```
94
+
95
+ 2. Download model from HuggingFace Hub
96
+
97
+ ```
98
+ import huggingface_hub as hf_hub
99
+
100
+ model_id = "OpenVINO/InternVL2-8B-int4-ov"
101
+ model_path = "InternVL2-8B-int4-ov"
102
+
103
+ hf_hub.snapshot_download(model_id, local_dir=model_path)
104
+
105
+ ```
106
+
107
+ 1. Run model inference:
108
+
109
+ ```
110
+ import openvino_genai as ov_genai
111
+ import requests
112
+ from PIL import Image
113
+ from io import BytesIO
114
+ import numpy as np
115
+ import openvino as ov
116
+
117
+ device = "CPU"
118
+ pipe = ov_genai.VLMPipeline(model_path, device)
119
+
120
+ def load_image(image_file):
121
+ if isinstance(image_file, str) and (image_file.startswith("http") or image_file.startswith("https")):
122
+ response = requests.get(image_file)
123
+ image = Image.open(BytesIO(response.content)).convert("RGB")
124
+ else:
125
+ image = Image.open(image_file).convert("RGB")
126
+ image_data = np.array(image.getdata()).reshape(1, image.size[1], image.size[0], 3).astype(np.byte)
127
+ return ov.Tensor(image_data)
128
+
129
+ prompt = "What is unusual on this picture?"
130
+
131
+ url = "https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/d5fbbd1a-d484-415c-88cb-9986625b7b11"
132
+ image_tensor = load_image(url)
133
+
134
+ def streamer(subword: str) -> bool:
135
+ print(subword, end="", flush=True)
136
+ return False
137
+
138
+ pipe.start_chat()
139
+ output = pipe.generate(prompt, image=image_tensor, max_new_tokens=100, streamer=streamer)
140
+ pipe.finish_chat()
141
+ ```
142
+
143
+ More GenAI usage examples can be found in OpenVINO GenAI library [docs](https://github.com/openvinotoolkit/openvino.genai/blob/master/src/README.md) and [samples](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#openvino-genai-samples)
144
+
145
+
146
+ ## Limitations
147
+
148
+ Check the original [model card](https://huggingface.co/OpenGVLab/InternVL2-8B) for limitations.
149
+
150
+ ## Legal information
151
+
152
+ The original model is distributed under [MIT](https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/mit.md) license. More details can be found in [original model card](https://huggingface.co/OpenGVLab/InternVL2-8B).
153
+
154
+ ## Disclaimer
155
+
156
+ Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See [Intel’s Global Human Rights Principles](https://www.intel.com/content/dam/www/central-libraries/us/en/documents/policy-human-rights.pdf). Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.
157
+
added_tokens.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</box>": 92552,
3
+ "</img>": 92545,
4
+ "</quad>": 92548,
5
+ "</ref>": 92550,
6
+ "<IMG_CONTEXT>": 92546,
7
+ "<box>": 92551,
8
+ "<img>": 92544,
9
+ "<quad>": 92547,
10
+ "<ref>": 92549
11
+ }
config.json ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": true,
3
+ "_commit_hash": null,
4
+ "architectures": [
5
+ "InternVLChatModel"
6
+ ],
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_internvl_chat.InternVLChatConfig",
9
+ "AutoModel": "OpenGVLab/InternVL2-8B--modeling_internvl_chat.InternVLChatModel",
10
+ "AutoModelForCausalLM": "OpenGVLab/InternVL2-8B--modeling_internvl_chat.InternVLChatModel"
11
+ },
12
+ "downsample_ratio": 0.5,
13
+ "dynamic_image_size": true,
14
+ "force_image_size": 448,
15
+ "img_context_token_id": 92546,
16
+ "llm_config": {
17
+ "_attn_implementation_autoset": true,
18
+ "_name_or_path": "internlm/internlm2_5-7b-chat",
19
+ "add_cross_attention": false,
20
+ "architectures": [
21
+ "InternLM2ForCausalLM"
22
+ ],
23
+ "attn_implementation": "eager",
24
+ "auto_map": {
25
+ "AutoConfig": "configuration_internlm2.InternLM2Config",
26
+ "AutoModel": "modeling_internlm2.InternLM2ForCausalLM",
27
+ "AutoModelForCausalLM": "modeling_internlm2.InternLM2ForCausalLM"
28
+ },
29
+ "bad_words_ids": null,
30
+ "begin_suppress_tokens": null,
31
+ "bias": false,
32
+ "bos_token_id": 1,
33
+ "chunk_size_feed_forward": 0,
34
+ "cross_attention_hidden_size": null,
35
+ "decoder_start_token_id": null,
36
+ "diversity_penalty": 0.0,
37
+ "do_sample": false,
38
+ "early_stopping": false,
39
+ "encoder_no_repeat_ngram_size": 0,
40
+ "eos_token_id": 2,
41
+ "exponential_decay_length_penalty": null,
42
+ "finetuning_task": null,
43
+ "forced_bos_token_id": null,
44
+ "forced_eos_token_id": null,
45
+ "hidden_act": "silu",
46
+ "hidden_size": 4096,
47
+ "id2label": {
48
+ "0": "LABEL_0",
49
+ "1": "LABEL_1"
50
+ },
51
+ "initializer_range": 0.02,
52
+ "intermediate_size": 14336,
53
+ "is_decoder": false,
54
+ "is_encoder_decoder": false,
55
+ "label2id": {
56
+ "LABEL_0": 0,
57
+ "LABEL_1": 1
58
+ },
59
+ "length_penalty": 1.0,
60
+ "max_length": 20,
61
+ "max_position_embeddings": 32768,
62
+ "min_length": 0,
63
+ "model_type": "internlm2",
64
+ "no_repeat_ngram_size": 0,
65
+ "num_attention_heads": 32,
66
+ "num_beam_groups": 1,
67
+ "num_beams": 1,
68
+ "num_hidden_layers": 32,
69
+ "num_key_value_heads": 8,
70
+ "num_return_sequences": 1,
71
+ "output_attentions": false,
72
+ "output_hidden_states": false,
73
+ "output_scores": false,
74
+ "pad_token_id": 2,
75
+ "prefix": null,
76
+ "pretraining_tp": 1,
77
+ "problem_type": null,
78
+ "pruned_heads": {},
79
+ "remove_invalid_values": false,
80
+ "repetition_penalty": 1.0,
81
+ "return_dict": true,
82
+ "return_dict_in_generate": false,
83
+ "rms_norm_eps": 1e-05,
84
+ "rope_scaling": {
85
+ "factor": 2.0,
86
+ "type": "dynamic"
87
+ },
88
+ "rope_theta": 1000000,
89
+ "sep_token_id": null,
90
+ "suppress_tokens": null,
91
+ "task_specific_params": null,
92
+ "temperature": 1.0,
93
+ "tf_legacy_loss": false,
94
+ "tie_encoder_decoder": false,
95
+ "tie_word_embeddings": false,
96
+ "tokenizer_class": null,
97
+ "top_k": 50,
98
+ "top_p": 1.0,
99
+ "torch_dtype": "bfloat16",
100
+ "torchscript": false,
101
+ "transformers_version": "4.51.3",
102
+ "typical_p": 1.0,
103
+ "use_bfloat16": true,
104
+ "use_cache": true,
105
+ "vocab_size": 92553
106
+ },
107
+ "max_dynamic_patch": 12,
108
+ "min_dynamic_patch": 1,
109
+ "model_type": "internvl_chat",
110
+ "ps_version": "v2",
111
+ "select_layer": -1,
112
+ "template": "internlm2-chat",
113
+ "tie_word_embeddings": false,
114
+ "torch_dtype": "bfloat16",
115
+ "transformers_version": null,
116
+ "use_backbone_lora": 0,
117
+ "use_llm_lora": 0,
118
+ "use_thumbnail": true,
119
+ "vision_config": {
120
+ "_attn_implementation_autoset": true,
121
+ "_name_or_path": "",
122
+ "add_cross_attention": false,
123
+ "architectures": [
124
+ "InternVisionModel"
125
+ ],
126
+ "attention_dropout": 0.0,
127
+ "bad_words_ids": null,
128
+ "begin_suppress_tokens": null,
129
+ "bos_token_id": null,
130
+ "chunk_size_feed_forward": 0,
131
+ "cross_attention_hidden_size": null,
132
+ "decoder_start_token_id": null,
133
+ "diversity_penalty": 0.0,
134
+ "do_sample": false,
135
+ "drop_path_rate": 0.0,
136
+ "dropout": 0.0,
137
+ "early_stopping": false,
138
+ "encoder_no_repeat_ngram_size": 0,
139
+ "eos_token_id": null,
140
+ "exponential_decay_length_penalty": null,
141
+ "finetuning_task": null,
142
+ "forced_bos_token_id": null,
143
+ "forced_eos_token_id": null,
144
+ "hidden_act": "gelu",
145
+ "hidden_size": 1024,
146
+ "id2label": {
147
+ "0": "LABEL_0",
148
+ "1": "LABEL_1"
149
+ },
150
+ "image_size": 448,
151
+ "initializer_factor": 1.0,
152
+ "initializer_range": 0.02,
153
+ "intermediate_size": 4096,
154
+ "is_decoder": false,
155
+ "is_encoder_decoder": false,
156
+ "label2id": {
157
+ "LABEL_0": 0,
158
+ "LABEL_1": 1
159
+ },
160
+ "layer_norm_eps": 1e-06,
161
+ "length_penalty": 1.0,
162
+ "max_length": 20,
163
+ "min_length": 0,
164
+ "model_type": "intern_vit_6b",
165
+ "no_repeat_ngram_size": 0,
166
+ "norm_type": "layer_norm",
167
+ "num_attention_heads": 16,
168
+ "num_beam_groups": 1,
169
+ "num_beams": 1,
170
+ "num_channels": 3,
171
+ "num_hidden_layers": 24,
172
+ "num_return_sequences": 1,
173
+ "output_attentions": false,
174
+ "output_hidden_states": false,
175
+ "output_scores": false,
176
+ "pad_token_id": null,
177
+ "patch_size": 14,
178
+ "prefix": null,
179
+ "problem_type": null,
180
+ "pruned_heads": {},
181
+ "qk_normalization": false,
182
+ "qkv_bias": true,
183
+ "remove_invalid_values": false,
184
+ "repetition_penalty": 1.0,
185
+ "return_dict": true,
186
+ "return_dict_in_generate": false,
187
+ "sep_token_id": null,
188
+ "suppress_tokens": null,
189
+ "task_specific_params": null,
190
+ "temperature": 1.0,
191
+ "tf_legacy_loss": false,
192
+ "tie_encoder_decoder": false,
193
+ "tie_word_embeddings": true,
194
+ "tokenizer_class": null,
195
+ "top_k": 50,
196
+ "top_p": 1.0,
197
+ "torch_dtype": "bfloat16",
198
+ "torchscript": false,
199
+ "transformers_version": "4.51.3",
200
+ "typical_p": 1.0,
201
+ "use_bfloat16": true,
202
+ "use_flash_attn": false
203
+ }
204
+ }
configuration_intern_vit.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --------------------------------------------------------
2
+ # InternVL
3
+ # Copyright (c) 2024 OpenGVLab
4
+ # Licensed under The MIT License [see LICENSE for details]
5
+ # --------------------------------------------------------
6
+
7
+ import os
8
+ from typing import Union
9
+
10
+ from transformers.configuration_utils import PretrainedConfig
11
+ from transformers.utils import logging
12
+
13
+ logger = logging.get_logger(__name__)
14
+
15
+
16
+ class InternVisionConfig(PretrainedConfig):
17
+ r"""
18
+ This is the configuration class to store the configuration of a [`InternVisionModel`]. It is used to
19
+ instantiate a vision encoder according to the specified arguments, defining the model architecture.
20
+
21
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
22
+ documentation from [`PretrainedConfig`] for more information.
23
+
24
+ Args:
25
+ num_channels (`int`, *optional*, defaults to 3):
26
+ Number of color channels in the input images (e.g., 3 for RGB).
27
+ patch_size (`int`, *optional*, defaults to 14):
28
+ The size (resolution) of each patch.
29
+ image_size (`int`, *optional*, defaults to 224):
30
+ The size (resolution) of each image.
31
+ qkv_bias (`bool`, *optional*, defaults to `False`):
32
+ Whether to add a bias to the queries and values in the self-attention layers.
33
+ hidden_size (`int`, *optional*, defaults to 3200):
34
+ Dimensionality of the encoder layers and the pooler layer.
35
+ num_attention_heads (`int`, *optional*, defaults to 25):
36
+ Number of attention heads for each attention layer in the Transformer encoder.
37
+ intermediate_size (`int`, *optional*, defaults to 12800):
38
+ Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
39
+ qk_normalization (`bool`, *optional*, defaults to `True`):
40
+ Whether to normalize the queries and keys in the self-attention layers.
41
+ num_hidden_layers (`int`, *optional*, defaults to 48):
42
+ Number of hidden layers in the Transformer encoder.
43
+ use_flash_attn (`bool`, *optional*, defaults to `True`):
44
+ Whether to use flash attention mechanism.
45
+ hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
46
+ The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
47
+ `"relu"`, `"selu"` and `"gelu_new"` ``"gelu"` are supported.
48
+ layer_norm_eps (`float`, *optional*, defaults to 1e-6):
49
+ The epsilon used by the layer normalization layers.
50
+ dropout (`float`, *optional*, defaults to 0.0):
51
+ The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
52
+ drop_path_rate (`float`, *optional*, defaults to 0.0):
53
+ Dropout rate for stochastic depth.
54
+ attention_dropout (`float`, *optional*, defaults to 0.0):
55
+ The dropout ratio for the attention probabilities.
56
+ initializer_range (`float`, *optional*, defaults to 0.02):
57
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
58
+ initializer_factor (`float`, *optional*, defaults to 0.1):
59
+ A factor for layer scale.
60
+ """
61
+
62
+ model_type = 'intern_vit_6b'
63
+
64
+ def __init__(
65
+ self,
66
+ num_channels=3,
67
+ patch_size=14,
68
+ image_size=224,
69
+ qkv_bias=False,
70
+ hidden_size=3200,
71
+ num_attention_heads=25,
72
+ intermediate_size=12800,
73
+ qk_normalization=True,
74
+ num_hidden_layers=48,
75
+ use_flash_attn=True,
76
+ hidden_act='gelu',
77
+ norm_type='rms_norm',
78
+ layer_norm_eps=1e-6,
79
+ dropout=0.0,
80
+ drop_path_rate=0.0,
81
+ attention_dropout=0.0,
82
+ initializer_range=0.02,
83
+ initializer_factor=0.1,
84
+ **kwargs,
85
+ ):
86
+ super().__init__(**kwargs)
87
+
88
+ self.hidden_size = hidden_size
89
+ self.intermediate_size = intermediate_size
90
+ self.dropout = dropout
91
+ self.drop_path_rate = drop_path_rate
92
+ self.num_hidden_layers = num_hidden_layers
93
+ self.num_attention_heads = num_attention_heads
94
+ self.num_channels = num_channels
95
+ self.patch_size = patch_size
96
+ self.image_size = image_size
97
+ self.initializer_range = initializer_range
98
+ self.initializer_factor = initializer_factor
99
+ self.attention_dropout = attention_dropout
100
+ self.layer_norm_eps = layer_norm_eps
101
+ self.hidden_act = hidden_act
102
+ self.norm_type = norm_type
103
+ self.qkv_bias = qkv_bias
104
+ self.qk_normalization = qk_normalization
105
+ self.use_flash_attn = use_flash_attn
106
+
107
+ @classmethod
108
+ def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> 'PretrainedConfig':
109
+ config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
110
+
111
+ if 'vision_config' in config_dict:
112
+ config_dict = config_dict['vision_config']
113
+
114
+ if 'model_type' in config_dict and hasattr(cls, 'model_type') and config_dict['model_type'] != cls.model_type:
115
+ logger.warning(
116
+ f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
117
+ f'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'
118
+ )
119
+
120
+ return cls.from_dict(config_dict, **kwargs)
configuration_internlm2.py ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) The InternLM team and The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # This code is based on transformers/src/transformers/models/llama/configuration_llama.py
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ """ InternLM2 model configuration"""
17
+
18
+ from transformers.configuration_utils import PretrainedConfig
19
+ from transformers.utils import logging
20
+
21
+ logger = logging.get_logger(__name__)
22
+
23
+ INTERNLM2_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
24
+
25
+
26
+ # Modified from transformers.model.llama.configuration_llama.LlamaConfig
27
+ class InternLM2Config(PretrainedConfig):
28
+ r"""
29
+ This is the configuration class to store the configuration of a [`InternLM2Model`]. It is used to instantiate
30
+ an InternLM2 model according to the specified arguments, defining the model architecture. Instantiating a
31
+ configuration with the defaults will yield a similar configuration to that of the InternLM2-7B.
32
+
33
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
34
+ documentation from [`PretrainedConfig`] for more information.
35
+
36
+
37
+ Args:
38
+ vocab_size (`int`, *optional*, defaults to 32000):
39
+ Vocabulary size of the InternLM2 model. Defines the number of different tokens that can be represented by the
40
+ `inputs_ids` passed when calling [`InternLM2Model`]
41
+ hidden_size (`int`, *optional*, defaults to 4096):
42
+ Dimension of the hidden representations.
43
+ intermediate_size (`int`, *optional*, defaults to 11008):
44
+ Dimension of the MLP representations.
45
+ num_hidden_layers (`int`, *optional*, defaults to 32):
46
+ Number of hidden layers in the Transformer encoder.
47
+ num_attention_heads (`int`, *optional*, defaults to 32):
48
+ Number of attention heads for each attention layer in the Transformer encoder.
49
+ num_key_value_heads (`int`, *optional*):
50
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
51
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
52
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
53
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
54
+ by meanpooling all the original heads within that group. For more details checkout [this
55
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
56
+ `num_attention_heads`.
57
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
58
+ The non-linear activation function (function or string) in the decoder.
59
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
60
+ The maximum sequence length that this model might ever be used with. Typically set this to something large
61
+ just in case (e.g., 512 or 1024 or 2048).
62
+ initializer_range (`float`, *optional*, defaults to 0.02):
63
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
64
+ rms_norm_eps (`float`, *optional*, defaults to 1e-12):
65
+ The epsilon used by the rms normalization layers.
66
+ use_cache (`bool`, *optional*, defaults to `True`):
67
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
68
+ relevant if `config.is_decoder=True`.
69
+ tie_word_embeddings(`bool`, *optional*, defaults to `False`):
70
+ Whether to tie weight embeddings
71
+ Example:
72
+
73
+ """
74
+ model_type = 'internlm2'
75
+ _auto_class = 'AutoConfig'
76
+
77
+ def __init__( # pylint: disable=W0102
78
+ self,
79
+ vocab_size=103168,
80
+ hidden_size=4096,
81
+ intermediate_size=11008,
82
+ num_hidden_layers=32,
83
+ num_attention_heads=32,
84
+ num_key_value_heads=None,
85
+ hidden_act='silu',
86
+ max_position_embeddings=2048,
87
+ initializer_range=0.02,
88
+ rms_norm_eps=1e-6,
89
+ use_cache=True,
90
+ pad_token_id=0,
91
+ bos_token_id=1,
92
+ eos_token_id=2,
93
+ tie_word_embeddings=False,
94
+ bias=True,
95
+ rope_theta=10000,
96
+ rope_scaling=None,
97
+ attn_implementation='eager',
98
+ **kwargs,
99
+ ):
100
+ self.vocab_size = vocab_size
101
+ self.max_position_embeddings = max_position_embeddings
102
+ self.hidden_size = hidden_size
103
+ self.intermediate_size = intermediate_size
104
+ self.num_hidden_layers = num_hidden_layers
105
+ self.num_attention_heads = num_attention_heads
106
+ self.bias = bias
107
+
108
+ if num_key_value_heads is None:
109
+ num_key_value_heads = num_attention_heads
110
+ self.num_key_value_heads = num_key_value_heads
111
+
112
+ self.hidden_act = hidden_act
113
+ self.initializer_range = initializer_range
114
+ self.rms_norm_eps = rms_norm_eps
115
+ self.use_cache = use_cache
116
+ self.rope_theta = rope_theta
117
+ self.rope_scaling = rope_scaling
118
+ self._rope_scaling_validation()
119
+
120
+ self.attn_implementation = attn_implementation
121
+ if self.attn_implementation is None:
122
+ self.attn_implementation = 'eager'
123
+ super().__init__(
124
+ pad_token_id=pad_token_id,
125
+ bos_token_id=bos_token_id,
126
+ eos_token_id=eos_token_id,
127
+ tie_word_embeddings=tie_word_embeddings,
128
+ **kwargs,
129
+ )
130
+
131
+ def _rope_scaling_validation(self):
132
+ """
133
+ Validate the `rope_scaling` configuration.
134
+ """
135
+ if self.rope_scaling is None:
136
+ return
137
+
138
+ if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 2:
139
+ raise ValueError(
140
+ '`rope_scaling` must be a dictionary with with two fields, `type` and `factor`, '
141
+ f'got {self.rope_scaling}'
142
+ )
143
+ rope_scaling_type = self.rope_scaling.get('type', None)
144
+ rope_scaling_factor = self.rope_scaling.get('factor', None)
145
+ if rope_scaling_type is None or rope_scaling_type not in ['linear', 'dynamic']:
146
+ raise ValueError(
147
+ f"`rope_scaling`'s type field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"
148
+ )
149
+ if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor < 1.0:
150
+ raise ValueError(f"`rope_scaling`'s factor field must be a float >= 1, got {rope_scaling_factor}")
configuration_internvl_chat.py ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --------------------------------------------------------
2
+ # InternVL
3
+ # Copyright (c) 2024 OpenGVLab
4
+ # Licensed under The MIT License [see LICENSE for details]
5
+ # --------------------------------------------------------
6
+
7
+ import copy
8
+
9
+ from transformers import AutoConfig, LlamaConfig
10
+ from transformers.configuration_utils import PretrainedConfig
11
+ from transformers.utils import logging
12
+
13
+ from .configuration_intern_vit import InternVisionConfig
14
+ from .configuration_internlm2 import InternLM2Config
15
+
16
+ logger = logging.get_logger(__name__)
17
+
18
+
19
+ class InternVLChatConfig(PretrainedConfig):
20
+ model_type = 'internvl_chat'
21
+ is_composition = True
22
+
23
+ def __init__(
24
+ self,
25
+ vision_config=None,
26
+ llm_config=None,
27
+ use_backbone_lora=0,
28
+ use_llm_lora=0,
29
+ select_layer=-1,
30
+ force_image_size=None,
31
+ downsample_ratio=0.5,
32
+ template=None,
33
+ dynamic_image_size=False,
34
+ use_thumbnail=False,
35
+ ps_version='v1',
36
+ min_dynamic_patch=1,
37
+ max_dynamic_patch=6,
38
+ **kwargs):
39
+ super().__init__(**kwargs)
40
+
41
+ if vision_config is None:
42
+ vision_config = {'architectures': ['InternVisionModel']}
43
+ logger.info('vision_config is None. Initializing the InternVisionConfig with default values.')
44
+
45
+ if llm_config is None:
46
+ llm_config = {'architectures': ['InternLM2ForCausalLM']}
47
+ logger.info('llm_config is None. Initializing the LlamaConfig config with default values (`LlamaConfig`).')
48
+
49
+ self.vision_config = InternVisionConfig(**vision_config)
50
+ if llm_config.get('architectures')[0] == 'LlamaForCausalLM':
51
+ self.llm_config = LlamaConfig(**llm_config)
52
+ elif llm_config.get('architectures')[0] == 'InternLM2ForCausalLM':
53
+ self.llm_config = InternLM2Config(**llm_config)
54
+ else:
55
+ raise ValueError('Unsupported architecture: {}'.format(llm_config.get('architectures')[0]))
56
+ self.use_backbone_lora = use_backbone_lora
57
+ self.use_llm_lora = use_llm_lora
58
+ self.select_layer = select_layer
59
+ self.force_image_size = force_image_size
60
+ self.downsample_ratio = downsample_ratio
61
+ self.template = template
62
+ self.dynamic_image_size = dynamic_image_size
63
+ self.use_thumbnail = use_thumbnail
64
+ self.ps_version = ps_version # pixel shuffle version
65
+ self.min_dynamic_patch = min_dynamic_patch
66
+ self.max_dynamic_patch = max_dynamic_patch
67
+ # By default, we use tie_word_embeddings=False for models of all sizes.
68
+ self.tie_word_embeddings = self.llm_config.tie_word_embeddings
69
+
70
+ logger.info(f'vision_select_layer: {self.select_layer}')
71
+ logger.info(f'ps_version: {self.ps_version}')
72
+ logger.info(f'min_dynamic_patch: {self.min_dynamic_patch}')
73
+ logger.info(f'max_dynamic_patch: {self.max_dynamic_patch}')
74
+
75
+ def to_dict(self):
76
+ """
77
+ Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`].
78
+
79
+ Returns:
80
+ `Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
81
+ """
82
+ output = copy.deepcopy(self.__dict__)
83
+ output['vision_config'] = self.vision_config.to_dict()
84
+ output['llm_config'] = self.llm_config.to_dict()
85
+ output['model_type'] = self.__class__.model_type
86
+ output['use_backbone_lora'] = self.use_backbone_lora
87
+ output['use_llm_lora'] = self.use_llm_lora
88
+ output['select_layer'] = self.select_layer
89
+ output['force_image_size'] = self.force_image_size
90
+ output['downsample_ratio'] = self.downsample_ratio
91
+ output['template'] = self.template
92
+ output['dynamic_image_size'] = self.dynamic_image_size
93
+ output['use_thumbnail'] = self.use_thumbnail
94
+ output['ps_version'] = self.ps_version
95
+ output['min_dynamic_patch'] = self.min_dynamic_patch
96
+ output['max_dynamic_patch'] = self.max_dynamic_patch
97
+
98
+ return output
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": [
4
+ 92542,
5
+ 92543
6
+ ],
7
+ "transformers_version": "4.51.3"
8
+ }
openvino_config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dtype": "int4",
3
+ "input_info": null,
4
+ "optimum_version": "1.27.0",
5
+ "quantization_config": {
6
+ "all_layers": null,
7
+ "backup_precision": null,
8
+ "bits": 4,
9
+ "dataset": "contextual",
10
+ "dtype": "int4",
11
+ "gptq": null,
12
+ "group_size": 128,
13
+ "ignored_scope": null,
14
+ "lora_correction": null,
15
+ "num_samples": 32,
16
+ "processor": null,
17
+ "quant_method": "awq",
18
+ "ratio": 1.0,
19
+ "scale_estimation": null,
20
+ "sensitivity_metric": null,
21
+ "statistics_path": null,
22
+ "sym": false,
23
+ "tokenizer": null,
24
+ "trust_remote_code": true
25
+ },
26
+ "save_onnx_model": false,
27
+ "transformers_version": "4.51.3"
28
+ }
openvino_detokenizer.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d99982bd38cc642f98134aabf7650a1ce0d28e7978c945c238d7620a8260d29
3
+ size 1477889
openvino_detokenizer.xml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <net name="detokenizer" version="11">
3
+ <layers>
4
+ <layer id="0" name="Parameter_1627067" type="Parameter" version="opset1">
5
+ <data shape="?,?" element_type="i64" />
6
+ <output>
7
+ <port id="0" precision="I64" names="Parameter_1627067">
8
+ <dim>-1</dim>
9
+ <dim>-1</dim>
10
+ </port>
11
+ </output>
12
+ </layer>
13
+ <layer id="1" name="Constant_1626981" type="Const" version="opset1">
14
+ <data element_type="u8" shape="1477889" offset="0" size="1477889" />
15
+ <output>
16
+ <port id="0" precision="U8">
17
+ <dim>1477889</dim>
18
+ </port>
19
+ </output>
20
+ </layer>
21
+ <layer id="2" name="Convert_1627256" type="Convert" version="opset1">
22
+ <data destination_type="i32" />
23
+ <input>
24
+ <port id="0" precision="I64">
25
+ <dim>-1</dim>
26
+ <dim>-1</dim>
27
+ </port>
28
+ </input>
29
+ <output>
30
+ <port id="1" precision="I32">
31
+ <dim>-1</dim>
32
+ <dim>-1</dim>
33
+ </port>
34
+ </output>
35
+ </layer>
36
+ <layer id="3" name="SentencepieceDetokenizer_1627068" type="SentencepieceDetokenizer" version="extension">
37
+ <input>
38
+ <port id="0" precision="U8">
39
+ <dim>1477889</dim>
40
+ </port>
41
+ <port id="1" precision="I32">
42
+ <dim>-1</dim>
43
+ <dim>-1</dim>
44
+ </port>
45
+ </input>
46
+ <output>
47
+ <port id="2" precision="I32">
48
+ <dim>-1</dim>
49
+ </port>
50
+ <port id="3" precision="I32">
51
+ <dim>-1</dim>
52
+ </port>
53
+ <port id="4" precision="U8">
54
+ <dim>-1</dim>
55
+ </port>
56
+ </output>
57
+ </layer>
58
+ <layer id="4" name="UTF8Validate_1627069" type="UTF8Validate" version="extension">
59
+ <data replace_mode="true" />
60
+ <input>
61
+ <port id="0" precision="I32">
62
+ <dim>-1</dim>
63
+ </port>
64
+ <port id="1" precision="I32">
65
+ <dim>-1</dim>
66
+ </port>
67
+ <port id="2" precision="U8">
68
+ <dim>-1</dim>
69
+ </port>
70
+ </input>
71
+ <output>
72
+ <port id="3" precision="I32">
73
+ <dim>-1</dim>
74
+ </port>
75
+ <port id="4" precision="I32">
76
+ <dim>-1</dim>
77
+ </port>
78
+ <port id="5" precision="U8">
79
+ <dim>-1</dim>
80
+ </port>
81
+ </output>
82
+ </layer>
83
+ <layer id="5" name="StringTensorPack_1627070" type="StringTensorPack" version="opset15">
84
+ <input>
85
+ <port id="0" precision="I32">
86
+ <dim>-1</dim>
87
+ </port>
88
+ <port id="1" precision="I32">
89
+ <dim>-1</dim>
90
+ </port>
91
+ <port id="2" precision="U8">
92
+ <dim>-1</dim>
93
+ </port>
94
+ </input>
95
+ <output>
96
+ <port id="3" precision="STRING" names="string_output">
97
+ <dim>-1</dim>
98
+ </port>
99
+ </output>
100
+ </layer>
101
+ <layer id="6" name="Result_1627071" type="Result" version="opset1" output_names="string_output">
102
+ <input>
103
+ <port id="0" precision="STRING">
104
+ <dim>-1</dim>
105
+ </port>
106
+ </input>
107
+ </layer>
108
+ </layers>
109
+ <edges>
110
+ <edge from-layer="0" from-port="0" to-layer="2" to-port="0" />
111
+ <edge from-layer="1" from-port="0" to-layer="3" to-port="0" />
112
+ <edge from-layer="2" from-port="1" to-layer="3" to-port="1" />
113
+ <edge from-layer="3" from-port="2" to-layer="4" to-port="0" />
114
+ <edge from-layer="3" from-port="3" to-layer="4" to-port="1" />
115
+ <edge from-layer="3" from-port="4" to-layer="4" to-port="2" />
116
+ <edge from-layer="4" from-port="3" to-layer="5" to-port="0" />
117
+ <edge from-layer="4" from-port="4" to-layer="5" to-port="1" />
118
+ <edge from-layer="4" from-port="5" to-layer="5" to-port="2" />
119
+ <edge from-layer="5" from-port="3" to-layer="6" to-port="0" />
120
+ </edges>
121
+ <rt_info>
122
+ <add_attention_mask value="True" />
123
+ <add_prefix_space />
124
+ <add_special_tokens value="True" />
125
+ <bos_token_id value="1" />
126
+ <chat_template value="{{ bos_token }}{% for message in messages %}{{'&lt;|im_start|>' + message['role'] + '&#10;' + message['content'] + '&lt;|im_end|>' + '&#10;'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|>assistant&#10;' }}{% endif %}" />
127
+ <clean_up_tokenization_spaces value="False" />
128
+ <detokenizer_input_type value="i64" />
129
+ <eos_token_id value="2" />
130
+ <handle_special_tokens_with_re value="True" />
131
+ <max_length />
132
+ <number_of_inputs value="1" />
133
+ <openvino_tokenizers_version value="2025.2.0.1-567-7885335c24b" />
134
+ <openvino_version value="2025.2.0-19140-c01cd93e24d-releases/2025/2" />
135
+ <original_tokenizer_class value="&lt;class 'transformers_modules.OpenGVLab.InternVL2-8B.6fb9ad6924f69424e57fab2ab061d707688f0296.tokenization_internlm2.InternLM2Tokenizer'>" />
136
+ <pad_token_id value="2" />
137
+ <sentencepiece_version value="0.2.1" />
138
+ <skip_special_tokens value="True" />
139
+ <streaming_detokenizer value="False" />
140
+ <tiktoken_version value="0.9.0" />
141
+ <tokenizer_output_type value="i64" />
142
+ <tokenizers_version value="0.21.4" />
143
+ <transformers_version value="4.51.3" />
144
+ <use_max_padding value="False" />
145
+ <use_sentencepiece_backend value="False" />
146
+ <utf8_replace_mode value="replace" />
147
+ <with_detokenizer value="True" />
148
+ </rt_info>
149
+ </net>
openvino_language_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa40462a4485b8ef9d04f4aa6fd8f71eb5acd9459fa26f17937f60d3f4f1b73b
3
+ size 4039970283
openvino_language_model.xml ADDED
The diff for this file is too large to render. See raw diff
 
openvino_text_embeddings_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5de3b48f3049d26e65474556baeac1da903ed958fda0ade542ec9284481524c7
3
+ size 379282198
openvino_text_embeddings_model.xml ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <net name="Model3" 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="92553, 4096" offset="0" size="379097088" />
15
+ <output>
16
+ <port id="0" precision="I8">
17
+ <dim>92553</dim>
18
+ <dim>4096</dim>
19
+ </port>
20
+ </output>
21
+ </layer>
22
+ <layer id="2" name="Convert_1135902" type="Convert" version="opset1">
23
+ <data destination_type="f16" />
24
+ <input>
25
+ <port id="0" precision="I8">
26
+ <dim>92553</dim>
27
+ <dim>4096</dim>
28
+ </port>
29
+ </input>
30
+ <output>
31
+ <port id="1" precision="FP16">
32
+ <dim>92553</dim>
33
+ <dim>4096</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="92553, 1" offset="379097088" size="185106" />
39
+ <output>
40
+ <port id="0" precision="FP16">
41
+ <dim>92553</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>92553</dim>
51
+ <dim>4096</dim>
52
+ </port>
53
+ <port id="1" precision="FP16">
54
+ <dim>92553</dim>
55
+ <dim>1</dim>
56
+ </port>
57
+ </input>
58
+ <output>
59
+ <port id="2" precision="FP16">
60
+ <dim>92553</dim>
61
+ <dim>4096</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>92553</dim>
73
+ <dim>4096</dim>
74
+ </port>
75
+ </input>
76
+ <output>
77
+ <port id="1" precision="FP32">
78
+ <dim>92553</dim>
79
+ <dim>4096</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="379282194" 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>92553</dim>
109
+ <dim>4096</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>4096</dim>
122
+ </port>
123
+ </output>
124
+ </layer>
125
+ <layer id="9" name="Result_25020" 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>4096</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="2025.2.0-19140-c01cd93e24d-releases/2025/2" />
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
+ <weight_compression>
155
+ <advanced_parameters value="{'statistics_path': None, 'awq_params': {'subset_size': 32, 'percent_to_apply': 0.002, 'alpha_min': 0.0, 'alpha_max': 1.0, 'steps': 100}, '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}}" />
156
+ <all_layers value="False" />
157
+ <awq value="False" />
158
+ <backup_mode value="int8_asym" />
159
+ <gptq value="False" />
160
+ <group_size value="-1" />
161
+ <ignored_scope value="[]" />
162
+ <lora_correction value="False" />
163
+ <mode value="int8_sym" />
164
+ <ratio value="1.0" />
165
+ <scale_estimation value="False" />
166
+ <sensitivity_metric value="weight_quantization_error" />
167
+ </weight_compression>
168
+ </nncf>
169
+ <optimum>
170
+ <nncf_version value="2.15.0" />
171
+ <optimum_intel_version value="1.26.0.dev0+e9c57b9" />
172
+ <optimum_version value="1.27.0" />
173
+ <pytorch_version value="2.8.0+cpu" />
174
+ <transformers_version value="4.51.3" />
175
+ </optimum>
176
+ </rt_info>
177
+ </net>
openvino_tokenizer.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd1ac23b5528df5dc2926bd19ff8d352d00b20fcaa778948306e70591ce6f153
3
+ size 1478353
openvino_tokenizer.xml ADDED
@@ -0,0 +1,1013 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <net name="tokenizer" version="11">
3
+ <layers>
4
+ <layer id="0" name="string_input" type="Parameter" version="opset1">
5
+ <data shape="?" element_type="string" />
6
+ <output>
7
+ <port id="0" precision="STRING" names="string_input">
8
+ <dim>-1</dim>
9
+ </port>
10
+ </output>
11
+ </layer>
12
+ <layer id="1" name="Constant_1627041" type="Const" version="opset1">
13
+ <data element_type="i32" shape="" offset="0" size="4" />
14
+ <output>
15
+ <port id="0" precision="I32" />
16
+ </output>
17
+ </layer>
18
+ <layer id="2" name="Constant_1626980" type="Const" version="opset1">
19
+ <data element_type="u8" shape="1477889" offset="4" size="1477889" />
20
+ <output>
21
+ <port id="0" precision="U8">
22
+ <dim>1477889</dim>
23
+ </port>
24
+ </output>
25
+ </layer>
26
+ <layer id="3" name="Constant_1626984" type="Const" version="opset1">
27
+ <data element_type="i32" shape="18" offset="1477893" size="72" />
28
+ <output>
29
+ <port id="0" precision="I32">
30
+ <dim>18</dim>
31
+ </port>
32
+ </output>
33
+ </layer>
34
+ <layer id="4" name="Constant_1626986" type="Const" version="opset1">
35
+ <data element_type="i32" shape="18" offset="1477965" size="72" />
36
+ <output>
37
+ <port id="0" precision="I32">
38
+ <dim>18</dim>
39
+ </port>
40
+ </output>
41
+ </layer>
42
+ <layer id="5" name="Constant_1626988" type="Const" version="opset1">
43
+ <data element_type="u8" shape="148" offset="1478037" size="148" />
44
+ <output>
45
+ <port id="0" precision="U8">
46
+ <dim>148</dim>
47
+ </port>
48
+ </output>
49
+ </layer>
50
+ <layer id="6" name="Constant_1626989" type="Const" version="opset1">
51
+ <data element_type="i32" shape="18" offset="1478185" size="72" />
52
+ <output>
53
+ <port id="0" precision="I32">
54
+ <dim>18</dim>
55
+ </port>
56
+ </output>
57
+ </layer>
58
+ <layer id="7" name="SentencepieceTokenizer_1626990" type="SentencepieceTokenizer" version="extension">
59
+ <data nbest_size="1" alpha="1" add_bos="false" add_eos="false" reverse="true" />
60
+ <input>
61
+ <port id="0" precision="U8">
62
+ <dim>1477889</dim>
63
+ </port>
64
+ <port id="1" precision="STRING">
65
+ <dim>-1</dim>
66
+ </port>
67
+ <port id="2" precision="I32">
68
+ <dim>18</dim>
69
+ </port>
70
+ <port id="3" precision="I32">
71
+ <dim>18</dim>
72
+ </port>
73
+ <port id="4" precision="U8">
74
+ <dim>148</dim>
75
+ </port>
76
+ <port id="5" precision="I32">
77
+ <dim>18</dim>
78
+ </port>
79
+ </input>
80
+ <output>
81
+ <port id="6" precision="I64">
82
+ <dim>-1</dim>
83
+ <dim>2</dim>
84
+ </port>
85
+ <port id="7" precision="I32">
86
+ <dim>-1</dim>
87
+ </port>
88
+ <port id="8" precision="I64">
89
+ <dim>2</dim>
90
+ </port>
91
+ </output>
92
+ </layer>
93
+ <layer id="8" name="Convert_1627000" type="Const" version="opset1">
94
+ <data element_type="i64" shape="2" offset="1478257" size="16" />
95
+ <output>
96
+ <port id="0" precision="I64">
97
+ <dim>2</dim>
98
+ </port>
99
+ </output>
100
+ </layer>
101
+ <layer id="9" name="Add_1627001" type="Add" version="opset1">
102
+ <data auto_broadcast="numpy" />
103
+ <input>
104
+ <port id="0" precision="I64">
105
+ <dim>2</dim>
106
+ </port>
107
+ <port id="1" precision="I64">
108
+ <dim>2</dim>
109
+ </port>
110
+ </input>
111
+ <output>
112
+ <port id="2" precision="I64">
113
+ <dim>2</dim>
114
+ </port>
115
+ </output>
116
+ </layer>
117
+ <layer id="10" name="Constant_1627006" type="Const" version="opset1">
118
+ <data element_type="i64" shape="1" offset="1478273" size="8" />
119
+ <output>
120
+ <port id="0" precision="I64">
121
+ <dim>1</dim>
122
+ </port>
123
+ </output>
124
+ </layer>
125
+ <layer id="11" name="Constant_1627007" type="Const" version="opset1">
126
+ <data element_type="i64" shape="1" offset="1478281" size="8" />
127
+ <output>
128
+ <port id="0" precision="I64">
129
+ <dim>1</dim>
130
+ </port>
131
+ </output>
132
+ </layer>
133
+ <layer id="12" name="Constant_1627008" type="Const" version="opset1">
134
+ <data element_type="i64" shape="1" offset="1478281" size="8" />
135
+ <output>
136
+ <port id="0" precision="I64">
137
+ <dim>1</dim>
138
+ </port>
139
+ </output>
140
+ </layer>
141
+ <layer id="13" name="Constant_1627010" type="Const" version="opset1">
142
+ <data element_type="i64" shape="1" offset="1478273" size="8" />
143
+ <output>
144
+ <port id="0" precision="I64">
145
+ <dim>1</dim>
146
+ </port>
147
+ </output>
148
+ </layer>
149
+ <layer id="14" name="Slice_1627009" type="Slice" version="opset8">
150
+ <input>
151
+ <port id="0" precision="I64">
152
+ <dim>2</dim>
153
+ </port>
154
+ <port id="1" precision="I64">
155
+ <dim>1</dim>
156
+ </port>
157
+ <port id="2" precision="I64">
158
+ <dim>1</dim>
159
+ </port>
160
+ <port id="3" precision="I64">
161
+ <dim>1</dim>
162
+ </port>
163
+ <port id="4" precision="I64">
164
+ <dim>1</dim>
165
+ </port>
166
+ </input>
167
+ <output>
168
+ <port id="5" precision="I64">
169
+ <dim>1</dim>
170
+ </port>
171
+ </output>
172
+ </layer>
173
+ <layer id="15" name="Constant_1627042" type="Const" version="opset1">
174
+ <data element_type="i64" shape="1" offset="1478281" size="8" />
175
+ <output>
176
+ <port id="0" precision="I64">
177
+ <dim>1</dim>
178
+ </port>
179
+ </output>
180
+ </layer>
181
+ <layer id="16" name="Concat_1627043" type="Concat" version="opset1">
182
+ <data axis="0" />
183
+ <input>
184
+ <port id="0" precision="I64">
185
+ <dim>1</dim>
186
+ </port>
187
+ <port id="1" precision="I64">
188
+ <dim>1</dim>
189
+ </port>
190
+ </input>
191
+ <output>
192
+ <port id="2" precision="I64">
193
+ <dim>2</dim>
194
+ </port>
195
+ </output>
196
+ </layer>
197
+ <layer id="17" name="Broadcast_1627044" type="Broadcast" version="opset3">
198
+ <data mode="numpy" />
199
+ <input>
200
+ <port id="0" precision="I32" />
201
+ <port id="1" precision="I64">
202
+ <dim>2</dim>
203
+ </port>
204
+ </input>
205
+ <output>
206
+ <port id="2" precision="I32">
207
+ <dim>-1</dim>
208
+ <dim>1</dim>
209
+ </port>
210
+ </output>
211
+ </layer>
212
+ <layer id="18" name="Constant_1626991" type="Const" version="opset1">
213
+ <data element_type="i32" shape="" offset="1478289" size="4" />
214
+ <output>
215
+ <port id="0" precision="I32" />
216
+ </output>
217
+ </layer>
218
+ <layer id="19" name="Broadcast_1626992" type="Broadcast" version="opset3">
219
+ <data mode="numpy" />
220
+ <input>
221
+ <port id="0" precision="I32" />
222
+ <port id="1" precision="I64">
223
+ <dim>2</dim>
224
+ </port>
225
+ </input>
226
+ <output>
227
+ <port id="2" precision="I32">
228
+ <dim>-1</dim>
229
+ <dim>-1</dim>
230
+ </port>
231
+ </output>
232
+ </layer>
233
+ <layer id="20" name="Constant_1626993" type="Const" version="opset1">
234
+ <data element_type="i32" shape="" offset="0" size="4" />
235
+ <output>
236
+ <port id="0" precision="I32" />
237
+ </output>
238
+ </layer>
239
+ <layer id="21" name="ShapeOf_1626994" type="ShapeOf" version="opset3">
240
+ <data output_type="i64" />
241
+ <input>
242
+ <port id="0" precision="I32">
243
+ <dim>-1</dim>
244
+ </port>
245
+ </input>
246
+ <output>
247
+ <port id="1" precision="I64">
248
+ <dim>1</dim>
249
+ </port>
250
+ </output>
251
+ </layer>
252
+ <layer id="22" name="Broadcast_1626995" type="Broadcast" version="opset3">
253
+ <data mode="numpy" />
254
+ <input>
255
+ <port id="0" precision="I32" />
256
+ <port id="1" precision="I64">
257
+ <dim>1</dim>
258
+ </port>
259
+ </input>
260
+ <output>
261
+ <port id="2" precision="I32">
262
+ <dim>-1</dim>
263
+ </port>
264
+ </output>
265
+ </layer>
266
+ <layer id="23" name="ScatterNDUpdate_1626998" type="ScatterNDUpdate" version="opset4">
267
+ <input>
268
+ <port id="0" precision="I32">
269
+ <dim>-1</dim>
270
+ <dim>-1</dim>
271
+ </port>
272
+ <port id="1" precision="I64">
273
+ <dim>-1</dim>
274
+ <dim>2</dim>
275
+ </port>
276
+ <port id="2" precision="I32">
277
+ <dim>-1</dim>
278
+ </port>
279
+ </input>
280
+ <output>
281
+ <port id="3" precision="I32">
282
+ <dim>-1</dim>
283
+ <dim>-1</dim>
284
+ </port>
285
+ </output>
286
+ </layer>
287
+ <layer id="24" name="Concat_1627045" type="Concat" version="opset1">
288
+ <data axis="1" />
289
+ <input>
290
+ <port id="0" precision="I32">
291
+ <dim>-1</dim>
292
+ <dim>1</dim>
293
+ </port>
294
+ <port id="1" precision="I32">
295
+ <dim>-1</dim>
296
+ <dim>-1</dim>
297
+ </port>
298
+ </input>
299
+ <output>
300
+ <port id="2" precision="I32">
301
+ <dim>-1</dim>
302
+ <dim>-1</dim>
303
+ </port>
304
+ </output>
305
+ </layer>
306
+ <layer id="25" name="Constant_1627049" type="Const" version="opset1">
307
+ <data element_type="i64" shape="1" offset="1478293" size="8" />
308
+ <output>
309
+ <port id="0" precision="I64">
310
+ <dim>1</dim>
311
+ </port>
312
+ </output>
313
+ </layer>
314
+ <layer id="26" name="Reverse_1627050" type="Reverse" version="opset1">
315
+ <data mode="index" />
316
+ <input>
317
+ <port id="0" precision="I32">
318
+ <dim>-1</dim>
319
+ <dim>-1</dim>
320
+ </port>
321
+ <port id="1" precision="I64">
322
+ <dim>1</dim>
323
+ </port>
324
+ </input>
325
+ <output>
326
+ <port id="2" precision="I32">
327
+ <dim>-1</dim>
328
+ <dim>-1</dim>
329
+ </port>
330
+ </output>
331
+ </layer>
332
+ <layer id="27" name="Constant_1627058" type="Const" version="opset1">
333
+ <data element_type="i64" shape="1" offset="1478301" size="8" />
334
+ <output>
335
+ <port id="0" precision="I64">
336
+ <dim>1</dim>
337
+ </port>
338
+ </output>
339
+ </layer>
340
+ <layer id="28" name="Constant_1627059" type="Const" version="opset1">
341
+ <data element_type="i64" shape="1" offset="1478309" size="8" />
342
+ <output>
343
+ <port id="0" precision="I64">
344
+ <dim>1</dim>
345
+ </port>
346
+ </output>
347
+ </layer>
348
+ <layer id="29" name="Constant_1627060" type="Const" version="opset1">
349
+ <data element_type="i64" shape="1" offset="1478281" size="8" />
350
+ <output>
351
+ <port id="0" precision="I64">
352
+ <dim>1</dim>
353
+ </port>
354
+ </output>
355
+ </layer>
356
+ <layer id="30" name="Constant_1627061" type="Const" version="opset1">
357
+ <data element_type="i64" shape="1" offset="1478293" size="8" />
358
+ <output>
359
+ <port id="0" precision="I64">
360
+ <dim>1</dim>
361
+ </port>
362
+ </output>
363
+ </layer>
364
+ <layer id="31" name="Slice_1627062" type="Slice" version="opset8">
365
+ <input>
366
+ <port id="0" precision="I32">
367
+ <dim>-1</dim>
368
+ <dim>-1</dim>
369
+ </port>
370
+ <port id="1" precision="I64">
371
+ <dim>1</dim>
372
+ </port>
373
+ <port id="2" precision="I64">
374
+ <dim>1</dim>
375
+ </port>
376
+ <port id="3" precision="I64">
377
+ <dim>1</dim>
378
+ </port>
379
+ <port id="4" precision="I64">
380
+ <dim>1</dim>
381
+ </port>
382
+ </input>
383
+ <output>
384
+ <port id="5" precision="I32">
385
+ <dim>-1</dim>
386
+ <dim>-1</dim>
387
+ </port>
388
+ </output>
389
+ </layer>
390
+ <layer id="32" name="Slice_1627062.0" type="Convert" version="opset1">
391
+ <data destination_type="i64" />
392
+ <input>
393
+ <port id="0" precision="I32">
394
+ <dim>-1</dim>
395
+ <dim>-1</dim>
396
+ </port>
397
+ </input>
398
+ <output>
399
+ <port id="1" precision="I64" names="attention_mask">
400
+ <dim>-1</dim>
401
+ <dim>-1</dim>
402
+ </port>
403
+ </output>
404
+ </layer>
405
+ <layer id="34" name="Constant_1627046" type="Const" version="opset1">
406
+ <data element_type="i32" shape="" offset="1478317" size="4" />
407
+ <output>
408
+ <port id="0" precision="I32" />
409
+ </output>
410
+ </layer>
411
+ <layer id="35" name="Broadcast_1627047" type="Broadcast" version="opset3">
412
+ <data mode="bidirectional" />
413
+ <input>
414
+ <port id="0" precision="I32" />
415
+ <port id="1" precision="I64">
416
+ <dim>2</dim>
417
+ </port>
418
+ </input>
419
+ <output>
420
+ <port id="2" precision="I32">
421
+ <dim>-1</dim>
422
+ <dim>-1</dim>
423
+ </port>
424
+ </output>
425
+ </layer>
426
+ <layer id="36" name="Constant_1627021" type="Const" version="opset1">
427
+ <data element_type="i64" shape="" offset="1478273" size="8" />
428
+ <output>
429
+ <port id="0" precision="I64" />
430
+ </output>
431
+ </layer>
432
+ <layer id="37" name="Constant_1627003" type="Const" version="opset1">
433
+ <data element_type="i64" shape="" offset="1478273" size="8" />
434
+ <output>
435
+ <port id="0" precision="I64" />
436
+ </output>
437
+ </layer>
438
+ <layer id="38" name="Constant_1627004" type="Const" version="opset1">
439
+ <data element_type="i64" shape="" offset="1478273" size="8" />
440
+ <output>
441
+ <port id="0" precision="I64" />
442
+ </output>
443
+ </layer>
444
+ <layer id="39" name="Gather_1627005" type="Gather" version="opset8">
445
+ <data batch_dims="0" />
446
+ <input>
447
+ <port id="0" precision="I64">
448
+ <dim>2</dim>
449
+ </port>
450
+ <port id="1" precision="I64" />
451
+ <port id="2" precision="I64" />
452
+ </input>
453
+ <output>
454
+ <port id="3" precision="I64" />
455
+ </output>
456
+ </layer>
457
+ <layer id="40" name="Constant_1627022" type="Const" version="opset1">
458
+ <data element_type="i64" shape="" offset="1478281" size="8" />
459
+ <output>
460
+ <port id="0" precision="I64" />
461
+ </output>
462
+ </layer>
463
+ <layer id="41" name="Range_1627023" type="Range" version="opset4">
464
+ <data output_type="i64" />
465
+ <input>
466
+ <port id="0" precision="I64" />
467
+ <port id="1" precision="I64" />
468
+ <port id="2" precision="I64" />
469
+ </input>
470
+ <output>
471
+ <port id="3" precision="I64">
472
+ <dim>-1</dim>
473
+ </port>
474
+ </output>
475
+ </layer>
476
+ <layer id="42" name="Constant_1627024" type="Const" version="opset1">
477
+ <data element_type="i64" shape="1" offset="1478281" size="8" />
478
+ <output>
479
+ <port id="0" precision="I64">
480
+ <dim>1</dim>
481
+ </port>
482
+ </output>
483
+ </layer>
484
+ <layer id="43" name="Concat_1627025" type="Concat" version="opset1">
485
+ <data axis="0" />
486
+ <input>
487
+ <port id="0" precision="I64">
488
+ <dim>1</dim>
489
+ </port>
490
+ <port id="1" precision="I64">
491
+ <dim>1</dim>
492
+ </port>
493
+ </input>
494
+ <output>
495
+ <port id="2" precision="I64">
496
+ <dim>2</dim>
497
+ </port>
498
+ </output>
499
+ </layer>
500
+ <layer id="44" name="Broadcast_1627026" type="Broadcast" version="opset3">
501
+ <data mode="bidirectional" />
502
+ <input>
503
+ <port id="0" precision="I64">
504
+ <dim>-1</dim>
505
+ </port>
506
+ <port id="1" precision="I64">
507
+ <dim>2</dim>
508
+ </port>
509
+ </input>
510
+ <output>
511
+ <port id="2" precision="I64">
512
+ <dim>1</dim>
513
+ <dim>-1</dim>
514
+ </port>
515
+ </output>
516
+ </layer>
517
+ <layer id="45" name="Constant_1627027" type="Const" version="opset1">
518
+ <data element_type="i64" shape="2" offset="1478321" size="16" />
519
+ <output>
520
+ <port id="0" precision="I64">
521
+ <dim>2</dim>
522
+ </port>
523
+ </output>
524
+ </layer>
525
+ <layer id="46" name="Transpose_1627028" type="Transpose" version="opset1">
526
+ <input>
527
+ <port id="0" precision="I64">
528
+ <dim>1</dim>
529
+ <dim>-1</dim>
530
+ </port>
531
+ <port id="1" precision="I64">
532
+ <dim>2</dim>
533
+ </port>
534
+ </input>
535
+ <output>
536
+ <port id="2" precision="I64">
537
+ <dim>-1</dim>
538
+ <dim>1</dim>
539
+ </port>
540
+ </output>
541
+ </layer>
542
+ <layer id="47" name="Constant_1627029" type="Const" version="opset1">
543
+ <data element_type="i64" shape="2" offset="1478337" size="16" />
544
+ <output>
545
+ <port id="0" precision="I64">
546
+ <dim>2</dim>
547
+ </port>
548
+ </output>
549
+ </layer>
550
+ <layer id="48" name="Reshape_1627030" type="Reshape" version="opset1">
551
+ <data special_zero="false" />
552
+ <input>
553
+ <port id="0" precision="I64">
554
+ <dim>-1</dim>
555
+ <dim>1</dim>
556
+ </port>
557
+ <port id="1" precision="I64">
558
+ <dim>2</dim>
559
+ </port>
560
+ </input>
561
+ <output>
562
+ <port id="2" precision="I64">
563
+ <dim>-1</dim>
564
+ <dim>1</dim>
565
+ </port>
566
+ </output>
567
+ </layer>
568
+ <layer id="49" name="Constant_1627031" type="Const" version="opset1">
569
+ <data element_type="i64" shape="" offset="1478293" size="8" />
570
+ <output>
571
+ <port id="0" precision="I64" />
572
+ </output>
573
+ </layer>
574
+ <layer id="50" name="ReduceSum_1627032" type="ReduceSum" version="opset1">
575
+ <data keep_dims="true" />
576
+ <input>
577
+ <port id="0" precision="I32">
578
+ <dim>-1</dim>
579
+ <dim>-1</dim>
580
+ </port>
581
+ <port id="1" precision="I64" />
582
+ </input>
583
+ <output>
584
+ <port id="2" precision="I32">
585
+ <dim>-1</dim>
586
+ <dim>1</dim>
587
+ </port>
588
+ </output>
589
+ </layer>
590
+ <layer id="51" name="Convert_1627033" type="Convert" version="opset1">
591
+ <data destination_type="i64" />
592
+ <input>
593
+ <port id="0" precision="I32">
594
+ <dim>-1</dim>
595
+ <dim>1</dim>
596
+ </port>
597
+ </input>
598
+ <output>
599
+ <port id="1" precision="I64">
600
+ <dim>-1</dim>
601
+ <dim>1</dim>
602
+ </port>
603
+ </output>
604
+ </layer>
605
+ <layer id="52" name="Reshape_1627035" type="Const" version="opset1">
606
+ <data element_type="i64" shape="1, 1" offset="1478273" size="8" />
607
+ <output>
608
+ <port id="0" precision="I64">
609
+ <dim>1</dim>
610
+ <dim>1</dim>
611
+ </port>
612
+ </output>
613
+ </layer>
614
+ <layer id="53" name="Add_1627036" type="Add" version="opset1">
615
+ <data auto_broadcast="numpy" />
616
+ <input>
617
+ <port id="0" precision="I64">
618
+ <dim>-1</dim>
619
+ <dim>1</dim>
620
+ </port>
621
+ <port id="1" precision="I64">
622
+ <dim>1</dim>
623
+ <dim>1</dim>
624
+ </port>
625
+ </input>
626
+ <output>
627
+ <port id="2" precision="I64">
628
+ <dim>-1</dim>
629
+ <dim>1</dim>
630
+ </port>
631
+ </output>
632
+ </layer>
633
+ <layer id="54" name="Constant_1627037" type="Const" version="opset1">
634
+ <data element_type="i64" shape="2" offset="1478337" size="16" />
635
+ <output>
636
+ <port id="0" precision="I64">
637
+ <dim>2</dim>
638
+ </port>
639
+ </output>
640
+ </layer>
641
+ <layer id="55" name="Reshape_1627038" type="Reshape" version="opset1">
642
+ <data special_zero="false" />
643
+ <input>
644
+ <port id="0" precision="I64">
645
+ <dim>-1</dim>
646
+ <dim>1</dim>
647
+ </port>
648
+ <port id="1" precision="I64">
649
+ <dim>2</dim>
650
+ </port>
651
+ </input>
652
+ <output>
653
+ <port id="2" precision="I64">
654
+ <dim>-1</dim>
655
+ <dim>1</dim>
656
+ </port>
657
+ </output>
658
+ </layer>
659
+ <layer id="56" name="Concat_1627039" type="Concat" version="opset1">
660
+ <data axis="1" />
661
+ <input>
662
+ <port id="0" precision="I64">
663
+ <dim>-1</dim>
664
+ <dim>1</dim>
665
+ </port>
666
+ <port id="1" precision="I64">
667
+ <dim>-1</dim>
668
+ <dim>1</dim>
669
+ </port>
670
+ </input>
671
+ <output>
672
+ <port id="2" precision="I64">
673
+ <dim>-1</dim>
674
+ <dim>2</dim>
675
+ </port>
676
+ </output>
677
+ </layer>
678
+ <layer id="57" name="Concat_1627040" type="Concat" version="opset1">
679
+ <data axis="0" />
680
+ <input>
681
+ <port id="0" precision="I64">
682
+ <dim>-1</dim>
683
+ <dim>2</dim>
684
+ </port>
685
+ <port id="1" precision="I64">
686
+ <dim>-1</dim>
687
+ <dim>2</dim>
688
+ </port>
689
+ </input>
690
+ <output>
691
+ <port id="2" precision="I64">
692
+ <dim>-1</dim>
693
+ <dim>2</dim>
694
+ </port>
695
+ </output>
696
+ </layer>
697
+ <layer id="58" name="Constant_1627002" type="Const" version="opset1">
698
+ <data element_type="i32" shape="1, 1" offset="0" size="4" />
699
+ <output>
700
+ <port id="0" precision="I32">
701
+ <dim>1</dim>
702
+ <dim>1</dim>
703
+ </port>
704
+ </output>
705
+ </layer>
706
+ <layer id="59" name="Broadcast_1627013" type="Broadcast" version="opset3">
707
+ <data mode="bidirectional" />
708
+ <input>
709
+ <port id="0" precision="I32">
710
+ <dim>1</dim>
711
+ <dim>1</dim>
712
+ </port>
713
+ <port id="1" precision="I64">
714
+ <dim>2</dim>
715
+ </port>
716
+ </input>
717
+ <output>
718
+ <port id="2" precision="I32">
719
+ <dim>-1</dim>
720
+ <dim>1</dim>
721
+ </port>
722
+ </output>
723
+ </layer>
724
+ <layer id="60" name="Constant_1627014" type="Const" version="opset1">
725
+ <data element_type="i64" shape="1" offset="1478293" size="8" />
726
+ <output>
727
+ <port id="0" precision="I64">
728
+ <dim>1</dim>
729
+ </port>
730
+ </output>
731
+ </layer>
732
+ <layer id="61" name="Reshape_1627015" type="Reshape" version="opset1">
733
+ <data special_zero="false" />
734
+ <input>
735
+ <port id="0" precision="I32">
736
+ <dim>-1</dim>
737
+ <dim>1</dim>
738
+ </port>
739
+ <port id="1" precision="I64">
740
+ <dim>1</dim>
741
+ </port>
742
+ </input>
743
+ <output>
744
+ <port id="2" precision="I32">
745
+ <dim>-1</dim>
746
+ </port>
747
+ </output>
748
+ </layer>
749
+ <layer id="62" name="Concat_1627016" type="Concat" version="opset1">
750
+ <data axis="0" />
751
+ <input>
752
+ <port id="0" precision="I32">
753
+ <dim>-1</dim>
754
+ </port>
755
+ <port id="1" precision="I32">
756
+ <dim>-1</dim>
757
+ </port>
758
+ </input>
759
+ <output>
760
+ <port id="2" precision="I32">
761
+ <dim>-1</dim>
762
+ </port>
763
+ </output>
764
+ </layer>
765
+ <layer id="63" name="ScatterNDUpdate_1627048" type="ScatterNDUpdate" version="opset4">
766
+ <input>
767
+ <port id="0" precision="I32">
768
+ <dim>-1</dim>
769
+ <dim>-1</dim>
770
+ </port>
771
+ <port id="1" precision="I64">
772
+ <dim>-1</dim>
773
+ <dim>2</dim>
774
+ </port>
775
+ <port id="2" precision="I32">
776
+ <dim>-1</dim>
777
+ </port>
778
+ </input>
779
+ <output>
780
+ <port id="3" precision="I32">
781
+ <dim>-1</dim>
782
+ <dim>-1</dim>
783
+ </port>
784
+ </output>
785
+ </layer>
786
+ <layer id="64" name="Constant_1627051" type="Const" version="opset1">
787
+ <data element_type="i64" shape="1" offset="1478293" size="8" />
788
+ <output>
789
+ <port id="0" precision="I64">
790
+ <dim>1</dim>
791
+ </port>
792
+ </output>
793
+ </layer>
794
+ <layer id="65" name="Reverse_1627052" type="Reverse" version="opset1">
795
+ <data mode="index" />
796
+ <input>
797
+ <port id="0" precision="I32">
798
+ <dim>-1</dim>
799
+ <dim>-1</dim>
800
+ </port>
801
+ <port id="1" precision="I64">
802
+ <dim>1</dim>
803
+ </port>
804
+ </input>
805
+ <output>
806
+ <port id="2" precision="I32">
807
+ <dim>-1</dim>
808
+ <dim>-1</dim>
809
+ </port>
810
+ </output>
811
+ </layer>
812
+ <layer id="66" name="Constant_1627053" type="Const" version="opset1">
813
+ <data element_type="i64" shape="1" offset="1478301" size="8" />
814
+ <output>
815
+ <port id="0" precision="I64">
816
+ <dim>1</dim>
817
+ </port>
818
+ </output>
819
+ </layer>
820
+ <layer id="67" name="Constant_1627054" type="Const" version="opset1">
821
+ <data element_type="i64" shape="1" offset="1478309" size="8" />
822
+ <output>
823
+ <port id="0" precision="I64">
824
+ <dim>1</dim>
825
+ </port>
826
+ </output>
827
+ </layer>
828
+ <layer id="68" name="Constant_1627055" type="Const" version="opset1">
829
+ <data element_type="i64" shape="1" offset="1478281" size="8" />
830
+ <output>
831
+ <port id="0" precision="I64">
832
+ <dim>1</dim>
833
+ </port>
834
+ </output>
835
+ </layer>
836
+ <layer id="69" name="Constant_1627056" type="Const" version="opset1">
837
+ <data element_type="i64" shape="1" offset="1478293" size="8" />
838
+ <output>
839
+ <port id="0" precision="I64">
840
+ <dim>1</dim>
841
+ </port>
842
+ </output>
843
+ </layer>
844
+ <layer id="70" name="Slice_1627057" type="Slice" version="opset8">
845
+ <input>
846
+ <port id="0" precision="I32">
847
+ <dim>-1</dim>
848
+ <dim>-1</dim>
849
+ </port>
850
+ <port id="1" precision="I64">
851
+ <dim>1</dim>
852
+ </port>
853
+ <port id="2" precision="I64">
854
+ <dim>1</dim>
855
+ </port>
856
+ <port id="3" precision="I64">
857
+ <dim>1</dim>
858
+ </port>
859
+ <port id="4" precision="I64">
860
+ <dim>1</dim>
861
+ </port>
862
+ </input>
863
+ <output>
864
+ <port id="5" precision="I32">
865
+ <dim>-1</dim>
866
+ <dim>-1</dim>
867
+ </port>
868
+ </output>
869
+ </layer>
870
+ <layer id="71" name="Slice_1627057.0" type="Convert" version="opset1">
871
+ <data destination_type="i64" />
872
+ <input>
873
+ <port id="0" precision="I32">
874
+ <dim>-1</dim>
875
+ <dim>-1</dim>
876
+ </port>
877
+ </input>
878
+ <output>
879
+ <port id="1" precision="I64" names="input_ids">
880
+ <dim>-1</dim>
881
+ <dim>-1</dim>
882
+ </port>
883
+ </output>
884
+ </layer>
885
+ <layer id="72" name="Result_1627063" type="Result" version="opset1" output_names="input_ids">
886
+ <input>
887
+ <port id="0" precision="I64">
888
+ <dim>-1</dim>
889
+ <dim>-1</dim>
890
+ </port>
891
+ </input>
892
+ </layer>
893
+ <layer id="33" name="Result_1627064" type="Result" version="opset1" output_names="attention_mask">
894
+ <input>
895
+ <port id="0" precision="I64">
896
+ <dim>-1</dim>
897
+ <dim>-1</dim>
898
+ </port>
899
+ </input>
900
+ </layer>
901
+ </layers>
902
+ <edges>
903
+ <edge from-layer="0" from-port="0" to-layer="7" to-port="1" />
904
+ <edge from-layer="1" from-port="0" to-layer="17" to-port="0" />
905
+ <edge from-layer="2" from-port="0" to-layer="7" to-port="0" />
906
+ <edge from-layer="3" from-port="0" to-layer="7" to-port="2" />
907
+ <edge from-layer="4" from-port="0" to-layer="7" to-port="3" />
908
+ <edge from-layer="5" from-port="0" to-layer="7" to-port="4" />
909
+ <edge from-layer="6" from-port="0" to-layer="7" to-port="5" />
910
+ <edge from-layer="7" from-port="8" to-layer="9" to-port="0" />
911
+ <edge from-layer="7" from-port="7" to-layer="62" to-port="0" />
912
+ <edge from-layer="7" from-port="6" to-layer="57" to-port="0" />
913
+ <edge from-layer="7" from-port="6" to-layer="23" to-port="1" />
914
+ <edge from-layer="7" from-port="7" to-layer="21" to-port="0" />
915
+ <edge from-layer="7" from-port="8" to-layer="19" to-port="1" />
916
+ <edge from-layer="8" from-port="0" to-layer="9" to-port="1" />
917
+ <edge from-layer="9" from-port="2" to-layer="35" to-port="1" />
918
+ <edge from-layer="9" from-port="2" to-layer="39" to-port="0" />
919
+ <edge from-layer="9" from-port="2" to-layer="14" to-port="0" />
920
+ <edge from-layer="10" from-port="0" to-layer="14" to-port="1" />
921
+ <edge from-layer="11" from-port="0" to-layer="14" to-port="2" />
922
+ <edge from-layer="12" from-port="0" to-layer="14" to-port="3" />
923
+ <edge from-layer="13" from-port="0" to-layer="14" to-port="4" />
924
+ <edge from-layer="14" from-port="5" to-layer="16" to-port="0" />
925
+ <edge from-layer="14" from-port="5" to-layer="43" to-port="1" />
926
+ <edge from-layer="15" from-port="0" to-layer="16" to-port="1" />
927
+ <edge from-layer="16" from-port="2" to-layer="17" to-port="1" />
928
+ <edge from-layer="16" from-port="2" to-layer="59" to-port="1" />
929
+ <edge from-layer="17" from-port="2" to-layer="24" to-port="0" />
930
+ <edge from-layer="18" from-port="0" to-layer="19" to-port="0" />
931
+ <edge from-layer="19" from-port="2" to-layer="23" to-port="0" />
932
+ <edge from-layer="20" from-port="0" to-layer="22" to-port="0" />
933
+ <edge from-layer="21" from-port="1" to-layer="22" to-port="1" />
934
+ <edge from-layer="22" from-port="2" to-layer="23" to-port="2" />
935
+ <edge from-layer="23" from-port="3" to-layer="24" to-port="1" />
936
+ <edge from-layer="23" from-port="3" to-layer="50" to-port="0" />
937
+ <edge from-layer="24" from-port="2" to-layer="26" to-port="0" />
938
+ <edge from-layer="25" from-port="0" to-layer="26" to-port="1" />
939
+ <edge from-layer="26" from-port="2" to-layer="31" to-port="0" />
940
+ <edge from-layer="27" from-port="0" to-layer="31" to-port="1" />
941
+ <edge from-layer="28" from-port="0" to-layer="31" to-port="2" />
942
+ <edge from-layer="29" from-port="0" to-layer="31" to-port="3" />
943
+ <edge from-layer="30" from-port="0" to-layer="31" to-port="4" />
944
+ <edge from-layer="31" from-port="5" to-layer="32" to-port="0" />
945
+ <edge from-layer="32" from-port="1" to-layer="33" to-port="0" />
946
+ <edge from-layer="34" from-port="0" to-layer="35" to-port="0" />
947
+ <edge from-layer="35" from-port="2" to-layer="63" to-port="0" />
948
+ <edge from-layer="36" from-port="0" to-layer="41" to-port="0" />
949
+ <edge from-layer="37" from-port="0" to-layer="39" to-port="1" />
950
+ <edge from-layer="38" from-port="0" to-layer="39" to-port="2" />
951
+ <edge from-layer="39" from-port="3" to-layer="41" to-port="1" />
952
+ <edge from-layer="40" from-port="0" to-layer="41" to-port="2" />
953
+ <edge from-layer="41" from-port="3" to-layer="44" to-port="0" />
954
+ <edge from-layer="42" from-port="0" to-layer="43" to-port="0" />
955
+ <edge from-layer="43" from-port="2" to-layer="44" to-port="1" />
956
+ <edge from-layer="44" from-port="2" to-layer="46" to-port="0" />
957
+ <edge from-layer="45" from-port="0" to-layer="46" to-port="1" />
958
+ <edge from-layer="46" from-port="2" to-layer="48" to-port="0" />
959
+ <edge from-layer="47" from-port="0" to-layer="48" to-port="1" />
960
+ <edge from-layer="48" from-port="2" to-layer="56" to-port="0" />
961
+ <edge from-layer="49" from-port="0" to-layer="50" to-port="1" />
962
+ <edge from-layer="50" from-port="2" to-layer="51" to-port="0" />
963
+ <edge from-layer="51" from-port="1" to-layer="53" to-port="0" />
964
+ <edge from-layer="52" from-port="0" to-layer="53" to-port="1" />
965
+ <edge from-layer="53" from-port="2" to-layer="55" to-port="0" />
966
+ <edge from-layer="54" from-port="0" to-layer="55" to-port="1" />
967
+ <edge from-layer="55" from-port="2" to-layer="56" to-port="1" />
968
+ <edge from-layer="56" from-port="2" to-layer="57" to-port="1" />
969
+ <edge from-layer="57" from-port="2" to-layer="63" to-port="1" />
970
+ <edge from-layer="58" from-port="0" to-layer="59" to-port="0" />
971
+ <edge from-layer="59" from-port="2" to-layer="61" to-port="0" />
972
+ <edge from-layer="60" from-port="0" to-layer="61" to-port="1" />
973
+ <edge from-layer="61" from-port="2" to-layer="62" to-port="1" />
974
+ <edge from-layer="62" from-port="2" to-layer="63" to-port="2" />
975
+ <edge from-layer="63" from-port="3" to-layer="65" to-port="0" />
976
+ <edge from-layer="64" from-port="0" to-layer="65" to-port="1" />
977
+ <edge from-layer="65" from-port="2" to-layer="70" to-port="0" />
978
+ <edge from-layer="66" from-port="0" to-layer="70" to-port="1" />
979
+ <edge from-layer="67" from-port="0" to-layer="70" to-port="2" />
980
+ <edge from-layer="68" from-port="0" to-layer="70" to-port="3" />
981
+ <edge from-layer="69" from-port="0" to-layer="70" to-port="4" />
982
+ <edge from-layer="70" from-port="5" to-layer="71" to-port="0" />
983
+ <edge from-layer="71" from-port="1" to-layer="72" to-port="0" />
984
+ </edges>
985
+ <rt_info>
986
+ <add_attention_mask value="True" />
987
+ <add_prefix_space />
988
+ <add_special_tokens value="True" />
989
+ <bos_token_id value="1" />
990
+ <chat_template value="{{ bos_token }}{% for message in messages %}{{'&lt;|im_start|>' + message['role'] + '&#10;' + message['content'] + '&lt;|im_end|>' + '&#10;'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|>assistant&#10;' }}{% endif %}" />
991
+ <clean_up_tokenization_spaces value="False" />
992
+ <detokenizer_input_type value="i64" />
993
+ <eos_token_id value="2" />
994
+ <handle_special_tokens_with_re value="True" />
995
+ <max_length />
996
+ <number_of_inputs value="1" />
997
+ <openvino_tokenizers_version value="2025.2.0.1-567-7885335c24b" />
998
+ <openvino_version value="2025.2.0-19140-c01cd93e24d-releases/2025/2" />
999
+ <original_tokenizer_class value="&lt;class 'transformers_modules.OpenGVLab.InternVL2-8B.6fb9ad6924f69424e57fab2ab061d707688f0296.tokenization_internlm2.InternLM2Tokenizer'>" />
1000
+ <pad_token_id value="2" />
1001
+ <sentencepiece_version value="0.2.1" />
1002
+ <skip_special_tokens value="True" />
1003
+ <streaming_detokenizer value="False" />
1004
+ <tiktoken_version value="0.9.0" />
1005
+ <tokenizer_output_type value="i64" />
1006
+ <tokenizers_version value="0.21.4" />
1007
+ <transformers_version value="4.51.3" />
1008
+ <use_max_padding value="False" />
1009
+ <use_sentencepiece_backend value="False" />
1010
+ <utf8_replace_mode value="replace" />
1011
+ <with_detokenizer value="True" />
1012
+ </rt_info>
1013
+ </net>
openvino_vision_embeddings_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b976f9a01c0bdea357bc3744300b5cc35df739d07e6da9532fd8a6330132767
3
+ size 342337956
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,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": {
3
+ "height": 448,
4
+ "width": 448
5
+ },
6
+ "do_center_crop": true,
7
+ "do_convert_rgb": true,
8
+ "do_normalize": true,
9
+ "do_rescale": true,
10
+ "do_resize": true,
11
+ "image_mean": [
12
+ 0.485,
13
+ 0.456,
14
+ 0.406
15
+ ],
16
+ "image_processor_type": "CLIPImageProcessor",
17
+ "image_std": [
18
+ 0.229,
19
+ 0.224,
20
+ 0.225
21
+ ],
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "size": {
25
+ "shortest_edge": 448
26
+ }
27
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|action_start|>",
6
+ "<|action_end|>",
7
+ "<|interpreter|>",
8
+ "<|plugin|>",
9
+ "<img>",
10
+ "</img>",
11
+ "<IMG_CONTEXT>",
12
+ "<quad>",
13
+ "</quad>",
14
+ "<ref>",
15
+ "</ref>",
16
+ "<box>",
17
+ "</box>"
18
+ ],
19
+ "bos_token": {
20
+ "content": "<s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false
25
+ },
26
+ "eos_token": {
27
+ "content": "</s>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ },
33
+ "pad_token": {
34
+ "content": "</s>",
35
+ "lstrip": false,
36
+ "normalized": false,
37
+ "rstrip": false,
38
+ "single_word": false
39
+ },
40
+ "unk_token": {
41
+ "content": "<unk>",
42
+ "lstrip": false,
43
+ "normalized": false,
44
+ "rstrip": false,
45
+ "single_word": false
46
+ }
47
+ }
tokenization_internlm2.py ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) The InternLM team and The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # This code is based on transformers/src/transformers/models/llama/tokenization_llama.py
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ """Tokenization classes for InternLM."""
18
+ import os
19
+ from shutil import copyfile
20
+ from typing import Any, Dict, List, Optional, Tuple
21
+
22
+ import sentencepiece as spm
23
+ from transformers.tokenization_utils import PreTrainedTokenizer
24
+ from transformers.utils import logging
25
+
26
+ logger = logging.get_logger(__name__)
27
+
28
+ VOCAB_FILES_NAMES = {'vocab_file': './tokenizer.model'}
29
+
30
+ PRETRAINED_VOCAB_FILES_MAP = {}
31
+
32
+
33
+ # Modified from transformers.model.llama.tokenization_llama.LlamaTokenizer
34
+ class InternLM2Tokenizer(PreTrainedTokenizer):
35
+ """
36
+ Construct a InternLM2 tokenizer. Based on byte-level Byte-Pair-Encoding.
37
+
38
+ Args:
39
+ vocab_file (`str`):
40
+ Path to the vocabulary file.
41
+ """
42
+
43
+ vocab_files_names = VOCAB_FILES_NAMES
44
+ pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
45
+ model_input_names = ['input_ids', 'attention_mask']
46
+ _auto_class = 'AutoTokenizer'
47
+
48
+ def __init__(
49
+ self,
50
+ vocab_file,
51
+ unk_token='<unk>',
52
+ bos_token='<s>',
53
+ eos_token='</s>',
54
+ pad_token='</s>',
55
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
56
+ add_bos_token=True,
57
+ add_eos_token=False,
58
+ decode_with_prefix_space=False,
59
+ clean_up_tokenization_spaces=False,
60
+ **kwargs,
61
+ ):
62
+ self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
63
+ self.vocab_file = vocab_file
64
+ self.add_bos_token = add_bos_token
65
+ self.add_eos_token = add_eos_token
66
+ self.decode_with_prefix_space = decode_with_prefix_space
67
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
68
+ self.sp_model.Load(vocab_file)
69
+ self._no_prefix_space_tokens = None
70
+ super().__init__(
71
+ bos_token=bos_token,
72
+ eos_token=eos_token,
73
+ unk_token=unk_token,
74
+ pad_token=pad_token,
75
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
76
+ **kwargs,
77
+ )
78
+
79
+ @property
80
+ def no_prefix_space_tokens(self):
81
+ if self._no_prefix_space_tokens is None:
82
+ vocab = self.convert_ids_to_tokens(list(range(self.vocab_size)))
83
+ self._no_prefix_space_tokens = {i for i, tok in enumerate(vocab) if not tok.startswith('▁')}
84
+ return self._no_prefix_space_tokens
85
+
86
+ @property
87
+ def vocab_size(self):
88
+ """Returns vocab size"""
89
+ return self.sp_model.get_piece_size()
90
+
91
+ @property
92
+ def bos_token_id(self) -> Optional[int]:
93
+ return self.sp_model.bos_id()
94
+
95
+ @property
96
+ def eos_token_id(self) -> Optional[int]:
97
+ return self.sp_model.eos_id()
98
+
99
+ def get_vocab(self):
100
+ """Returns vocab as a dict"""
101
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
102
+ vocab.update(self.added_tokens_encoder)
103
+ return vocab
104
+
105
+ def _tokenize(self, text):
106
+ """Returns a tokenized string."""
107
+ return self.sp_model.encode(text, out_type=str)
108
+
109
+ def _convert_token_to_id(self, token):
110
+ """Converts a token (str) in an id using the vocab."""
111
+ return self.sp_model.piece_to_id(token)
112
+
113
+ def _convert_id_to_token(self, index):
114
+ """Converts an index (integer) in a token (str) using the vocab."""
115
+ token = self.sp_model.IdToPiece(index)
116
+ return token
117
+
118
+ def _maybe_add_prefix_space(self, tokens, decoded):
119
+ if tokens and tokens[0] not in self.no_prefix_space_tokens:
120
+ return ' ' + decoded
121
+ else:
122
+ return decoded
123
+
124
+ def convert_tokens_to_string(self, tokens):
125
+ """Converts a sequence of tokens (string) in a single string."""
126
+ current_sub_tokens = []
127
+ out_string = ''
128
+ prev_is_special = False
129
+ for token in tokens:
130
+ # make sure that special tokens are not decoded using sentencepiece model
131
+ if token in self.all_special_tokens:
132
+ if not prev_is_special:
133
+ out_string += ' '
134
+ out_string += self.sp_model.decode(current_sub_tokens) + token
135
+ prev_is_special = True
136
+ current_sub_tokens = []
137
+ else:
138
+ current_sub_tokens.append(token)
139
+ prev_is_special = False
140
+ out_string += self.sp_model.decode(current_sub_tokens)
141
+ out_string = self.clean_up_tokenization(out_string)
142
+ out_string = self._maybe_add_prefix_space(tokens=tokens, decoded=out_string)
143
+ return out_string[1:]
144
+
145
+ def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]:
146
+ """
147
+ Save the vocabulary and special tokens file to a directory.
148
+
149
+ Args:
150
+ save_directory (`str`):
151
+ The directory in which to save the vocabulary.
152
+
153
+ Returns:
154
+ `Tuple(str)`: Paths to the files saved.
155
+ """
156
+ if not os.path.isdir(save_directory):
157
+ logger.error(f'Vocabulary path ({save_directory}) should be a directory')
158
+ return
159
+ out_vocab_file = os.path.join(
160
+ save_directory, (filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file']
161
+ )
162
+
163
+ if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file):
164
+ copyfile(self.vocab_file, out_vocab_file)
165
+ elif not os.path.isfile(self.vocab_file):
166
+ with open(out_vocab_file, 'wb') as fi:
167
+ content_spiece_model = self.sp_model.serialized_model_proto()
168
+ fi.write(content_spiece_model)
169
+
170
+ return (out_vocab_file,)
171
+
172
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
173
+ if self.add_bos_token:
174
+ bos_token_ids = [self.bos_token_id]
175
+ else:
176
+ bos_token_ids = []
177
+
178
+ output = bos_token_ids + token_ids_0
179
+
180
+ if token_ids_1 is not None:
181
+ output = output + token_ids_1
182
+
183
+ if self.add_eos_token:
184
+ output = output + [self.eos_token_id]
185
+
186
+ return output
187
+
188
+ def get_special_tokens_mask(
189
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
190
+ ) -> List[int]:
191
+ """
192
+ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
193
+ special tokens using the tokenizer `prepare_for_model` method.
194
+
195
+ Args:
196
+ token_ids_0 (`List[int]`):
197
+ List of IDs.
198
+ token_ids_1 (`List[int]`, *optional*):
199
+ Optional second list of IDs for sequence pairs.
200
+ already_has_special_tokens (`bool`, *optional*, defaults to `False`):
201
+ Whether or not the token list is already formatted with special tokens for the model.
202
+
203
+ Returns:
204
+ `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
205
+ """
206
+ if already_has_special_tokens:
207
+ return super().get_special_tokens_mask(
208
+ token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True
209
+ )
210
+
211
+ if token_ids_1 is None:
212
+ return [1] + ([0] * len(token_ids_0)) + [1]
213
+ return [1] + ([0] * len(token_ids_0)) + [1, 1] + ([0] * len(token_ids_1)) + [1]
214
+
215
+ def create_token_type_ids_from_sequences(
216
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
217
+ ) -> List[int]:
218
+ """
219
+ Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
220
+ use of token type ids, therefore a list of zeros is returned.
221
+
222
+ Args:
223
+ token_ids_0 (`List[int]`):
224
+ List of IDs.
225
+ token_ids_1 (`List[int]`, *optional*):
226
+ Optional second list of IDs for sequence pairs.
227
+
228
+ Returns:
229
+ `List[int]`: List of zeros.
230
+ """
231
+ eos = [self.eos_token_id]
232
+
233
+ if token_ids_1 is None:
234
+ return len(token_ids_0 + eos) * [0]
235
+ return len(token_ids_0 + eos + token_ids_1 + eos) * [0]
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f868398fc4e05ee1e8aeba95ddf18ddcc45b8bce55d5093bead5bbf80429b48b
3
+ size 1477754
tokenizer_config.json ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<unk>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<s>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "92538": {
28
+ "content": "<|plugin|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "92539": {
36
+ "content": "<|interpreter|>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "92540": {
44
+ "content": "<|action_end|>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "92541": {
52
+ "content": "<|action_start|>",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "92542": {
60
+ "content": "<|im_end|>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "92543": {
68
+ "content": "<|im_start|>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "92544": {
76
+ "content": "<img>",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "92545": {
84
+ "content": "</img>",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "92546": {
92
+ "content": "<IMG_CONTEXT>",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "92547": {
100
+ "content": "<quad>",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "92548": {
108
+ "content": "</quad>",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "92549": {
116
+ "content": "<ref>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "92550": {
124
+ "content": "</ref>",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "92551": {
132
+ "content": "<box>",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "92552": {
140
+ "content": "</box>",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ }
147
+ },
148
+ "additional_special_tokens": [
149
+ "<|im_start|>",
150
+ "<|im_end|>",
151
+ "<|action_start|>",
152
+ "<|action_end|>",
153
+ "<|interpreter|>",
154
+ "<|plugin|>",
155
+ "<img>",
156
+ "</img>",
157
+ "<IMG_CONTEXT>",
158
+ "<quad>",
159
+ "</quad>",
160
+ "<ref>",
161
+ "</ref>",
162
+ "<box>",
163
+ "</box>"
164
+ ],
165
+ "auto_map": {
166
+ "AutoTokenizer": [
167
+ "tokenization_internlm2.InternLM2Tokenizer",
168
+ null
169
+ ]
170
+ },
171
+ "bos_token": "<s>",
172
+ "chat_template": "{{ bos_token }}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
173
+ "clean_up_tokenization_spaces": false,
174
+ "eos_token": "</s>",
175
+ "extra_special_tokens": {},
176
+ "model_max_length": 8192,
177
+ "pad_token": "</s>",
178
+ "tokenizer_class": "InternLM2Tokenizer",
179
+ "unk_token": "<unk>"
180
+ }