Upload folder using huggingface_hub
Browse files- config.json +192 -0
- configuration_phi3_v.py +218 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- special_tokens_map.json +36 -0
- tokenizer.json +0 -0
- tokenizer_config.json +413 -0
config.json
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/home/mgoin/.cache/huggingface/hub/models--microsoft--Phi-3.5-vision-instruct/snapshots/4a0d683eba9f1d0cbfb6151705d1ee73c25a80ca",
|
3 |
+
"architectures": [
|
4 |
+
"Phi3VForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "configuration_phi3_v.Phi3VConfig",
|
9 |
+
"AutoModelForCausalLM": "modeling_phi3_v.Phi3VForCausalLM"
|
10 |
+
},
|
11 |
+
"bos_token_id": 1,
|
12 |
+
"embd_layer": {
|
13 |
+
"embedding_cls": "image",
|
14 |
+
"hd_transform_order": "sub_glb",
|
15 |
+
"projection_cls": "mlp",
|
16 |
+
"use_hd_transform": true,
|
17 |
+
"with_learnable_separator": true
|
18 |
+
},
|
19 |
+
"embd_pdrop": 0.0,
|
20 |
+
"eos_token_id": 2,
|
21 |
+
"hidden_act": "silu",
|
22 |
+
"hidden_size": 3072,
|
23 |
+
"img_processor": {
|
24 |
+
"image_dim_out": 1024,
|
25 |
+
"model_name": "openai/clip-vit-large-patch14-336",
|
26 |
+
"name": "clip_vision_model",
|
27 |
+
"num_img_tokens": 144
|
28 |
+
},
|
29 |
+
"initializer_range": 0.02,
|
30 |
+
"intermediate_size": 8192,
|
31 |
+
"max_position_embeddings": 131072,
|
32 |
+
"model_type": "phi3_v",
|
33 |
+
"num_attention_heads": 32,
|
34 |
+
"num_hidden_layers": 32,
|
35 |
+
"num_key_value_heads": 32,
|
36 |
+
"original_max_position_embeddings": 4096,
|
37 |
+
"pad_token_id": 32000,
|
38 |
+
"quantization_config": {
|
39 |
+
"config_groups": {
|
40 |
+
"group_0": {
|
41 |
+
"input_activations": {
|
42 |
+
"actorder": null,
|
43 |
+
"block_structure": null,
|
44 |
+
"dynamic": true,
|
45 |
+
"group_size": null,
|
46 |
+
"num_bits": 8,
|
47 |
+
"observer": "memoryless",
|
48 |
+
"observer_kwargs": {},
|
49 |
+
"strategy": "token",
|
50 |
+
"symmetric": true,
|
51 |
+
"type": "int"
|
52 |
+
},
|
53 |
+
"output_activations": null,
|
54 |
+
"targets": [
|
55 |
+
"Linear"
|
56 |
+
],
|
57 |
+
"weights": {
|
58 |
+
"actorder": null,
|
59 |
+
"block_structure": null,
|
60 |
+
"dynamic": false,
|
61 |
+
"group_size": null,
|
62 |
+
"num_bits": 8,
|
63 |
+
"observer": "minmax",
|
64 |
+
"observer_kwargs": {},
|
65 |
+
"strategy": "channel",
|
66 |
+
"symmetric": true,
|
67 |
+
"type": "int"
|
68 |
+
}
|
69 |
+
}
|
70 |
+
},
|
71 |
+
"format": "int-quantized",
|
72 |
+
"global_compression_ratio": 1.199964041858949,
|
73 |
+
"ignore": [
|
74 |
+
"lm_head"
|
75 |
+
],
|
76 |
+
"kv_cache_scheme": null,
|
77 |
+
"quant_method": "compressed-tensors",
|
78 |
+
"quantization_status": "compressed"
|
79 |
+
},
|
80 |
+
"resid_pdrop": 0.0,
|
81 |
+
"rms_norm_eps": 1e-05,
|
82 |
+
"rope_scaling": {
|
83 |
+
"long_factor": [
|
84 |
+
1.0800000429153442,
|
85 |
+
1.1100000143051147,
|
86 |
+
1.1399999856948853,
|
87 |
+
1.340000033378601,
|
88 |
+
1.5899999141693115,
|
89 |
+
1.600000023841858,
|
90 |
+
1.6200000047683716,
|
91 |
+
2.620000123977661,
|
92 |
+
3.2300000190734863,
|
93 |
+
3.2300000190734863,
|
94 |
+
4.789999961853027,
|
95 |
+
7.400000095367432,
|
96 |
+
7.700000286102295,
|
97 |
+
9.09000015258789,
|
98 |
+
12.199999809265137,
|
99 |
+
17.670000076293945,
|
100 |
+
24.46000099182129,
|
101 |
+
28.57000160217285,
|
102 |
+
30.420001983642578,
|
103 |
+
30.840002059936523,
|
104 |
+
32.590003967285156,
|
105 |
+
32.93000411987305,
|
106 |
+
42.320003509521484,
|
107 |
+
44.96000289916992,
|
108 |
+
50.340003967285156,
|
109 |
+
50.45000457763672,
|
110 |
+
57.55000305175781,
|
111 |
+
57.93000411987305,
|
112 |
+
58.21000289916992,
|
113 |
+
60.1400032043457,
|
114 |
+
62.61000442504883,
|
115 |
+
62.62000274658203,
|
116 |
+
62.71000289916992,
|
117 |
+
63.1400032043457,
|
118 |
+
63.1400032043457,
|
119 |
+
63.77000427246094,
|
120 |
+
63.93000411987305,
|
121 |
+
63.96000289916992,
|
122 |
+
63.970001220703125,
|
123 |
+
64.02999877929688,
|
124 |
+
64.06999969482422,
|
125 |
+
64.08000183105469,
|
126 |
+
64.12000274658203,
|
127 |
+
64.41000366210938,
|
128 |
+
64.4800033569336,
|
129 |
+
64.51000213623047,
|
130 |
+
64.52999877929688,
|
131 |
+
64.83999633789062
|
132 |
+
],
|
133 |
+
"short_factor": [
|
134 |
+
1.08,
|
135 |
+
1.1,
|
136 |
+
1.1300000000000001,
|
137 |
+
1.2800000000000002,
|
138 |
+
1.3100000000000003,
|
139 |
+
1.4500000000000004,
|
140 |
+
1.4500000000000004,
|
141 |
+
1.9500000000000008,
|
142 |
+
2.030000000000001,
|
143 |
+
2.4299999999999926,
|
144 |
+
2.5699999999999896,
|
145 |
+
2.9499999999999815,
|
146 |
+
3.729999999999965,
|
147 |
+
3.869999999999962,
|
148 |
+
4.189999999999955,
|
149 |
+
4.43999999999995,
|
150 |
+
4.6399999999999455,
|
151 |
+
4.979999999999938,
|
152 |
+
5.159999999999934,
|
153 |
+
5.279999999999932,
|
154 |
+
5.759999999999922,
|
155 |
+
5.889999999999919,
|
156 |
+
5.889999999999919,
|
157 |
+
5.969999999999917,
|
158 |
+
6.089999999999915,
|
159 |
+
6.2799999999999105,
|
160 |
+
6.7699999999999,
|
161 |
+
6.8899999999998975,
|
162 |
+
7.109999999999893,
|
163 |
+
7.129999999999892,
|
164 |
+
7.179999999999891,
|
165 |
+
7.289999999999889,
|
166 |
+
7.339999999999888,
|
167 |
+
7.559999999999883,
|
168 |
+
7.619999999999882,
|
169 |
+
7.69999999999988,
|
170 |
+
7.879999999999876,
|
171 |
+
7.879999999999876,
|
172 |
+
7.879999999999876,
|
173 |
+
7.939999999999875,
|
174 |
+
7.949999999999875,
|
175 |
+
7.979999999999874,
|
176 |
+
8.19999999999987,
|
177 |
+
8.439999999999864,
|
178 |
+
8.469999999999864,
|
179 |
+
8.589999999999861,
|
180 |
+
8.809999999999857,
|
181 |
+
8.999999999999853
|
182 |
+
],
|
183 |
+
"type": "su"
|
184 |
+
},
|
185 |
+
"rope_theta": 10000.0,
|
186 |
+
"sliding_window": 262144,
|
187 |
+
"tie_word_embeddings": false,
|
188 |
+
"torch_dtype": "bfloat16",
|
189 |
+
"transformers_version": "4.46.0.dev0",
|
190 |
+
"use_cache": true,
|
191 |
+
"vocab_size": 32064
|
192 |
+
}
|
configuration_phi3_v.py
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
""" 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.46.0.dev0"
|
7 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5cc639128711d712dfe12f6130b0729852aa632bb6fc295b73d3a8c4b449e738
|
3 |
+
size 4544968752
|
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 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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": "microsoft/Phi-3.5-vision-instruct--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 |
+
}
|