Add model
Browse files- chat_template.json +3 -0
- config.json +0 -0
- configuration_phi3_v.py +218 -0
- generation_config.json +7 -0
- openvino_config.json +28 -0
- openvino_detokenizer.bin +3 -0
- openvino_detokenizer.xml +416 -0
- openvino_language_model.bin +3 -0
- openvino_language_model.xml +0 -0
- openvino_text_embeddings_model.bin +3 -0
- openvino_text_embeddings_model.xml +173 -0
- openvino_tokenizer.bin +3 -0
- openvino_tokenizer.xml +835 -0
- openvino_vision_embeddings_model.bin +3 -0
- openvino_vision_embeddings_model.xml +0 -0
- openvino_vision_projection_model.bin +3 -0
- openvino_vision_projection_model.xml +331 -0
- preprocessor_config.json +21 -0
- processing_phi3_v.py +478 -0
- processor_config.json +6 -0
- special_tokens_map.json +36 -0
- tokenizer.json +0 -0
- tokenizer_config.json +413 -0
chat_template.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chat_template": "{% for message in messages %}{{'<|' + message['role'] + '|>' + '\n' + message['content'] + '<|end|>\n' }}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{- '<|assistant|>\n' -}}{% endif %}"
|
| 3 |
+
}
|
config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
configuration_phi3_v.py
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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the HuggingFace Inc. team. All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
""" Phi-3-V model configuration"""
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 20 |
+
from transformers.utils import logging
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
logger = logging.get_logger(__name__)
|
| 24 |
+
|
| 25 |
+
PHI3V_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
| 26 |
+
"microsoft/Phi-3-vision-128k-instruct": "https://huggingface.co/microsoft/Phi-3-vision-128k-instruct/resolve/main/config.json",
|
| 27 |
+
"microsoft/Phi-3.5-vision-instruct": "https://huggingface.co/microsoft/Phi-3.5-vision-instruct/resolve/main/config.json",
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class Phi3VConfig(PretrainedConfig):
|
| 32 |
+
r"""
|
| 33 |
+
This is the configuration class to store the configuration of a [`Phi3VModel`]. It is used to instantiate a Phi-3
|
| 34 |
+
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
| 35 |
+
defaults will yield a similar configuration to that of the
|
| 36 |
+
[microsoft/Phi-3-vision-128k-instruct](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct).
|
| 37 |
+
|
| 38 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 39 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 40 |
+
|
| 41 |
+
Args:
|
| 42 |
+
vocab_size (`int`, *optional*, defaults to 32064):
|
| 43 |
+
Vocabulary size of the Phi-3-V model. Defines the number of different tokens that can be represented by the
|
| 44 |
+
`inputs_ids` passed when calling [`Phi3VModel`].
|
| 45 |
+
hidden_size (`int`, *optional*, defaults to 3072):
|
| 46 |
+
Dimension of the hidden representations.
|
| 47 |
+
intermediate_size (`int`, *optional*, defaults to 8192):
|
| 48 |
+
Dimension of the MLP representations.
|
| 49 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
| 50 |
+
Number of hidden layers in the Transformer decoder.
|
| 51 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
| 52 |
+
Number of attention heads for each attention layer in the Transformer decoder.
|
| 53 |
+
num_key_value_heads (`int`, *optional*):
|
| 54 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
| 55 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
| 56 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
| 57 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
| 58 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
| 59 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
| 60 |
+
`num_attention_heads`.
|
| 61 |
+
resid_pdrop (`float`, *optional*, defaults to 0.0):
|
| 62 |
+
Dropout probability for mlp outputs.
|
| 63 |
+
embd_pdrop (`int`, *optional*, defaults to 0.0):
|
| 64 |
+
The dropout ratio for the embeddings.
|
| 65 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 66 |
+
The dropout ratio after computing the attention scores.
|
| 67 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 68 |
+
The non-linear activation function (function or string) in the decoder.
|
| 69 |
+
max_position_embeddings (`int`, *optional*, defaults to 4096):
|
| 70 |
+
The maximum sequence length that this model might ever be used with.
|
| 71 |
+
original_max_position_embeddings (`int`, *optional*, defaults to 4096):
|
| 72 |
+
The maximum sequence length that this model was trained with. This is used to determine the size of the
|
| 73 |
+
original RoPE embeddings when using long scaling.
|
| 74 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 75 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 76 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-05):
|
| 77 |
+
The epsilon value used for the RMSNorm.
|
| 78 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 79 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
| 80 |
+
relevant if `config.is_decoder=True`. Whether to tie weight embeddings or not.
|
| 81 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
| 82 |
+
Whether to tie weight embeddings
|
| 83 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
| 84 |
+
The base period of the RoPE embeddings.
|
| 85 |
+
rope_scaling (`dict`, *optional*):
|
| 86 |
+
The scaling strategy for the RoPE embeddings. If `None`, no scaling is applied. If a dictionary, it must
|
| 87 |
+
contain the following keys: `type`, `short_factor` and `long_factor`. The `type` must be either `su` or `yarn` and
|
| 88 |
+
the `short_factor` and `long_factor` must be lists of numbers with the same length as the hidden size
|
| 89 |
+
divided by the number of attention heads divided by 2.
|
| 90 |
+
bos_token_id (`int`, *optional*, defaults to 1):
|
| 91 |
+
The id of the "beginning-of-sequence" token.
|
| 92 |
+
eos_token_id (`int`, *optional*, defaults to 32000):
|
| 93 |
+
The id of the "end-of-sequence" token.
|
| 94 |
+
pad_token_id (`int`, *optional*, defaults to 32000):
|
| 95 |
+
The id of the padding token.
|
| 96 |
+
sliding_window (`int`, *optional*):
|
| 97 |
+
Sliding window attention window size. If `None`, no sliding window is applied.
|
| 98 |
+
embd_layer (`str`, *optional*, defaults to `"default"`):
|
| 99 |
+
The embedding layer to use. Can be either `"default"` or `"image"`. "default" uses the standard embedding for text.
|
| 100 |
+
|
| 101 |
+
Example:
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
>>> from transformers import Phi3VModel, Phi3VConfig
|
| 105 |
+
|
| 106 |
+
>>> # Initializing a Phi-3-V style configuration
|
| 107 |
+
>>> configuration = Phi3Config.from_pretrained("microsoft/Phi-3-vision-128k-instruct")
|
| 108 |
+
|
| 109 |
+
>>> # Initializing a model from the configuration
|
| 110 |
+
>>> model = Phi3VModel(configuration)
|
| 111 |
+
|
| 112 |
+
>>> # Accessing the model configuration
|
| 113 |
+
>>> configuration = model.config
|
| 114 |
+
```"""
|
| 115 |
+
|
| 116 |
+
model_type = "phi3_v"
|
| 117 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 118 |
+
|
| 119 |
+
def __init__(
|
| 120 |
+
self,
|
| 121 |
+
vocab_size=32064,
|
| 122 |
+
hidden_size=3072,
|
| 123 |
+
intermediate_size=8192,
|
| 124 |
+
num_hidden_layers=32,
|
| 125 |
+
num_attention_heads=32,
|
| 126 |
+
num_key_value_heads=None,
|
| 127 |
+
resid_pdrop=0.0,
|
| 128 |
+
embd_pdrop=0.0,
|
| 129 |
+
attention_dropout=0.0,
|
| 130 |
+
hidden_act="silu",
|
| 131 |
+
max_position_embeddings=4096,
|
| 132 |
+
original_max_position_embeddings=4096,
|
| 133 |
+
initializer_range=0.02,
|
| 134 |
+
rms_norm_eps=1e-5,
|
| 135 |
+
use_cache=True,
|
| 136 |
+
tie_word_embeddings=False,
|
| 137 |
+
rope_theta=10000.0,
|
| 138 |
+
rope_scaling=None,
|
| 139 |
+
bos_token_id=1,
|
| 140 |
+
eos_token_id=32000,
|
| 141 |
+
pad_token_id=32000,
|
| 142 |
+
sliding_window=None,
|
| 143 |
+
embd_layer: str = "default",
|
| 144 |
+
**kwargs,
|
| 145 |
+
):
|
| 146 |
+
self.vocab_size = vocab_size
|
| 147 |
+
self.hidden_size = hidden_size
|
| 148 |
+
self.intermediate_size = intermediate_size
|
| 149 |
+
self.num_hidden_layers = num_hidden_layers
|
| 150 |
+
self.num_attention_heads = num_attention_heads
|
| 151 |
+
|
| 152 |
+
if num_key_value_heads is None:
|
| 153 |
+
num_key_value_heads = num_attention_heads
|
| 154 |
+
|
| 155 |
+
self.num_key_value_heads = num_key_value_heads
|
| 156 |
+
self.resid_pdrop = resid_pdrop
|
| 157 |
+
self.embd_pdrop = embd_pdrop
|
| 158 |
+
self.attention_dropout = attention_dropout
|
| 159 |
+
self.hidden_act = hidden_act
|
| 160 |
+
self.max_position_embeddings = max_position_embeddings
|
| 161 |
+
self.original_max_position_embeddings = original_max_position_embeddings
|
| 162 |
+
self.initializer_range = initializer_range
|
| 163 |
+
self.rms_norm_eps = rms_norm_eps
|
| 164 |
+
self.use_cache = use_cache
|
| 165 |
+
self.rope_theta = rope_theta
|
| 166 |
+
self.rope_scaling = rope_scaling
|
| 167 |
+
self._rope_scaling_validation()
|
| 168 |
+
self.sliding_window = sliding_window
|
| 169 |
+
self.embd_layer = embd_layer
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
super().__init__(
|
| 173 |
+
bos_token_id=bos_token_id,
|
| 174 |
+
eos_token_id=eos_token_id,
|
| 175 |
+
pad_token_id=pad_token_id,
|
| 176 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 177 |
+
**kwargs,
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
def _rope_scaling_validation(self):
|
| 181 |
+
"""
|
| 182 |
+
Validate the `rope_scaling` configuration.
|
| 183 |
+
"""
|
| 184 |
+
if self.rope_scaling is None:
|
| 185 |
+
return
|
| 186 |
+
|
| 187 |
+
if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 3:
|
| 188 |
+
raise ValueError(
|
| 189 |
+
"`rope_scaling` must be a dictionary with three fields, `type`, `short_factor` and `long_factor`, "
|
| 190 |
+
f"got {self.rope_scaling}"
|
| 191 |
+
)
|
| 192 |
+
rope_scaling_type = self.rope_scaling.get("type", None)
|
| 193 |
+
rope_scaling_short_factor = self.rope_scaling.get("short_factor", None)
|
| 194 |
+
rope_scaling_long_factor = self.rope_scaling.get("long_factor", None)
|
| 195 |
+
if rope_scaling_type is None or rope_scaling_type not in ["su", "yarn"]:
|
| 196 |
+
raise ValueError(f"`rope_scaling`'s type field must be one of ['su', 'yarn'], got {rope_scaling_type}")
|
| 197 |
+
if not (
|
| 198 |
+
isinstance(rope_scaling_short_factor, list)
|
| 199 |
+
and all(isinstance(x, (int, float)) for x in rope_scaling_short_factor)
|
| 200 |
+
):
|
| 201 |
+
raise ValueError(
|
| 202 |
+
f"`rope_scaling`'s short_factor field must be a list of numbers, got {rope_scaling_short_factor}"
|
| 203 |
+
)
|
| 204 |
+
if not len(rope_scaling_short_factor) == self.hidden_size // self.num_attention_heads // 2:
|
| 205 |
+
raise ValueError(
|
| 206 |
+
f"`rope_scaling`'s short_factor field must have length {self.hidden_size // self.num_attention_heads // 2}, got {len(rope_scaling_short_factor)}"
|
| 207 |
+
)
|
| 208 |
+
if not (
|
| 209 |
+
isinstance(rope_scaling_long_factor, list)
|
| 210 |
+
and all(isinstance(x, (int, float)) for x in rope_scaling_long_factor)
|
| 211 |
+
):
|
| 212 |
+
raise ValueError(
|
| 213 |
+
f"`rope_scaling`'s long_factor field must be a list of numbers, got {rope_scaling_long_factor}"
|
| 214 |
+
)
|
| 215 |
+
if not len(rope_scaling_long_factor) == self.hidden_size // self.num_attention_heads // 2:
|
| 216 |
+
raise ValueError(
|
| 217 |
+
f"`rope_scaling`'s long_factor field must have length {self.hidden_size // self.num_attention_heads // 2}, got {len(rope_scaling_long_factor)}"
|
| 218 |
+
)
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"pad_token_id": 32000,
|
| 6 |
+
"transformers_version": "4.45.0"
|
| 7 |
+
}
|
openvino_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compression": null,
|
| 3 |
+
"dtype": "int4",
|
| 4 |
+
"input_info": null,
|
| 5 |
+
"optimum_version": "1.24.0.dev0",
|
| 6 |
+
"quantization_config": {
|
| 7 |
+
"all_layers": null,
|
| 8 |
+
"backup_precision": null,
|
| 9 |
+
"bits": 4,
|
| 10 |
+
"dataset": "contextual",
|
| 11 |
+
"gptq": null,
|
| 12 |
+
"group_size": 128,
|
| 13 |
+
"ignored_scope": null,
|
| 14 |
+
"lora_correction": null,
|
| 15 |
+
"num_samples": null,
|
| 16 |
+
"processor": null,
|
| 17 |
+
"quant_method": "awq",
|
| 18 |
+
"ratio": 1.0,
|
| 19 |
+
"scale_estimation": null,
|
| 20 |
+
"sensitivity_metric": null,
|
| 21 |
+
"sym": false,
|
| 22 |
+
"tokenizer": null,
|
| 23 |
+
"trust_remote_code": true,
|
| 24 |
+
"weight_format": "int4"
|
| 25 |
+
},
|
| 26 |
+
"save_onnx_model": false,
|
| 27 |
+
"transformers_version": "4.45.0"
|
| 28 |
+
}
|
openvino_detokenizer.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a60c90df70041d2a3db95701b3bc410f557a9d2568b2055ce20b3003c778c3f9
|
| 3 |
+
size 340120
|
openvino_detokenizer.xml
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<net name="detokenizer" version="11">
|
| 3 |
+
<layers>
|
| 4 |
+
<layer id="0" name="Parameter_122" type="Parameter" version="opset1">
|
| 5 |
+
<data shape="?,?" element_type="i64" />
|
| 6 |
+
<output>
|
| 7 |
+
<port id="0" precision="I64" names="Parameter_122">
|
| 8 |
+
<dim>-1</dim>
|
| 9 |
+
<dim>-1</dim>
|
| 10 |
+
</port>
|
| 11 |
+
</output>
|
| 12 |
+
</layer>
|
| 13 |
+
<layer id="1" name="Convert_149" type="Convert" version="opset1">
|
| 14 |
+
<data destination_type="i32" />
|
| 15 |
+
<input>
|
| 16 |
+
<port id="0" precision="I64">
|
| 17 |
+
<dim>-1</dim>
|
| 18 |
+
<dim>-1</dim>
|
| 19 |
+
</port>
|
| 20 |
+
</input>
|
| 21 |
+
<output>
|
| 22 |
+
<port id="1" precision="I32">
|
| 23 |
+
<dim>-1</dim>
|
| 24 |
+
<dim>-1</dim>
|
| 25 |
+
</port>
|
| 26 |
+
</output>
|
| 27 |
+
</layer>
|
| 28 |
+
<layer id="2" name="Constant_89" type="Const" version="opset1">
|
| 29 |
+
<data element_type="u8" shape="339905" offset="0" size="339905" />
|
| 30 |
+
<output>
|
| 31 |
+
<port id="0" precision="U8">
|
| 32 |
+
<dim>339905</dim>
|
| 33 |
+
</port>
|
| 34 |
+
</output>
|
| 35 |
+
</layer>
|
| 36 |
+
<layer id="3" name="StringTensorUnpack_90" type="StringTensorUnpack" version="extension">
|
| 37 |
+
<data mode="begins_ends" />
|
| 38 |
+
<input>
|
| 39 |
+
<port id="0" precision="U8">
|
| 40 |
+
<dim>339905</dim>
|
| 41 |
+
</port>
|
| 42 |
+
</input>
|
| 43 |
+
<output>
|
| 44 |
+
<port id="1" precision="I32">
|
| 45 |
+
<dim>-1</dim>
|
| 46 |
+
</port>
|
| 47 |
+
<port id="2" precision="I32">
|
| 48 |
+
<dim>-1</dim>
|
| 49 |
+
</port>
|
| 50 |
+
<port id="3" precision="U8">
|
| 51 |
+
<dim>-1</dim>
|
| 52 |
+
</port>
|
| 53 |
+
</output>
|
| 54 |
+
</layer>
|
| 55 |
+
<layer id="4" name="Constant_126" type="Const" version="opset1">
|
| 56 |
+
<data element_type="i32" shape="47" offset="339905" size="188" />
|
| 57 |
+
<output>
|
| 58 |
+
<port id="0" precision="I32">
|
| 59 |
+
<dim>47</dim>
|
| 60 |
+
</port>
|
| 61 |
+
</output>
|
| 62 |
+
</layer>
|
| 63 |
+
<layer id="5" name="Constant_124" type="Const" version="opset1">
|
| 64 |
+
<data element_type="i32" shape="1" offset="340093" size="4" />
|
| 65 |
+
<output>
|
| 66 |
+
<port id="0" precision="I32">
|
| 67 |
+
<dim>1</dim>
|
| 68 |
+
</port>
|
| 69 |
+
</output>
|
| 70 |
+
</layer>
|
| 71 |
+
<layer id="6" name="Constant_123" type="Const" version="opset1">
|
| 72 |
+
<data element_type="i32" shape="1" offset="340097" size="4" />
|
| 73 |
+
<output>
|
| 74 |
+
<port id="0" precision="I32">
|
| 75 |
+
<dim>1</dim>
|
| 76 |
+
</port>
|
| 77 |
+
</output>
|
| 78 |
+
</layer>
|
| 79 |
+
<layer id="7" name="Constant_125" type="Const" version="opset1">
|
| 80 |
+
<data element_type="i32" shape="1" offset="340101" size="4" />
|
| 81 |
+
<output>
|
| 82 |
+
<port id="0" precision="I32">
|
| 83 |
+
<dim>1</dim>
|
| 84 |
+
</port>
|
| 85 |
+
</output>
|
| 86 |
+
</layer>
|
| 87 |
+
<layer id="8" name="Constant_128" type="Const" version="opset1">
|
| 88 |
+
<data element_type="i64" shape="1" offset="340105" size="8" />
|
| 89 |
+
<output>
|
| 90 |
+
<port id="0" precision="I64">
|
| 91 |
+
<dim>1</dim>
|
| 92 |
+
</port>
|
| 93 |
+
</output>
|
| 94 |
+
</layer>
|
| 95 |
+
<layer id="9" name="Slice_127" type="Slice" version="opset8">
|
| 96 |
+
<input>
|
| 97 |
+
<port id="0" precision="I32">
|
| 98 |
+
<dim>47</dim>
|
| 99 |
+
</port>
|
| 100 |
+
<port id="1" precision="I32">
|
| 101 |
+
<dim>1</dim>
|
| 102 |
+
</port>
|
| 103 |
+
<port id="2" precision="I32">
|
| 104 |
+
<dim>1</dim>
|
| 105 |
+
</port>
|
| 106 |
+
<port id="3" precision="I32">
|
| 107 |
+
<dim>1</dim>
|
| 108 |
+
</port>
|
| 109 |
+
<port id="4" precision="I64">
|
| 110 |
+
<dim>1</dim>
|
| 111 |
+
</port>
|
| 112 |
+
</input>
|
| 113 |
+
<output>
|
| 114 |
+
<port id="5" precision="I32">
|
| 115 |
+
<dim>47</dim>
|
| 116 |
+
</port>
|
| 117 |
+
</output>
|
| 118 |
+
</layer>
|
| 119 |
+
<layer id="10" name="VocabDecoder_129" type="VocabDecoder" version="extension">
|
| 120 |
+
<data skip_tokens="" />
|
| 121 |
+
<input>
|
| 122 |
+
<port id="0" precision="I32">
|
| 123 |
+
<dim>-1</dim>
|
| 124 |
+
<dim>-1</dim>
|
| 125 |
+
</port>
|
| 126 |
+
<port id="1" precision="I32">
|
| 127 |
+
<dim>-1</dim>
|
| 128 |
+
</port>
|
| 129 |
+
<port id="2" precision="I32">
|
| 130 |
+
<dim>-1</dim>
|
| 131 |
+
</port>
|
| 132 |
+
<port id="3" precision="U8">
|
| 133 |
+
<dim>-1</dim>
|
| 134 |
+
</port>
|
| 135 |
+
<port id="4" precision="I32">
|
| 136 |
+
<dim>47</dim>
|
| 137 |
+
</port>
|
| 138 |
+
</input>
|
| 139 |
+
<output>
|
| 140 |
+
<port id="5" precision="I32">
|
| 141 |
+
<dim>-1</dim>
|
| 142 |
+
</port>
|
| 143 |
+
<port id="6" precision="I32">
|
| 144 |
+
<dim>-1</dim>
|
| 145 |
+
</port>
|
| 146 |
+
<port id="7" precision="I32">
|
| 147 |
+
<dim>-1</dim>
|
| 148 |
+
</port>
|
| 149 |
+
<port id="8" precision="I32">
|
| 150 |
+
<dim>-1</dim>
|
| 151 |
+
</port>
|
| 152 |
+
<port id="9" precision="U8">
|
| 153 |
+
<dim>-1</dim>
|
| 154 |
+
</port>
|
| 155 |
+
</output>
|
| 156 |
+
</layer>
|
| 157 |
+
<layer id="11" name="Constant_131" type="Const" version="opset1">
|
| 158 |
+
<data element_type="u8" shape="3" offset="340113" size="3" />
|
| 159 |
+
<output>
|
| 160 |
+
<port id="0" precision="U8">
|
| 161 |
+
<dim>3</dim>
|
| 162 |
+
</port>
|
| 163 |
+
</output>
|
| 164 |
+
</layer>
|
| 165 |
+
<layer id="12" name="Constant_133" type="Const" version="opset1">
|
| 166 |
+
<data element_type="u8" shape="1" offset="340116" size="1" />
|
| 167 |
+
<output>
|
| 168 |
+
<port id="0" precision="U8">
|
| 169 |
+
<dim>1</dim>
|
| 170 |
+
</port>
|
| 171 |
+
</output>
|
| 172 |
+
</layer>
|
| 173 |
+
<layer id="13" name="RegexNormalization_134" type="RegexNormalization" version="extension">
|
| 174 |
+
<data global_replace="true" />
|
| 175 |
+
<input>
|
| 176 |
+
<port id="0" precision="I32">
|
| 177 |
+
<dim>-1</dim>
|
| 178 |
+
</port>
|
| 179 |
+
<port id="1" precision="I32">
|
| 180 |
+
<dim>-1</dim>
|
| 181 |
+
</port>
|
| 182 |
+
<port id="2" precision="U8">
|
| 183 |
+
<dim>-1</dim>
|
| 184 |
+
</port>
|
| 185 |
+
<port id="3" precision="U8">
|
| 186 |
+
<dim>3</dim>
|
| 187 |
+
</port>
|
| 188 |
+
<port id="4" precision="U8">
|
| 189 |
+
<dim>1</dim>
|
| 190 |
+
</port>
|
| 191 |
+
</input>
|
| 192 |
+
<output>
|
| 193 |
+
<port id="5" precision="I32">
|
| 194 |
+
<dim>-1</dim>
|
| 195 |
+
</port>
|
| 196 |
+
<port id="6" precision="I32">
|
| 197 |
+
<dim>-1</dim>
|
| 198 |
+
</port>
|
| 199 |
+
<port id="7" precision="U8">
|
| 200 |
+
<dim>-1</dim>
|
| 201 |
+
</port>
|
| 202 |
+
</output>
|
| 203 |
+
</layer>
|
| 204 |
+
<layer id="14" name="ByteFallback_135" type="ByteFallback" version="extension">
|
| 205 |
+
<input>
|
| 206 |
+
<port id="0" precision="I32">
|
| 207 |
+
<dim>-1</dim>
|
| 208 |
+
</port>
|
| 209 |
+
<port id="1" precision="I32">
|
| 210 |
+
<dim>-1</dim>
|
| 211 |
+
</port>
|
| 212 |
+
<port id="2" precision="U8">
|
| 213 |
+
<dim>-1</dim>
|
| 214 |
+
</port>
|
| 215 |
+
</input>
|
| 216 |
+
<output>
|
| 217 |
+
<port id="3" precision="I32">
|
| 218 |
+
<dim>-1</dim>
|
| 219 |
+
</port>
|
| 220 |
+
<port id="4" precision="I32">
|
| 221 |
+
<dim>-1</dim>
|
| 222 |
+
</port>
|
| 223 |
+
<port id="5" precision="U8">
|
| 224 |
+
<dim>-1</dim>
|
| 225 |
+
</port>
|
| 226 |
+
</output>
|
| 227 |
+
</layer>
|
| 228 |
+
<layer id="15" name="FuzeRagged_136" type="FuzeRagged" version="extension">
|
| 229 |
+
<input>
|
| 230 |
+
<port id="0" precision="I32">
|
| 231 |
+
<dim>-1</dim>
|
| 232 |
+
</port>
|
| 233 |
+
<port id="1" precision="I32">
|
| 234 |
+
<dim>-1</dim>
|
| 235 |
+
</port>
|
| 236 |
+
<port id="2" precision="I32">
|
| 237 |
+
<dim>-1</dim>
|
| 238 |
+
</port>
|
| 239 |
+
<port id="3" precision="I32">
|
| 240 |
+
<dim>-1</dim>
|
| 241 |
+
</port>
|
| 242 |
+
</input>
|
| 243 |
+
<output>
|
| 244 |
+
<port id="4" precision="I32">
|
| 245 |
+
<dim>-1</dim>
|
| 246 |
+
</port>
|
| 247 |
+
<port id="5" precision="I32">
|
| 248 |
+
<dim>-1</dim>
|
| 249 |
+
</port>
|
| 250 |
+
</output>
|
| 251 |
+
</layer>
|
| 252 |
+
<layer id="16" name="Constant_138" type="Const" version="opset1">
|
| 253 |
+
<data element_type="u8" shape="2" offset="340117" size="2" />
|
| 254 |
+
<output>
|
| 255 |
+
<port id="0" precision="U8">
|
| 256 |
+
<dim>2</dim>
|
| 257 |
+
</port>
|
| 258 |
+
</output>
|
| 259 |
+
</layer>
|
| 260 |
+
<layer id="17" name="Constant_140" type="Const" version="opset1">
|
| 261 |
+
<data element_type="u8" shape="0" offset="340119" size="1" />
|
| 262 |
+
<output>
|
| 263 |
+
<port id="0" precision="U8">
|
| 264 |
+
<dim>0</dim>
|
| 265 |
+
</port>
|
| 266 |
+
</output>
|
| 267 |
+
</layer>
|
| 268 |
+
<layer id="18" name="RegexNormalization_141" type="RegexNormalization" version="extension">
|
| 269 |
+
<data global_replace="true" />
|
| 270 |
+
<input>
|
| 271 |
+
<port id="0" precision="I32">
|
| 272 |
+
<dim>-1</dim>
|
| 273 |
+
</port>
|
| 274 |
+
<port id="1" precision="I32">
|
| 275 |
+
<dim>-1</dim>
|
| 276 |
+
</port>
|
| 277 |
+
<port id="2" precision="U8">
|
| 278 |
+
<dim>-1</dim>
|
| 279 |
+
</port>
|
| 280 |
+
<port id="3" precision="U8">
|
| 281 |
+
<dim>2</dim>
|
| 282 |
+
</port>
|
| 283 |
+
<port id="4" precision="U8">
|
| 284 |
+
<dim>0</dim>
|
| 285 |
+
</port>
|
| 286 |
+
</input>
|
| 287 |
+
<output>
|
| 288 |
+
<port id="5" precision="I32">
|
| 289 |
+
<dim>-1</dim>
|
| 290 |
+
</port>
|
| 291 |
+
<port id="6" precision="I32">
|
| 292 |
+
<dim>-1</dim>
|
| 293 |
+
</port>
|
| 294 |
+
<port id="7" precision="U8">
|
| 295 |
+
<dim>-1</dim>
|
| 296 |
+
</port>
|
| 297 |
+
</output>
|
| 298 |
+
</layer>
|
| 299 |
+
<layer id="19" name="UTF8Validate_142" type="UTF8Validate" version="extension">
|
| 300 |
+
<data replace_mode="true" />
|
| 301 |
+
<input>
|
| 302 |
+
<port id="0" precision="I32">
|
| 303 |
+
<dim>-1</dim>
|
| 304 |
+
</port>
|
| 305 |
+
<port id="1" precision="I32">
|
| 306 |
+
<dim>-1</dim>
|
| 307 |
+
</port>
|
| 308 |
+
<port id="2" precision="U8">
|
| 309 |
+
<dim>-1</dim>
|
| 310 |
+
</port>
|
| 311 |
+
</input>
|
| 312 |
+
<output>
|
| 313 |
+
<port id="3" precision="I32">
|
| 314 |
+
<dim>-1</dim>
|
| 315 |
+
</port>
|
| 316 |
+
<port id="4" precision="I32">
|
| 317 |
+
<dim>-1</dim>
|
| 318 |
+
</port>
|
| 319 |
+
<port id="5" precision="U8">
|
| 320 |
+
<dim>-1</dim>
|
| 321 |
+
</port>
|
| 322 |
+
</output>
|
| 323 |
+
</layer>
|
| 324 |
+
<layer id="20" name="StringTensorPack_143" type="StringTensorPack" version="extension">
|
| 325 |
+
<data mode="begins_ends" />
|
| 326 |
+
<input>
|
| 327 |
+
<port id="0" precision="I32">
|
| 328 |
+
<dim>-1</dim>
|
| 329 |
+
</port>
|
| 330 |
+
<port id="1" precision="I32">
|
| 331 |
+
<dim>-1</dim>
|
| 332 |
+
</port>
|
| 333 |
+
<port id="2" precision="U8">
|
| 334 |
+
<dim>-1</dim>
|
| 335 |
+
</port>
|
| 336 |
+
</input>
|
| 337 |
+
<output>
|
| 338 |
+
<port id="3" precision="STRING" names="string_output">
|
| 339 |
+
<dim>-1</dim>
|
| 340 |
+
</port>
|
| 341 |
+
</output>
|
| 342 |
+
</layer>
|
| 343 |
+
<layer id="21" name="Result_144" type="Result" version="opset1">
|
| 344 |
+
<input>
|
| 345 |
+
<port id="0" precision="STRING">
|
| 346 |
+
<dim>-1</dim>
|
| 347 |
+
</port>
|
| 348 |
+
</input>
|
| 349 |
+
</layer>
|
| 350 |
+
</layers>
|
| 351 |
+
<edges>
|
| 352 |
+
<edge from-layer="0" from-port="0" to-layer="1" to-port="0" />
|
| 353 |
+
<edge from-layer="1" from-port="1" to-layer="10" to-port="0" />
|
| 354 |
+
<edge from-layer="2" from-port="0" to-layer="3" to-port="0" />
|
| 355 |
+
<edge from-layer="3" from-port="3" to-layer="10" to-port="3" />
|
| 356 |
+
<edge from-layer="3" from-port="2" to-layer="10" to-port="2" />
|
| 357 |
+
<edge from-layer="3" from-port="1" to-layer="10" to-port="1" />
|
| 358 |
+
<edge from-layer="4" from-port="0" to-layer="9" to-port="0" />
|
| 359 |
+
<edge from-layer="5" from-port="0" to-layer="9" to-port="1" />
|
| 360 |
+
<edge from-layer="6" from-port="0" to-layer="9" to-port="2" />
|
| 361 |
+
<edge from-layer="7" from-port="0" to-layer="9" to-port="3" />
|
| 362 |
+
<edge from-layer="8" from-port="0" to-layer="9" to-port="4" />
|
| 363 |
+
<edge from-layer="9" from-port="5" to-layer="10" to-port="4" />
|
| 364 |
+
<edge from-layer="10" from-port="7" to-layer="13" to-port="0" />
|
| 365 |
+
<edge from-layer="10" from-port="8" to-layer="13" to-port="1" />
|
| 366 |
+
<edge from-layer="10" from-port="9" to-layer="13" to-port="2" />
|
| 367 |
+
<edge from-layer="10" from-port="6" to-layer="15" to-port="1" />
|
| 368 |
+
<edge from-layer="10" from-port="5" to-layer="15" to-port="0" />
|
| 369 |
+
<edge from-layer="11" from-port="0" to-layer="13" to-port="3" />
|
| 370 |
+
<edge from-layer="12" from-port="0" to-layer="13" to-port="4" />
|
| 371 |
+
<edge from-layer="13" from-port="6" to-layer="14" to-port="1" />
|
| 372 |
+
<edge from-layer="13" from-port="7" to-layer="14" to-port="2" />
|
| 373 |
+
<edge from-layer="13" from-port="5" to-layer="14" to-port="0" />
|
| 374 |
+
<edge from-layer="14" from-port="3" to-layer="15" to-port="2" />
|
| 375 |
+
<edge from-layer="14" from-port="4" to-layer="15" to-port="3" />
|
| 376 |
+
<edge from-layer="14" from-port="5" to-layer="18" to-port="2" />
|
| 377 |
+
<edge from-layer="15" from-port="4" to-layer="18" to-port="0" />
|
| 378 |
+
<edge from-layer="15" from-port="5" to-layer="18" to-port="1" />
|
| 379 |
+
<edge from-layer="16" from-port="0" to-layer="18" to-port="3" />
|
| 380 |
+
<edge from-layer="17" from-port="0" to-layer="18" to-port="4" />
|
| 381 |
+
<edge from-layer="18" from-port="5" to-layer="19" to-port="0" />
|
| 382 |
+
<edge from-layer="18" from-port="6" to-layer="19" to-port="1" />
|
| 383 |
+
<edge from-layer="18" from-port="7" to-layer="19" to-port="2" />
|
| 384 |
+
<edge from-layer="19" from-port="3" to-layer="20" to-port="0" />
|
| 385 |
+
<edge from-layer="19" from-port="4" to-layer="20" to-port="1" />
|
| 386 |
+
<edge from-layer="19" from-port="5" to-layer="20" to-port="2" />
|
| 387 |
+
<edge from-layer="20" from-port="3" to-layer="21" to-port="0" />
|
| 388 |
+
</edges>
|
| 389 |
+
<rt_info>
|
| 390 |
+
<add_attention_mask value="True" />
|
| 391 |
+
<add_prefix_space />
|
| 392 |
+
<add_special_tokens value="True" />
|
| 393 |
+
<bos_token_id value="1" />
|
| 394 |
+
<chat_template value="{% for message in messages %}{{'<|' + message['role'] + '|>' + ' ' + message['content'] + '<|end|> ' }}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{- '<|assistant|> ' -}}{% endif %}" />
|
| 395 |
+
<clean_up_tokenization_spaces />
|
| 396 |
+
<detokenizer_input_type value="i64" />
|
| 397 |
+
<eos_token_id value="32000" />
|
| 398 |
+
<handle_special_tokens_with_re value="False" />
|
| 399 |
+
<number_of_inputs value="1" />
|
| 400 |
+
<openvino_tokenizers_version value="2025.0.0.0rc2" />
|
| 401 |
+
<openvino_version value="2025.0.0rc2" />
|
| 402 |
+
<original_tokenizer_class value="<class 'transformers.models.llama.tokenization_llama_fast.LlamaTokenizerFast'>" />
|
| 403 |
+
<pad_token_id value="32000" />
|
| 404 |
+
<sentencepiece_version value="0.2.0" />
|
| 405 |
+
<skip_special_tokens value="True" />
|
| 406 |
+
<streaming_detokenizer value="False" />
|
| 407 |
+
<tiktoken_version value="0.8.0" />
|
| 408 |
+
<tokenizer_output_type value="i64" />
|
| 409 |
+
<tokenizers_version value="0.20.1" />
|
| 410 |
+
<transformers_version value="4.45.0" />
|
| 411 |
+
<use_max_padding value="False" />
|
| 412 |
+
<use_sentencepiece_backend value="True" />
|
| 413 |
+
<utf8_replace_mode value="replace" />
|
| 414 |
+
<with_detokenizer value="True" />
|
| 415 |
+
</rt_info>
|
| 416 |
+
</net>
|
openvino_language_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a9b850352619797981d9c5b022de81ef6b37dbf5bf1efa149af7e8980e360cb
|
| 3 |
+
size 1983162812
|
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:3b8295cb8c1b0a2ab714d0d309b47015967e11c2b5205e038abff0d6f229b3bc
|
| 3 |
+
size 98564740
|
openvino_text_embeddings_model.xml
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 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="32064, 3072" offset="0" size="98500608" />
|
| 15 |
+
<output>
|
| 16 |
+
<port id="0" precision="I8">
|
| 17 |
+
<dim>32064</dim>
|
| 18 |
+
<dim>3072</dim>
|
| 19 |
+
</port>
|
| 20 |
+
</output>
|
| 21 |
+
</layer>
|
| 22 |
+
<layer id="2" name="Convert_240039" type="Convert" version="opset1">
|
| 23 |
+
<data destination_type="f16" />
|
| 24 |
+
<input>
|
| 25 |
+
<port id="0" precision="I8">
|
| 26 |
+
<dim>32064</dim>
|
| 27 |
+
<dim>3072</dim>
|
| 28 |
+
</port>
|
| 29 |
+
</input>
|
| 30 |
+
<output>
|
| 31 |
+
<port id="1" precision="FP16">
|
| 32 |
+
<dim>32064</dim>
|
| 33 |
+
<dim>3072</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="32064, 1" offset="98500608" size="64128" />
|
| 39 |
+
<output>
|
| 40 |
+
<port id="0" precision="FP16">
|
| 41 |
+
<dim>32064</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>32064</dim>
|
| 51 |
+
<dim>3072</dim>
|
| 52 |
+
</port>
|
| 53 |
+
<port id="1" precision="FP16">
|
| 54 |
+
<dim>32064</dim>
|
| 55 |
+
<dim>1</dim>
|
| 56 |
+
</port>
|
| 57 |
+
</input>
|
| 58 |
+
<output>
|
| 59 |
+
<port id="2" precision="FP16">
|
| 60 |
+
<dim>32064</dim>
|
| 61 |
+
<dim>3072</dim>
|
| 62 |
+
</port>
|
| 63 |
+
</output>
|
| 64 |
+
</layer>
|
| 65 |
+
<layer id="5" name="self.weight/fq_weights_0/convert" type="Convert" version="opset1">
|
| 66 |
+
<data destination_type="f32" />
|
| 67 |
+
<input>
|
| 68 |
+
<port id="0" precision="FP16">
|
| 69 |
+
<dim>32064</dim>
|
| 70 |
+
<dim>3072</dim>
|
| 71 |
+
</port>
|
| 72 |
+
</input>
|
| 73 |
+
<output>
|
| 74 |
+
<port id="1" precision="FP32">
|
| 75 |
+
<dim>32064</dim>
|
| 76 |
+
<dim>3072</dim>
|
| 77 |
+
</port>
|
| 78 |
+
</output>
|
| 79 |
+
</layer>
|
| 80 |
+
<layer id="6" name="aten::embedding/Convert" type="Convert" version="opset1">
|
| 81 |
+
<data destination_type="i32" />
|
| 82 |
+
<input>
|
| 83 |
+
<port id="0" precision="I64">
|
| 84 |
+
<dim>-1</dim>
|
| 85 |
+
<dim>-1</dim>
|
| 86 |
+
</port>
|
| 87 |
+
</input>
|
| 88 |
+
<output>
|
| 89 |
+
<port id="1" precision="I32">
|
| 90 |
+
<dim>-1</dim>
|
| 91 |
+
<dim>-1</dim>
|
| 92 |
+
</port>
|
| 93 |
+
</output>
|
| 94 |
+
</layer>
|
| 95 |
+
<layer id="7" name="aten::embedding/Constant" type="Const" version="opset1">
|
| 96 |
+
<data element_type="i32" shape="" offset="98564736" size="4" />
|
| 97 |
+
<output>
|
| 98 |
+
<port id="0" precision="I32" />
|
| 99 |
+
</output>
|
| 100 |
+
</layer>
|
| 101 |
+
<layer id="8" name="aten::embedding/Gather" type="Gather" version="opset8">
|
| 102 |
+
<data batch_dims="0" />
|
| 103 |
+
<input>
|
| 104 |
+
<port id="0" precision="FP32">
|
| 105 |
+
<dim>32064</dim>
|
| 106 |
+
<dim>3072</dim>
|
| 107 |
+
</port>
|
| 108 |
+
<port id="1" precision="I32">
|
| 109 |
+
<dim>-1</dim>
|
| 110 |
+
<dim>-1</dim>
|
| 111 |
+
</port>
|
| 112 |
+
<port id="2" precision="I32" />
|
| 113 |
+
</input>
|
| 114 |
+
<output>
|
| 115 |
+
<port id="3" precision="FP32" names="inputs_embeds">
|
| 116 |
+
<dim>-1</dim>
|
| 117 |
+
<dim>-1</dim>
|
| 118 |
+
<dim>3072</dim>
|
| 119 |
+
</port>
|
| 120 |
+
</output>
|
| 121 |
+
</layer>
|
| 122 |
+
<layer id="9" name="Result_129532" type="Result" version="opset1">
|
| 123 |
+
<input>
|
| 124 |
+
<port id="0" precision="FP32">
|
| 125 |
+
<dim>-1</dim>
|
| 126 |
+
<dim>-1</dim>
|
| 127 |
+
<dim>3072</dim>
|
| 128 |
+
</port>
|
| 129 |
+
</input>
|
| 130 |
+
</layer>
|
| 131 |
+
</layers>
|
| 132 |
+
<edges>
|
| 133 |
+
<edge from-layer="0" from-port="0" to-layer="6" to-port="0" />
|
| 134 |
+
<edge from-layer="1" from-port="0" to-layer="2" to-port="0" />
|
| 135 |
+
<edge from-layer="2" from-port="1" to-layer="4" to-port="0" />
|
| 136 |
+
<edge from-layer="3" from-port="0" to-layer="4" to-port="1" />
|
| 137 |
+
<edge from-layer="4" from-port="2" to-layer="5" to-port="0" />
|
| 138 |
+
<edge from-layer="5" from-port="1" to-layer="8" to-port="0" />
|
| 139 |
+
<edge from-layer="6" from-port="1" to-layer="8" to-port="1" />
|
| 140 |
+
<edge from-layer="7" from-port="0" to-layer="8" to-port="2" />
|
| 141 |
+
<edge from-layer="8" from-port="3" to-layer="9" to-port="0" />
|
| 142 |
+
</edges>
|
| 143 |
+
<rt_info>
|
| 144 |
+
<Runtime_version value="2025.0.0-17933-815af98acd8-releases/2025/0" />
|
| 145 |
+
<conversion_parameters>
|
| 146 |
+
<framework value="pytorch" />
|
| 147 |
+
<is_python_object value="True" />
|
| 148 |
+
</conversion_parameters>
|
| 149 |
+
<nncf>
|
| 150 |
+
<friendly_names_were_updated value="True" />
|
| 151 |
+
<weight_compression>
|
| 152 |
+
<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}}" />
|
| 153 |
+
<all_layers value="False" />
|
| 154 |
+
<awq value="False" />
|
| 155 |
+
<backup_mode value="int8_asym" />
|
| 156 |
+
<gptq value="False" />
|
| 157 |
+
<group_size value="-1" />
|
| 158 |
+
<ignored_scope value="[]" />
|
| 159 |
+
<lora_correction value="False" />
|
| 160 |
+
<mode value="int8_sym" />
|
| 161 |
+
<ratio value="1.0" />
|
| 162 |
+
<scale_estimation value="False" />
|
| 163 |
+
<sensitivity_metric value="weight_quantization_error" />
|
| 164 |
+
</weight_compression>
|
| 165 |
+
</nncf>
|
| 166 |
+
<optimum>
|
| 167 |
+
<optimum_intel_version value="1.22.0.dev0+753f84d" />
|
| 168 |
+
<optimum_version value="1.24.0.dev0" />
|
| 169 |
+
<pytorch_version value="2.5.0+cpu" />
|
| 170 |
+
<transformers_version value="4.45.0" />
|
| 171 |
+
</optimum>
|
| 172 |
+
</rt_info>
|
| 173 |
+
</net>
|
openvino_tokenizer.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c1510cca0328e390459199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>
|
| 2 |
+
<net name="tokenizer" version="11">
|
| 3 |
+
<layers>
|
| 4 |
+
<layer id="0" name="Parameter_1" type="Parameter" version="opset1">
|
| 5 |
+
<data shape="?" element_type="string" />
|
| 6 |
+
<output>
|
| 7 |
+
<port id="0" precision="STRING" names="Parameter_1">
|
| 8 |
+
<dim>-1</dim>
|
| 9 |
+
</port>
|
| 10 |
+
</output>
|
| 11 |
+
</layer>
|
| 12 |
+
<layer id="1" name="Constant_106" 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_107" type="Const" version="opset1">
|
| 19 |
+
<data element_type="i32" shape="" offset="4" size="4" />
|
| 20 |
+
<output>
|
| 21 |
+
<port id="0" precision="I32" />
|
| 22 |
+
</output>
|
| 23 |
+
</layer>
|
| 24 |
+
<layer id="3" name="Constant_108" type="Const" version="opset1">
|
| 25 |
+
<data element_type="i32" shape="1" offset="4" size="4" />
|
| 26 |
+
<output>
|
| 27 |
+
<port id="0" precision="I32">
|
| 28 |
+
<dim>1</dim>
|
| 29 |
+
</port>
|
| 30 |
+
</output>
|
| 31 |
+
</layer>
|
| 32 |
+
<layer id="4" name="Constant_7" type="Const" version="opset1">
|
| 33 |
+
<data element_type="i64" shape="" offset="8" size="8" />
|
| 34 |
+
<output>
|
| 35 |
+
<port id="0" precision="I64" />
|
| 36 |
+
</output>
|
| 37 |
+
</layer>
|
| 38 |
+
<layer id="5" name="StringTensorUnpack_2" type="StringTensorUnpack" version="extension">
|
| 39 |
+
<data mode="begins_ends" />
|
| 40 |
+
<input>
|
| 41 |
+
<port id="0" precision="STRING">
|
| 42 |
+
<dim>-1</dim>
|
| 43 |
+
</port>
|
| 44 |
+
</input>
|
| 45 |
+
<output>
|
| 46 |
+
<port id="1" precision="I32">
|
| 47 |
+
<dim>-1</dim>
|
| 48 |
+
</port>
|
| 49 |
+
<port id="2" precision="I32">
|
| 50 |
+
<dim>-1</dim>
|
| 51 |
+
</port>
|
| 52 |
+
<port id="3" precision="U8">
|
| 53 |
+
<dim>-1</dim>
|
| 54 |
+
</port>
|
| 55 |
+
</output>
|
| 56 |
+
</layer>
|
| 57 |
+
<layer id="6" name="ShapeOf_3" type="ShapeOf" version="opset3">
|
| 58 |
+
<data output_type="i64" />
|
| 59 |
+
<input>
|
| 60 |
+
<port id="0" precision="I32">
|
| 61 |
+
<dim>-1</dim>
|
| 62 |
+
</port>
|
| 63 |
+
</input>
|
| 64 |
+
<output>
|
| 65 |
+
<port id="1" precision="I64">
|
| 66 |
+
<dim>1</dim>
|
| 67 |
+
</port>
|
| 68 |
+
</output>
|
| 69 |
+
</layer>
|
| 70 |
+
<layer id="7" name="Constant_4" type="Const" version="opset1">
|
| 71 |
+
<data element_type="i64" shape="" offset="8" size="8" />
|
| 72 |
+
<output>
|
| 73 |
+
<port id="0" precision="I64" />
|
| 74 |
+
</output>
|
| 75 |
+
</layer>
|
| 76 |
+
<layer id="8" name="Constant_5" type="Const" version="opset1">
|
| 77 |
+
<data element_type="i64" shape="" offset="8" size="8" />
|
| 78 |
+
<output>
|
| 79 |
+
<port id="0" precision="I64" />
|
| 80 |
+
</output>
|
| 81 |
+
</layer>
|
| 82 |
+
<layer id="9" name="Gather_6" type="Gather" version="opset8">
|
| 83 |
+
<data batch_dims="0" />
|
| 84 |
+
<input>
|
| 85 |
+
<port id="0" precision="I64">
|
| 86 |
+
<dim>1</dim>
|
| 87 |
+
</port>
|
| 88 |
+
<port id="1" precision="I64" />
|
| 89 |
+
<port id="2" precision="I64" />
|
| 90 |
+
</input>
|
| 91 |
+
<output>
|
| 92 |
+
<port id="3" precision="I64" />
|
| 93 |
+
</output>
|
| 94 |
+
</layer>
|
| 95 |
+
<layer id="10" name="Constant_8" type="Const" version="opset1">
|
| 96 |
+
<data element_type="i64" shape="" offset="16" size="8" />
|
| 97 |
+
<output>
|
| 98 |
+
<port id="0" precision="I64" />
|
| 99 |
+
</output>
|
| 100 |
+
</layer>
|
| 101 |
+
<layer id="11" name="Range_9" type="Range" version="opset4">
|
| 102 |
+
<data output_type="i32" />
|
| 103 |
+
<input>
|
| 104 |
+
<port id="0" precision="I64" />
|
| 105 |
+
<port id="1" precision="I64" />
|
| 106 |
+
<port id="2" precision="I64" />
|
| 107 |
+
</input>
|
| 108 |
+
<output>
|
| 109 |
+
<port id="3" precision="I32">
|
| 110 |
+
<dim>-1</dim>
|
| 111 |
+
</port>
|
| 112 |
+
</output>
|
| 113 |
+
</layer>
|
| 114 |
+
<layer id="12" name="Constant_10" type="Const" version="opset1">
|
| 115 |
+
<data element_type="i64" shape="" offset="16" size="8" />
|
| 116 |
+
<output>
|
| 117 |
+
<port id="0" precision="I64" />
|
| 118 |
+
</output>
|
| 119 |
+
</layer>
|
| 120 |
+
<layer id="13" name="Constant_11" type="Const" version="opset1">
|
| 121 |
+
<data element_type="i64" shape="" offset="16" size="8" />
|
| 122 |
+
<output>
|
| 123 |
+
<port id="0" precision="I64" />
|
| 124 |
+
</output>
|
| 125 |
+
</layer>
|
| 126 |
+
<layer id="14" name="Add_12" type="Add" version="opset1">
|
| 127 |
+
<data auto_broadcast="numpy" />
|
| 128 |
+
<input>
|
| 129 |
+
<port id="0" precision="I64" />
|
| 130 |
+
<port id="1" precision="I64" />
|
| 131 |
+
</input>
|
| 132 |
+
<output>
|
| 133 |
+
<port id="2" precision="I64" />
|
| 134 |
+
</output>
|
| 135 |
+
</layer>
|
| 136 |
+
<layer id="15" name="Constant_13" type="Const" version="opset1">
|
| 137 |
+
<data element_type="i64" shape="" offset="16" size="8" />
|
| 138 |
+
<output>
|
| 139 |
+
<port id="0" precision="I64" />
|
| 140 |
+
</output>
|
| 141 |
+
</layer>
|
| 142 |
+
<layer id="16" name="Range_14" type="Range" version="opset4">
|
| 143 |
+
<data output_type="i32" />
|
| 144 |
+
<input>
|
| 145 |
+
<port id="0" precision="I64" />
|
| 146 |
+
<port id="1" precision="I64" />
|
| 147 |
+
<port id="2" precision="I64" />
|
| 148 |
+
</input>
|
| 149 |
+
<output>
|
| 150 |
+
<port id="3" precision="I32">
|
| 151 |
+
<dim>-1</dim>
|
| 152 |
+
</port>
|
| 153 |
+
</output>
|
| 154 |
+
</layer>
|
| 155 |
+
<layer id="17" name="Constant_76" type="Const" version="opset1">
|
| 156 |
+
<data element_type="u8" shape="1350" offset="24" size="1350" />
|
| 157 |
+
<output>
|
| 158 |
+
<port id="0" precision="U8">
|
| 159 |
+
<dim>1350</dim>
|
| 160 |
+
</port>
|
| 161 |
+
</output>
|
| 162 |
+
</layer>
|
| 163 |
+
<layer id="18" name="SpecialTokensSplit_77" type="SpecialTokensSplit" version="extension">
|
| 164 |
+
<input>
|
| 165 |
+
<port id="0" precision="I32">
|
| 166 |
+
<dim>-1</dim>
|
| 167 |
+
</port>
|
| 168 |
+
<port id="1" precision="I32">
|
| 169 |
+
<dim>-1</dim>
|
| 170 |
+
</port>
|
| 171 |
+
<port id="2" precision="I32">
|
| 172 |
+
<dim>-1</dim>
|
| 173 |
+
</port>
|
| 174 |
+
<port id="3" precision="I32">
|
| 175 |
+
<dim>-1</dim>
|
| 176 |
+
</port>
|
| 177 |
+
<port id="4" precision="U8">
|
| 178 |
+
<dim>-1</dim>
|
| 179 |
+
</port>
|
| 180 |
+
<port id="5" precision="U8">
|
| 181 |
+
<dim>1350</dim>
|
| 182 |
+
</port>
|
| 183 |
+
</input>
|
| 184 |
+
<output>
|
| 185 |
+
<port id="6" precision="I32">
|
| 186 |
+
<dim>-1</dim>
|
| 187 |
+
</port>
|
| 188 |
+
<port id="7" precision="I32">
|
| 189 |
+
<dim>-1</dim>
|
| 190 |
+
</port>
|
| 191 |
+
<port id="8" precision="I32">
|
| 192 |
+
<dim>-1</dim>
|
| 193 |
+
</port>
|
| 194 |
+
<port id="9" precision="I32">
|
| 195 |
+
<dim>-1</dim>
|
| 196 |
+
</port>
|
| 197 |
+
<port id="10" precision="U8">
|
| 198 |
+
<dim>-1</dim>
|
| 199 |
+
</port>
|
| 200 |
+
<port id="11" precision="BOOL">
|
| 201 |
+
<dim>-1</dim>
|
| 202 |
+
</port>
|
| 203 |
+
</output>
|
| 204 |
+
</layer>
|
| 205 |
+
<layer id="19" name="Constant_79" type="Const" version="opset1">
|
| 206 |
+
<data element_type="u8" shape="13" offset="1374" size="13" />
|
| 207 |
+
<output>
|
| 208 |
+
<port id="0" precision="U8">
|
| 209 |
+
<dim>13</dim>
|
| 210 |
+
</port>
|
| 211 |
+
</output>
|
| 212 |
+
</layer>
|
| 213 |
+
<layer id="20" name="Constant_81" type="Const" version="opset1">
|
| 214 |
+
<data element_type="u8" shape="5" offset="1387" size="5" />
|
| 215 |
+
<output>
|
| 216 |
+
<port id="0" precision="U8">
|
| 217 |
+
<dim>5</dim>
|
| 218 |
+
</port>
|
| 219 |
+
</output>
|
| 220 |
+
</layer>
|
| 221 |
+
<layer id="21" name="RegexNormalization_82" type="RegexNormalization" version="extension">
|
| 222 |
+
<data global_replace="true" />
|
| 223 |
+
<input>
|
| 224 |
+
<port id="0" precision="I32">
|
| 225 |
+
<dim>-1</dim>
|
| 226 |
+
</port>
|
| 227 |
+
<port id="1" precision="I32">
|
| 228 |
+
<dim>-1</dim>
|
| 229 |
+
</port>
|
| 230 |
+
<port id="2" precision="U8">
|
| 231 |
+
<dim>-1</dim>
|
| 232 |
+
</port>
|
| 233 |
+
<port id="3" precision="BOOL">
|
| 234 |
+
<dim>-1</dim>
|
| 235 |
+
</port>
|
| 236 |
+
<port id="4" precision="U8">
|
| 237 |
+
<dim>13</dim>
|
| 238 |
+
</port>
|
| 239 |
+
<port id="5" precision="U8">
|
| 240 |
+
<dim>5</dim>
|
| 241 |
+
</port>
|
| 242 |
+
</input>
|
| 243 |
+
<output>
|
| 244 |
+
<port id="6" precision="I32">
|
| 245 |
+
<dim>-1</dim>
|
| 246 |
+
</port>
|
| 247 |
+
<port id="7" precision="I32">
|
| 248 |
+
<dim>-1</dim>
|
| 249 |
+
</port>
|
| 250 |
+
<port id="8" precision="U8">
|
| 251 |
+
<dim>-1</dim>
|
| 252 |
+
</port>
|
| 253 |
+
<port id="9" precision="BOOL">
|
| 254 |
+
<dim>-1</dim>
|
| 255 |
+
</port>
|
| 256 |
+
</output>
|
| 257 |
+
</layer>
|
| 258 |
+
<layer id="22" name="Constant_84" type="Const" version="opset1">
|
| 259 |
+
<data element_type="u8" shape="1" offset="1392" size="1" />
|
| 260 |
+
<output>
|
| 261 |
+
<port id="0" precision="U8">
|
| 262 |
+
<dim>1</dim>
|
| 263 |
+
</port>
|
| 264 |
+
</output>
|
| 265 |
+
</layer>
|
| 266 |
+
<layer id="23" name="Constant_86" type="Const" version="opset1">
|
| 267 |
+
<data element_type="u8" shape="3" offset="1393" size="3" />
|
| 268 |
+
<output>
|
| 269 |
+
<port id="0" precision="U8">
|
| 270 |
+
<dim>3</dim>
|
| 271 |
+
</port>
|
| 272 |
+
</output>
|
| 273 |
+
</layer>
|
| 274 |
+
<layer id="24" name="RegexNormalization_87" type="RegexNormalization" version="extension">
|
| 275 |
+
<data global_replace="true" />
|
| 276 |
+
<input>
|
| 277 |
+
<port id="0" precision="I32">
|
| 278 |
+
<dim>-1</dim>
|
| 279 |
+
</port>
|
| 280 |
+
<port id="1" precision="I32">
|
| 281 |
+
<dim>-1</dim>
|
| 282 |
+
</port>
|
| 283 |
+
<port id="2" precision="U8">
|
| 284 |
+
<dim>-1</dim>
|
| 285 |
+
</port>
|
| 286 |
+
<port id="3" precision="BOOL">
|
| 287 |
+
<dim>-1</dim>
|
| 288 |
+
</port>
|
| 289 |
+
<port id="4" precision="U8">
|
| 290 |
+
<dim>1</dim>
|
| 291 |
+
</port>
|
| 292 |
+
<port id="5" precision="U8">
|
| 293 |
+
<dim>3</dim>
|
| 294 |
+
</port>
|
| 295 |
+
</input>
|
| 296 |
+
<output>
|
| 297 |
+
<port id="6" precision="I32">
|
| 298 |
+
<dim>-1</dim>
|
| 299 |
+
</port>
|
| 300 |
+
<port id="7" precision="I32">
|
| 301 |
+
<dim>-1</dim>
|
| 302 |
+
</port>
|
| 303 |
+
<port id="8" precision="U8">
|
| 304 |
+
<dim>-1</dim>
|
| 305 |
+
</port>
|
| 306 |
+
<port id="9" precision="BOOL">
|
| 307 |
+
<dim>-1</dim>
|
| 308 |
+
</port>
|
| 309 |
+
</output>
|
| 310 |
+
</layer>
|
| 311 |
+
<layer id="25" name="Constant_89" type="Const" version="opset1">
|
| 312 |
+
<data element_type="u8" shape="339905" offset="1396" size="339905" />
|
| 313 |
+
<output>
|
| 314 |
+
<port id="0" precision="U8">
|
| 315 |
+
<dim>339905</dim>
|
| 316 |
+
</port>
|
| 317 |
+
</output>
|
| 318 |
+
</layer>
|
| 319 |
+
<layer id="26" name="StringTensorUnpack_90" type="StringTensorUnpack" version="extension">
|
| 320 |
+
<data mode="begins_ends" />
|
| 321 |
+
<input>
|
| 322 |
+
<port id="0" precision="U8">
|
| 323 |
+
<dim>339905</dim>
|
| 324 |
+
</port>
|
| 325 |
+
</input>
|
| 326 |
+
<output>
|
| 327 |
+
<port id="1" precision="I32">
|
| 328 |
+
<dim>-1</dim>
|
| 329 |
+
</port>
|
| 330 |
+
<port id="2" precision="I32">
|
| 331 |
+
<dim>-1</dim>
|
| 332 |
+
</port>
|
| 333 |
+
<port id="3" precision="U8">
|
| 334 |
+
<dim>-1</dim>
|
| 335 |
+
</port>
|
| 336 |
+
</output>
|
| 337 |
+
</layer>
|
| 338 |
+
<layer id="27" name="Constant_95" type="Const" version="opset1">
|
| 339 |
+
<data element_type="u8" shape="499127" offset="341301" size="499127" />
|
| 340 |
+
<output>
|
| 341 |
+
<port id="0" precision="U8">
|
| 342 |
+
<dim>499127</dim>
|
| 343 |
+
</port>
|
| 344 |
+
</output>
|
| 345 |
+
</layer>
|
| 346 |
+
<layer id="28" name="StringTensorUnpack_96" type="StringTensorUnpack" version="extension">
|
| 347 |
+
<data mode="begins_ends" />
|
| 348 |
+
<input>
|
| 349 |
+
<port id="0" precision="U8">
|
| 350 |
+
<dim>499127</dim>
|
| 351 |
+
</port>
|
| 352 |
+
</input>
|
| 353 |
+
<output>
|
| 354 |
+
<port id="1" precision="I32">
|
| 355 |
+
<dim>-1</dim>
|
| 356 |
+
</port>
|
| 357 |
+
<port id="2" precision="I32">
|
| 358 |
+
<dim>-1</dim>
|
| 359 |
+
</port>
|
| 360 |
+
<port id="3" precision="U8">
|
| 361 |
+
<dim>-1</dim>
|
| 362 |
+
</port>
|
| 363 |
+
</output>
|
| 364 |
+
</layer>
|
| 365 |
+
<layer id="29" name="Constant_98" type="Const" version="opset1">
|
| 366 |
+
<data element_type="u8" shape="412810" offset="840428" size="412810" />
|
| 367 |
+
<output>
|
| 368 |
+
<port id="0" precision="U8">
|
| 369 |
+
<dim>412810</dim>
|
| 370 |
+
</port>
|
| 371 |
+
</output>
|
| 372 |
+
</layer>
|
| 373 |
+
<layer id="30" name="StringTensorUnpack_99" type="StringTensorUnpack" version="extension">
|
| 374 |
+
<data mode="begins_ends" />
|
| 375 |
+
<input>
|
| 376 |
+
<port id="0" precision="U8">
|
| 377 |
+
<dim>412810</dim>
|
| 378 |
+
</port>
|
| 379 |
+
</input>
|
| 380 |
+
<output>
|
| 381 |
+
<port id="1" precision="I32">
|
| 382 |
+
<dim>-1</dim>
|
| 383 |
+
</port>
|
| 384 |
+
<port id="2" precision="I32">
|
| 385 |
+
<dim>-1</dim>
|
| 386 |
+
</port>
|
| 387 |
+
<port id="3" precision="U8">
|
| 388 |
+
<dim>-1</dim>
|
| 389 |
+
</port>
|
| 390 |
+
</output>
|
| 391 |
+
</layer>
|
| 392 |
+
<layer id="31" name="Constant_92" type="Const" version="opset1">
|
| 393 |
+
<data element_type="u8" shape="39809" offset="1253238" size="39809" />
|
| 394 |
+
<output>
|
| 395 |
+
<port id="0" precision="U8">
|
| 396 |
+
<dim>39809</dim>
|
| 397 |
+
</port>
|
| 398 |
+
</output>
|
| 399 |
+
</layer>
|
| 400 |
+
<layer id="32" name="StringTensorUnpack_93" type="StringTensorUnpack" version="extension">
|
| 401 |
+
<data mode="begins_ends" />
|
| 402 |
+
<input>
|
| 403 |
+
<port id="0" precision="U8">
|
| 404 |
+
<dim>39809</dim>
|
| 405 |
+
</port>
|
| 406 |
+
</input>
|
| 407 |
+
<output>
|
| 408 |
+
<port id="1" precision="I32">
|
| 409 |
+
<dim>-1</dim>
|
| 410 |
+
</port>
|
| 411 |
+
<port id="2" precision="I32">
|
| 412 |
+
<dim>-1</dim>
|
| 413 |
+
</port>
|
| 414 |
+
<port id="3" precision="U8">
|
| 415 |
+
<dim>-1</dim>
|
| 416 |
+
</port>
|
| 417 |
+
</output>
|
| 418 |
+
</layer>
|
| 419 |
+
<layer id="33" name="Constant_100" type="Const" version="opset1">
|
| 420 |
+
<data element_type="i32" shape="1811" offset="1293047" size="7244" />
|
| 421 |
+
<output>
|
| 422 |
+
<port id="0" precision="I32">
|
| 423 |
+
<dim>1811</dim>
|
| 424 |
+
</port>
|
| 425 |
+
</output>
|
| 426 |
+
</layer>
|
| 427 |
+
<layer id="34" name="BPETokenizer_101" type="BPETokenizer" version="extension">
|
| 428 |
+
<data unk_token="<unk>" fuse_unk="true" suffix_indicator="" end_suffix="" byte_fallback="true" cache_capacity="20000" />
|
| 429 |
+
<input>
|
| 430 |
+
<port id="0" precision="I32">
|
| 431 |
+
<dim>-1</dim>
|
| 432 |
+
</port>
|
| 433 |
+
<port id="1" precision="I32">
|
| 434 |
+
<dim>-1</dim>
|
| 435 |
+
</port>
|
| 436 |
+
<port id="2" precision="I32">
|
| 437 |
+
<dim>-1</dim>
|
| 438 |
+
</port>
|
| 439 |
+
<port id="3" precision="I32">
|
| 440 |
+
<dim>-1</dim>
|
| 441 |
+
</port>
|
| 442 |
+
<port id="4" precision="U8">
|
| 443 |
+
<dim>-1</dim>
|
| 444 |
+
</port>
|
| 445 |
+
<port id="5" precision="I32">
|
| 446 |
+
<dim>-1</dim>
|
| 447 |
+
</port>
|
| 448 |
+
<port id="6" precision="I32">
|
| 449 |
+
<dim>-1</dim>
|
| 450 |
+
</port>
|
| 451 |
+
<port id="7" precision="U8">
|
| 452 |
+
<dim>-1</dim>
|
| 453 |
+
</port>
|
| 454 |
+
<port id="8" precision="I32">
|
| 455 |
+
<dim>-1</dim>
|
| 456 |
+
</port>
|
| 457 |
+
<port id="9" precision="I32">
|
| 458 |
+
<dim>-1</dim>
|
| 459 |
+
</port>
|
| 460 |
+
<port id="10" precision="U8">
|
| 461 |
+
<dim>-1</dim>
|
| 462 |
+
</port>
|
| 463 |
+
<port id="11" precision="I32">
|
| 464 |
+
<dim>-1</dim>
|
| 465 |
+
</port>
|
| 466 |
+
<port id="12" precision="I32">
|
| 467 |
+
<dim>-1</dim>
|
| 468 |
+
</port>
|
| 469 |
+
<port id="13" precision="U8">
|
| 470 |
+
<dim>-1</dim>
|
| 471 |
+
</port>
|
| 472 |
+
<port id="14" precision="I32">
|
| 473 |
+
<dim>-1</dim>
|
| 474 |
+
</port>
|
| 475 |
+
<port id="15" precision="I32">
|
| 476 |
+
<dim>-1</dim>
|
| 477 |
+
</port>
|
| 478 |
+
<port id="16" precision="U8">
|
| 479 |
+
<dim>-1</dim>
|
| 480 |
+
</port>
|
| 481 |
+
<port id="17" precision="I32">
|
| 482 |
+
<dim>1811</dim>
|
| 483 |
+
</port>
|
| 484 |
+
</input>
|
| 485 |
+
<output>
|
| 486 |
+
<port id="18" precision="I32">
|
| 487 |
+
<dim>-1</dim>
|
| 488 |
+
</port>
|
| 489 |
+
<port id="19" precision="I32">
|
| 490 |
+
<dim>-1</dim>
|
| 491 |
+
</port>
|
| 492 |
+
<port id="20" precision="I32">
|
| 493 |
+
<dim>-1</dim>
|
| 494 |
+
</port>
|
| 495 |
+
</output>
|
| 496 |
+
</layer>
|
| 497 |
+
<layer id="35" name="Subtract_102" type="Subtract" version="opset1">
|
| 498 |
+
<data auto_broadcast="numpy" />
|
| 499 |
+
<input>
|
| 500 |
+
<port id="0" precision="I32">
|
| 501 |
+
<dim>-1</dim>
|
| 502 |
+
</port>
|
| 503 |
+
<port id="1" precision="I32">
|
| 504 |
+
<dim>-1</dim>
|
| 505 |
+
</port>
|
| 506 |
+
</input>
|
| 507 |
+
<output>
|
| 508 |
+
<port id="2" precision="I32">
|
| 509 |
+
<dim>-1</dim>
|
| 510 |
+
</port>
|
| 511 |
+
</output>
|
| 512 |
+
</layer>
|
| 513 |
+
<layer id="36" name="Constant_103" type="Const" version="opset1">
|
| 514 |
+
<data element_type="i32" shape="" offset="1300291" size="4" />
|
| 515 |
+
<output>
|
| 516 |
+
<port id="0" precision="I32" />
|
| 517 |
+
</output>
|
| 518 |
+
</layer>
|
| 519 |
+
<layer id="37" name="Minimum_104" type="Minimum" version="opset1">
|
| 520 |
+
<data auto_broadcast="numpy" />
|
| 521 |
+
<input>
|
| 522 |
+
<port id="0" precision="I32">
|
| 523 |
+
<dim>-1</dim>
|
| 524 |
+
</port>
|
| 525 |
+
<port id="1" precision="I32" />
|
| 526 |
+
</input>
|
| 527 |
+
<output>
|
| 528 |
+
<port id="2" precision="I32">
|
| 529 |
+
<dim>-1</dim>
|
| 530 |
+
</port>
|
| 531 |
+
</output>
|
| 532 |
+
</layer>
|
| 533 |
+
<layer id="38" name="Add_105" type="Add" version="opset1">
|
| 534 |
+
<data auto_broadcast="numpy" />
|
| 535 |
+
<input>
|
| 536 |
+
<port id="0" precision="I32">
|
| 537 |
+
<dim>-1</dim>
|
| 538 |
+
</port>
|
| 539 |
+
<port id="1" precision="I32">
|
| 540 |
+
<dim>-1</dim>
|
| 541 |
+
</port>
|
| 542 |
+
</input>
|
| 543 |
+
<output>
|
| 544 |
+
<port id="2" precision="I32">
|
| 545 |
+
<dim>-1</dim>
|
| 546 |
+
</port>
|
| 547 |
+
</output>
|
| 548 |
+
</layer>
|
| 549 |
+
<layer id="39" name="Constant_109" type="Const" version="opset1">
|
| 550 |
+
<data element_type="i32" shape="2" offset="8" size="8" />
|
| 551 |
+
<output>
|
| 552 |
+
<port id="0" precision="I32">
|
| 553 |
+
<dim>2</dim>
|
| 554 |
+
</port>
|
| 555 |
+
</output>
|
| 556 |
+
</layer>
|
| 557 |
+
<layer id="40" name="CombineSegments_110" type="CombineSegments" version="extension">
|
| 558 |
+
<input>
|
| 559 |
+
<port id="0" precision="I32" />
|
| 560 |
+
<port id="1" precision="I32" />
|
| 561 |
+
<port id="2" precision="I32">
|
| 562 |
+
<dim>1</dim>
|
| 563 |
+
</port>
|
| 564 |
+
<port id="3" precision="I32">
|
| 565 |
+
<dim>-1</dim>
|
| 566 |
+
</port>
|
| 567 |
+
<port id="4" precision="I32">
|
| 568 |
+
<dim>-1</dim>
|
| 569 |
+
</port>
|
| 570 |
+
<port id="5" precision="I32">
|
| 571 |
+
<dim>-1</dim>
|
| 572 |
+
</port>
|
| 573 |
+
<port id="6" precision="I32">
|
| 574 |
+
<dim>2</dim>
|
| 575 |
+
</port>
|
| 576 |
+
</input>
|
| 577 |
+
<output>
|
| 578 |
+
<port id="7" precision="I32">
|
| 579 |
+
<dim>-1</dim>
|
| 580 |
+
</port>
|
| 581 |
+
<port id="8" precision="I32">
|
| 582 |
+
<dim>-1</dim>
|
| 583 |
+
</port>
|
| 584 |
+
<port id="9" precision="I32">
|
| 585 |
+
<dim>-1</dim>
|
| 586 |
+
</port>
|
| 587 |
+
<port id="10" precision="I32">
|
| 588 |
+
<dim>-1</dim>
|
| 589 |
+
</port>
|
| 590 |
+
<port id="11" precision="I32">
|
| 591 |
+
<dim>-1</dim>
|
| 592 |
+
</port>
|
| 593 |
+
<port id="12" precision="I32">
|
| 594 |
+
<dim>-1</dim>
|
| 595 |
+
</port>
|
| 596 |
+
</output>
|
| 597 |
+
</layer>
|
| 598 |
+
<layer id="41" name="Subtract_111" type="Subtract" version="opset1">
|
| 599 |
+
<data auto_broadcast="numpy" />
|
| 600 |
+
<input>
|
| 601 |
+
<port id="0" precision="I32">
|
| 602 |
+
<dim>-1</dim>
|
| 603 |
+
</port>
|
| 604 |
+
<port id="1" precision="I32">
|
| 605 |
+
<dim>-1</dim>
|
| 606 |
+
</port>
|
| 607 |
+
</input>
|
| 608 |
+
<output>
|
| 609 |
+
<port id="2" precision="I32">
|
| 610 |
+
<dim>-1</dim>
|
| 611 |
+
</port>
|
| 612 |
+
</output>
|
| 613 |
+
</layer>
|
| 614 |
+
<layer id="42" name="Constant_112" type="Const" version="opset1">
|
| 615 |
+
<data element_type="i32" shape="" offset="0" size="4" />
|
| 616 |
+
<output>
|
| 617 |
+
<port id="0" precision="I32" />
|
| 618 |
+
</output>
|
| 619 |
+
</layer>
|
| 620 |
+
<layer id="43" name="ReduceMax_113" type="ReduceMax" version="opset1">
|
| 621 |
+
<data keep_dims="false" />
|
| 622 |
+
<input>
|
| 623 |
+
<port id="0" precision="I32">
|
| 624 |
+
<dim>-1</dim>
|
| 625 |
+
</port>
|
| 626 |
+
<port id="1" precision="I32" />
|
| 627 |
+
</input>
|
| 628 |
+
<output>
|
| 629 |
+
<port id="2" precision="I32" />
|
| 630 |
+
</output>
|
| 631 |
+
</layer>
|
| 632 |
+
<layer id="44" name="Constant_114" type="Const" version="opset1">
|
| 633 |
+
<data element_type="i32" shape="" offset="1300295" size="4" />
|
| 634 |
+
<output>
|
| 635 |
+
<port id="0" precision="I32" />
|
| 636 |
+
</output>
|
| 637 |
+
</layer>
|
| 638 |
+
<layer id="45" name="RaggedToDense_115" type="RaggedToDense" version="extension">
|
| 639 |
+
<data pad_right="true" />
|
| 640 |
+
<input>
|
| 641 |
+
<port id="0" precision="I32">
|
| 642 |
+
<dim>-1</dim>
|
| 643 |
+
</port>
|
| 644 |
+
<port id="1" precision="I32">
|
| 645 |
+
<dim>-1</dim>
|
| 646 |
+
</port>
|
| 647 |
+
<port id="2" precision="I32">
|
| 648 |
+
<dim>-1</dim>
|
| 649 |
+
</port>
|
| 650 |
+
<port id="3" precision="I32" />
|
| 651 |
+
<port id="4" precision="I32" />
|
| 652 |
+
</input>
|
| 653 |
+
<output>
|
| 654 |
+
<port id="5" precision="I32">
|
| 655 |
+
<dim>-1</dim>
|
| 656 |
+
<dim>-1</dim>
|
| 657 |
+
</port>
|
| 658 |
+
<port id="6" precision="BOOL">
|
| 659 |
+
<dim>-1</dim>
|
| 660 |
+
<dim>-1</dim>
|
| 661 |
+
</port>
|
| 662 |
+
</output>
|
| 663 |
+
</layer>
|
| 664 |
+
<layer id="46" name="Convert_116" type="Convert" version="opset1">
|
| 665 |
+
<data destination_type="i32" />
|
| 666 |
+
<input>
|
| 667 |
+
<port id="0" precision="BOOL">
|
| 668 |
+
<dim>-1</dim>
|
| 669 |
+
<dim>-1</dim>
|
| 670 |
+
</port>
|
| 671 |
+
</input>
|
| 672 |
+
<output>
|
| 673 |
+
<port id="1" precision="I32">
|
| 674 |
+
<dim>-1</dim>
|
| 675 |
+
<dim>-1</dim>
|
| 676 |
+
</port>
|
| 677 |
+
</output>
|
| 678 |
+
</layer>
|
| 679 |
+
<layer id="47" name="Convert_116.0" type="Convert" version="opset1">
|
| 680 |
+
<data destination_type="i64" />
|
| 681 |
+
<input>
|
| 682 |
+
<port id="0" precision="I32">
|
| 683 |
+
<dim>-1</dim>
|
| 684 |
+
<dim>-1</dim>
|
| 685 |
+
</port>
|
| 686 |
+
</input>
|
| 687 |
+
<output>
|
| 688 |
+
<port id="1" precision="I64" names="attention_mask">
|
| 689 |
+
<dim>-1</dim>
|
| 690 |
+
<dim>-1</dim>
|
| 691 |
+
</port>
|
| 692 |
+
</output>
|
| 693 |
+
</layer>
|
| 694 |
+
<layer id="49" name="RaggedToDense_115.0" type="Convert" version="opset1">
|
| 695 |
+
<data destination_type="i64" />
|
| 696 |
+
<input>
|
| 697 |
+
<port id="0" precision="I32">
|
| 698 |
+
<dim>-1</dim>
|
| 699 |
+
<dim>-1</dim>
|
| 700 |
+
</port>
|
| 701 |
+
</input>
|
| 702 |
+
<output>
|
| 703 |
+
<port id="1" precision="I64" names="input_ids">
|
| 704 |
+
<dim>-1</dim>
|
| 705 |
+
<dim>-1</dim>
|
| 706 |
+
</port>
|
| 707 |
+
</output>
|
| 708 |
+
</layer>
|
| 709 |
+
<layer id="50" name="Result_119" type="Result" version="opset1">
|
| 710 |
+
<input>
|
| 711 |
+
<port id="0" precision="I64">
|
| 712 |
+
<dim>-1</dim>
|
| 713 |
+
<dim>-1</dim>
|
| 714 |
+
</port>
|
| 715 |
+
</input>
|
| 716 |
+
</layer>
|
| 717 |
+
<layer id="48" name="Result_121" type="Result" version="opset1">
|
| 718 |
+
<input>
|
| 719 |
+
<port id="0" precision="I64">
|
| 720 |
+
<dim>-1</dim>
|
| 721 |
+
<dim>-1</dim>
|
| 722 |
+
</port>
|
| 723 |
+
</input>
|
| 724 |
+
</layer>
|
| 725 |
+
</layers>
|
| 726 |
+
<edges>
|
| 727 |
+
<edge from-layer="0" from-port="0" to-layer="5" to-port="0" />
|
| 728 |
+
<edge from-layer="1" from-port="0" to-layer="40" to-port="0" />
|
| 729 |
+
<edge from-layer="2" from-port="0" to-layer="40" to-port="1" />
|
| 730 |
+
<edge from-layer="3" from-port="0" to-layer="40" to-port="2" />
|
| 731 |
+
<edge from-layer="4" from-port="0" to-layer="11" to-port="0" />
|
| 732 |
+
<edge from-layer="5" from-port="1" to-layer="6" to-port="0" />
|
| 733 |
+
<edge from-layer="5" from-port="3" to-layer="18" to-port="4" />
|
| 734 |
+
<edge from-layer="5" from-port="2" to-layer="18" to-port="3" />
|
| 735 |
+
<edge from-layer="5" from-port="1" to-layer="18" to-port="2" />
|
| 736 |
+
<edge from-layer="6" from-port="1" to-layer="9" to-port="0" />
|
| 737 |
+
<edge from-layer="7" from-port="0" to-layer="9" to-port="1" />
|
| 738 |
+
<edge from-layer="8" from-port="0" to-layer="9" to-port="2" />
|
| 739 |
+
<edge from-layer="9" from-port="3" to-layer="14" to-port="0" />
|
| 740 |
+
<edge from-layer="9" from-port="3" to-layer="11" to-port="1" />
|
| 741 |
+
<edge from-layer="10" from-port="0" to-layer="11" to-port="2" />
|
| 742 |
+
<edge from-layer="11" from-port="3" to-layer="18" to-port="0" />
|
| 743 |
+
<edge from-layer="12" from-port="0" to-layer="16" to-port="0" />
|
| 744 |
+
<edge from-layer="13" from-port="0" to-layer="14" to-port="1" />
|
| 745 |
+
<edge from-layer="14" from-port="2" to-layer="16" to-port="1" />
|
| 746 |
+
<edge from-layer="15" from-port="0" to-layer="16" to-port="2" />
|
| 747 |
+
<edge from-layer="16" from-port="3" to-layer="18" to-port="1" />
|
| 748 |
+
<edge from-layer="17" from-port="0" to-layer="18" to-port="5" />
|
| 749 |
+
<edge from-layer="18" from-port="7" to-layer="34" to-port="1" />
|
| 750 |
+
<edge from-layer="18" from-port="6" to-layer="34" to-port="0" />
|
| 751 |
+
<edge from-layer="18" from-port="10" to-layer="21" to-port="2" />
|
| 752 |
+
<edge from-layer="18" from-port="8" to-layer="21" to-port="0" />
|
| 753 |
+
<edge from-layer="18" from-port="9" to-layer="21" to-port="1" />
|
| 754 |
+
<edge from-layer="18" from-port="11" to-layer="21" to-port="3" />
|
| 755 |
+
<edge from-layer="19" from-port="0" to-layer="21" to-port="4" />
|
| 756 |
+
<edge from-layer="20" from-port="0" to-layer="21" to-port="5" />
|
| 757 |
+
<edge from-layer="21" from-port="7" to-layer="24" to-port="1" />
|
| 758 |
+
<edge from-layer="21" from-port="9" to-layer="24" to-port="3" />
|
| 759 |
+
<edge from-layer="21" from-port="8" to-layer="24" to-port="2" />
|
| 760 |
+
<edge from-layer="21" from-port="6" to-layer="24" to-port="0" />
|
| 761 |
+
<edge from-layer="22" from-port="0" to-layer="24" to-port="4" />
|
| 762 |
+
<edge from-layer="23" from-port="0" to-layer="24" to-port="5" />
|
| 763 |
+
<edge from-layer="24" from-port="6" to-layer="34" to-port="2" />
|
| 764 |
+
<edge from-layer="24" from-port="7" to-layer="34" to-port="3" />
|
| 765 |
+
<edge from-layer="24" from-port="8" to-layer="34" to-port="4" />
|
| 766 |
+
<edge from-layer="25" from-port="0" to-layer="26" to-port="0" />
|
| 767 |
+
<edge from-layer="26" from-port="1" to-layer="34" to-port="5" />
|
| 768 |
+
<edge from-layer="26" from-port="3" to-layer="34" to-port="7" />
|
| 769 |
+
<edge from-layer="26" from-port="2" to-layer="34" to-port="6" />
|
| 770 |
+
<edge from-layer="27" from-port="0" to-layer="28" to-port="0" />
|
| 771 |
+
<edge from-layer="28" from-port="1" to-layer="34" to-port="8" />
|
| 772 |
+
<edge from-layer="28" from-port="3" to-layer="34" to-port="10" />
|
| 773 |
+
<edge from-layer="28" from-port="2" to-layer="34" to-port="9" />
|
| 774 |
+
<edge from-layer="29" from-port="0" to-layer="30" to-port="0" />
|
| 775 |
+
<edge from-layer="30" from-port="1" to-layer="34" to-port="11" />
|
| 776 |
+
<edge from-layer="30" from-port="2" to-layer="34" to-port="12" />
|
| 777 |
+
<edge from-layer="30" from-port="3" to-layer="34" to-port="13" />
|
| 778 |
+
<edge from-layer="31" from-port="0" to-layer="32" to-port="0" />
|
| 779 |
+
<edge from-layer="32" from-port="1" to-layer="34" to-port="14" />
|
| 780 |
+
<edge from-layer="32" from-port="2" to-layer="34" to-port="15" />
|
| 781 |
+
<edge from-layer="32" from-port="3" to-layer="34" to-port="16" />
|
| 782 |
+
<edge from-layer="33" from-port="0" to-layer="34" to-port="17" />
|
| 783 |
+
<edge from-layer="34" from-port="18" to-layer="40" to-port="3" />
|
| 784 |
+
<edge from-layer="34" from-port="20" to-layer="40" to-port="5" />
|
| 785 |
+
<edge from-layer="34" from-port="18" to-layer="38" to-port="0" />
|
| 786 |
+
<edge from-layer="34" from-port="18" to-layer="35" to-port="1" />
|
| 787 |
+
<edge from-layer="34" from-port="19" to-layer="35" to-port="0" />
|
| 788 |
+
<edge from-layer="35" from-port="2" to-layer="37" to-port="0" />
|
| 789 |
+
<edge from-layer="36" from-port="0" to-layer="37" to-port="1" />
|
| 790 |
+
<edge from-layer="37" from-port="2" to-layer="38" to-port="1" />
|
| 791 |
+
<edge from-layer="38" from-port="2" to-layer="40" to-port="4" />
|
| 792 |
+
<edge from-layer="39" from-port="0" to-layer="40" to-port="6" />
|
| 793 |
+
<edge from-layer="40" from-port="8" to-layer="41" to-port="0" />
|
| 794 |
+
<edge from-layer="40" from-port="7" to-layer="41" to-port="1" />
|
| 795 |
+
<edge from-layer="40" from-port="7" to-layer="45" to-port="0" />
|
| 796 |
+
<edge from-layer="40" from-port="8" to-layer="45" to-port="1" />
|
| 797 |
+
<edge from-layer="40" from-port="9" to-layer="45" to-port="2" />
|
| 798 |
+
<edge from-layer="41" from-port="2" to-layer="43" to-port="0" />
|
| 799 |
+
<edge from-layer="42" from-port="0" to-layer="43" to-port="1" />
|
| 800 |
+
<edge from-layer="43" from-port="2" to-layer="45" to-port="3" />
|
| 801 |
+
<edge from-layer="44" from-port="0" to-layer="45" to-port="4" />
|
| 802 |
+
<edge from-layer="45" from-port="6" to-layer="46" to-port="0" />
|
| 803 |
+
<edge from-layer="45" from-port="5" to-layer="49" to-port="0" />
|
| 804 |
+
<edge from-layer="46" from-port="1" to-layer="47" to-port="0" />
|
| 805 |
+
<edge from-layer="47" from-port="1" to-layer="48" to-port="0" />
|
| 806 |
+
<edge from-layer="49" from-port="1" to-layer="50" to-port="0" />
|
| 807 |
+
</edges>
|
| 808 |
+
<rt_info>
|
| 809 |
+
<add_attention_mask value="True" />
|
| 810 |
+
<add_prefix_space />
|
| 811 |
+
<add_special_tokens value="True" />
|
| 812 |
+
<bos_token_id value="1" />
|
| 813 |
+
<chat_template value="{% for message in messages %}{{'<|' + message['role'] + '|>' + ' ' + message['content'] + '<|end|> ' }}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{- '<|assistant|> ' -}}{% endif %}" />
|
| 814 |
+
<clean_up_tokenization_spaces />
|
| 815 |
+
<detokenizer_input_type value="i64" />
|
| 816 |
+
<eos_token_id value="32000" />
|
| 817 |
+
<handle_special_tokens_with_re value="False" />
|
| 818 |
+
<number_of_inputs value="1" />
|
| 819 |
+
<openvino_tokenizers_version value="2025.0.0.0rc2" />
|
| 820 |
+
<openvino_version value="2025.0.0rc2" />
|
| 821 |
+
<original_tokenizer_class value="<class 'transformers.models.llama.tokenization_llama_fast.LlamaTokenizerFast'>" />
|
| 822 |
+
<pad_token_id value="32000" />
|
| 823 |
+
<sentencepiece_version value="0.2.0" />
|
| 824 |
+
<skip_special_tokens value="True" />
|
| 825 |
+
<streaming_detokenizer value="False" />
|
| 826 |
+
<tiktoken_version value="0.8.0" />
|
| 827 |
+
<tokenizer_output_type value="i64" />
|
| 828 |
+
<tokenizers_version value="0.20.1" />
|
| 829 |
+
<transformers_version value="4.45.0" />
|
| 830 |
+
<use_max_padding value="False" />
|
| 831 |
+
<use_sentencepiece_backend value="True" />
|
| 832 |
+
<utf8_replace_mode value="replace" />
|
| 833 |
+
<with_detokenizer value="True" />
|
| 834 |
+
</rt_info>
|
| 835 |
+
</net>
|
openvino_vision_embeddings_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb63340ca7e80ba5789d291b7c1d01888e1a773dd4c77fc9d1507df7ef0ff3d9
|
| 3 |
+
size 294035604
|
openvino_vision_embeddings_model.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
openvino_vision_projection_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:70e6b5f4c4ce54dde0bdd193e7346ef5641c12fcf8370167f14f26ad85f8f60d
|
| 3 |
+
size 22056960
|
openvino_vision_projection_model.xml
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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="?,?,4096" element_type="f32" />
|
| 6 |
+
<output>
|
| 7 |
+
<port id="0" precision="FP32" names="input">
|
| 8 |
+
<dim>-1</dim>
|
| 9 |
+
<dim>-1</dim>
|
| 10 |
+
<dim>4096</dim>
|
| 11 |
+
</port>
|
| 12 |
+
</output>
|
| 13 |
+
</layer>
|
| 14 |
+
<layer id="1" name="self.0.weight" type="Const" version="opset1">
|
| 15 |
+
<data element_type="i8" shape="3072, 4096" offset="0" size="12582912" />
|
| 16 |
+
<output>
|
| 17 |
+
<port id="0" precision="I8">
|
| 18 |
+
<dim>3072</dim>
|
| 19 |
+
<dim>4096</dim>
|
| 20 |
+
</port>
|
| 21 |
+
</output>
|
| 22 |
+
</layer>
|
| 23 |
+
<layer id="2" name="Convert_240046" type="Convert" version="opset1">
|
| 24 |
+
<data destination_type="f16" />
|
| 25 |
+
<input>
|
| 26 |
+
<port id="0" precision="I8">
|
| 27 |
+
<dim>3072</dim>
|
| 28 |
+
<dim>4096</dim>
|
| 29 |
+
</port>
|
| 30 |
+
</input>
|
| 31 |
+
<output>
|
| 32 |
+
<port id="1" precision="FP16">
|
| 33 |
+
<dim>3072</dim>
|
| 34 |
+
<dim>4096</dim>
|
| 35 |
+
</port>
|
| 36 |
+
</output>
|
| 37 |
+
</layer>
|
| 38 |
+
<layer id="3" name="self.0.weight/scale" type="Const" version="opset1">
|
| 39 |
+
<data element_type="f16" shape="3072, 1" offset="12582912" size="6144" />
|
| 40 |
+
<output>
|
| 41 |
+
<port id="0" precision="FP16">
|
| 42 |
+
<dim>3072</dim>
|
| 43 |
+
<dim>1</dim>
|
| 44 |
+
</port>
|
| 45 |
+
</output>
|
| 46 |
+
</layer>
|
| 47 |
+
<layer id="4" name="self.0.weight/fq_weights_1" type="Multiply" version="opset1">
|
| 48 |
+
<data auto_broadcast="numpy" />
|
| 49 |
+
<input>
|
| 50 |
+
<port id="0" precision="FP16">
|
| 51 |
+
<dim>3072</dim>
|
| 52 |
+
<dim>4096</dim>
|
| 53 |
+
</port>
|
| 54 |
+
<port id="1" precision="FP16">
|
| 55 |
+
<dim>3072</dim>
|
| 56 |
+
<dim>1</dim>
|
| 57 |
+
</port>
|
| 58 |
+
</input>
|
| 59 |
+
<output>
|
| 60 |
+
<port id="2" precision="FP16">
|
| 61 |
+
<dim>3072</dim>
|
| 62 |
+
<dim>4096</dim>
|
| 63 |
+
</port>
|
| 64 |
+
</output>
|
| 65 |
+
</layer>
|
| 66 |
+
<layer id="5" name="self.0.weight/fq_weights_1/convert" type="Convert" version="opset1">
|
| 67 |
+
<data destination_type="f32" />
|
| 68 |
+
<input>
|
| 69 |
+
<port id="0" precision="FP16">
|
| 70 |
+
<dim>3072</dim>
|
| 71 |
+
<dim>4096</dim>
|
| 72 |
+
</port>
|
| 73 |
+
</input>
|
| 74 |
+
<output>
|
| 75 |
+
<port id="1" precision="FP32">
|
| 76 |
+
<dim>3072</dim>
|
| 77 |
+
<dim>4096</dim>
|
| 78 |
+
</port>
|
| 79 |
+
</output>
|
| 80 |
+
</layer>
|
| 81 |
+
<layer id="6" name="__module.0/aten::linear/MatMul" type="MatMul" version="opset1">
|
| 82 |
+
<data transpose_a="false" transpose_b="true" />
|
| 83 |
+
<input>
|
| 84 |
+
<port id="0" precision="FP32">
|
| 85 |
+
<dim>-1</dim>
|
| 86 |
+
<dim>-1</dim>
|
| 87 |
+
<dim>4096</dim>
|
| 88 |
+
</port>
|
| 89 |
+
<port id="1" precision="FP32">
|
| 90 |
+
<dim>3072</dim>
|
| 91 |
+
<dim>4096</dim>
|
| 92 |
+
</port>
|
| 93 |
+
</input>
|
| 94 |
+
<output>
|
| 95 |
+
<port id="2" precision="FP32">
|
| 96 |
+
<dim>-1</dim>
|
| 97 |
+
<dim>-1</dim>
|
| 98 |
+
<dim>3072</dim>
|
| 99 |
+
</port>
|
| 100 |
+
</output>
|
| 101 |
+
</layer>
|
| 102 |
+
<layer id="7" name="Constant_110946" type="Const" version="opset1">
|
| 103 |
+
<data element_type="f32" shape="1, 1, 3072" offset="12589056" size="12288" />
|
| 104 |
+
<output>
|
| 105 |
+
<port id="0" precision="FP32">
|
| 106 |
+
<dim>1</dim>
|
| 107 |
+
<dim>1</dim>
|
| 108 |
+
<dim>3072</dim>
|
| 109 |
+
</port>
|
| 110 |
+
</output>
|
| 111 |
+
</layer>
|
| 112 |
+
<layer id="8" name="__module.0/aten::linear/Add" type="Add" version="opset1">
|
| 113 |
+
<data auto_broadcast="numpy" />
|
| 114 |
+
<input>
|
| 115 |
+
<port id="0" precision="FP32">
|
| 116 |
+
<dim>-1</dim>
|
| 117 |
+
<dim>-1</dim>
|
| 118 |
+
<dim>3072</dim>
|
| 119 |
+
</port>
|
| 120 |
+
<port id="1" precision="FP32">
|
| 121 |
+
<dim>1</dim>
|
| 122 |
+
<dim>1</dim>
|
| 123 |
+
<dim>3072</dim>
|
| 124 |
+
</port>
|
| 125 |
+
</input>
|
| 126 |
+
<output>
|
| 127 |
+
<port id="2" precision="FP32" names="11">
|
| 128 |
+
<dim>-1</dim>
|
| 129 |
+
<dim>-1</dim>
|
| 130 |
+
<dim>3072</dim>
|
| 131 |
+
</port>
|
| 132 |
+
</output>
|
| 133 |
+
</layer>
|
| 134 |
+
<layer id="9" name="__module.1/aten::gelu/Gelu" type="Gelu" version="opset7">
|
| 135 |
+
<data approximation_mode="ERF" />
|
| 136 |
+
<input>
|
| 137 |
+
<port id="0" precision="FP32">
|
| 138 |
+
<dim>-1</dim>
|
| 139 |
+
<dim>-1</dim>
|
| 140 |
+
<dim>3072</dim>
|
| 141 |
+
</port>
|
| 142 |
+
</input>
|
| 143 |
+
<output>
|
| 144 |
+
<port id="1" precision="FP32" names="13">
|
| 145 |
+
<dim>-1</dim>
|
| 146 |
+
<dim>-1</dim>
|
| 147 |
+
<dim>3072</dim>
|
| 148 |
+
</port>
|
| 149 |
+
</output>
|
| 150 |
+
</layer>
|
| 151 |
+
<layer id="10" name="self.2.weight" type="Const" version="opset1">
|
| 152 |
+
<data element_type="i8" shape="3072, 3072" offset="12601344" size="9437184" />
|
| 153 |
+
<output>
|
| 154 |
+
<port id="0" precision="I8">
|
| 155 |
+
<dim>3072</dim>
|
| 156 |
+
<dim>3072</dim>
|
| 157 |
+
</port>
|
| 158 |
+
</output>
|
| 159 |
+
</layer>
|
| 160 |
+
<layer id="11" name="Convert_240053" type="Convert" version="opset1">
|
| 161 |
+
<data destination_type="f16" />
|
| 162 |
+
<input>
|
| 163 |
+
<port id="0" precision="I8">
|
| 164 |
+
<dim>3072</dim>
|
| 165 |
+
<dim>3072</dim>
|
| 166 |
+
</port>
|
| 167 |
+
</input>
|
| 168 |
+
<output>
|
| 169 |
+
<port id="1" precision="FP16">
|
| 170 |
+
<dim>3072</dim>
|
| 171 |
+
<dim>3072</dim>
|
| 172 |
+
</port>
|
| 173 |
+
</output>
|
| 174 |
+
</layer>
|
| 175 |
+
<layer id="12" name="self.2.weight/scale" type="Const" version="opset1">
|
| 176 |
+
<data element_type="f16" shape="3072, 1" offset="22038528" size="6144" />
|
| 177 |
+
<output>
|
| 178 |
+
<port id="0" precision="FP16">
|
| 179 |
+
<dim>3072</dim>
|
| 180 |
+
<dim>1</dim>
|
| 181 |
+
</port>
|
| 182 |
+
</output>
|
| 183 |
+
</layer>
|
| 184 |
+
<layer id="13" name="self.2.weight/fq_weights_1" type="Multiply" version="opset1">
|
| 185 |
+
<data auto_broadcast="numpy" />
|
| 186 |
+
<input>
|
| 187 |
+
<port id="0" precision="FP16">
|
| 188 |
+
<dim>3072</dim>
|
| 189 |
+
<dim>3072</dim>
|
| 190 |
+
</port>
|
| 191 |
+
<port id="1" precision="FP16">
|
| 192 |
+
<dim>3072</dim>
|
| 193 |
+
<dim>1</dim>
|
| 194 |
+
</port>
|
| 195 |
+
</input>
|
| 196 |
+
<output>
|
| 197 |
+
<port id="2" precision="FP16">
|
| 198 |
+
<dim>3072</dim>
|
| 199 |
+
<dim>3072</dim>
|
| 200 |
+
</port>
|
| 201 |
+
</output>
|
| 202 |
+
</layer>
|
| 203 |
+
<layer id="14" name="self.2.weight/fq_weights_1/convert" type="Convert" version="opset1">
|
| 204 |
+
<data destination_type="f32" />
|
| 205 |
+
<input>
|
| 206 |
+
<port id="0" precision="FP16">
|
| 207 |
+
<dim>3072</dim>
|
| 208 |
+
<dim>3072</dim>
|
| 209 |
+
</port>
|
| 210 |
+
</input>
|
| 211 |
+
<output>
|
| 212 |
+
<port id="1" precision="FP32">
|
| 213 |
+
<dim>3072</dim>
|
| 214 |
+
<dim>3072</dim>
|
| 215 |
+
</port>
|
| 216 |
+
</output>
|
| 217 |
+
</layer>
|
| 218 |
+
<layer id="15" name="__module.2/aten::linear/MatMul" type="MatMul" version="opset1">
|
| 219 |
+
<data transpose_a="false" transpose_b="true" />
|
| 220 |
+
<input>
|
| 221 |
+
<port id="0" precision="FP32">
|
| 222 |
+
<dim>-1</dim>
|
| 223 |
+
<dim>-1</dim>
|
| 224 |
+
<dim>3072</dim>
|
| 225 |
+
</port>
|
| 226 |
+
<port id="1" precision="FP32">
|
| 227 |
+
<dim>3072</dim>
|
| 228 |
+
<dim>3072</dim>
|
| 229 |
+
</port>
|
| 230 |
+
</input>
|
| 231 |
+
<output>
|
| 232 |
+
<port id="2" precision="FP32">
|
| 233 |
+
<dim>-1</dim>
|
| 234 |
+
<dim>-1</dim>
|
| 235 |
+
<dim>3072</dim>
|
| 236 |
+
</port>
|
| 237 |
+
</output>
|
| 238 |
+
</layer>
|
| 239 |
+
<layer id="16" name="Constant_110947" type="Const" version="opset1">
|
| 240 |
+
<data element_type="f32" shape="1, 1, 3072" offset="22044672" size="12288" />
|
| 241 |
+
<output>
|
| 242 |
+
<port id="0" precision="FP32">
|
| 243 |
+
<dim>1</dim>
|
| 244 |
+
<dim>1</dim>
|
| 245 |
+
<dim>3072</dim>
|
| 246 |
+
</port>
|
| 247 |
+
</output>
|
| 248 |
+
</layer>
|
| 249 |
+
<layer id="17" name="__module.2/aten::linear/Add" type="Add" version="opset1">
|
| 250 |
+
<data auto_broadcast="numpy" />
|
| 251 |
+
<input>
|
| 252 |
+
<port id="0" precision="FP32">
|
| 253 |
+
<dim>-1</dim>
|
| 254 |
+
<dim>-1</dim>
|
| 255 |
+
<dim>3072</dim>
|
| 256 |
+
</port>
|
| 257 |
+
<port id="1" precision="FP32">
|
| 258 |
+
<dim>1</dim>
|
| 259 |
+
<dim>1</dim>
|
| 260 |
+
<dim>3072</dim>
|
| 261 |
+
</port>
|
| 262 |
+
</input>
|
| 263 |
+
<output>
|
| 264 |
+
<port id="2" precision="FP32" names="last_hidden_state">
|
| 265 |
+
<dim>-1</dim>
|
| 266 |
+
<dim>-1</dim>
|
| 267 |
+
<dim>3072</dim>
|
| 268 |
+
</port>
|
| 269 |
+
</output>
|
| 270 |
+
</layer>
|
| 271 |
+
<layer id="18" name="Result_109306" type="Result" version="opset1">
|
| 272 |
+
<input>
|
| 273 |
+
<port id="0" precision="FP32">
|
| 274 |
+
<dim>-1</dim>
|
| 275 |
+
<dim>-1</dim>
|
| 276 |
+
<dim>3072</dim>
|
| 277 |
+
</port>
|
| 278 |
+
</input>
|
| 279 |
+
</layer>
|
| 280 |
+
</layers>
|
| 281 |
+
<edges>
|
| 282 |
+
<edge from-layer="0" from-port="0" to-layer="6" to-port="0" />
|
| 283 |
+
<edge from-layer="1" from-port="0" to-layer="2" to-port="0" />
|
| 284 |
+
<edge from-layer="2" from-port="1" to-layer="4" to-port="0" />
|
| 285 |
+
<edge from-layer="3" from-port="0" to-layer="4" to-port="1" />
|
| 286 |
+
<edge from-layer="4" from-port="2" to-layer="5" to-port="0" />
|
| 287 |
+
<edge from-layer="5" from-port="1" to-layer="6" to-port="1" />
|
| 288 |
+
<edge from-layer="6" from-port="2" to-layer="8" to-port="0" />
|
| 289 |
+
<edge from-layer="7" from-port="0" to-layer="8" to-port="1" />
|
| 290 |
+
<edge from-layer="8" from-port="2" to-layer="9" to-port="0" />
|
| 291 |
+
<edge from-layer="9" from-port="1" to-layer="15" to-port="0" />
|
| 292 |
+
<edge from-layer="10" from-port="0" to-layer="11" to-port="0" />
|
| 293 |
+
<edge from-layer="11" from-port="1" to-layer="13" to-port="0" />
|
| 294 |
+
<edge from-layer="12" from-port="0" to-layer="13" to-port="1" />
|
| 295 |
+
<edge from-layer="13" from-port="2" to-layer="14" to-port="0" />
|
| 296 |
+
<edge from-layer="14" from-port="1" to-layer="15" to-port="1" />
|
| 297 |
+
<edge from-layer="15" from-port="2" to-layer="17" to-port="0" />
|
| 298 |
+
<edge from-layer="16" from-port="0" to-layer="17" to-port="1" />
|
| 299 |
+
<edge from-layer="17" from-port="2" to-layer="18" to-port="0" />
|
| 300 |
+
</edges>
|
| 301 |
+
<rt_info>
|
| 302 |
+
<Runtime_version value="2025.0.0-17933-815af98acd8-releases/2025/0" />
|
| 303 |
+
<conversion_parameters>
|
| 304 |
+
<framework value="pytorch" />
|
| 305 |
+
<is_python_object value="True" />
|
| 306 |
+
</conversion_parameters>
|
| 307 |
+
<nncf>
|
| 308 |
+
<friendly_names_were_updated value="True" />
|
| 309 |
+
<weight_compression>
|
| 310 |
+
<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}}" />
|
| 311 |
+
<all_layers value="False" />
|
| 312 |
+
<awq value="False" />
|
| 313 |
+
<backup_mode value="int8_asym" />
|
| 314 |
+
<gptq value="False" />
|
| 315 |
+
<group_size value="-1" />
|
| 316 |
+
<ignored_scope value="[]" />
|
| 317 |
+
<lora_correction value="False" />
|
| 318 |
+
<mode value="int8_sym" />
|
| 319 |
+
<ratio value="1.0" />
|
| 320 |
+
<scale_estimation value="False" />
|
| 321 |
+
<sensitivity_metric value="weight_quantization_error" />
|
| 322 |
+
</weight_compression>
|
| 323 |
+
</nncf>
|
| 324 |
+
<optimum>
|
| 325 |
+
<optimum_intel_version value="1.22.0.dev0+753f84d" />
|
| 326 |
+
<optimum_version value="1.24.0.dev0" />
|
| 327 |
+
<pytorch_version value="2.5.0+cpu" />
|
| 328 |
+
<transformers_version value="4.45.0" />
|
| 329 |
+
</optimum>
|
| 330 |
+
</rt_info>
|
| 331 |
+
</net>
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoImageProcessor": "microsoft/Phi-3.5-vision-instruct--processing_phi3_v.Phi3VImageProcessor",
|
| 4 |
+
"AutoProcessor": "processing_phi3_v.Phi3VProcessor"
|
| 5 |
+
},
|
| 6 |
+
"do_convert_rgb": true,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.48145466,
|
| 9 |
+
0.4578275,
|
| 10 |
+
0.40821073
|
| 11 |
+
],
|
| 12 |
+
"image_processor_type": "Phi3VImageProcessor",
|
| 13 |
+
"image_std": [
|
| 14 |
+
0.26862954,
|
| 15 |
+
0.26130258,
|
| 16 |
+
0.27577711
|
| 17 |
+
],
|
| 18 |
+
"num_crops": 4,
|
| 19 |
+
"num_img_tokens": 144,
|
| 20 |
+
"processor_class": "Phi3VProcessor"
|
| 21 |
+
}
|
processing_phi3_v.py
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2024 Microsoft and the HuggingFace Inc. team. All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
"""
|
| 17 |
+
Processor class for Phi3-V.
|
| 18 |
+
"""
|
| 19 |
+
import re
|
| 20 |
+
from typing import List, Optional, Union
|
| 21 |
+
|
| 22 |
+
import torch
|
| 23 |
+
|
| 24 |
+
import transformers
|
| 25 |
+
from transformers.feature_extraction_utils import BatchFeature
|
| 26 |
+
from transformers.image_utils import ImageInput
|
| 27 |
+
from transformers.processing_utils import ProcessorMixin
|
| 28 |
+
from transformers.tokenization_utils_base import PaddingStrategy, TextInput, TruncationStrategy
|
| 29 |
+
from transformers.utils import TensorType
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
"""Image processor class for Phi3-V."""
|
| 33 |
+
|
| 34 |
+
from typing import List, Optional, Union
|
| 35 |
+
|
| 36 |
+
import numpy as np
|
| 37 |
+
|
| 38 |
+
from transformers.image_processing_utils import BaseImageProcessor, BatchFeature
|
| 39 |
+
from transformers.image_transforms import (
|
| 40 |
+
convert_to_rgb,
|
| 41 |
+
)
|
| 42 |
+
from transformers.image_utils import (
|
| 43 |
+
OPENAI_CLIP_MEAN,
|
| 44 |
+
OPENAI_CLIP_STD,
|
| 45 |
+
ImageInput,
|
| 46 |
+
make_list_of_images,
|
| 47 |
+
valid_images,
|
| 48 |
+
)
|
| 49 |
+
from transformers.utils import TensorType, is_vision_available, logging
|
| 50 |
+
|
| 51 |
+
from transformers import AutoImageProcessor
|
| 52 |
+
|
| 53 |
+
logger = logging.get_logger(__name__)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
if is_vision_available():
|
| 57 |
+
from PIL import Image
|
| 58 |
+
|
| 59 |
+
import torch
|
| 60 |
+
import torchvision
|
| 61 |
+
|
| 62 |
+
def padding_336(b):
|
| 63 |
+
width, height = b.size
|
| 64 |
+
tar = int(np.ceil(height / 336) * 336)
|
| 65 |
+
top_padding = int((tar - height)/2)
|
| 66 |
+
bottom_padding = tar - height - top_padding
|
| 67 |
+
left_padding = 0
|
| 68 |
+
right_padding = 0
|
| 69 |
+
b = torchvision.transforms.functional.pad(b, [left_padding, top_padding, right_padding, bottom_padding], fill=[255,255,255])
|
| 70 |
+
|
| 71 |
+
return b
|
| 72 |
+
|
| 73 |
+
def calc_padded_size(width, height, padding_unit=336):
|
| 74 |
+
target_height = int(np.ceil(height / padding_unit) * padding_unit)
|
| 75 |
+
top_padding = int((target_height - height) / 2)
|
| 76 |
+
bottom_padding = target_height - height - top_padding
|
| 77 |
+
left_padding = 0
|
| 78 |
+
right_padding = 0
|
| 79 |
+
padded_width = width + left_padding + right_padding
|
| 80 |
+
padded_height = height + top_padding + bottom_padding
|
| 81 |
+
return padded_width, padded_height
|
| 82 |
+
|
| 83 |
+
def HD_transform(img, hd_num=16):
|
| 84 |
+
width, height = img.size
|
| 85 |
+
trans = False
|
| 86 |
+
if width < height:
|
| 87 |
+
img = img.transpose(Image.TRANSPOSE)
|
| 88 |
+
trans = True
|
| 89 |
+
width, height = img.size
|
| 90 |
+
ratio = (width/ height)
|
| 91 |
+
scale = 1
|
| 92 |
+
while scale*np.ceil(scale/ratio) <= hd_num:
|
| 93 |
+
scale += 1
|
| 94 |
+
scale -= 1
|
| 95 |
+
new_w = int(scale * 336)
|
| 96 |
+
new_h = int(new_w / ratio)
|
| 97 |
+
|
| 98 |
+
img = torchvision.transforms.functional.resize(img, [new_h, new_w],)
|
| 99 |
+
img = padding_336(img)
|
| 100 |
+
width, height = img.size
|
| 101 |
+
if trans:
|
| 102 |
+
img = img.transpose(Image.TRANSPOSE)
|
| 103 |
+
|
| 104 |
+
return img
|
| 105 |
+
|
| 106 |
+
def calc_hd_transform_size(width, height, hd_num=16):
|
| 107 |
+
transposed = False
|
| 108 |
+
if width < height:
|
| 109 |
+
width, height = height, width
|
| 110 |
+
transposed = True
|
| 111 |
+
|
| 112 |
+
ratio = width / height
|
| 113 |
+
scale = 1
|
| 114 |
+
while scale * np.ceil(scale / ratio) <= hd_num:
|
| 115 |
+
scale += 1
|
| 116 |
+
scale -= 1
|
| 117 |
+
|
| 118 |
+
new_width = int(scale * 336)
|
| 119 |
+
new_height = int(new_width / ratio)
|
| 120 |
+
|
| 121 |
+
padded_width, padded_height = calc_padded_size(new_width, new_height)
|
| 122 |
+
|
| 123 |
+
if transposed:
|
| 124 |
+
padded_width, padded_height = padded_height, padded_width
|
| 125 |
+
|
| 126 |
+
return padded_width, padded_height
|
| 127 |
+
|
| 128 |
+
def pad_to_max_num_crops_tensor(images, max_crops=5):
|
| 129 |
+
"""
|
| 130 |
+
images: B x 3 x H x W, B<=max_crops
|
| 131 |
+
"""
|
| 132 |
+
B, _, H, W = images.shape
|
| 133 |
+
if B < max_crops:
|
| 134 |
+
pad = torch.zeros(max_crops - B, 3, H, W, dtype=images.dtype, device=images.device)
|
| 135 |
+
images = torch.cat([images, pad], dim=0)
|
| 136 |
+
return images
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class Phi3VImageProcessor(BaseImageProcessor):
|
| 140 |
+
r"""
|
| 141 |
+
Constructs a Phi3 image processor. Based on [`CLIPImageProcessor`] with incorporation of additional techniques
|
| 142 |
+
for processing high resolution images as explained in the [InternLM-XComposer2-4KHD](https://arxiv.org/pdf/2404.06512)
|
| 143 |
+
|
| 144 |
+
Args:
|
| 145 |
+
image_mean (`float` or `List[float]`, *optional*, defaults to `[0.48145466, 0.4578275, 0.40821073]`):
|
| 146 |
+
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
|
| 147 |
+
channels in the image. Can be overridden by the `image_mean` parameter in the `preprocess` method.
|
| 148 |
+
image_std (`float` or `List[float]`, *optional*, defaults to `[0.26862954, 0.26130258, 0.27577711]`):
|
| 149 |
+
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
|
| 150 |
+
number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
|
| 151 |
+
Can be overridden by the `image_std` parameter in the `preprocess` method.
|
| 152 |
+
do_convert_rgb (`bool`, *optional*, defaults to `True`):
|
| 153 |
+
Whether to convert the image to RGB.
|
| 154 |
+
"""
|
| 155 |
+
|
| 156 |
+
model_input_names = ["pixel_values"]
|
| 157 |
+
|
| 158 |
+
def __init__(
|
| 159 |
+
self,
|
| 160 |
+
num_crops: int = 1,
|
| 161 |
+
image_mean: Optional[Union[float, List[float]]] = None,
|
| 162 |
+
image_std: Optional[Union[float, List[float]]] = None,
|
| 163 |
+
do_convert_rgb: bool = True,
|
| 164 |
+
**kwargs,
|
| 165 |
+
) -> None:
|
| 166 |
+
super().__init__(**kwargs)
|
| 167 |
+
self.num_crops = num_crops
|
| 168 |
+
self.image_mean = image_mean if image_mean is not None else OPENAI_CLIP_MEAN
|
| 169 |
+
self.image_std = image_std if image_std is not None else OPENAI_CLIP_STD
|
| 170 |
+
self.do_convert_rgb = do_convert_rgb
|
| 171 |
+
|
| 172 |
+
def calc_num_image_tokens(
|
| 173 |
+
self,
|
| 174 |
+
images: ImageInput
|
| 175 |
+
):
|
| 176 |
+
""" Calculate the number of image tokens for each image.
|
| 177 |
+
Args:
|
| 178 |
+
images (`ImageInput`):
|
| 179 |
+
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
|
| 180 |
+
passing in images with pixel values between 0 and 1, set `do_rescale=False`.
|
| 181 |
+
"""
|
| 182 |
+
images = make_list_of_images(images)
|
| 183 |
+
|
| 184 |
+
if not valid_images(images):
|
| 185 |
+
raise ValueError(
|
| 186 |
+
"Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
|
| 187 |
+
"torch.Tensor, tf.Tensor or jax.ndarray."
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
images = [image.convert('RGB') for image in images]
|
| 191 |
+
# (H, W, C)
|
| 192 |
+
elems = [HD_transform(im, hd_num = self.num_crops) for im in images]
|
| 193 |
+
shapes = [[im.size[1], im.size[0]] for im in elems]
|
| 194 |
+
num_img_tokens = [int((h//336*w//336+1)*144 + 1 + (h//336+1)*12) for h, w in shapes]
|
| 195 |
+
return num_img_tokens
|
| 196 |
+
|
| 197 |
+
def calc_num_image_tokens_from_image_size(self, width, height):
|
| 198 |
+
"""
|
| 199 |
+
Calculate the number of image tokens for a given image size.
|
| 200 |
+
Args:
|
| 201 |
+
width (`int`): Width of the image.
|
| 202 |
+
height (`int`): Height of the image.
|
| 203 |
+
"""
|
| 204 |
+
new_width, new_height = calc_hd_transform_size(width, height, hd_num=self.num_crops)
|
| 205 |
+
num_img_tokens = int((new_height // 336 * new_width // 336 + 1) * 144 + 1 + (new_height // 336 + 1) * 12)
|
| 206 |
+
return num_img_tokens
|
| 207 |
+
|
| 208 |
+
def preprocess(
|
| 209 |
+
self,
|
| 210 |
+
images: ImageInput,
|
| 211 |
+
image_mean: Optional[Union[float, List[float]]] = None,
|
| 212 |
+
image_std: Optional[Union[float, List[float]]] = None,
|
| 213 |
+
do_convert_rgb: bool = None,
|
| 214 |
+
return_tensors: Optional[Union[str, TensorType]] = None,
|
| 215 |
+
):
|
| 216 |
+
"""
|
| 217 |
+
Args:
|
| 218 |
+
images (`ImageInput`):
|
| 219 |
+
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
|
| 220 |
+
passing in images with pixel values between 0 and 1, set `do_rescale=False`.
|
| 221 |
+
image_mean (`float` or `List[float]`, *optional*, defaults to `self.image_mean`):
|
| 222 |
+
Image mean to use for normalization. Only has an effect if `do_normalize` is set to `True`.
|
| 223 |
+
image_std (`float` or `List[float]`, *optional*, defaults to `self.image_std`):
|
| 224 |
+
Image standard deviation to use for normalization. Only has an effect if `do_normalize` is set to
|
| 225 |
+
`True`.
|
| 226 |
+
do_convert_rgb (`bool`, *optional*, defaults to `self.do_convert_rgb`):
|
| 227 |
+
Whether to convert the image to RGB.
|
| 228 |
+
return_tensors (`str` or `TensorType`, *optional*):
|
| 229 |
+
The type of tensors to return. Can be one of:
|
| 230 |
+
- Unset: Return a list of `np.ndarray`.
|
| 231 |
+
- `TensorType.TENSORFLOW` or `'tf'`: Return a batch of type `tf.Tensor`.
|
| 232 |
+
- `TensorType.PYTORCH` or `'pt'`: Return a batch of type `torch.Tensor`.
|
| 233 |
+
- `TensorType.NUMPY` or `'np'`: Return a batch of type `np.ndarray`.
|
| 234 |
+
- `TensorType.JAX` or `'jax'`: Return a batch of type `jax.numpy.ndarray`.
|
| 235 |
+
"""
|
| 236 |
+
image_mean = image_mean if image_mean is not None else self.image_mean
|
| 237 |
+
image_std = image_std if image_std is not None else self.image_std
|
| 238 |
+
do_convert_rgb = do_convert_rgb if do_convert_rgb is not None else self.do_convert_rgb
|
| 239 |
+
|
| 240 |
+
images = make_list_of_images(images)
|
| 241 |
+
|
| 242 |
+
if not valid_images(images):
|
| 243 |
+
raise ValueError(
|
| 244 |
+
"Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
|
| 245 |
+
"torch.Tensor, tf.Tensor or jax.ndarray."
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
if do_convert_rgb:
|
| 249 |
+
images = [convert_to_rgb(image) for image in images]
|
| 250 |
+
|
| 251 |
+
image_sizes = []
|
| 252 |
+
img_processor = torchvision.transforms.Compose([
|
| 253 |
+
torchvision.transforms.ToTensor(),
|
| 254 |
+
torchvision.transforms.Normalize(image_mean, image_std)
|
| 255 |
+
])
|
| 256 |
+
|
| 257 |
+
# PIL images
|
| 258 |
+
# HD_transform pad images to size of multiiply of 336, 336
|
| 259 |
+
# convert to RGB first
|
| 260 |
+
images = [image.convert('RGB') for image in images]
|
| 261 |
+
elems = [HD_transform(im, hd_num = self.num_crops) for im in images]
|
| 262 |
+
# tensor transform and normalize
|
| 263 |
+
hd_images = [img_processor(im) for im in elems]
|
| 264 |
+
# create global image
|
| 265 |
+
global_image = [torch.nn.functional.interpolate(im.unsqueeze(0).float(), size=(336, 336), mode='bicubic',).to(im.dtype) for im in hd_images]
|
| 266 |
+
|
| 267 |
+
# [(3, h, w)], where h, w is multiple of 336
|
| 268 |
+
shapes = [[im.size(1), im.size(2)] for im in hd_images]
|
| 269 |
+
num_img_tokens = [int(((h//336)*(w//336)+1)*144 + 1 + (h//336+1)*12) for h, w in shapes]
|
| 270 |
+
# reshape to channel dimension -> (num_images, num_crops, 3, 336, 336)
|
| 271 |
+
# (1, 3, h//336, 336, w//336, 336) -> (1, h//336, w//336, 3, 336, 336) -> (h//336*w//336, 3, 336, 336)
|
| 272 |
+
hd_images_reshape = [im.reshape(1, 3, h//336, 336, w//336, 336).permute(0,2,4,1,3,5).reshape(-1, 3, 336, 336).contiguous() for im, (h, w) in zip(hd_images, shapes)]
|
| 273 |
+
# concat global image and local image
|
| 274 |
+
hd_images_reshape = [torch.cat([_global_image] + [_im], dim=0) for _global_image, _im in zip(global_image, hd_images_reshape)]
|
| 275 |
+
|
| 276 |
+
# pad to max_num_crops
|
| 277 |
+
image_transformed = [pad_to_max_num_crops_tensor(im, self.num_crops+1) for im in hd_images_reshape]
|
| 278 |
+
image_transformed = torch.stack(image_transformed, dim=0)
|
| 279 |
+
image_sizes = [torch.LongTensor(_shapes) for _shapes in shapes]
|
| 280 |
+
padded_images = image_transformed
|
| 281 |
+
image_sizes = shapes
|
| 282 |
+
|
| 283 |
+
data = {"pixel_values": padded_images,
|
| 284 |
+
"image_sizes": image_sizes,
|
| 285 |
+
"num_img_tokens": num_img_tokens
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
return BatchFeature(data=data, tensor_type=return_tensors)
|
| 289 |
+
|
| 290 |
+
AutoImageProcessor.register("Phi3VImageProcessor", Phi3VImageProcessor)
|
| 291 |
+
|
| 292 |
+
transformers.Phi3VImageProcessor = Phi3VImageProcessor
|
| 293 |
+
|
| 294 |
+
class Phi3VProcessor(ProcessorMixin):
|
| 295 |
+
r"""
|
| 296 |
+
Constructs a Phi3-V processor which wraps a Phi3-V image processor and a LLaMa tokenizer into a single processor.
|
| 297 |
+
|
| 298 |
+
[`Phi3VProcessor`] offers all the functionalities of [`Phi3VImageProcessor`] and [`LlamaTokenizerFast`]. See the
|
| 299 |
+
[`~Phi3VProcessor.__call__`] and [`~Phi3VProcessor.decode`] for more information.
|
| 300 |
+
|
| 301 |
+
Args:
|
| 302 |
+
image_processor ([`Phi3VImageProcessor`], *optional*):
|
| 303 |
+
The image processor is a required input.
|
| 304 |
+
tokenizer ([`LlamaTokenizerFast`], *optional*):
|
| 305 |
+
The tokenizer is a required input.
|
| 306 |
+
"""
|
| 307 |
+
|
| 308 |
+
attributes = ["image_processor", "tokenizer"]
|
| 309 |
+
image_processor_class = "Phi3VImageProcessor"
|
| 310 |
+
tokenizer_class = ("LlamaTokenizer", "LlamaTokenizerFast")
|
| 311 |
+
special_image_token = "<|image|>"
|
| 312 |
+
|
| 313 |
+
def __init__(self, image_processor, tokenizer):
|
| 314 |
+
self.image_processor = image_processor
|
| 315 |
+
self.tokenizer = tokenizer
|
| 316 |
+
self.num_img_tokens = image_processor.num_img_tokens
|
| 317 |
+
self.img_tokens = [f"<|image_{i+1}|>" for i in range(1000000)]
|
| 318 |
+
|
| 319 |
+
def __call__(
|
| 320 |
+
self,
|
| 321 |
+
text: Union[TextInput, List[TextInput]],
|
| 322 |
+
images: ImageInput = None,
|
| 323 |
+
padding: Union[bool, str, PaddingStrategy] = False,
|
| 324 |
+
truncation: Union[bool, str, TruncationStrategy] = None,
|
| 325 |
+
max_length=None,
|
| 326 |
+
return_tensors: Optional[Union[str, TensorType]] = TensorType.PYTORCH,
|
| 327 |
+
) -> BatchFeature:
|
| 328 |
+
"""
|
| 329 |
+
Main method to prepare for the model one or several sequences(s) and image(s). This method forwards the `text`
|
| 330 |
+
and `kwargs` arguments to LlamaTokenizerFast's [`~LlamaTokenizerFast.__call__`] if `text` is not `None` to encode
|
| 331 |
+
the text. To prepare the image(s), this method forwards the `images` and `kwrags` arguments to
|
| 332 |
+
Phi3ImageProcessor's [`~Phi3ImageProcessor.__call__`] if `images` is not `None`. Please refer to the doctsring
|
| 333 |
+
of the above two methods for more information.
|
| 334 |
+
|
| 335 |
+
Args:
|
| 336 |
+
text (`str`, `List[str]`, `List[List[str]]`):
|
| 337 |
+
The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
|
| 338 |
+
(pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
|
| 339 |
+
`is_split_into_words=True` (to lift the ambiguity with a batch of sequences).
|
| 340 |
+
images (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[torch.Tensor]`):
|
| 341 |
+
The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
|
| 342 |
+
tensor. Both channels-first and channels-last formats are supported.
|
| 343 |
+
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`):
|
| 344 |
+
Select a strategy to pad the returned sequences (according to the model's padding side and padding
|
| 345 |
+
index) among:
|
| 346 |
+
- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
|
| 347 |
+
sequence if provided).
|
| 348 |
+
- `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
|
| 349 |
+
acceptable input length for the model if that argument is not provided.
|
| 350 |
+
- `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different
|
| 351 |
+
lengths).
|
| 352 |
+
max_length (`int`, *optional*):
|
| 353 |
+
Maximum length of the returned list and optionally padding length (see above).
|
| 354 |
+
truncation (`bool`, *optional*):
|
| 355 |
+
Activates truncation to cut input sequences longer than `max_length` to `max_length`.
|
| 356 |
+
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
| 357 |
+
If set, will return tensors of a particular framework. Acceptable values are:
|
| 358 |
+
|
| 359 |
+
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
| 360 |
+
- `'pt'`: Return PyTorch `torch.Tensor` objects.
|
| 361 |
+
- `'np'`: Return NumPy `np.ndarray` objects.
|
| 362 |
+
- `'jax'`: Return JAX `jnp.ndarray` objects.
|
| 363 |
+
|
| 364 |
+
Returns:
|
| 365 |
+
[`BatchFeature`]: A [`BatchFeature`] with the following fields:
|
| 366 |
+
|
| 367 |
+
- **input_ids** -- List of token ids to be fed to a model. Returned when `text` is not `None`.
|
| 368 |
+
- **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when
|
| 369 |
+
`return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names` and if `text` is not
|
| 370 |
+
`None`).
|
| 371 |
+
- **pixel_values** -- Pixel values to be fed to a model. Returned when `images` is not `None`.
|
| 372 |
+
"""
|
| 373 |
+
if images is not None:
|
| 374 |
+
image_inputs = self.image_processor(images, return_tensors=return_tensors)
|
| 375 |
+
else:
|
| 376 |
+
image_inputs = {}
|
| 377 |
+
inputs = self._convert_images_texts_to_inputs(image_inputs, text, padding=padding, truncation=truncation, max_length=max_length, return_tensors=return_tensors)
|
| 378 |
+
return inputs
|
| 379 |
+
|
| 380 |
+
def calc_num_image_tokens(self, images: ImageInput):
|
| 381 |
+
""" Calculate the number of image tokens for each image.
|
| 382 |
+
Args:
|
| 383 |
+
images (`ImageInput`):
|
| 384 |
+
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
|
| 385 |
+
passing in images with pixel values between 0 and 1, set `do_rescale=False`.
|
| 386 |
+
"""
|
| 387 |
+
return self.image_processor.calc_num_image_tokens(images)
|
| 388 |
+
|
| 389 |
+
def calc_num_image_tokens_from_image_size(self, width, height):
|
| 390 |
+
""" Calculate the number of image token for an image with given width and height.
|
| 391 |
+
Args:
|
| 392 |
+
width (`int`):
|
| 393 |
+
Width of the image.
|
| 394 |
+
height (`int`):
|
| 395 |
+
Height of the image.
|
| 396 |
+
"""
|
| 397 |
+
return self.image_processor.calc_num_image_tokens_from_image_size(width, height)
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
@property
|
| 401 |
+
def special_image_token_id(self):
|
| 402 |
+
return self.tokenizer.convert_tokens_to_ids(self.special_image_token)
|
| 403 |
+
|
| 404 |
+
def get_special_image_token_id(self):
|
| 405 |
+
return self.tokenizer.convert_tokens_to_ids(self.special_image_token)
|
| 406 |
+
|
| 407 |
+
def _convert_images_texts_to_inputs(self, images, texts, padding=False, truncation=None, max_length=None, return_tensors=None):
|
| 408 |
+
|
| 409 |
+
if not len(images):
|
| 410 |
+
model_inputs = self.tokenizer(texts, return_tensors=return_tensors, padding=padding, truncation=truncation, max_length=max_length)
|
| 411 |
+
return BatchFeature(data={**model_inputs})
|
| 412 |
+
|
| 413 |
+
pattern = r"<\|image_\d+\|>"
|
| 414 |
+
prompt_chunks = [self.tokenizer(chunk).input_ids for chunk in re.split(pattern, texts)]
|
| 415 |
+
|
| 416 |
+
if 'num_img_tokens' in images:
|
| 417 |
+
num_img_tokens = images['num_img_tokens']
|
| 418 |
+
else:
|
| 419 |
+
assert 'num_crops' in images, 'num_crops must be provided in images if num_img_tokens is not provided'
|
| 420 |
+
num_crops = images['num_crops']
|
| 421 |
+
num_img_tokens = [_num_crops * self.num_img_tokens for _num_crops in num_crops]
|
| 422 |
+
|
| 423 |
+
images, image_sizes = images['pixel_values'], images['image_sizes']
|
| 424 |
+
|
| 425 |
+
# image_tags needs to start from 1 to n
|
| 426 |
+
image_tags = re.findall(pattern, texts)
|
| 427 |
+
# image_ids = [int(s.split("|")[1].split("_")[-1]) * -1 for s in image_tags]
|
| 428 |
+
# image_ids_pad = [[iid]*num_img_tokens[i] for i, iid in enumerate(image_ids)]
|
| 429 |
+
image_ids = [int(s.split("|")[1].split("_")[-1]) for s in image_tags]
|
| 430 |
+
unique_image_ids = sorted(list(set(image_ids)))
|
| 431 |
+
# image_ids must start from 1, and must be continuous int, e.g. [1, 2, 3], cannot be [1, 4, 5]
|
| 432 |
+
# check the condition
|
| 433 |
+
assert unique_image_ids == list(range(1, len(unique_image_ids)+1)), f"image_ids must start from 1, and must be continuous int, e.g. [1, 2, 3], cannot be {unique_image_ids}"
|
| 434 |
+
# total images must be the same as the number of image tags
|
| 435 |
+
assert len(unique_image_ids) == len(images), f"total images must be the same as the number of image tags, got {len(unique_image_ids)} image tags and {len(images)} images"
|
| 436 |
+
|
| 437 |
+
image_ids_pad = [[-iid]*num_img_tokens[iid-1] for iid in image_ids]
|
| 438 |
+
|
| 439 |
+
def insert_separator(X, sep_list):
|
| 440 |
+
if len(X) > len(sep_list):
|
| 441 |
+
sep_list.append([])
|
| 442 |
+
return [ele for sublist in zip(X, sep_list) for ele in sublist]
|
| 443 |
+
input_ids = []
|
| 444 |
+
offset = 0
|
| 445 |
+
for x in insert_separator(prompt_chunks, image_ids_pad):
|
| 446 |
+
input_ids.extend(x[offset:])
|
| 447 |
+
|
| 448 |
+
input_ids = torch.tensor(input_ids, dtype=torch.long).unsqueeze(0)
|
| 449 |
+
attention_mask = (input_ids > -1000000).to(torch.long)
|
| 450 |
+
|
| 451 |
+
return BatchFeature(data={"input_ids": input_ids,
|
| 452 |
+
"attention_mask": attention_mask,
|
| 453 |
+
"pixel_values": images,
|
| 454 |
+
"image_sizes": image_sizes})
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.batch_decode with CLIP->Llama
|
| 458 |
+
def batch_decode(self, *args, **kwargs):
|
| 459 |
+
"""
|
| 460 |
+
This method forwards all its arguments to LlamaTokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
|
| 461 |
+
refer to the docstring of this method for more information.
|
| 462 |
+
"""
|
| 463 |
+
return self.tokenizer.batch_decode(*args, **kwargs)
|
| 464 |
+
|
| 465 |
+
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.decode with CLIP->Llama
|
| 466 |
+
def decode(self, *args, **kwargs):
|
| 467 |
+
"""
|
| 468 |
+
This method forwards all its arguments to LlamaTokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
|
| 469 |
+
the docstring of this method for more information.
|
| 470 |
+
"""
|
| 471 |
+
return self.tokenizer.decode(*args, **kwargs)
|
| 472 |
+
|
| 473 |
+
@property
|
| 474 |
+
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.model_input_names
|
| 475 |
+
def model_input_names(self):
|
| 476 |
+
tokenizer_input_names = self.tokenizer.model_input_names
|
| 477 |
+
image_processor_input_names = self.image_processor.model_input_names
|
| 478 |
+
return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))
|
processor_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "processing_phi3_v.Phi3VProcessor"
|
| 4 |
+
},
|
| 5 |
+
"processor_class": "Phi3VProcessor"
|
| 6 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|system|>",
|
| 4 |
+
"<|end|>",
|
| 5 |
+
"<|user|>",
|
| 6 |
+
"<|end|>"
|
| 7 |
+
],
|
| 8 |
+
"bos_token": {
|
| 9 |
+
"content": "<s>",
|
| 10 |
+
"lstrip": false,
|
| 11 |
+
"normalized": false,
|
| 12 |
+
"rstrip": false,
|
| 13 |
+
"single_word": false
|
| 14 |
+
},
|
| 15 |
+
"eos_token": {
|
| 16 |
+
"content": "<|endoftext|>",
|
| 17 |
+
"lstrip": false,
|
| 18 |
+
"normalized": false,
|
| 19 |
+
"rstrip": false,
|
| 20 |
+
"single_word": false
|
| 21 |
+
},
|
| 22 |
+
"pad_token": {
|
| 23 |
+
"content": "<|endoftext|>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false
|
| 28 |
+
},
|
| 29 |
+
"unk_token": {
|
| 30 |
+
"content": "<unk>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false
|
| 35 |
+
}
|
| 36 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": true,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": false
|
| 29 |
+
},
|
| 30 |
+
"32000": {
|
| 31 |
+
"content": "<|endoftext|>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false,
|
| 36 |
+
"special": true
|
| 37 |
+
},
|
| 38 |
+
"32001": {
|
| 39 |
+
"content": "<|assistant|>",
|
| 40 |
+
"lstrip": false,
|
| 41 |
+
"normalized": false,
|
| 42 |
+
"rstrip": true,
|
| 43 |
+
"single_word": false,
|
| 44 |
+
"special": true
|
| 45 |
+
},
|
| 46 |
+
"32002": {
|
| 47 |
+
"content": "<|placeholder1|>",
|
| 48 |
+
"lstrip": false,
|
| 49 |
+
"normalized": false,
|
| 50 |
+
"rstrip": true,
|
| 51 |
+
"single_word": false,
|
| 52 |
+
"special": true
|
| 53 |
+
},
|
| 54 |
+
"32003": {
|
| 55 |
+
"content": "<|placeholder2|>",
|
| 56 |
+
"lstrip": false,
|
| 57 |
+
"normalized": false,
|
| 58 |
+
"rstrip": true,
|
| 59 |
+
"single_word": false,
|
| 60 |
+
"special": true
|
| 61 |
+
},
|
| 62 |
+
"32004": {
|
| 63 |
+
"content": "<|placeholder3|>",
|
| 64 |
+
"lstrip": false,
|
| 65 |
+
"normalized": false,
|
| 66 |
+
"rstrip": true,
|
| 67 |
+
"single_word": false,
|
| 68 |
+
"special": true
|
| 69 |
+
},
|
| 70 |
+
"32005": {
|
| 71 |
+
"content": "<|placeholder4|>",
|
| 72 |
+
"lstrip": false,
|
| 73 |
+
"normalized": false,
|
| 74 |
+
"rstrip": true,
|
| 75 |
+
"single_word": false,
|
| 76 |
+
"special": true
|
| 77 |
+
},
|
| 78 |
+
"32006": {
|
| 79 |
+
"content": "<|system|>",
|
| 80 |
+
"lstrip": false,
|
| 81 |
+
"normalized": false,
|
| 82 |
+
"rstrip": false,
|
| 83 |
+
"single_word": false,
|
| 84 |
+
"special": true
|
| 85 |
+
},
|
| 86 |
+
"32007": {
|
| 87 |
+
"content": "<|end|>",
|
| 88 |
+
"lstrip": false,
|
| 89 |
+
"normalized": false,
|
| 90 |
+
"rstrip": false,
|
| 91 |
+
"single_word": false,
|
| 92 |
+
"special": true
|
| 93 |
+
},
|
| 94 |
+
"32008": {
|
| 95 |
+
"content": "<|placeholder5|>",
|
| 96 |
+
"lstrip": false,
|
| 97 |
+
"normalized": false,
|
| 98 |
+
"rstrip": true,
|
| 99 |
+
"single_word": false,
|
| 100 |
+
"special": true
|
| 101 |
+
},
|
| 102 |
+
"32009": {
|
| 103 |
+
"content": "<|placeholder6|>",
|
| 104 |
+
"lstrip": false,
|
| 105 |
+
"normalized": false,
|
| 106 |
+
"rstrip": true,
|
| 107 |
+
"single_word": false,
|
| 108 |
+
"special": true
|
| 109 |
+
},
|
| 110 |
+
"32010": {
|
| 111 |
+
"content": "<|user|>",
|
| 112 |
+
"lstrip": false,
|
| 113 |
+
"normalized": false,
|
| 114 |
+
"rstrip": false,
|
| 115 |
+
"single_word": false,
|
| 116 |
+
"special": true
|
| 117 |
+
},
|
| 118 |
+
"32011": {
|
| 119 |
+
"content": "<|placeholder7|>",
|
| 120 |
+
"lstrip": false,
|
| 121 |
+
"normalized": false,
|
| 122 |
+
"rstrip": true,
|
| 123 |
+
"single_word": false,
|
| 124 |
+
"special": true
|
| 125 |
+
},
|
| 126 |
+
"32012": {
|
| 127 |
+
"content": "<|placeholder8|>",
|
| 128 |
+
"lstrip": false,
|
| 129 |
+
"normalized": false,
|
| 130 |
+
"rstrip": true,
|
| 131 |
+
"single_word": false,
|
| 132 |
+
"special": true
|
| 133 |
+
},
|
| 134 |
+
"32013": {
|
| 135 |
+
"content": "<|placeholder9|>",
|
| 136 |
+
"lstrip": false,
|
| 137 |
+
"normalized": false,
|
| 138 |
+
"rstrip": true,
|
| 139 |
+
"single_word": false,
|
| 140 |
+
"special": true
|
| 141 |
+
},
|
| 142 |
+
"32014": {
|
| 143 |
+
"content": "<|placeholder10|>",
|
| 144 |
+
"lstrip": false,
|
| 145 |
+
"normalized": false,
|
| 146 |
+
"rstrip": true,
|
| 147 |
+
"single_word": false,
|
| 148 |
+
"special": true
|
| 149 |
+
},
|
| 150 |
+
"32015": {
|
| 151 |
+
"content": "<|placeholder11|>",
|
| 152 |
+
"lstrip": false,
|
| 153 |
+
"normalized": false,
|
| 154 |
+
"rstrip": true,
|
| 155 |
+
"single_word": false,
|
| 156 |
+
"special": true
|
| 157 |
+
},
|
| 158 |
+
"32016": {
|
| 159 |
+
"content": "<|placeholder12|>",
|
| 160 |
+
"lstrip": false,
|
| 161 |
+
"normalized": false,
|
| 162 |
+
"rstrip": true,
|
| 163 |
+
"single_word": false,
|
| 164 |
+
"special": true
|
| 165 |
+
},
|
| 166 |
+
"32017": {
|
| 167 |
+
"content": "<|placeholder13|>",
|
| 168 |
+
"lstrip": false,
|
| 169 |
+
"normalized": false,
|
| 170 |
+
"rstrip": true,
|
| 171 |
+
"single_word": false,
|
| 172 |
+
"special": true
|
| 173 |
+
},
|
| 174 |
+
"32018": {
|
| 175 |
+
"content": "<|placeholder14|>",
|
| 176 |
+
"lstrip": false,
|
| 177 |
+
"normalized": false,
|
| 178 |
+
"rstrip": true,
|
| 179 |
+
"single_word": false,
|
| 180 |
+
"special": true
|
| 181 |
+
},
|
| 182 |
+
"32019": {
|
| 183 |
+
"content": "<|placeholder15|>",
|
| 184 |
+
"lstrip": false,
|
| 185 |
+
"normalized": false,
|
| 186 |
+
"rstrip": true,
|
| 187 |
+
"single_word": false,
|
| 188 |
+
"special": true
|
| 189 |
+
},
|
| 190 |
+
"32020": {
|
| 191 |
+
"content": "<|placeholder16|>",
|
| 192 |
+
"lstrip": false,
|
| 193 |
+
"normalized": false,
|
| 194 |
+
"rstrip": true,
|
| 195 |
+
"single_word": false,
|
| 196 |
+
"special": true
|
| 197 |
+
},
|
| 198 |
+
"32021": {
|
| 199 |
+
"content": "<|placeholder17|>",
|
| 200 |
+
"lstrip": false,
|
| 201 |
+
"normalized": false,
|
| 202 |
+
"rstrip": true,
|
| 203 |
+
"single_word": false,
|
| 204 |
+
"special": true
|
| 205 |
+
},
|
| 206 |
+
"32022": {
|
| 207 |
+
"content": "<|placeholder18|>",
|
| 208 |
+
"lstrip": false,
|
| 209 |
+
"normalized": false,
|
| 210 |
+
"rstrip": true,
|
| 211 |
+
"single_word": false,
|
| 212 |
+
"special": true
|
| 213 |
+
},
|
| 214 |
+
"32023": {
|
| 215 |
+
"content": "<|placeholder19|>",
|
| 216 |
+
"lstrip": false,
|
| 217 |
+
"normalized": false,
|
| 218 |
+
"rstrip": true,
|
| 219 |
+
"single_word": false,
|
| 220 |
+
"special": true
|
| 221 |
+
},
|
| 222 |
+
"32024": {
|
| 223 |
+
"content": "<|placeholder20|>",
|
| 224 |
+
"lstrip": false,
|
| 225 |
+
"normalized": false,
|
| 226 |
+
"rstrip": true,
|
| 227 |
+
"single_word": false,
|
| 228 |
+
"special": true
|
| 229 |
+
},
|
| 230 |
+
"32025": {
|
| 231 |
+
"content": "<|placeholder21|>",
|
| 232 |
+
"lstrip": false,
|
| 233 |
+
"normalized": false,
|
| 234 |
+
"rstrip": true,
|
| 235 |
+
"single_word": false,
|
| 236 |
+
"special": true
|
| 237 |
+
},
|
| 238 |
+
"32026": {
|
| 239 |
+
"content": "<|placeholder22|>",
|
| 240 |
+
"lstrip": false,
|
| 241 |
+
"normalized": false,
|
| 242 |
+
"rstrip": true,
|
| 243 |
+
"single_word": false,
|
| 244 |
+
"special": true
|
| 245 |
+
},
|
| 246 |
+
"32027": {
|
| 247 |
+
"content": "<|placeholder23|>",
|
| 248 |
+
"lstrip": false,
|
| 249 |
+
"normalized": false,
|
| 250 |
+
"rstrip": true,
|
| 251 |
+
"single_word": false,
|
| 252 |
+
"special": true
|
| 253 |
+
},
|
| 254 |
+
"32028": {
|
| 255 |
+
"content": "<|placeholder24|>",
|
| 256 |
+
"lstrip": false,
|
| 257 |
+
"normalized": false,
|
| 258 |
+
"rstrip": true,
|
| 259 |
+
"single_word": false,
|
| 260 |
+
"special": true
|
| 261 |
+
},
|
| 262 |
+
"32029": {
|
| 263 |
+
"content": "<|placeholder25|>",
|
| 264 |
+
"lstrip": false,
|
| 265 |
+
"normalized": false,
|
| 266 |
+
"rstrip": true,
|
| 267 |
+
"single_word": false,
|
| 268 |
+
"special": true
|
| 269 |
+
},
|
| 270 |
+
"32030": {
|
| 271 |
+
"content": "<|placeholder26|>",
|
| 272 |
+
"lstrip": false,
|
| 273 |
+
"normalized": false,
|
| 274 |
+
"rstrip": true,
|
| 275 |
+
"single_word": false,
|
| 276 |
+
"special": true
|
| 277 |
+
},
|
| 278 |
+
"32031": {
|
| 279 |
+
"content": "<|placeholder27|>",
|
| 280 |
+
"lstrip": false,
|
| 281 |
+
"normalized": false,
|
| 282 |
+
"rstrip": true,
|
| 283 |
+
"single_word": false,
|
| 284 |
+
"special": true
|
| 285 |
+
},
|
| 286 |
+
"32032": {
|
| 287 |
+
"content": "<|placeholder28|>",
|
| 288 |
+
"lstrip": false,
|
| 289 |
+
"normalized": false,
|
| 290 |
+
"rstrip": true,
|
| 291 |
+
"single_word": false,
|
| 292 |
+
"special": true
|
| 293 |
+
},
|
| 294 |
+
"32033": {
|
| 295 |
+
"content": "<|placeholder29|>",
|
| 296 |
+
"lstrip": false,
|
| 297 |
+
"normalized": false,
|
| 298 |
+
"rstrip": true,
|
| 299 |
+
"single_word": false,
|
| 300 |
+
"special": true
|
| 301 |
+
},
|
| 302 |
+
"32034": {
|
| 303 |
+
"content": "<|placeholder30|>",
|
| 304 |
+
"lstrip": false,
|
| 305 |
+
"normalized": false,
|
| 306 |
+
"rstrip": true,
|
| 307 |
+
"single_word": false,
|
| 308 |
+
"special": true
|
| 309 |
+
},
|
| 310 |
+
"32035": {
|
| 311 |
+
"content": "<|placeholder31|>",
|
| 312 |
+
"lstrip": false,
|
| 313 |
+
"normalized": false,
|
| 314 |
+
"rstrip": true,
|
| 315 |
+
"single_word": false,
|
| 316 |
+
"special": true
|
| 317 |
+
},
|
| 318 |
+
"32036": {
|
| 319 |
+
"content": "<|placeholder32|>",
|
| 320 |
+
"lstrip": false,
|
| 321 |
+
"normalized": false,
|
| 322 |
+
"rstrip": true,
|
| 323 |
+
"single_word": false,
|
| 324 |
+
"special": true
|
| 325 |
+
},
|
| 326 |
+
"32037": {
|
| 327 |
+
"content": "<|placeholder33|>",
|
| 328 |
+
"lstrip": false,
|
| 329 |
+
"normalized": false,
|
| 330 |
+
"rstrip": true,
|
| 331 |
+
"single_word": false,
|
| 332 |
+
"special": true
|
| 333 |
+
},
|
| 334 |
+
"32038": {
|
| 335 |
+
"content": "<|placeholder34|>",
|
| 336 |
+
"lstrip": false,
|
| 337 |
+
"normalized": false,
|
| 338 |
+
"rstrip": true,
|
| 339 |
+
"single_word": false,
|
| 340 |
+
"special": true
|
| 341 |
+
},
|
| 342 |
+
"32039": {
|
| 343 |
+
"content": "<|placeholder35|>",
|
| 344 |
+
"lstrip": false,
|
| 345 |
+
"normalized": false,
|
| 346 |
+
"rstrip": true,
|
| 347 |
+
"single_word": false,
|
| 348 |
+
"special": true
|
| 349 |
+
},
|
| 350 |
+
"32040": {
|
| 351 |
+
"content": "<|placeholder36|>",
|
| 352 |
+
"lstrip": false,
|
| 353 |
+
"normalized": false,
|
| 354 |
+
"rstrip": true,
|
| 355 |
+
"single_word": false,
|
| 356 |
+
"special": true
|
| 357 |
+
},
|
| 358 |
+
"32041": {
|
| 359 |
+
"content": "<|placeholder37|>",
|
| 360 |
+
"lstrip": false,
|
| 361 |
+
"normalized": false,
|
| 362 |
+
"rstrip": true,
|
| 363 |
+
"single_word": false,
|
| 364 |
+
"special": true
|
| 365 |
+
},
|
| 366 |
+
"32042": {
|
| 367 |
+
"content": "<|placeholder38|>",
|
| 368 |
+
"lstrip": false,
|
| 369 |
+
"normalized": false,
|
| 370 |
+
"rstrip": true,
|
| 371 |
+
"single_word": false,
|
| 372 |
+
"special": true
|
| 373 |
+
},
|
| 374 |
+
"32043": {
|
| 375 |
+
"content": "<|placeholder39|>",
|
| 376 |
+
"lstrip": false,
|
| 377 |
+
"normalized": false,
|
| 378 |
+
"rstrip": true,
|
| 379 |
+
"single_word": false,
|
| 380 |
+
"special": true
|
| 381 |
+
},
|
| 382 |
+
"32044": {
|
| 383 |
+
"content": "<|image|>",
|
| 384 |
+
"lstrip": false,
|
| 385 |
+
"normalized": false,
|
| 386 |
+
"rstrip": true,
|
| 387 |
+
"single_word": false,
|
| 388 |
+
"special": true
|
| 389 |
+
}
|
| 390 |
+
},
|
| 391 |
+
"additional_special_tokens": [
|
| 392 |
+
"<|system|>",
|
| 393 |
+
"<|end|>",
|
| 394 |
+
"<|user|>",
|
| 395 |
+
"<|end|>"
|
| 396 |
+
],
|
| 397 |
+
"auto_map": {
|
| 398 |
+
"AutoProcessor": "processing_phi3_v.Phi3VProcessor"
|
| 399 |
+
},
|
| 400 |
+
"bos_token": "<s>",
|
| 401 |
+
"chat_template": "{% for message in messages %}{{'<|' + message['role'] + '|>' + '\n' + message['content'] + '<|end|>\n' }}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{- '<|assistant|>\n' -}}{% endif %}",
|
| 402 |
+
"clean_up_tokenization_spaces": false,
|
| 403 |
+
"eos_token": "<|endoftext|>",
|
| 404 |
+
"legacy": false,
|
| 405 |
+
"model_max_length": 131072,
|
| 406 |
+
"pad_token": "<|endoftext|>",
|
| 407 |
+
"padding_side": "right",
|
| 408 |
+
"processor_class": "Phi3VProcessor",
|
| 409 |
+
"sp_model_kwargs": {},
|
| 410 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 411 |
+
"unk_token": "<unk>",
|
| 412 |
+
"use_default_system_prompt": false
|
| 413 |
+
}
|