Add files
Browse files- README.md +115 -1
- config.json +24 -0
- flax_model.msgpack +3 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- rust_model.ot +3 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
README.md
CHANGED
@@ -1,3 +1,117 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language: en
|
3 |
+
datasets:
|
4 |
+
- squad_v2
|
5 |
+
license: cc-by-4.0
|
6 |
---
|
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
|
15 |
+
**Language:** English
|
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
|
23 |
+
|
24 |
+
```
|
25 |
+
batch_size = 96
|
26 |
+
n_epochs = 2
|
27 |
+
base_LM_model = "roberta-base"
|
28 |
+
max_seq_len = 386
|
29 |
+
learning_rate = 3e-5
|
30 |
+
lr_schedule = LinearWarmup
|
31 |
+
warmup_proportion = 0.2
|
32 |
+
doc_stride=128
|
33 |
+
max_query_length=64
|
34 |
+
```
|
35 |
+
|
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 Haystack 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
|
52 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
53 |
+
|
54 |
+
model_name = "deepset/roberta-base-squad2"
|
55 |
+
|
56 |
+
# a) Get predictions
|
57 |
+
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
58 |
+
QA_input = {
|
59 |
+
'question': 'Why is model conversion important?',
|
60 |
+
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
61 |
+
}
|
62 |
+
res = nlp(QA_input)
|
63 |
+
|
64 |
+
# b) Load model & tokenizer
|
65 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
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.moeller@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 |
+
## Get in touch and join the Haystack community
|
110 |
+
|
111 |
+
<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>.
|
112 |
+
|
113 |
+
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community/join"><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"/>community open to everyone!</a></strong></p>
|
114 |
+
|
115 |
+
[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)
|
116 |
+
|
117 |
+
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|
config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"RobertaForQuestionAnswering"
|
4 |
+
],
|
5 |
+
"attention_probs_dropout_prob": 0.1,
|
6 |
+
"bos_token_id": 0,
|
7 |
+
"eos_token_id": 2,
|
8 |
+
"gradient_checkpointing": false,
|
9 |
+
"hidden_act": "gelu",
|
10 |
+
"hidden_dropout_prob": 0.1,
|
11 |
+
"hidden_size": 768,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 3072,
|
14 |
+
"language": "english",
|
15 |
+
"layer_norm_eps": 1e-05,
|
16 |
+
"max_position_embeddings": 514,
|
17 |
+
"model_type": "roberta",
|
18 |
+
"name": "Roberta",
|
19 |
+
"num_attention_heads": 12,
|
20 |
+
"num_hidden_layers": 12,
|
21 |
+
"pad_token_id": 1,
|
22 |
+
"type_vocab_size": 1,
|
23 |
+
"vocab_size": 50265
|
24 |
+
}
|
flax_model.msgpack
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a8d759d881d9c1b39dbf4ee451fb8a8c2d43ccbd180218863a54ffd9b4d2447
|
3 |
+
size 496233457
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e0b64ccefc1bcb569b604baea27eb873e5482fdf6eb3ceff1fb5368397db5aed
|
3 |
+
size 496313727
|
rust_model.ot
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5a16ed126bbc8c4cf794406bac0c7946f62d0f175c02dc54d77a00a6255597ed
|
3 |
+
size 498638704
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
|
tf_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b672dd16f09f6f805d407800278e60217b9d7c040df1dde5098765a40cdc88a
|
3 |
+
size 496513256
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"do_lower_case": false, "model_max_length": 512, "full_tokenizer_file": null}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|