Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags: []
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
@@ -15,23 +15,21 @@ tags: []
|
|
15 |
|
16 |
<!-- Provide a longer summary of what this model is. -->
|
17 |
|
18 |
-
This is the
|
19 |
|
20 |
-
- **
|
21 |
-
- **
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
### Model Sources
|
29 |
|
30 |
<!-- Provide the basic links for the model. -->
|
31 |
|
32 |
-
- **Repository:**
|
33 |
-
- **Paper
|
34 |
-
- **Demo
|
|
|
|
|
35 |
|
36 |
## Uses
|
37 |
|
@@ -41,159 +39,66 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
41 |
|
42 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
|
44 |
-
[
|
45 |
|
46 |
-
### Downstream Use
|
47 |
|
48 |
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
|
70 |
## How to Get Started with the Model
|
71 |
|
72 |
Use the code below to get started with the model.
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
[
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
- **Hardware Type:** [More Information Needed]
|
146 |
-
- **Hours used:** [More Information Needed]
|
147 |
-
- **Cloud Provider:** [More Information Needed]
|
148 |
-
- **Compute Region:** [More Information Needed]
|
149 |
-
- **Carbon Emitted:** [More Information Needed]
|
150 |
-
|
151 |
-
## Technical Specifications [optional]
|
152 |
-
|
153 |
-
### Model Architecture and Objective
|
154 |
-
|
155 |
-
[More Information Needed]
|
156 |
-
|
157 |
-
### Compute Infrastructure
|
158 |
-
|
159 |
-
[More Information Needed]
|
160 |
-
|
161 |
-
#### Hardware
|
162 |
-
|
163 |
-
[More Information Needed]
|
164 |
-
|
165 |
-
#### Software
|
166 |
-
|
167 |
-
[More Information Needed]
|
168 |
-
|
169 |
-
## Citation [optional]
|
170 |
-
|
171 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
172 |
|
173 |
**BibTeX:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
-
[More Information Needed]
|
176 |
-
|
177 |
-
**APA:**
|
178 |
-
|
179 |
-
[More Information Needed]
|
180 |
-
|
181 |
-
## Glossary [optional]
|
182 |
-
|
183 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
184 |
-
|
185 |
-
[More Information Needed]
|
186 |
-
|
187 |
-
## More Information [optional]
|
188 |
-
|
189 |
-
[More Information Needed]
|
190 |
-
|
191 |
-
## Model Card Authors [optional]
|
192 |
-
|
193 |
-
[More Information Needed]
|
194 |
-
|
195 |
-
## Model Card Contact
|
196 |
-
|
197 |
-
[More Information Needed]
|
198 |
|
199 |
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags: [KBVQA, Multimodal, Retrieval, Knowledge Retrieval, RAG, FLMR, PreFLMR, ColBERT]
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
|
|
15 |
|
16 |
<!-- Provide a longer summary of what this model is. -->
|
17 |
|
18 |
+
This is the PreFLMR model
|
19 |
|
20 |
+
- **Model type:** PreFLMR is an open-source model for general knowledge retrieval. It is a transformer-based model that uses a combination of text and image inputs to retrieve relevant documents from a large corpus.
|
21 |
+
- **Language(s) (NLP):** English
|
|
|
|
|
|
|
22 |
- **License:** [More Information Needed]
|
|
|
23 |
|
24 |
+
### Model Sources
|
25 |
|
26 |
<!-- Provide the basic links for the model. -->
|
27 |
|
28 |
+
- **Repository:** https://github.com/LinWeizheDragon/FLMR
|
29 |
+
- **Paper:** https://arxiv.org/abs/2402.08327
|
30 |
+
- **Demo:** http://region-3.seetacloud.com:38703/
|
31 |
+
- **Blog Post:** https://www.jinghong-chen.net/preflmr-sota-open-sourced-multi/
|
32 |
+
- **Project Page:** https://preflmr.github.io/
|
33 |
|
34 |
## Uses
|
35 |
|
|
|
39 |
|
40 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
41 |
|
42 |
+
This model can be used directly to retrieve documents from a large corpus using a combination of text and image input queries. The retrieval useage can be found in the [official implementation](https://github.com/LinWeizheDragon/FLMR).
|
43 |
|
44 |
+
### Downstream Use
|
45 |
|
46 |
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
47 |
|
48 |
+
This model can be used combined with language models to create a retrieval-augmented language model. The useage for Knowledge-based VQA can be found in https://github.com/linweizhedragon/retrieval-augmented-visual-question-answering
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
## How to Get Started with the Model
|
51 |
|
52 |
Use the code below to get started with the model.
|
53 |
|
54 |
+
```python
|
55 |
+
from transformers import AutoConfig, AutoModel, AutoImageProcessor, AutoTokenizer
|
56 |
+
import torch
|
57 |
+
|
58 |
+
checkpoint_path = "LinWeizheDragon/PreFLMR_ViT-L"
|
59 |
+
image_processor_name = "openai/clip-vit-large-patch14"
|
60 |
+
query_tokenizer = AutoTokenizer.from_pretrained(checkpoint_path, subfolder="query_tokenizer", trust_remote_code=True)
|
61 |
+
context_tokenizer = AutoTokenizer.from_pretrained(checkpoint_path, subfolder="context_tokenizer", trust_remote_code=True)
|
62 |
+
|
63 |
+
model = AutoModel.from_pretrained(checkpoint_path,
|
64 |
+
query_tokenizer=query_tokenizer,
|
65 |
+
context_tokenizer=context_tokenizer,
|
66 |
+
trust_remote_code=True,
|
67 |
+
)
|
68 |
+
image_processor = AutoImageProcessor.from_pretrained(image_processor_name)
|
69 |
+
|
70 |
+
Q_encoding = query_tokenizer(["Using the provided image, obtain documents that address the subsequent question: What is the capital of France?", "Extract documents linked to the question provided in conjunction with the image: What is the capital of China?"])
|
71 |
+
D_encoding = context_tokenizer(["Paris is the capital of France.", "Beijing is the capital of China.",
|
72 |
+
"Paris is the capital of France.", "Beijing is the capital of China."])
|
73 |
+
Q_pixel_values = torch.zeros(2, 3, 224, 224)
|
74 |
+
inputs = dict(
|
75 |
+
query_input_ids=Q_encoding['input_ids'],
|
76 |
+
query_attention_mask=Q_encoding['attention_mask'],
|
77 |
+
query_pixel_values=Q_pixel_values,
|
78 |
+
context_input_ids=D_encoding['input_ids'],
|
79 |
+
context_attention_mask=D_encoding['attention_mask'],
|
80 |
+
use_in_batch_negatives=True,
|
81 |
+
)
|
82 |
+
|
83 |
+
res = model.forward(**inputs)
|
84 |
+
print(res)
|
85 |
+
```
|
86 |
+
|
87 |
+
## Training datasets
|
88 |
+
The model is trained on a combination of eight image-text datasets and a text-only dataset.
|
89 |
+
## Citation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
**BibTeX:**
|
93 |
+
```
|
94 |
+
@article{Lin_Mei_Chen_Byrne_2024,
|
95 |
+
title={PreFLMR: Scaling Up Fine-Grained Late-Interaction Multi-modal Retrievers},
|
96 |
+
url={http://arxiv.org/abs/2402.08327},
|
97 |
+
number={arXiv:2402.08327},
|
98 |
+
publisher={arXiv},
|
99 |
+
author={Lin, Weizhe and Mei, Jingbiao and Chen, Jinghong and Byrne, Bill},
|
100 |
+
year={2024}}
|
101 |
+
```
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
|