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htqgnhOaEDKKnaRMGBJLj98D5V4VirYT6jLh8FlR0FiwvMTMjReBcfTisAQ
|
| 28 |
---
|
| 29 |
|
| 30 |
+
This is a BERT base cased model trained on SQuAD v2
|
| 31 |
+
|
| 32 |
+
## Overview
|
| 33 |
+
**Language model:** bert-base-cased
|
| 34 |
+
**Language:** English
|
| 35 |
+
**Downstream-task:** Extractive QA
|
| 36 |
+
**Training data:** SQuAD 2.0
|
| 37 |
+
**Eval data:** SQuAD 2.0
|
| 38 |
+
**Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
|
| 39 |
+
|
| 40 |
+
## Usage
|
| 41 |
+
|
| 42 |
+
### In Haystack
|
| 43 |
+
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.
|
| 44 |
+
To load and run the model with [Haystack](https://github.com/deepset-ai/haystack/):
|
| 45 |
+
```python
|
| 46 |
+
# After running pip install haystack-ai "transformers[torch,sentencepiece]"
|
| 47 |
+
|
| 48 |
+
from haystack import Document
|
| 49 |
+
from haystack.components.readers import ExtractiveReader
|
| 50 |
+
|
| 51 |
+
docs = [
|
| 52 |
+
Document(content="Python is a popular programming language"),
|
| 53 |
+
Document(content="python ist eine beliebte Programmiersprache"),
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
reader = ExtractiveReader(model="deepset/bert-base-cased-squad2")
|
| 57 |
+
reader.warm_up()
|
| 58 |
+
|
| 59 |
+
question = "What is a popular programming language?"
|
| 60 |
+
result = reader.run(query=question, documents=docs)
|
| 61 |
+
# {'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),...)]}
|
| 62 |
+
```
|
| 63 |
+
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).
|
| 64 |
+
|
| 65 |
+
### In Transformers
|
| 66 |
+
```python
|
| 67 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 68 |
+
|
| 69 |
+
model_name = "deepset/bert-base-cased-squad2"
|
| 70 |
+
|
| 71 |
+
# a) Get predictions
|
| 72 |
+
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
| 73 |
+
QA_input = {
|
| 74 |
+
'question': 'Why is model conversion important?',
|
| 75 |
+
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
| 76 |
+
}
|
| 77 |
+
res = nlp(QA_input)
|
| 78 |
+
|
| 79 |
+
# b) Load model & tokenizer
|
| 80 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 81 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
## About us
|
| 85 |
+
|
| 86 |
+
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
| 87 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
| 88 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
|
| 89 |
+
</div>
|
| 90 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
| 91 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored.png" class="w-40"/>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
[deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
|
| 96 |
+
|
| 97 |
+
Some of our other work:
|
| 98 |
+
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
|
| 99 |
+
- [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
|
| 100 |
+
- [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
|
| 101 |
+
|
| 102 |
+
## Get in touch and join the Haystack community
|
| 103 |
+
|
| 104 |
+
<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>.
|
| 105 |
+
|
| 106 |
+
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
|
| 107 |
+
|
| 108 |
+
[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)
|
| 109 |
+
|
| 110 |
+
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|