julien-c HF staff commited on
Commit
47aee87
1 Parent(s): 6e764f5

Migrate model card from transformers-repo

Browse files

Read 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/bert-multi-cased-finetuned-xquadv1/README.md

Files changed (1) hide show
  1. README.md +131 -0
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: multilingual
3
+ thumbnail:
4
+ ---
5
+
6
+ # BERT (base-multilingual-cased) fine-tuned for multilingual Q&A
7
+
8
+ This model was created by [Google](https://github.com/google-research/bert/blob/master/multilingual.md) and fine-tuned on [XQuAD](https://github.com/deepmind/xquad) like data for multilingual (`11 different languages`) **Q&A** downstream task.
9
+
10
+ ## Details of the language model('bert-base-multilingual-cased')
11
+
12
+ [Language model](https://github.com/google-research/bert/blob/master/multilingual.md)
13
+
14
+ | Languages | Heads | Layers | Hidden | Params |
15
+ | --------- | ----- | ------ | ------ | ------ |
16
+ | 104 | 12 | 12 | 768 | 100 M |
17
+
18
+ ## Details of the downstream task (multilingual Q&A) - Dataset
19
+
20
+ Deepmind [XQuAD](https://github.com/deepmind/xquad)
21
+
22
+ Languages covered:
23
+
24
+ - Arabic: `ar`
25
+ - German: `de`
26
+ - Greek: `el`
27
+ - English: `en`
28
+ - Spanish: `es`
29
+ - Hindi: `hi`
30
+ - Russian: `ru`
31
+ - Thai: `th`
32
+ - Turkish: `tr`
33
+ - Vietnamese: `vi`
34
+ - Chinese: `zh`
35
+
36
+ As the dataset is based on SQuAD v1.1, there are no unanswerable questions in the data. We chose this
37
+ setting so that models can focus on cross-lingual transfer.
38
+
39
+ We show the average number of tokens per paragraph, question, and answer for each language in the
40
+ table below. The statistics were obtained using [Jieba](https://github.com/fxsjy/jieba) for Chinese
41
+ and the [Moses tokenizer](https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl)
42
+ for the other languages.
43
+
44
+ | | en | es | de | el | ru | tr | ar | vi | th | zh | hi |
45
+ | --------- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
46
+ | Paragraph | 142.4 | 160.7 | 139.5 | 149.6 | 133.9 | 126.5 | 128.2 | 191.2 | 158.7 | 147.6 | 232.4 |
47
+ | Question | 11.5 | 13.4 | 11.0 | 11.7 | 10.0 | 9.8 | 10.7 | 14.8 | 11.5 | 10.5 | 18.7 |
48
+ | Answer | 3.1 | 3.6 | 3.0 | 3.3 | 3.1 | 3.1 | 3.1 | 4.5 | 4.1 | 3.5 | 5.6 |
49
+
50
+ Citation:
51
+
52
+ <details>
53
+
54
+ ```bibtex
55
+ @article{Artetxe:etal:2019,
56
+ author = {Mikel Artetxe and Sebastian Ruder and Dani Yogatama},
57
+ title = {On the cross-lingual transferability of monolingual representations},
58
+ journal = {CoRR},
59
+ volume = {abs/1910.11856},
60
+ year = {2019},
61
+ archivePrefix = {arXiv},
62
+ eprint = {1910.11856}
63
+ }
64
+ ```
65
+
66
+ </details>
67
+
68
+ As **XQuAD** is just an evaluation dataset, I used `Data augmentation techniques` (scraping, neural machine translation, etc) to obtain more samples and split the dataset in order to have a train and test set. The test set was created in a way that contains the same number of samples for each language. Finally, I got:
69
+
70
+ | Dataset | # samples |
71
+ | ----------- | --------- |
72
+ | XQUAD train | 50 K |
73
+ | XQUAD test | 8 K |
74
+
75
+ ## Model training
76
+
77
+ The model was trained on a Tesla P100 GPU and 25GB of RAM.
78
+ The script for fine tuning can be found [here](https://github.com/huggingface/transformers/blob/master/examples/distillation/run_squad_w_distillation.py)
79
+
80
+
81
+ ## Model in action
82
+
83
+ Fast usage with **pipelines**:
84
+
85
+ ```python
86
+ from transformers import pipeline
87
+
88
+ from transformers import pipeline
89
+
90
+ qa_pipeline = pipeline(
91
+ "question-answering",
92
+ model="mrm8488/bert-multi-cased-finetuned-xquadv1",
93
+ tokenizer="mrm8488/bert-multi-cased-finetuned-xquadv1"
94
+ )
95
+
96
+
97
+ # context: Coronavirus is seeding panic in the West because it expands so fast.
98
+
99
+ # question: Where is seeding panic Coronavirus?
100
+ qa_pipeline({
101
+ 'context': "कोरोनावायरस पश्चिम में आतंक बो रहा है क्योंकि यह इतनी तेजी से फैलता है।",
102
+ 'question': "कोरोनावायरस घबराहट कहां है?"
103
+
104
+ })
105
+ # output: {'answer': 'पश्चिम', 'end': 18, 'score': 0.7037217439689059, 'start': 12}
106
+
107
+ qa_pipeline({
108
+ 'context': "Manuel Romero has been working hardly in the repository hugginface/transformers lately",
109
+ 'question': "Who has been working hard for hugginface/transformers lately?"
110
+
111
+ })
112
+ # output: {'answer': 'Manuel Romero', 'end': 13, 'score': 0.7254485993702389, 'start': 0}
113
+
114
+ qa_pipeline({
115
+ 'context': "Manuel Romero a travaillé à peine dans le référentiel hugginface / transformers ces derniers temps",
116
+ 'question': "Pour quel référentiel a travaillé Manuel Romero récemment?"
117
+
118
+ })
119
+ #output: {'answer': 'hugginface / transformers', 'end': 79, 'score': 0.6482061613915384, 'start': 54}
120
+ ```
121
+ ![model in action](https://media.giphy.com/media/MBlire8Wj7ng73VBQ5/giphy.gif)
122
+
123
+ Try it on a Colab:
124
+
125
+ <a href="https://colab.research.google.com/github/mrm8488/shared_colab_notebooks/blob/master/Try_mrm8488_xquad_finetuned_model.ipynb" target="_parent"><img src="https://camo.githubusercontent.com/52feade06f2fecbf006889a904d221e6a730c194/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667" alt="Open In Colab" data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg"></a>
126
+
127
+
128
+
129
+ > Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488)
130
+
131
+ > Made with <span style="color: #e25555;">&hearts;</span> in Spain