julianrisch commited on
Commit
e451d6d
1 Parent(s): d05a47e

update code example to Haystack 2.x, new tutorial link, website link, twitter link, Haystack description

Browse files
Files changed (1) hide show
  1. README.md +25 -14
README.md CHANGED
@@ -142,9 +142,10 @@ base_model:
142
  - FacebookAI/roberta-base
143
  ---
144
 
145
- # roberta-base for QA
146
 
147
- This is the [roberta-base](https://huggingface.co/roberta-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.
 
148
 
149
 
150
  ## Overview
@@ -153,7 +154,7 @@ This is the [roberta-base](https://huggingface.co/roberta-base) model, fine-tune
153
  **Downstream-task:** Extractive QA
154
  **Training data:** SQuAD 2.0
155
  **Eval data:** SQuAD 2.0
156
- **Code:** See [an example QA pipeline on Haystack](https://haystack.deepset.ai/tutorials/first-qa-system)
157
  **Infrastructure**: 4x Tesla v100
158
 
159
  ## Hyperparameters
@@ -170,19 +171,30 @@ doc_stride=128
170
  max_query_length=64
171
  ```
172
 
173
- ## Using a distilled model instead
174
- Please note that we have also released a distilled version of this model called [deepset/tinyroberta-squad2](https://huggingface.co/deepset/tinyroberta-squad2). The distilled model has a comparable prediction quality and runs at twice the speed of the base model.
175
-
176
  ## Usage
177
 
178
  ### In Haystack
179
- Haystack is an NLP framework by deepset. You can use this model in a Haystack pipeline to do question answering at scale (over many documents). To load the model in [Haystack](https://github.com/deepset-ai/haystack/):
 
180
  ```python
181
- reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2")
182
- # or
183
- reader = TransformersReader(model_name_or_path="deepset/roberta-base-squad2",tokenizer="deepset/roberta-base-squad2")
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  ```
185
- For a complete example of ``roberta-base-squad2`` being used for Question Answering, check out the [Tutorials in Haystack Documentation](https://haystack.deepset.ai/tutorials/first-qa-system)
186
 
187
  ### In Transformers
188
  ```python
@@ -236,8 +248,7 @@ Evaluated on the SQuAD 2.0 dev set with the [official eval script](https://works
236
  </div>
237
  </div>
238
 
239
- [deepset](http://deepset.ai/) is the company behind the open-source NLP framework [Haystack](https://haystack.deepset.ai/) which is designed to help you build production ready NLP systems that use: Question answering, summarization, ranking etc.
240
-
241
 
242
  Some of our other work:
243
  - [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
@@ -250,6 +261,6 @@ Some of our other work:
250
 
251
  We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
252
 
253
- [Twitter](https://twitter.com/deepset_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://deepset.ai)
254
 
255
  By the way: [we're hiring!](http://www.deepset.ai/jobs)
 
142
  - FacebookAI/roberta-base
143
  ---
144
 
145
+ # roberta-base for Extractive QA
146
 
147
+ This is the [roberta-base](https://huggingface.co/roberta-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 Extractive Question Answering.
148
+ We have also released a distilled version of this model called [deepset/tinyroberta-squad2](https://huggingface.co/deepset/tinyroberta-squad2). It has a comparable prediction quality and runs at twice the speed of [deepset/roberta-base-squad2](https://huggingface.co/deepset/roberta-base-squad2).
149
 
150
 
151
  ## Overview
 
154
  **Downstream-task:** Extractive QA
155
  **Training data:** SQuAD 2.0
156
  **Eval data:** SQuAD 2.0
157
+ **Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
158
  **Infrastructure**: 4x Tesla v100
159
 
160
  ## Hyperparameters
 
171
  max_query_length=64
172
  ```
173
 
 
 
 
174
  ## Usage
175
 
176
  ### In Haystack
177
+ 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.
178
+ To load and run the model with [Haystack version 2.x](https://github.com/deepset-ai/haystack/):
179
  ```python
180
+ # After running pip install haystack-ai "transformers[torch,sentencepiece]"
181
+
182
+ from haystack import Document
183
+ from haystack.components.readers import ExtractiveReader
184
+
185
+ docs = [
186
+ Document(content="Python is a popular programming language"),
187
+ Document(content="python ist eine beliebte Programmiersprache"),
188
+ ]
189
+
190
+ reader = ExtractiveReader(model="deepset/roberta-base-squad2")
191
+ reader.warm_up()
192
+
193
+ question = "What is a popular programming language?"
194
+ result = reader.run(query=question, documents=docs)
195
+ # {'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),...)]}
196
  ```
197
+ 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).
198
 
199
  ### In Transformers
200
  ```python
 
248
  </div>
249
  </div>
250
 
251
+ [deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
 
252
 
253
  Some of our other work:
254
  - [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
 
261
 
262
  We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
263
 
264
+ [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/)
265
 
266
  By the way: [we're hiring!](http://www.deepset.ai/jobs)