draft update for the model card
Browse files
README.md
CHANGED
|
@@ -7,11 +7,8 @@ license: cc-by-4.0
|
|
| 7 |
|
| 8 |
# roberta-base for QA
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
model_name = "deepset/roberta-base-squad2"
|
| 13 |
-
pipeline(model=model_name, tokenizer=model_name, revision="v1.0", task="question-answering")
|
| 14 |
-
```
|
| 15 |
|
| 16 |
## Overview
|
| 17 |
**Language model:** roberta-base
|
|
@@ -19,7 +16,7 @@ pipeline(model=model_name, tokenizer=model_name, revision="v1.0", task="question
|
|
| 19 |
**Downstream-task:** Extractive QA
|
| 20 |
**Training data:** SQuAD 2.0
|
| 21 |
**Eval data:** SQuAD 2.0
|
| 22 |
-
**Code:** See [example
|
| 23 |
**Infrastructure**: 4x Tesla v100
|
| 24 |
|
| 25 |
## Hyperparameters
|
|
@@ -39,23 +36,16 @@ max_query_length=64
|
|
| 39 |
## Using a distilled model instead
|
| 40 |
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.
|
| 41 |
|
| 42 |
-
##
|
| 43 |
-
Evaluated on the SQuAD 2.0 dev set with the [official eval script](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/).
|
| 44 |
-
|
| 45 |
-
```
|
| 46 |
-
"exact": 79.87029394424324,
|
| 47 |
-
"f1": 82.91251169582613,
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
"
|
| 53 |
-
|
| 54 |
-
"
|
| 55 |
-
"NoAns_total": 5945
|
| 56 |
```
|
| 57 |
-
|
| 58 |
-
## Usage
|
| 59 |
|
| 60 |
### In Transformers
|
| 61 |
```python
|
|
@@ -76,53 +66,51 @@ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
|
| 76 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 77 |
```
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
```python
|
| 82 |
-
from farm.modeling.adaptive_model import AdaptiveModel
|
| 83 |
-
from farm.modeling.tokenization import Tokenizer
|
| 84 |
-
from farm.infer import Inferencer
|
| 85 |
-
|
| 86 |
-
model_name = "deepset/roberta-base-squad2"
|
| 87 |
-
|
| 88 |
-
# a) Get predictions
|
| 89 |
-
nlp = Inferencer.load(model_name, task_type="question_answering")
|
| 90 |
-
QA_input = [{"questions": ["Why is model conversion important?"],
|
| 91 |
-
"text": "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."}]
|
| 92 |
-
res = nlp.inference_from_dicts(dicts=QA_input, rest_api_schema=True)
|
| 93 |
|
| 94 |
-
# b) Load model & tokenizer
|
| 95 |
-
model = AdaptiveModel.convert_from_transformers(model_name, device="cpu", task_type="question_answering")
|
| 96 |
-
tokenizer = Tokenizer.load(model_name)
|
| 97 |
```
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
| 105 |
```
|
| 106 |
|
| 107 |
-
|
| 108 |
## Authors
|
| 109 |
-
Branden Chan
|
| 110 |
-
Timo M枚ller
|
| 111 |
-
Malte Pietsch
|
| 112 |
-
Tanay Soni
|
| 113 |
|
| 114 |
## About us
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
- [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
|
| 121 |
- [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
|
| 122 |
-
|
| 123 |
-
|
| 124 |
|
| 125 |
Get in touch:
|
|
|
|
|
|
|
| 126 |
[Twitter](https://twitter.com/deepset_ai) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Slack](https://haystack.deepset.ai/community/join) | [GitHub Discussions](https://github.com/deepset-ai/haystack/discussions) | [Website](https://deepset.ai)
|
| 127 |
|
| 128 |
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|
|
|
|
| 7 |
|
| 8 |
# roberta-base for QA
|
| 9 |
|
| 10 |
+
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.
|
| 11 |
+
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
## Overview
|
| 14 |
**Language model:** roberta-base
|
|
|
|
| 16 |
**Downstream-task:** Extractive QA
|
| 17 |
**Training data:** SQuAD 2.0
|
| 18 |
**Eval data:** SQuAD 2.0
|
| 19 |
+
**Code:** See [an example QA pipeline on Haystack](https://haystack.deepset.ai/tutorials/first-qa-system)
|
| 20 |
**Infrastructure**: 4x Tesla v100
|
| 21 |
|
| 22 |
## Hyperparameters
|
|
|
|
| 36 |
## Using a distilled model instead
|
| 37 |
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.
|
| 38 |
|
| 39 |
+
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
### In Haystack
|
| 42 |
+
Haystack is an NLP framework by deepset. You can use this model in a Hasytack pipeline to do question answering at scale (over many documents). To load the model in [Haystack](https://github.com/deepset-ai/haystack/):
|
| 43 |
+
```python
|
| 44 |
+
reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2")
|
| 45 |
+
# or
|
| 46 |
+
reader = TransformersReader(model_name_or_path="deepset/roberta-base-squad2",tokenizer="deepset/roberta-base-squad2")
|
|
|
|
| 47 |
```
|
| 48 |
+
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)
|
|
|
|
| 49 |
|
| 50 |
### In Transformers
|
| 51 |
```python
|
|
|
|
| 66 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 67 |
```
|
| 68 |
|
| 69 |
+
## Performance
|
| 70 |
+
Evaluated on the SQuAD 2.0 dev set with the [official eval script](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
|
|
|
|
|
|
|
|
|
| 72 |
```
|
| 73 |
+
"exact": 79.87029394424324,
|
| 74 |
+
"f1": 82.91251169582613,
|
| 75 |
|
| 76 |
+
"total": 11873,
|
| 77 |
+
"HasAns_exact": 77.93522267206478,
|
| 78 |
+
"HasAns_f1": 84.02838248389763,
|
| 79 |
+
"HasAns_total": 5928,
|
| 80 |
+
"NoAns_exact": 81.79983179142137,
|
| 81 |
+
"NoAns_f1": 81.79983179142137,
|
| 82 |
+
"NoAns_total": 5945
|
| 83 |
```
|
| 84 |
|
|
|
|
| 85 |
## Authors
|
| 86 |
+
**Branden Chan:** branden.chan@deepset.ai
|
| 87 |
+
**Timo M枚ller:** timo.moelle@deepset.ai
|
| 88 |
+
**Malte Pietsch:** malte.pietsch@deepset.ai
|
| 89 |
+
**Tanay Soni:** tanay.soni@deepset.ai
|
| 90 |
|
| 91 |
## About us
|
| 92 |
+
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
| 93 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
| 94 |
+
<img alt="" src="https://huggingface.co/spaces/deepset/README/resolve/main/haystack-logo-colored.svg" class="w-40"/>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
| 97 |
+
<img alt="" src="https://huggingface.co/spaces/deepset/README/resolve/main/deepset-logo-colored.svg" class="w-40"/>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
[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.
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
Some of our other work:
|
| 105 |
+
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")]([https://huggingface.co/deepset/tinyroberta-squad2)
|
| 106 |
- [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
|
| 107 |
- [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
|
| 108 |
+
|
| 109 |
+
<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>. You can also <strong><a class="h-7" href="https://haystack.deepset.ai/community/join">join us on <img alt="slack" class="h-7 inline-block m-0" style="margin: 0" src="https://huggingface.co/spaces/deepset/README/resolve/main/Slack_RGB.png"/></a></strong></p>
|
| 110 |
|
| 111 |
Get in touch:
|
| 112 |
+
|
| 113 |
+
|
| 114 |
[Twitter](https://twitter.com/deepset_ai) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Slack](https://haystack.deepset.ai/community/join) | [GitHub Discussions](https://github.com/deepset-ai/haystack/discussions) | [Website](https://deepset.ai)
|
| 115 |
|
| 116 |
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|