Commit 路
7e67e5e
1
Parent(s): a2fc7bb
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,115 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-4.0
|
| 3 |
-
---
|
| 4 |
-
|
| 5 |
-
# roberta-base-squad2 for QA on COVID-19
|
| 6 |
-
|
| 7 |
-
## Overview
|
| 8 |
-
**Language model:** deepset/roberta-base-squad2
|
| 9 |
-
**Language:** English
|
| 10 |
-
**Downstream-task:** Extractive QA
|
| 11 |
-
**Training data:** [SQuAD-style CORD-19 annotations from 23rd April](https://github.com/deepset-ai/COVID-QA/blob/master/data/question-answering/200423_covidQA.json)
|
| 12 |
-
**Code:** See [example](https://github.com/deepset-ai/FARM/blob/master/examples/question_answering_crossvalidation.py) in [FARM](https://github.com/deepset-ai/FARM)
|
| 13 |
-
**Infrastructure**: Tesla v100
|
| 14 |
-
|
| 15 |
-
## Hyperparameters
|
| 16 |
-
```
|
| 17 |
-
batch_size = 24
|
| 18 |
-
n_epochs = 3
|
| 19 |
-
base_LM_model = "deepset/roberta-base-squad2"
|
| 20 |
-
max_seq_len = 384
|
| 21 |
-
learning_rate = 3e-5
|
| 22 |
-
lr_schedule = LinearWarmup
|
| 23 |
-
warmup_proportion = 0.1
|
| 24 |
-
doc_stride = 128
|
| 25 |
-
xval_folds = 5
|
| 26 |
-
dev_split = 0
|
| 27 |
-
no_ans_boost = -100
|
| 28 |
-
```
|
| 29 |
-
---
|
| 30 |
-
license: cc-by-4.0
|
| 31 |
-
---
|
| 32 |
-
|
| 33 |
-
## Performance
|
| 34 |
-
5-fold cross-validation on the data set led to the following results:
|
| 35 |
-
|
| 36 |
-
**Single EM-Scores:** [0.222, 0.123, 0.234, 0.159, 0.158]
|
| 37 |
-
**Single F1-Scores:** [0.476, 0.493, 0.599, 0.461, 0.465]
|
| 38 |
-
**Single top\\_3\\_recall Scores:** [0.827, 0.776, 0.860, 0.771, 0.777]
|
| 39 |
-
**XVAL EM:** 0.17890995260663506
|
| 40 |
-
**XVAL f1:** 0.49925444207319924
|
| 41 |
-
**XVAL top\\_3\\_recall:** 0.8021327014218009
|
| 42 |
-
|
| 43 |
-
This model is the model obtained from the **third** fold of the cross-validation.
|
| 44 |
-
|
| 45 |
-
## Usage
|
| 46 |
-
|
| 47 |
-
### In Transformers
|
| 48 |
-
```python
|
| 49 |
-
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
model_name = "deepset/roberta-base-squad2-covid"
|
| 53 |
-
|
| 54 |
-
# a) Get predictions
|
| 55 |
-
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
| 56 |
-
QA_input = {
|
| 57 |
-
'question': 'Why is model conversion important?',
|
| 58 |
-
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
| 59 |
-
}
|
| 60 |
-
res = nlp(QA_input)
|
| 61 |
-
|
| 62 |
-
# b) Load model & tokenizer
|
| 63 |
-
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 64 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 65 |
-
```
|
| 66 |
-
|
| 67 |
-
### In FARM
|
| 68 |
-
```python
|
| 69 |
-
from farm.modeling.adaptive_model import AdaptiveModel
|
| 70 |
-
from farm.modeling.tokenization import Tokenizer
|
| 71 |
-
from farm.infer import Inferencer
|
| 72 |
-
|
| 73 |
-
model_name = "deepset/roberta-base-squad2-covid"
|
| 74 |
-
|
| 75 |
-
# a) Get predictions
|
| 76 |
-
nlp = Inferencer.load(model_name, task_type="question_answering")
|
| 77 |
-
QA_input = [{"questions": ["Why is model conversion important?"],
|
| 78 |
-
"text": "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."}]
|
| 79 |
-
res = nlp.inference_from_dicts(dicts=QA_input, rest_api_schema=True)
|
| 80 |
-
|
| 81 |
-
# b) Load model & tokenizer
|
| 82 |
-
model = AdaptiveModel.convert_from_transformers(model_name, device="cpu", task_type="question_answering")
|
| 83 |
-
tokenizer = Tokenizer.load(model_name)
|
| 84 |
-
```
|
| 85 |
-
|
| 86 |
-
### In haystack
|
| 87 |
-
For doing QA at scale (i.e. many docs instead of single paragraph), you can load the model also in [haystack](https://github.com/deepset-ai/haystack/):
|
| 88 |
-
```python
|
| 89 |
-
reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2-covid")
|
| 90 |
-
# or
|
| 91 |
-
reader = TransformersReader(model="deepset/roberta-base-squad2",tokenizer="deepset/roberta-base-squad2-covid")
|
| 92 |
-
```
|
| 93 |
-
|
| 94 |
-
## Authors
|
| 95 |
-
Branden Chan: `branden.chan [at] deepset.ai`
|
| 96 |
-
Timo M枚ller: `timo.moeller [at] deepset.ai`
|
| 97 |
-
Malte Pietsch: `malte.pietsch [at] deepset.ai`
|
| 98 |
-
Tanay Soni: `tanay.soni [at] deepset.ai`
|
| 99 |
-
Bogdan Kosti膰: `bogdan.kostic [at] deepset.ai`
|
| 100 |
-
|
| 101 |
-
## About us
|
| 102 |
-

|
| 103 |
-
We bring NLP to the industry via open source!
|
| 104 |
-
Our focus: Industry specific language models & large scale QA systems.
|
| 105 |
-
|
| 106 |
-
Some of our work:
|
| 107 |
-
- [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
|
| 108 |
-
- [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
|
| 109 |
-
- [FARM](https://github.com/deepset-ai/FARM)
|
| 110 |
-
- [Haystack](https://github.com/deepset-ai/haystack/)
|
| 111 |
-
|
| 112 |
-
Get in touch:
|
| 113 |
-
[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)
|
| 114 |
-
|
| 115 |
-
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|