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/henryk/bert-base-multilingual-cased-finetuned-dutch-squad2/README.md
README.md
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: nl
|
3 |
+
---
|
4 |
+
|
5 |
+
# Multilingual + Dutch SQuAD2.0
|
6 |
+
|
7 |
+
This model is the multilingual model provided by the Google research team with a fine-tuned dutch Q&A downstream task.
|
8 |
+
|
9 |
+
## Details of the language model
|
10 |
+
|
11 |
+
Language model ([**bert-base-multilingual-cased**](https://github.com/google-research/bert/blob/master/multilingual.md)):
|
12 |
+
12-layer, 768-hidden, 12-heads, 110M parameters.
|
13 |
+
Trained on cased text in the top 104 languages with the largest Wikipedias.
|
14 |
+
|
15 |
+
## Details of the downstream task
|
16 |
+
Using the `mtranslate` Python module, [**SQuAD2.0**](https://rajpurkar.github.io/SQuAD-explorer/) was machine-translated. In order to find the start tokens, the direct translations of the answers were searched in the corresponding paragraphs. Due to the different translations depending on the context (missing context in the pure answer), the answer could not always be found in the text, and thus a loss of question-answer examples occurred. This is a potential problem where errors can occur in the data set.
|
17 |
+
|
18 |
+
| Dataset | # Q&A |
|
19 |
+
| ---------------------- | ----- |
|
20 |
+
| SQuAD2.0 Train | 130 K |
|
21 |
+
| Dutch SQuAD2.0 Train | 99 K |
|
22 |
+
| SQuAD2.0 Dev | 12 K |
|
23 |
+
| Dutch SQuAD2.0 Dev | 10 K |
|
24 |
+
|
25 |
+
|
26 |
+
## Model benchmark
|
27 |
+
|
28 |
+
|
29 |
+
| Model | EM/F1 |HasAns (EM/F1) | NoAns |
|
30 |
+
| ---------------------- | ----- | ----- | ----- |
|
31 |
+
| [robBERT](https://huggingface.co/pdelobelle/robBERT-base) | 58.04/60.95 | 33.08/40.64 | 73.67 |
|
32 |
+
| [dutchBERT](https://huggingface.co/wietsedv/bert-base-dutch-cased) | 64.25/68.45 | 45.59/56.49 | 75.94 |
|
33 |
+
| [multiBERT](https://huggingface.co/bert-base-multilingual-cased) | **67.38**/**71.36** | 47.42/57.76 | 79.88 |
|
34 |
+
|
35 |
+
## Model training
|
36 |
+
|
37 |
+
The model was trained on a **Tesla V100** GPU with the following command:
|
38 |
+
|
39 |
+
```python
|
40 |
+
export SQUAD_DIR=path/to/nl_squad
|
41 |
+
|
42 |
+
python run_squad.py
|
43 |
+
--model_type bert \
|
44 |
+
--model_name_or_path bert-base-multilingual-cased \
|
45 |
+
--do_train \
|
46 |
+
--do_eval \
|
47 |
+
--train_file $SQUAD_DIR/nl_squadv2_train_clean.json \
|
48 |
+
--predict_file $SQUAD_DIR/nl_squadv2_dev_clean.json \
|
49 |
+
--num_train_epochs 2 \
|
50 |
+
--max_seq_length 384 \
|
51 |
+
--doc_stride 128 \
|
52 |
+
--save_steps=8000 \
|
53 |
+
--output_dir ../../output \
|
54 |
+
--overwrite_cache \
|
55 |
+
--overwrite_output_dir
|
56 |
+
```
|
57 |
+
|
58 |
+
**Results**:
|
59 |
+
|
60 |
+
{'exact': 67.38028751680629, 'f1': 71.362297054268, 'total': 9669, 'HasAns_exact': 47.422126745435015, 'HasAns_f1': 57.761023151910734, 'HasAns_total': 3724, 'NoAns_exact': 79.88225399495374, 'NoAns_f1': 79.88225399495374, 'NoAns_total': 5945, 'best_exact': 67.53542248422795, 'best_exact_thresh': 0.0, 'best_f1': 71.36229705426837, 'best_f1_thresh': 0.0}
|
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="henryk/bert-base-multilingual-cased-finetuned-dutch-squad2",
|
72 |
+
tokenizer="henryk/bert-base-multilingual-cased-finetuned-dutch-squad2"
|
73 |
+
)
|
74 |
+
|
75 |
+
qa_pipeline({
|
76 |
+
'context': "Amsterdam is de hoofdstad en de dichtstbevolkte stad van Nederland.",
|
77 |
+
'question': "Wat is de hoofdstad van Nederland?"})
|
78 |
+
|
79 |
+
```
|
80 |
+
|
81 |
+
# Output:
|
82 |
+
|
83 |
+
```json
|
84 |
+
{
|
85 |
+
"score": 0.83,
|
86 |
+
"start": 0,
|
87 |
+
"end": 9,
|
88 |
+
"answer": "Amsterdam"
|
89 |
+
}
|
90 |
+
```
|
91 |
+
|
92 |
+
## Contact
|
93 |
+
|
94 |
+
Please do not hesitate to contact me via [LinkedIn](https://www.linkedin.com/in/henryk-borzymowski-0755a2167/) if you want to discuss or get access to the Dutch version of SQuAD.
|