Update model for latest `transformers` changes

#14
by RaushanTurganbay HF staff - opened
README.md CHANGED
@@ -4,7 +4,7 @@ license: other
4
  tags:
5
  - vision
6
  - image-captioning
7
- pipeline_tag: image-to-text
8
  ---
9
 
10
  # InstructBLIP model
 
4
  tags:
5
  - vision
6
  - image-captioning
7
+ pipeline_tag: image-text-to-text
8
  ---
9
 
10
  # InstructBLIP model
added_tokens.json CHANGED
@@ -1,3 +1,5 @@
1
  {
 
 
2
  "[PAD]": 32000
3
  }
 
1
  {
2
+ "<image>": 32001,
3
+ "<video>": 32002,
4
  "[PAD]": 32000
5
  }
config.json CHANGED
@@ -1,244 +1,49 @@
1
  {
2
- "_commit_hash": null,
3
  "architectures": [
4
  "InstructBlipForConditionalGeneration"
5
  ],
 
6
  "initializer_factor": 1.0,
7
  "initializer_range": 0.02,
8
  "model_type": "instructblip",
9
  "num_query_tokens": 32,
10
  "qformer_config": {
11
- "_name_or_path": "",
12
- "add_cross_attention": false,
13
- "architectures": null,
14
- "attention_probs_dropout_prob": 0.1,
15
- "bad_words_ids": null,
16
- "begin_suppress_tokens": null,
17
- "bos_token_id": null,
18
- "chunk_size_feed_forward": 0,
19
- "cross_attention_frequency": 2,
20
- "cross_attention_hidden_size": null,
21
- "decoder_start_token_id": null,
22
- "diversity_penalty": 0.0,
23
- "do_sample": false,
24
- "early_stopping": false,
25
- "encoder_hidden_size": 1408,
26
- "encoder_no_repeat_ngram_size": 0,
27
- "eos_token_id": null,
28
- "exponential_decay_length_penalty": null,
29
- "finetuning_task": null,
30
- "forced_bos_token_id": null,
31
- "forced_eos_token_id": null,
32
- "hidden_act": "gelu",
33
- "hidden_dropout_prob": 0.1,
34
- "hidden_size": 768,
35
- "id2label": {
36
- "0": "LABEL_0",
37
- "1": "LABEL_1"
38
- },
39
- "initializer_range": 0.02,
40
- "intermediate_size": 3072,
41
- "is_decoder": false,
42
- "is_encoder_decoder": false,
43
- "label2id": {
44
- "LABEL_0": 0,
45
- "LABEL_1": 1
46
- },
47
- "layer_norm_eps": 1e-12,
48
- "length_penalty": 1.0,
49
- "max_length": 20,
50
- "max_position_embeddings": 512,
51
- "min_length": 0,
52
  "model_type": "instructblip_qformer",
53
- "no_repeat_ngram_size": 0,
54
- "num_attention_heads": 12,
55
- "num_beam_groups": 1,
56
- "num_beams": 1,
57
- "num_hidden_layers": 12,
58
- "num_return_sequences": 1,
59
- "output_attentions": false,
60
- "output_hidden_states": false,
61
- "output_scores": false,
62
- "pad_token_id": 0,
63
- "position_embedding_type": "absolute",
64
- "prefix": null,
65
- "problem_type": null,
66
- "pruned_heads": {},
67
- "remove_invalid_values": false,
68
- "repetition_penalty": 1.0,
69
- "return_dict": true,
70
- "return_dict_in_generate": false,
71
- "sep_token_id": null,
72
- "suppress_tokens": null,
73
- "task_specific_params": null,
74
- "temperature": 1.0,
75
- "tf_legacy_loss": false,
76
- "tie_encoder_decoder": false,
77
- "tie_word_embeddings": true,
78
- "tokenizer_class": null,
79
- "top_k": 50,
80
- "top_p": 1.0,
81
- "torch_dtype": null,
82
- "torchscript": false,
83
- "transformers_version": "4.31.0.dev0",
84
- "typical_p": 1.0,
85
- "use_bfloat16": false,
86
  "vocab_size": 30523
87
  },
88
  "text_config": {
89
- "_name_or_path": "",
90
- "add_cross_attention": false,
91
  "architectures": [
92
  "LLaMAForCausalLM"
93
  ],
94
- "bad_words_ids": null,
95
- "begin_suppress_tokens": null,
96
  "bos_token_id": 0,
97
- "chunk_size_feed_forward": 0,
98
- "cross_attention_hidden_size": null,
99
- "decoder_start_token_id": null,
100
- "diversity_penalty": 0.0,
101
- "do_sample": false,
102
- "early_stopping": false,
103
- "encoder_no_repeat_ngram_size": 0,
104
  "eos_token_id": 1,
105
- "exponential_decay_length_penalty": null,
106
- "finetuning_task": null,
107
- "forced_bos_token_id": null,
108
- "forced_eos_token_id": null,
109
  "hidden_act": "silu",
110
  "hidden_size": 4096,
111
- "id2label": {
112
- "0": "LABEL_0",
113
- "1": "LABEL_1"
114
- },
115
  "initializer_range": 0.02,
116
  "intermediate_size": 11008,
117
- "is_decoder": false,
118
- "is_encoder_decoder": false,
119
- "label2id": {
120
- "LABEL_0": 0,
121
- "LABEL_1": 1
122
- },
123
- "length_penalty": 1.0,
124
- "max_length": 20,
125
- "max_position_embeddings": 2048,
126
  "max_sequence_length": 2048,
127
- "min_length": 0,
128
  "model_type": "llama",
129
- "no_repeat_ngram_size": 0,
130
  "num_attention_heads": 32,
131
- "num_beam_groups": 1,
132
- "num_beams": 1,
133
  "num_hidden_layers": 32,
134
- "num_return_sequences": 1,
135
- "output_attentions": false,
136
- "output_hidden_states": false,
137
- "output_scores": false,
138
  "pad_token_id": 32000,
139
- "prefix": null,
140
- "problem_type": null,
141
- "pruned_heads": {},
142
- "remove_invalid_values": false,
143
- "repetition_penalty": 1.0,
144
- "return_dict": true,
145
- "return_dict_in_generate": false,
146
  "rms_norm_eps": 1e-06,
147
- "sep_token_id": null,
148
- "suppress_tokens": null,
149
- "task_specific_params": null,
150
- "temperature": 1.0,
151
- "tf_legacy_loss": false,
152
- "tie_encoder_decoder": false,
153
  "tie_word_embeddings": false,
154
- "tokenizer_class": null,
155
- "top_k": 50,
156
- "top_p": 1.0,
157
  "torch_dtype": "float16",
158
- "torchscript": false,
159
- "transformers_version": "4.31.0.dev0",
160
- "typical_p": 1.0,
161
- "use_bfloat16": false,
162
- "use_cache": true,
163
- "vocab_size": 32001
164
  },
165
  "tie_word_embeddings": false,
166
  "torch_dtype": "float32",
167
- "transformers_version": null,
168
  "use_decoder_only_language_model": true,
 
169
  "vision_config": {
170
- "_name_or_path": "",
171
- "add_cross_attention": false,
172
- "architectures": null,
173
- "attention_dropout": 0.0,
174
- "bad_words_ids": null,
175
- "begin_suppress_tokens": null,
176
- "bos_token_id": null,
177
- "chunk_size_feed_forward": 0,
178
- "cross_attention_hidden_size": null,
179
- "decoder_start_token_id": null,
180
- "diversity_penalty": 0.0,
181
- "do_sample": false,
182
- "early_stopping": false,
183
- "encoder_no_repeat_ngram_size": 0,
184
- "eos_token_id": null,
185
- "exponential_decay_length_penalty": null,
186
- "finetuning_task": null,
187
- "forced_bos_token_id": null,
188
- "forced_eos_token_id": null,
189
- "hidden_act": "gelu",
190
- "hidden_size": 1408,
191
- "id2label": {
192
- "0": "LABEL_0",
193
- "1": "LABEL_1"
194
- },
195
- "image_size": 224,
196
- "initializer_range": 1e-10,
197
- "intermediate_size": 6144,
198
- "is_decoder": false,
199
- "is_encoder_decoder": false,
200
- "label2id": {
201
- "LABEL_0": 0,
202
- "LABEL_1": 1
203
- },
204
- "layer_norm_eps": 1e-06,
205
- "length_penalty": 1.0,
206
- "max_length": 20,
207
- "min_length": 0,
208
- "model_type": "instructblip_vision_model",
209
- "no_repeat_ngram_size": 0,
210
- "num_attention_heads": 16,
211
- "num_beam_groups": 1,
212
- "num_beams": 1,
213
- "num_hidden_layers": 39,
214
- "num_return_sequences": 1,
215
- "output_attentions": false,
216
- "output_hidden_states": false,
217
- "output_scores": false,
218
- "pad_token_id": null,
219
- "patch_size": 14,
220
- "prefix": null,
221
- "problem_type": null,
222
- "pruned_heads": {},
223
- "qkv_bias": true,
224
- "remove_invalid_values": false,
225
- "repetition_penalty": 1.0,
226
- "return_dict": true,
227
- "return_dict_in_generate": false,
228
- "sep_token_id": null,
229
- "suppress_tokens": null,
230
- "task_specific_params": null,
231
- "temperature": 1.0,
232
- "tf_legacy_loss": false,
233
- "tie_encoder_decoder": false,
234
- "tie_word_embeddings": true,
235
- "tokenizer_class": null,
236
- "top_k": 50,
237
- "top_p": 1.0,
238
- "torch_dtype": null,
239
- "torchscript": false,
240
- "transformers_version": "4.31.0.dev0",
241
- "typical_p": 1.0,
242
- "use_bfloat16": false
243
  }
244
  }
 
