Commit
•
4e95534
0
Parent(s):
Duplicate from Salesforce/blip2-opt-2.7b
Browse filesCo-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>
- .gitattributes +34 -0
- README.md +174 -0
- config.json +255 -0
- merges.txt +0 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +0 -0
- preprocessor_config.json +24 -0
- pytorch_model-00001-of-00002.bin +3 -0
- pytorch_model-00002-of-00002.bin +3 -0
- pytorch_model.bin.index.json +0 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer_config.json +41 -0
- vocab.json +0 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
tags:
|
5 |
+
- vision
|
6 |
+
- image-to-text
|
7 |
+
- image-captioning
|
8 |
+
- visual-question-answering
|
9 |
+
pipeline_tag: image-to-text
|
10 |
+
---
|
11 |
+
|
12 |
+
# BLIP-2, OPT-2.7b, pre-trained only
|
13 |
+
|
14 |
+
BLIP-2 model, leveraging [OPT-2.7b](https://huggingface.co/facebook/opt-2.7b) (a large language model with 2.7 billion parameters).
|
15 |
+
It was introduced in the paper [BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models](https://arxiv.org/abs/2301.12597) by Li et al. and first released in [this repository](https://github.com/salesforce/LAVIS/tree/main/projects/blip2).
|
16 |
+
|
17 |
+
Disclaimer: The team releasing BLIP-2 did not write a model card for this model so this model card has been written by the Hugging Face team.
|
18 |
+
|
19 |
+
## Model description
|
20 |
+
|
21 |
+
BLIP-2 consists of 3 models: a CLIP-like image encoder, a Querying Transformer (Q-Former) and a large language model.
|
22 |
+
|
23 |
+
The authors initialize the weights of the image encoder and large language model from pre-trained checkpoints and keep them frozen
|
24 |
+
while training the Querying Transformer, which is a BERT-like Transformer encoder that maps a set of "query tokens" to query embeddings,
|
25 |
+
which bridge the gap between the embedding space of the image encoder and the large language model.
|
26 |
+
|
27 |
+
The goal for the model is simply to predict the next text token, giving the query embeddings and the previous text.
|
28 |
+
|
29 |
+
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/blip2_architecture.jpg"
|
30 |
+
alt="drawing" width="600"/>
|
31 |
+
|
32 |
+
This allows the model to be used for tasks like:
|
33 |
+
|
34 |
+
- image captioning
|
35 |
+
- visual question answering (VQA)
|
36 |
+
- chat-like conversations by feeding the image and the previous conversation as prompt to the model
|
37 |
+
|
38 |
+
## Direct Use and Downstream Use
|
39 |
+
|
40 |
+
You can use the raw model for conditional text generation given an image and optional text. See the [model hub](https://huggingface.co/models?search=Salesforce/blip) to look for
|
41 |
+
fine-tuned versions on a task that interests you.
|
42 |
+
|
43 |
+
## Bias, Risks, Limitations, and Ethical Considerations
|
44 |
+
|
45 |
+
BLIP2-OPT uses off-the-shelf OPT as the language model. It inherits the same risks and limitations as mentioned in Meta's model card.
|
46 |
+
|
47 |
+
> Like other large language models for which the diversity (or lack thereof) of training
|
48 |
+
> data induces downstream impact on the quality of our model, OPT-175B has limitations in terms
|
49 |
+
> of bias and safety. OPT-175B can also have quality issues in terms of generation diversity and
|
50 |
+
> hallucination. In general, OPT-175B is not immune from the plethora of issues that plague modern
|
51 |
+
> large language models.
|
52 |
+
>
|
53 |
+
BLIP2 is fine-tuned on image-text datasets (e.g. [LAION](https://laion.ai/blog/laion-400-open-dataset/) ) collected from the internet. As a result the model itself is potentially vulnerable to generating equivalently inappropriate content or replicating inherent biases in the underlying data.
|
54 |
+
|
55 |
+
BLIP2 has not been tested in real world applications. It should not be directly deployed in any applications. Researchers should first carefully assess the safety and fairness of the model in relation to the specific context they’re being deployed within.
|
56 |
+
|
57 |
+
|
58 |
+
### How to use
|
59 |
+
|
60 |
+
For code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2ForConditionalGeneration.forward.example).
|
61 |
+
|
62 |
+
### Memory requirements
|
63 |
+
|
64 |
+
The memory requirements differ based on the precision one uses. One can use 4-bit inference using [Bitsandbytes](https://huggingface.co/blog/4bit-transformers-bitsandbytes), which greatly reduce the memory requirements.
|
65 |
+
|
66 |
+
| dtype | Largest Layer or Residual Group | Total Size | Training using Adam |
|
67 |
+
|-------------------|---------------------------------|------------|----------------------|
|
68 |
+
| float32 | 490.94 MB | 14.43 GB | 57.72 GB |
|
69 |
+
| float16/bfloat16 | 245.47 MB | 7.21 GB | 28.86 GB |
|
70 |
+
| int8 | 122.73 MB | 3.61 GB | 14.43 GB |
|
71 |
+
| int4 | 61.37 MB | 1.8 GB | 7.21 GB |
|
72 |
+
|
73 |
+
#### Running the model on CPU
|
74 |
+
|
75 |
+
<details>
|
76 |
+
<summary> Click to expand </summary>
|
77 |
+
|
78 |
+
```python
|
79 |
+
import requests
|
80 |
+
from PIL import Image
|
81 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
82 |
+
|
83 |
+
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
84 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b")
|
85 |
+
|
86 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
87 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
88 |
+
|
89 |
+
question = "how many dogs are in the picture?"
|
90 |
+
inputs = processor(raw_image, question, return_tensors="pt")
|
91 |
+
|
92 |
+
out = model.generate(**inputs)
|
93 |
+
print(processor.decode(out[0], skip_special_tokens=True).strip())
|
94 |
+
```
|
95 |
+
</details>
|
96 |
+
|
97 |
+
#### Running the model on GPU
|
98 |
+
|
99 |
+
##### In full precision
|
100 |
+
|
101 |
+
<details>
|
102 |
+
<summary> Click to expand </summary>
|
103 |
+
|
104 |
+
```python
|
105 |
+
# pip install accelerate
|
106 |
+
import requests
|
107 |
+
from PIL import Image
|
108 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
109 |
+
|
110 |
+
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
111 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", device_map="auto")
|
112 |
+
|
113 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
114 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
115 |
+
|
116 |
+
question = "how many dogs are in the picture?"
|
117 |
+
inputs = processor(raw_image, question, return_tensors="pt").to("cuda")
|
118 |
+
|
119 |
+
out = model.generate(**inputs)
|
120 |
+
print(processor.decode(out[0], skip_special_tokens=True).strip())
|
121 |
+
```
|
122 |
+
</details>
|
123 |
+
|
124 |
+
##### In half precision (`float16`)
|
125 |
+
|
126 |
+
<details>
|
127 |
+
<summary> Click to expand </summary>
|
128 |
+
|
129 |
+
```python
|
130 |
+
# pip install accelerate
|
131 |
+
import torch
|
132 |
+
import requests
|
133 |
+
from PIL import Image
|
134 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
135 |
+
|
136 |
+
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
137 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", torch_dtype=torch.float16, device_map="auto")
|
138 |
+
|
139 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
140 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
141 |
+
|
142 |
+
question = "how many dogs are in the picture?"
|
143 |
+
inputs = processor(raw_image, question, return_tensors="pt").to("cuda", torch.float16)
|
144 |
+
|
145 |
+
out = model.generate(**inputs)
|
146 |
+
print(processor.decode(out[0], skip_special_tokens=True).strip())
|
147 |
+
```
|
148 |
+
</details>
|
149 |
+
|
150 |
+
##### In 8-bit precision (`int8`)
|
151 |
+
|
152 |
+
<details>
|
153 |
+
<summary> Click to expand </summary>
|
154 |
+
|
155 |
+
```python
|
156 |
+
# pip install accelerate bitsandbytes
|
157 |
+
import torch
|
158 |
+
import requests
|
159 |
+
from PIL import Image
|
160 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
161 |
+
|
162 |
+
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
163 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", load_in_8bit=True, device_map="auto")
|
164 |
+
|
165 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
166 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
167 |
+
|
168 |
+
question = "how many dogs are in the picture?"
|
169 |
+
inputs = processor(raw_image, question, return_tensors="pt").to("cuda", torch.float16)
|
170 |
+
|
171 |
+
out = model.generate(**inputs)
|
172 |
+
print(processor.decode(out[0], skip_special_tokens=True).strip())
|
173 |
+
```
|
174 |
+
</details>
|
config.json
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_commit_hash": null,
|
3 |
+
"architectures": [
|
4 |
+
"Blip2ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"initializer_factor": 1.0,
|
7 |
+
"initializer_range": 0.02,
|
8 |
+
"model_type": "blip-2",
|
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 |
+
"classifier_dropout": null,
|
20 |
+
"cross_attention_frequency": 2,
|
21 |
+
"cross_attention_hidden_size": null,
|
22 |
+
"decoder_start_token_id": null,
|
23 |
+
"diversity_penalty": 0.0,
|
24 |
+
"do_sample": false,
|
25 |
+
"early_stopping": false,
|
26 |
+
"encoder_hidden_size": 1408,
|
27 |
+
"encoder_no_repeat_ngram_size": 0,
|
28 |
+
"eos_token_id": null,
|
29 |
+
"exponential_decay_length_penalty": null,
|
30 |
+
"finetuning_task": null,
|
31 |
+
"forced_bos_token_id": null,
|
32 |
+
"forced_eos_token_id": null,
|
33 |
+
"hidden_act": "gelu",
|
34 |
+
"hidden_dropout_prob": 0.1,
|
35 |
+
"hidden_size": 768,
|
36 |
+
"id2label": {
|
37 |
+
"0": "LABEL_0",
|
38 |
+
"1": "LABEL_1"
|
39 |
+
},
|
40 |
+
"initializer_range": 0.02,
|
41 |
+
"intermediate_size": 3072,
|
42 |
+
"is_decoder": false,
|
43 |
+
"is_encoder_decoder": false,
|
44 |
+
"label2id": {
|
45 |
+
"LABEL_0": 0,
|
46 |
+
"LABEL_1": 1
|
47 |
+
},
|
48 |
+
"layer_norm_eps": 1e-12,
|
49 |
+
"length_penalty": 1.0,
|
50 |
+
"max_length": 20,
|
51 |
+
"max_position_embeddings": 512,
|
52 |
+
"min_length": 0,
|
53 |
+
"model_type": "blip_2_qformer",
|
54 |
+
"no_repeat_ngram_size": 0,
|
55 |
+
"num_attention_heads": 12,
|
56 |
+
"num_beam_groups": 1,
|
57 |
+
"num_beams": 1,
|
58 |
+
"num_hidden_layers": 12,
|
59 |
+
"num_return_sequences": 1,
|
60 |
+
"output_attentions": false,
|
61 |
+
"output_hidden_states": false,
|
62 |
+
"output_scores": false,
|
63 |
+
"pad_token_id": 0,
|
64 |
+
"position_embedding_type": "absolute",
|
65 |
+
"prefix": null,
|
66 |
+
"problem_type": null,
|
67 |
+
"pruned_heads": {},
|
68 |
+
"remove_invalid_values": false,
|
69 |
+
"repetition_penalty": 1.0,
|
70 |
+
"return_dict": true,
|
71 |
+
"return_dict_in_generate": false,
|
72 |
+
"sep_token_id": null,
|
73 |
+
"suppress_tokens": null,
|
74 |
+
"task_specific_params": null,
|
75 |
+
"temperature": 1.0,
|
76 |
+
"tf_legacy_loss": false,
|
77 |
+
"tie_encoder_decoder": false,
|
78 |
+
"tie_word_embeddings": true,
|
79 |
+
"tokenizer_class": null,
|
80 |
+
"top_k": 50,
|
81 |
+
"top_p": 1.0,
|
82 |
+
"torch_dtype": null,
|
83 |
+
"torchscript": false,
|
84 |
+
"transformers_version": "4.27.0.dev0",
|
85 |
+
"typical_p": 1.0,
|
86 |
+
"use_bfloat16": false,
|
87 |
+
"vocab_size": 30522
|
88 |
+
},
|
89 |
+
"text_config": {
|
90 |
+
"_name_or_path": "facebook/opt-2.7b",
|
91 |
+
"_remove_final_layer_norm": false,
|
92 |
+
"activation_dropout": 0.0,
|
93 |
+
"activation_function": "relu",
|
94 |
+
"add_cross_attention": false,
|
95 |
+
"architectures": [
|
96 |
+
"OPTForCausalLM"
|
97 |
+
],
|
98 |
+
"attention_dropout": 0.0,
|
99 |
+
"bad_words_ids": null,
|
100 |
+
"begin_suppress_tokens": null,
|
101 |
+
"bos_token_id": 2,
|
102 |
+
"chunk_size_feed_forward": 0,
|
103 |
+
"cross_attention_hidden_size": null,
|
104 |
+
"decoder_start_token_id": null,
|
105 |
+
"diversity_penalty": 0.0,
|
106 |
+
"do_layer_norm_before": true,
|
107 |
+
"do_sample": false,
|
108 |
+
"dropout": 0.1,
|
109 |
+
"early_stopping": false,
|
110 |
+
"enable_bias": true,
|
111 |
+
"encoder_no_repeat_ngram_size": 0,
|
112 |
+
"eos_token_id": 50118,
|
113 |
+
"exponential_decay_length_penalty": null,
|
114 |
+
"ffn_dim": 10240,
|
115 |
+
"finetuning_task": null,
|
116 |
+
"forced_bos_token_id": null,
|
117 |
+
"forced_eos_token_id": null,
|
118 |
+
"hidden_size": 2560,
|
119 |
+
"id2label": {
|
120 |
+
"0": "LABEL_0",
|
121 |
+
"1": "LABEL_1"
|
122 |
+
},
|
123 |
+
"init_std": 0.02,
|
124 |
+
"is_decoder": false,
|
125 |
+
"is_encoder_decoder": false,
|
126 |
+
"label2id": {
|
127 |
+
"LABEL_0": 0,
|
128 |
+
"LABEL_1": 1
|
129 |
+
},
|
130 |
+
"layer_norm_elementwise_affine": true,
|
131 |
+
"layerdrop": 0.0,
|
132 |
+
"length_penalty": 1.0,
|
133 |
+
"max_length": 20,
|
134 |
+
"max_position_embeddings": 2048,
|
135 |
+
"min_length": 0,
|
136 |
+
"model_type": "opt",
|
137 |
+
"no_repeat_ngram_size": 0,
|
138 |
+
"num_attention_heads": 32,
|
139 |
+
"num_beam_groups": 1,
|
140 |
+
"num_beams": 1,
|
141 |
+
"num_hidden_layers": 32,
|
142 |
+
"num_return_sequences": 1,
|
143 |
+
"output_attentions": false,
|
144 |
+
"output_hidden_states": false,
|
145 |
+
"output_scores": false,
|
146 |
+
"pad_token_id": 1,
|
147 |
+
"prefix": "</s>",
|
148 |
+
"problem_type": null,
|
149 |
+
"pruned_heads": {},
|
150 |
+
"remove_invalid_values": false,
|
151 |
+
"repetition_penalty": 1.0,
|
152 |
+
"return_dict": true,
|
153 |
+
"return_dict_in_generate": false,
|
154 |
+
"sep_token_id": null,
|
155 |
+
"suppress_tokens": null,
|
156 |
+
"task_specific_params": null,
|
157 |
+
"temperature": 1.0,
|
158 |
+
"tf_legacy_loss": false,
|
159 |
+
"tie_encoder_decoder": false,
|
160 |
+
"tie_word_embeddings": true,
|
161 |
+
"tokenizer_class": null,
|
162 |
+
"top_k": 50,
|
163 |
+
"top_p": 1.0,
|
164 |
+
"torch_dtype": "float16",
|
165 |
+
"torchscript": false,
|
166 |
+
"transformers_version": "4.27.0.dev0",
|
167 |
+
"typical_p": 1.0,
|
168 |
+
"use_bfloat16": false,
|
169 |
+
"use_cache": true,
|
170 |
+
"vocab_size": 50272,
|
171 |
+
"word_embed_proj_dim": 2560
|
172 |
+
},
|
173 |
+
"torch_dtype": "float32",
|
174 |
+
"transformers_version": null,
|
175 |
+
"use_decoder_only_language_model": true,
|
176 |
+
"vision_config": {
|
177 |
+
"_name_or_path": "",
|
178 |
+
"add_cross_attention": false,
|
179 |
+
"architectures": null,
|
180 |
+
"attention_dropout": 0.0,
|
181 |
+
"bad_words_ids": null,
|
182 |
+
"begin_suppress_tokens": null,
|
183 |
+
"bos_token_id": null,
|
184 |
+
"chunk_size_feed_forward": 0,
|
185 |
+
"cross_attention_hidden_size": null,
|
186 |
+
"decoder_start_token_id": null,
|
187 |
+
"diversity_penalty": 0.0,
|
188 |
+
"do_sample": false,
|
189 |
+
"dropout": 0.0,
|
190 |
+
"early_stopping": false,
|
191 |
+
"encoder_no_repeat_ngram_size": 0,
|
192 |
+
"eos_token_id": null,
|
193 |
+
"exponential_decay_length_penalty": null,
|
194 |
+
"finetuning_task": null,
|
195 |
+
"forced_bos_token_id": null,
|
196 |
+
"forced_eos_token_id": null,
|
197 |
+
"hidden_act": "gelu",
|
198 |
+
"hidden_size": 1408,
|
199 |
+
"id2label": {
|
200 |
+
"0": "LABEL_0",
|
201 |
+
"1": "LABEL_1"
|
202 |
+
},
|
203 |
+
"image_size": 224,
|
204 |
+
"initializer_factor": 1.0,
|
205 |
+
"initializer_range": 1e-10,
|
206 |
+
"intermediate_size": 6144,
|
207 |
+
"is_decoder": false,
|
208 |
+
"is_encoder_decoder": false,
|
209 |
+
"label2id": {
|
210 |
+
"LABEL_0": 0,
|
211 |
+
"LABEL_1": 1
|
212 |
+
},
|
213 |
+
"layer_norm_eps": 1e-6,
|
214 |
+
"length_penalty": 1.0,
|
215 |
+
"max_length": 20,
|
216 |
+
"min_length": 0,
|
217 |
+
"model_type": "blip_2_vision_model",
|
218 |
+
"no_repeat_ngram_size": 0,
|
219 |
+
"num_attention_heads": 16,
|
220 |
+
"num_beam_groups": 1,
|
221 |
+
"num_beams": 1,
|
222 |
+
"num_channels": 3,
|
223 |
+
"num_hidden_layers": 39,
|
224 |
+
"num_return_sequences": 1,
|
225 |
+
"output_attentions": false,
|
226 |
+
"output_hidden_states": false,
|
227 |
+
"output_scores": false,
|
228 |
+
"pad_token_id": null,
|
229 |
+
"patch_size": 14,
|
230 |
+
"prefix": null,
|
231 |
+
"problem_type": null,
|
232 |
+
"projection_dim": 512,
|
233 |
+
"pruned_heads": {},
|
234 |
+
"qkv_bias": true,
|
235 |
+
"remove_invalid_values": false,
|
236 |
+
"repetition_penalty": 1.0,
|
237 |
+
"return_dict": true,
|
238 |
+
"return_dict_in_generate": false,
|
239 |
+
"sep_token_id": null,
|
240 |
+
"suppress_tokens": null,
|
241 |
+
"task_specific_params": null,
|
242 |
+
"temperature": 1.0,
|
243 |
+
"tf_legacy_loss": false,
|
244 |
+
"tie_encoder_decoder": false,
|
245 |
+
"tie_word_embeddings": true,
|
246 |
+
"tokenizer_class": null,
|
247 |
+
"top_k": 50,
|
248 |
+
"top_p": 1.0,
|
249 |
+
"torch_dtype": null,
|
250 |
+
"torchscript": false,
|
251 |
+
"transformers_version": "4.27.0.dev0",
|
252 |
+
"typical_p": 1.0,
|
253 |
+
"use_bfloat16": false
|
254 |
+
}
|
255 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model-00001-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:81b77c37224d4f5ba35295c122e614e30ee8312bb5ca60eb0859749a09bb8c37
|
3 |
+
size 9996000440
|
model-00002-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ec126c79363120a346db188eb3524a07547f4fdd6d63a049d855650444dedd4f
|
3 |
+
size 5497664472
|
model.safetensors.index.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
preprocessor_config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_convert_rgb": true,
|
3 |
+
"do_normalize": true,
|
4 |
+
"do_rescale": true,
|
5 |
+
"do_resize": true,
|
6 |
+
"image_mean": [
|
7 |
+
0.48145466,
|
8 |
+
0.4578275,
|
9 |
+
0.40821073
|
10 |
+
],
|
11 |
+
"image_processor_type": "BlipImageProcessor",
|
12 |
+
"image_std": [
|
13 |
+
0.26862954,
|
14 |
+
0.26130258,
|
15 |
+
0.27577711
|
16 |
+
],
|
17 |
+
"processor_class": "Blip2Processor",
|
18 |
+
"resample": 3,
|
19 |
+
"rescale_factor": 0.00392156862745098,
|
20 |
+
"size": {
|
21 |
+
"height": 224,
|
22 |
+
"width": 224
|
23 |
+
}
|
24 |
+
}
|
pytorch_model-00001-of-00002.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83f4604e9f2c81dace48cbbb245cbe9acadddce7471c17eedc10cd675bf9af62
|
3 |
+
size 9996239804
|
pytorch_model-00002-of-00002.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b224ac0c148bf3aa0a211e5d043d38918ef57c2d3b714771a7c4b124129dbd48
|
3 |
+
size 5497724774
|
pytorch_model.bin.index.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
special_tokens_map.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "<pad>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": true,
|
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
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_prefix_space": false,
|
4 |
+
"bos_token": {
|
5 |
+
"__type": "AddedToken",
|
6 |
+
"content": "</s>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": true,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"eos_token": {
|
13 |
+
"__type": "AddedToken",
|
14 |
+
"content": "</s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": true,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false
|
19 |
+
},
|
20 |
+
"errors": "replace",
|
21 |
+
"model_max_length": 1000000000000000019884624838656,
|
22 |
+
"pad_token": {
|
23 |
+
"__type": "AddedToken",
|
24 |
+
"content": "<pad>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": true,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"processor_class": "Blip2Processor",
|
31 |
+
"special_tokens_map_file": null,
|
32 |
+
"tokenizer_class": "GPT2Tokenizer",
|
33 |
+
"unk_token": {
|
34 |
+
"__type": "AddedToken",
|
35 |
+
"content": "</s>",
|
36 |
+
"lstrip": false,
|
37 |
+
"normalized": true,
|
38 |
+
"rstrip": false,
|
39 |
+
"single_word": false
|
40 |
+
}
|
41 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|