Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/mrm8488/spanbert-finetuned-squadv1/README.md
README.md
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
thumbnail:
|
4 |
+
---
|
5 |
+
|
6 |
+
# SpanBERT (spanbert-base-cased) fine-tuned on SQuAD v1.1
|
7 |
+
|
8 |
+
|
9 |
+
[SpanBERT](https://github.com/facebookresearch/SpanBERT) created by [Facebook Research](https://github.com/facebookresearch) and fine-tuned on [SQuAD 1.1](https://rajpurkar.github.io/SQuAD-explorer/) for **Q&A** downstream task.
|
10 |
+
|
11 |
+
## Details of SpanBERT
|
12 |
+
|
13 |
+
A pre-training method that is designed to better represent and predict spans of text.
|
14 |
+
|
15 |
+
[SpanBERT: Improving Pre-training by Representing and Predicting Spans](https://arxiv.org/abs/1907.10529)
|
16 |
+
|
17 |
+
## Details of the downstream task (Q&A) - Dataset
|
18 |
+
|
19 |
+
[SQuAD 1.1](https://rajpurkar.github.io/SQuAD-explorer/) contains 100,000+ question-answer pairs on 500+ articles.
|
20 |
+
|
21 |
+
| Dataset | Split | # samples |
|
22 |
+
| -------- | ----- | --------- |
|
23 |
+
| SQuAD1.1 | train | 87.7k |
|
24 |
+
| SQuAD1.1 | eval | 10.6k |
|
25 |
+
|
26 |
+
## Model training
|
27 |
+
|
28 |
+
The model was trained on a Tesla P100 GPU and 25GB of RAM.
|
29 |
+
The script for fine tuning can be found [here](https://github.com/huggingface/transformers/blob/master/examples/question-answering/run_squad.py)
|
30 |
+
|
31 |
+
## Results:
|
32 |
+
|
33 |
+
| Metric | # Value |
|
34 |
+
| ------ | --------- |
|
35 |
+
| **EM** | **85.49** |
|
36 |
+
| **F1** | **91.98** |
|
37 |
+
|
38 |
+
### Raw metrics:
|
39 |
+
|
40 |
+
```json
|
41 |
+
{
|
42 |
+
"exact": 85.49668874172185,
|
43 |
+
"f1": 91.9845699540379,
|
44 |
+
"total": 10570,
|
45 |
+
"HasAns_exact": 85.49668874172185,
|
46 |
+
"HasAns_f1": 91.9845699540379,
|
47 |
+
"HasAns_total": 10570,
|
48 |
+
"best_exact": 85.49668874172185,
|
49 |
+
"best_exact_thresh": 0.0,
|
50 |
+
"best_f1": 91.9845699540379,
|
51 |
+
"best_f1_thresh": 0.0
|
52 |
+
}
|
53 |
+
```
|
54 |
+
|
55 |
+
## Comparison:
|
56 |
+
|
57 |
+
| Model | EM | F1 score |
|
58 |
+
| ----------------------------------------------------------------------------------------- | --------- | --------- |
|
59 |
+
| [SpanBert official repo](https://github.com/facebookresearch/SpanBERT#pre-trained-models) | - | 92.4\* |
|
60 |
+
| [spanbert-finetuned-squadv1](https://huggingface.co/mrm8488/spanbert-finetuned-squadv1) | **85.49** | **91.98** |
|
61 |
+
|
62 |
+
## Model in action
|
63 |
+
|
64 |
+
Fast usage with **pipelines**:
|
65 |
+
|
66 |
+
```python
|
67 |
+
from transformers import pipeline
|
68 |
+
|
69 |
+
qa_pipeline = pipeline(
|
70 |
+
"question-answering",
|
71 |
+
model="mrm8488/spanbert-finetuned-squadv1",
|
72 |
+
tokenizer="mrm8488/spanbert-finetuned-squadv1"
|
73 |
+
)
|
74 |
+
|
75 |
+
qa_pipeline({
|
76 |
+
'context': "Manuel Romero has been working hardly in the repository hugginface/transformers lately",
|
77 |
+
'question': "Who has been working hard for hugginface/transformers lately?"
|
78 |
+
|
79 |
+
})
|
80 |
+
```
|
81 |
+
|
82 |
+
> Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488) | [LinkedIn](https://www.linkedin.com/in/manuel-romero-cs/)
|
83 |
+
|
84 |
+
> Made with <span style="color: #e25555;">♥</span> in Spain
|