1
  {
 
2
  "architectures": [
3
  "InstructBlipForConditionalGeneration"
4
  ],
5
+ "image_token_index": 32001,
6
  "initializer_factor": 1.0,
7
  "initializer_range": 0.02,
8
  "model_type": "instructblip",
9
  "num_query_tokens": 32,
10
  "qformer_config": {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  "model_type": "instructblip_qformer",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  "vocab_size": 30523
13
  },
14
  "text_config": {
 
 
15
  "architectures": [
16
  "LLaMAForCausalLM"
17
  ],
18
+ "attention_bias": false,
 
19
  "bos_token_id": 0,
 
 
 
 
 
 
 
20
  "eos_token_id": 1,
21
+ "head_dim": 128,
 
 
 
22
  "hidden_act": "silu",
23
  "hidden_size": 4096,
 
 
 
 
24
  "initializer_range": 0.02,
25
  "intermediate_size": 11008,
 
 
 
 
 
 
 
 
 
26
  "max_sequence_length": 2048,
27
+ "mlp_bias": false,
28
  "model_type": "llama",
 
29
  "num_attention_heads": 32,
 
 
30
  "num_hidden_layers": 32,
31
+ "num_key_value_heads": 32,
 
 
 
32
  "pad_token_id": 32000,
33
+ "pretraining_tp": 1,
 
 
 
 
 
 
34
  "rms_norm_eps": 1e-06,
35
+ "rope_scaling": null,
36
+ "rope_theta": 10000.0,
 
 
 
 
37
  "tie_word_embeddings": false,
 
 
 
38
  "torch_dtype": "float16",
39
+ "vocab_size": 32064
 
 
 
 
 
40
  },
41
  "tie_word_embeddings": false,
42
  "torch_dtype": "float32",
43
+ "transformers_version": "4.47.0.dev0",
44
  "use_decoder_only_language_model": true,
45
+ "video_token_index": 32002,
46
  "vision_config": {
47
+ "model_type": "instructblip_vision_model"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
  }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 32000,
6
+ "transformers_version": "4.47.0.dev0"
7
+ }
model-00001-of-00004.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a1773d66d8e56dfd4cf5fa4ccfe72be2fe24a5798cdaf88be26bfba9c0942f61
3
- size 9900377640
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da825eee67c127052d38bc429e077571dfba65860dabbbd84d9fdaf5cd496666
3
+ size 9901403320
model-00002-of-00004.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a0fbf9da35fb9728e5863ec12879efbfb5a9595b5097f48aaa665cfdb846ca24
3
- size 9961917232
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e7afd5d1bc89391d3a6735ca68e4539a7a65d6d1ae0f5151b883c57b0ee649c
3
+ size 9961912600
model-00003-of-00004.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0d53b9fcde48bc699749d187827ee4c3d9a8e690371384c8b4837f46d9e38f06
3
- size 9915747424
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68637c404c6e8953ab85247ee311dfefe102830c0a289f13447fa8a1ccabb1bb
3
+ size 9915742400
model-00004-of-00004.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e9cf86c9c7f7318b6604598f20eed517074b60de47bfd14817a4cb35550b2c11
3
- size 1874954648
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46d674bda7114f639c411b6341716c03e0f821407b1c4cd58f28aa1c64b34481
3
+ size 1875986448
model.safetensors.index.json CHANGED
The diff for this file is too large to render. See raw diff
 
