Update README.md
Browse files
README.md
CHANGED
|
@@ -140,7 +140,7 @@ model-index:
|
|
| 140 |
name: F1
|
| 141 |
---
|
| 142 |
|
| 143 |
-
# deberta-v3-base for QA
|
| 144 |
|
| 145 |
This is the [deberta-v3-base](https://huggingface.co/microsoft/deberta-v3-base) model, fine-tuned using the [SQuAD2.0](https://huggingface.co/datasets/squad_v2) dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Question Answering.
|
| 146 |
|
|
@@ -151,7 +151,7 @@ This is the [deberta-v3-base](https://huggingface.co/microsoft/deberta-v3-base)
|
|
| 151 |
**Downstream-task:** Extractive QA
|
| 152 |
**Training data:** SQuAD 2.0
|
| 153 |
**Eval data:** SQuAD 2.0
|
| 154 |
-
**Code:** See [an example QA pipeline
|
| 155 |
**Infrastructure**: 1x NVIDIA A10G
|
| 156 |
|
| 157 |
## Hyperparameters
|
|
@@ -171,17 +171,34 @@ max_query_length = 64
|
|
| 171 |
## Usage
|
| 172 |
|
| 173 |
### In Haystack
|
| 174 |
-
Haystack is an
|
|
|
|
| 175 |
```python
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
```
|
|
|
|
| 180 |
|
| 181 |
### In Transformers
|
| 182 |
```python
|
| 183 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 184 |
-
|
|
|
|
|
|
|
| 185 |
# a) Get predictions
|
| 186 |
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
| 187 |
QA_input = {
|
|
@@ -189,38 +206,42 @@ QA_input = {
|
|
| 189 |
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
| 190 |
}
|
| 191 |
res = nlp(QA_input)
|
|
|
|
| 192 |
# b) Load model & tokenizer
|
| 193 |
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 194 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 195 |
```
|
| 196 |
|
|
|
|
| 197 |
## Authors
|
| 198 |
**Sebastian Lee:** sebastian.lee [at] deepset.ai
|
| 199 |
**Timo M枚ller:** timo.moeller [at] deepset.ai
|
| 200 |
**Malte Pietsch:** malte.pietsch [at] deepset.ai
|
| 201 |
|
| 202 |
## About us
|
|
|
|
| 203 |
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
| 204 |
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
| 205 |
-
<img alt="" src="https://
|
| 206 |
</div>
|
| 207 |
-
|
| 208 |
-
<img alt="" src="https://
|
| 209 |
</div>
|
| 210 |
</div>
|
| 211 |
|
| 212 |
-
[deepset](http://deepset.ai/) is the company behind the open-source
|
| 213 |
-
|
| 214 |
|
| 215 |
Some of our other work:
|
| 216 |
-
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](
|
| 217 |
-
- [German BERT
|
| 218 |
-
- [
|
| 219 |
|
| 220 |
## Get in touch and join the Haystack community
|
| 221 |
|
| 222 |
-
<p>For more info on Haystack, visit our <strong><a href="https://github.com/deepset-ai/haystack">GitHub</a></strong> repo and <strong><a href="https://haystack.deepset.ai">Documentation</a></strong>.
|
|
|
|
|
|
|
| 223 |
|
| 224 |
-
|
| 225 |
|
| 226 |
-
|
|
|
|
| 140 |
name: F1
|
| 141 |
---
|
| 142 |
|
| 143 |
+
# deberta-v3-base for Extractive QA
|
| 144 |
|
| 145 |
This is the [deberta-v3-base](https://huggingface.co/microsoft/deberta-v3-base) model, fine-tuned using the [SQuAD2.0](https://huggingface.co/datasets/squad_v2) dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Question Answering.
|
| 146 |
|
|
|
|
| 151 |
**Downstream-task:** Extractive QA
|
| 152 |
**Training data:** SQuAD 2.0
|
| 153 |
**Eval data:** SQuAD 2.0
|
| 154 |
+
**Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
|
| 155 |
**Infrastructure**: 1x NVIDIA A10G
|
| 156 |
|
| 157 |
## Hyperparameters
|
|
|
|
| 171 |
## Usage
|
| 172 |
|
| 173 |
### In Haystack
|
| 174 |
+
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.
|
| 175 |
+
To load and run the model with [Haystack](https://github.com/deepset-ai/haystack/):
|
| 176 |
```python
|
| 177 |
+
# After running pip install haystack-ai "transformers[torch,sentencepiece]"
|
| 178 |
+
|
| 179 |
+
from haystack import Document
|
| 180 |
+
from haystack.components.readers import ExtractiveReader
|
| 181 |
+
|
| 182 |
+
docs = [
|
| 183 |
+
Document(content="Python is a popular programming language"),
|
| 184 |
+
Document(content="python ist eine beliebte Programmiersprache"),
|
| 185 |
+
]
|
| 186 |
+
|
| 187 |
+
reader = ExtractiveReader(model="deepset/roberta-base-squad2")
|
| 188 |
+
reader.warm_up()
|
| 189 |
+
|
| 190 |
+
question = "What is a popular programming language?"
|
| 191 |
+
result = reader.run(query=question, documents=docs)
|
| 192 |
+
# {'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),...)]}
|
| 193 |
```
|
| 194 |
+
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).
|
| 195 |
|
| 196 |
### In Transformers
|
| 197 |
```python
|
| 198 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 199 |
+
|
| 200 |
+
model_name = "deepset/roberta-base-squad2"
|
| 201 |
+
|
| 202 |
# a) Get predictions
|
| 203 |
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
| 204 |
QA_input = {
|
|
|
|
| 206 |
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
| 207 |
}
|
| 208 |
res = nlp(QA_input)
|
| 209 |
+
|
| 210 |
# b) Load model & tokenizer
|
| 211 |
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 212 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 213 |
```
|
| 214 |
|
| 215 |
+
|
| 216 |
## Authors
|
| 217 |
**Sebastian Lee:** sebastian.lee [at] deepset.ai
|
| 218 |
**Timo M枚ller:** timo.moeller [at] deepset.ai
|
| 219 |
**Malte Pietsch:** malte.pietsch [at] deepset.ai
|
| 220 |
|
| 221 |
## About us
|
| 222 |
+
|
| 223 |
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
| 224 |
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
| 225 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
|
| 226 |
</div>
|
| 227 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
| 228 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored.png" class="w-40"/>
|
| 229 |
</div>
|
| 230 |
</div>
|
| 231 |
|
| 232 |
+
[deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
|
|
|
|
| 233 |
|
| 234 |
Some of our other work:
|
| 235 |
+
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
|
| 236 |
+
- [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)
|
| 237 |
+
- [deepset Cloud](https://www.deepset.ai/deepset-cloud-product), [deepset Studio](https://www.deepset.ai/deepset-studio)
|
| 238 |
|
| 239 |
## Get in touch and join the Haystack community
|
| 240 |
|
| 241 |
+
<p>For more info on Haystack, visit our <strong><a href="https://github.com/deepset-ai/haystack">GitHub</a></strong> repo and <strong><a href="https://docs.haystack.deepset.ai">Documentation</a></strong>.
|
| 242 |
+
|
| 243 |
+
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
|
| 244 |
|
| 245 |
+
[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)
|
| 246 |
|
| 247 |
+
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|