README.md
7.4 KB · 217 lines · markdown Raw
1 ---
2 language: en
3 license: cc-by-4.0
4 datasets:
5 - squad_v2
6 model-index:
7 - name: deepset/bert-large-uncased-whole-word-masking-squad2
8 results:
9 - task:
10 type: question-answering
11 name: Question Answering
12 dataset:
13 name: squad_v2
14 type: squad_v2
15 config: squad_v2
16 split: validation
17 metrics:
18 - type: exact_match
19 value: 80.8846
20 name: Exact Match
21 verified: true
22 verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiY2E5ZGNkY2ExZWViZGEwNWE3OGRmMWM2ZmE4ZDU4ZDQ1OGM3ZWE0NTVmZjFmYmZjZmJmNjJmYTc3NTM3OTk3OSIsInZlcnNpb24iOjF9.aSblF4ywh1fnHHrN6UGL392R5KLaH3FCKQlpiXo_EdQ4XXEAENUCjYm9HWDiFsgfSENL35GkbSyz_GAhnefsAQ
23 - type: f1
24 value: 83.8765
25 name: F1
26 verified: true
27 verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiNGFlNmEzMTk2NjRkNTI3ZTk3ZTU1NWNlYzIyN2E0ZDFlNDA2ZjYwZWJlNThkMmRmMmE0YzcwYjIyZDM5NmRiMCIsInZlcnNpb24iOjF9.-rc2_Bsp_B26-o12MFYuAU0Ad2Hg9PDx7Preuk27WlhYJDeKeEr32CW8LLANQABR3Mhw2x8uTYkEUrSDMxxLBw
28 - task:
29 type: question-answering
30 name: Question Answering
31 dataset:
32 name: squad
33 type: squad
34 config: plain_text
35 split: validation
36 metrics:
37 - type: exact_match
38 value: 85.904
39 name: Exact Match
40 - type: f1
41 value: 92.586
42 name: F1
43 - task:
44 type: question-answering
45 name: Question Answering
46 dataset:
47 name: adversarial_qa
48 type: adversarial_qa
49 config: adversarialQA
50 split: validation
51 metrics:
52 - type: exact_match
53 value: 28.233
54 name: Exact Match
55 - type: f1
56 value: 41.170
57 name: F1
58 - task:
59 type: question-answering
60 name: Question Answering
61 dataset:
62 name: squad_adversarial
63 type: squad_adversarial
64 config: AddOneSent
65 split: validation
66 metrics:
67 - type: exact_match
68 value: 78.064
69 name: Exact Match
70 - type: f1
71 value: 83.591
72 name: F1
73 - task:
74 type: question-answering
75 name: Question Answering
76 dataset:
77 name: squadshifts amazon
78 type: squadshifts
79 config: amazon
80 split: test
81 metrics:
82 - type: exact_match
83 value: 65.615
84 name: Exact Match
85 - type: f1
86 value: 80.733
87 name: F1
88 - task:
89 type: question-answering
90 name: Question Answering
91 dataset:
92 name: squadshifts new_wiki
93 type: squadshifts
94 config: new_wiki
95 split: test
96 metrics:
97 - type: exact_match
98 value: 81.570
99 name: Exact Match
100 - type: f1
101 value: 91.199
102 name: F1
103 - task:
104 type: question-answering
105 name: Question Answering
106 dataset:
107 name: squadshifts nyt
108 type: squadshifts
109 config: nyt
110 split: test
111 metrics:
112 - type: exact_match
113 value: 83.279
114 name: Exact Match
115 - type: f1
116 value: 91.090
117 name: F1
118 - task:
119 type: question-answering
120 name: Question Answering
121 dataset:
122 name: squadshifts reddit
123 type: squadshifts
124 config: reddit
125 split: test
126 metrics:
127 - type: exact_match
128 value: 69.305
129 name: Exact Match
130 - type: f1
131 value: 82.405
132 name: F1
133 ---
134
135 # bert-large-uncased-whole-word-masking-squad2 for Extractive QA
136
137 This is a berta-large model, fine-tuned using the SQuAD2.0 dataset for the task of question answering.
138
139 ## Overview
140 **Language model:** bert-large
141 **Language:** English
142 **Downstream-task:** Extractive QA
143 **Training data:** SQuAD 2.0
144 **Eval data:** SQuAD 2.0
145 **Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
146
147 ## Usage
148
149 ### In Haystack
150 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.
151 To load and run the model with [Haystack](https://github.com/deepset-ai/haystack/):
152 ```python
153 # After running pip install haystack-ai "transformers[torch,sentencepiece]"
154
155 from haystack import Document
156 from haystack.components.readers import ExtractiveReader
157
158 docs = [
159 Document(content="Python is a popular programming language"),
160 Document(content="python ist eine beliebte Programmiersprache"),
161 ]
162
163 reader = ExtractiveReader(model="deepset/bert-large-uncased-whole-word-masking-squad2")
164 reader.warm_up()
165
166 question = "What is a popular programming language?"
167 result = reader.run(query=question, documents=docs)
168 # {'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),...)]}
169 ```
170 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).
171
172 ### In Transformers
173 ```python
174 from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
175
176 model_name = "deepset/bert-large-uncased-whole-word-masking-squad2"
177
178 # a) Get predictions
179 nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
180 QA_input = {
181 'question': 'Why is model conversion important?',
182 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
183 }
184 res = nlp(QA_input)
185
186 # b) Load model & tokenizer
187 model = AutoModelForQuestionAnswering.from_pretrained(model_name)
188 tokenizer = AutoTokenizer.from_pretrained(model_name)
189 ```
190
191 ## About us
192
193 <div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
194 <div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
195 <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
196 </div>
197 <div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
198 <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored.png" class="w-40"/>
199 </div>
200 </div>
201
202 [deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
203
204 Some of our other work:
205 - [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
206 - [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)
207 - [deepset Cloud](https://www.deepset.ai/deepset-cloud-product), [deepset Studio](https://www.deepset.ai/deepset-studio)
208
209 ## Get in touch and join the Haystack community
210
211 <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>.
212
213 We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
214
215 [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)
216
217 By the way: [we're hiring!](http://www.deepset.ai/jobs)