processor_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "num_query_tokens": 32,
3
+ "processor_class": "InstructBlipVideoProcessor"
4
+ }
qformer_tokenizer/special_tokens_map.json CHANGED
@@ -1,8 +1,44 @@
1
  {
2
- "bos_token": "[DEC]",
3
- "cls_token": "[CLS]",
4
- "mask_token": "[MASK]",
5
- "pad_token": "[PAD]",
6
- "sep_token": "[SEP]",
7
- "unk_token": "[UNK]"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
 
1
  {
2
+ "bos_token": {
3
+ "content": "[DEC]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "[CLS]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "mask_token": {
17
+ "content": "[MASK]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "pad_token": {
24
+ "content": "[PAD]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "sep_token": {
31
+ "content": "[SEP]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "unk_token": {
38
+ "content": "[UNK]",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ }
44
  }
qformer_tokenizer/tokenizer_config.json CHANGED
@@ -1,7 +1,59 @@
1
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  "clean_up_tokenization_spaces": true,
3
  "cls_token": "[CLS]",
4
  "do_lower_case": true,
 
5
  "mask_token": "[MASK]",
6
  "model_max_length": 512,
7
  "pad_token": "[PAD]",
 
1
  {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "30522": {
44
+ "content": "[DEC]",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ }
51
+ },
52
+ "bos_token": "[DEC]",
53
  "clean_up_tokenization_spaces": true,
54
  "cls_token": "[CLS]",
55
  "do_lower_case": true,
56
+ "extra_special_tokens": {},
57
  "mask_token": "[MASK]",
58
  "model_max_length": 512,
59
  "pad_token": "[PAD]",
special_tokens_map.json CHANGED
@@ -1,5 +1,11 @@
1
  {
2
- "bos_token": "</s>",
 
 
 
 
 
 
3
  "eos_token": {
4
  "content": "</s>",
5
  "lstrip": false,
@@ -7,6 +13,18 @@
7
  "rstrip": false,
8
  "single_word": false
9
  },
10
- "pad_token": "[PAD]",
11
- "unk_token": "</s>"
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
 
1
  {
2
+ "bos_token": {
3
+ "content": "</s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
  "eos_token": {
10
  "content": "</s>",
11
  "lstrip": false,
 
13
  "rstrip": false,
14
  "single_word": false
15
  },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "</s>",
25
+ "lstrip": false,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
  }
tokenizer.json CHANGED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json CHANGED
@@ -1,19 +1,68 @@
1
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  "bos_token": "</s>",
3
  "clean_up_tokenization_spaces": false,
4
- "eos_token": {
5
- "__type": "AddedToken",
6
- "content": "</s>",
7
- "lstrip": false,
8
- "normalized": true,
9
- "rstrip": false,
10
- "single_word": false
11
- },
12
  "model_max_length": 2048,
13
- "pad_token": null,
14
  "processor_class": "InstructBlipProcessor",
15
  "sp_model_kwargs": {},
16
  "tokenizer_class": "LlamaTokenizer",
17
  "truncation_side": "left",
18
- "unk_token": "</s>"
 
19
  }
 
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": true,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": true,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "32000": {
31
+ "content": "[PAD]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "32001": {
39
+ "content": "<image>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "32002": {
47
+ "content": "<video>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": true
53
+ }
54
+ },
55
  "bos_token": "</s>",
56
  "clean_up_tokenization_spaces": false,
57
+ "eos_token": "</s>",
58
+ "extra_special_tokens": {},
59
+ "legacy": true,
 
 
 
 
 
60
  "model_max_length": 2048,
61
+ "pad_token": "[PAD]",
62
  "processor_class": "InstructBlipProcessor",
63
  "sp_model_kwargs": {},
64
  "tokenizer_class": "LlamaTokenizer",
65
  "truncation_side": "left",
66
+ "unk_token": "</s>",
67
+ "use_default_system_prompt": false
68
  }