julianrisch
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -135,11 +135,14 @@ model-index:
|
|
135 |
name: F1
|
136 |
---
|
137 |
|
|
|
|
|
138 |
## Overview
|
139 |
**Language model:** deepset/roberta-base-squad2-distilled
|
140 |
**Language:** English
|
141 |
-
**Training data:** SQuAD 2.0 training set
|
142 |
-
**Eval data:** SQuAD 2.0 dev set
|
|
|
143 |
**Infrastructure**: 4x V100 GPU
|
144 |
**Published**: Dec 8th, 2021
|
145 |
|
@@ -157,6 +160,51 @@ embeds_dropout_prob = 0.1
|
|
157 |
temperature = 1.5
|
158 |
distillation_loss_weight = 0.75
|
159 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
## Performance
|
161 |
```
|
162 |
"exact": 79.8366040596311
|
@@ -170,6 +218,7 @@ distillation_loss_weight = 0.75
|
|
170 |
**Michel Bartels:** michel.bartels@deepset.ai
|
171 |
|
172 |
## About us
|
|
|
173 |
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
174 |
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
175 |
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
|
@@ -179,13 +228,12 @@ distillation_loss_weight = 0.75
|
|
179 |
</div>
|
180 |
</div>
|
181 |
|
182 |
-
[deepset](http://deepset.ai/) is the company behind the open-source
|
183 |
-
|
184 |
|
185 |
Some of our other work:
|
186 |
-
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](
|
187 |
-
- [German BERT
|
188 |
-
- [
|
189 |
|
190 |
## Get in touch and join the Haystack community
|
191 |
|
@@ -193,6 +241,6 @@ Some of our other work:
|
|
193 |
|
194 |
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
|
195 |
|
196 |
-
[Twitter](https://twitter.com/
|
197 |
|
198 |
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|
|
|
135 |
name: F1
|
136 |
---
|
137 |
|
138 |
+
# roberta-base distilled for Extractive QA
|
139 |
+
|
140 |
## Overview
|
141 |
**Language model:** deepset/roberta-base-squad2-distilled
|
142 |
**Language:** English
|
143 |
+
**Training data:** SQuAD 2.0 training set
|
144 |
+
**Eval data:** SQuAD 2.0 dev set
|
145 |
+
**Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
|
146 |
**Infrastructure**: 4x V100 GPU
|
147 |
**Published**: Dec 8th, 2021
|
148 |
|
|
|
160 |
temperature = 1.5
|
161 |
distillation_loss_weight = 0.75
|
162 |
```
|
163 |
+
|
164 |
+
## Usage
|
165 |
+
|
166 |
+
### In Haystack
|
167 |
+
Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents.
|
168 |
+
To load and run the model with [Haystack](https://github.com/deepset-ai/haystack/):
|
169 |
+
```python
|
170 |
+
# After running pip install haystack-ai "transformers[torch,sentencepiece]"
|
171 |
+
|
172 |
+
from haystack import Document
|
173 |
+
from haystack.components.readers import ExtractiveReader
|
174 |
+
|
175 |
+
docs = [
|
176 |
+
Document(content="Python is a popular programming language"),
|
177 |
+
Document(content="python ist eine beliebte Programmiersprache"),
|
178 |
+
]
|
179 |
+
|
180 |
+
reader = ExtractiveReader(model="deepset/roberta-base-squad2-distilled")
|
181 |
+
reader.warm_up()
|
182 |
+
|
183 |
+
question = "What is a popular programming language?"
|
184 |
+
result = reader.run(query=question, documents=docs)
|
185 |
+
# {'answers': [ExtractedAnswer(query='What is a popular programming language?', score=0.5740374326705933, data='python', document=Document(id=..., content: '...'), context=None, document_offset=ExtractedAnswer.Span(start=0, end=6),...)]}
|
186 |
+
```
|
187 |
+
For a complete example with an extractive question answering pipeline that scales over many documents, check out the [corresponding Haystack tutorial](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline).
|
188 |
+
|
189 |
+
### In Transformers
|
190 |
+
```python
|
191 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
192 |
+
|
193 |
+
model_name = "deepset/roberta-base-squad2-distilled"
|
194 |
+
|
195 |
+
# a) Get predictions
|
196 |
+
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
197 |
+
QA_input = {
|
198 |
+
'question': 'Why is model conversion important?',
|
199 |
+
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
200 |
+
}
|
201 |
+
res = nlp(QA_input)
|
202 |
+
|
203 |
+
# b) Load model & tokenizer
|
204 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
205 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
206 |
+
```
|
207 |
+
|
208 |
## Performance
|
209 |
```
|
210 |
"exact": 79.8366040596311
|
|
|
218 |
**Michel Bartels:** michel.bartels@deepset.ai
|
219 |
|
220 |
## About us
|
221 |
+
|
222 |
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
223 |
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
224 |
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
|
|
|
228 |
</div>
|
229 |
</div>
|
230 |
|
231 |
+
[deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
|
|
|
232 |
|
233 |
Some of our other work:
|
234 |
+
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
|
235 |
+
- [German BERT](https://deepset.ai/german-bert), [GermanQuAD and GermanDPR](https://deepset.ai/germanquad), [German embedding model](https://huggingface.co/mixedbread-ai/deepset-mxbai-embed-de-large-v1)
|
236 |
+
- [deepset Cloud](https://www.deepset.ai/deepset-cloud-product), [deepset Studio](https://www.deepset.ai/deepset-studio)
|
237 |
|
238 |
## Get in touch and join the Haystack community
|
239 |
|
|
|
241 |
|
242 |
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
|
243 |
|
244 |
+
[Twitter](https://twitter.com/Haystack_AI) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Discord](https://haystack.deepset.ai/community) | [GitHub Discussions](https://github.com/deepset-ai/haystack/discussions) | [Website](https://haystack.deepset.ai/) | [YouTube](https://www.youtube.com/@deepset_ai)
|
245 |
|
246 |
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|