julien-c HF staff commited on
Commit
12e9297
1 Parent(s): 841677c

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-uncased-finetuned-xquadv1/README.md

Files changed (1) hide show
  1. README.md +129 -0
README.md ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: multilingual
3
+ thumbnail:
4
+ ---
5
+
6
+ # BERT (base-multilingual-uncased) 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-uncased')
11
+
12
+ [Language model](https://github.com/google-research/bert/blob/master/multilingual.md)
13
+
14
+ | Languages | Heads | Layers | Hidden | Params |
15
+ | --------- | ----- | ------ | ------ | ------ |
16
+ | 102 | 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
+ qa_pipeline = pipeline(
89
+ "question-answering",
90
+ model="mrm8488/bert-multi-uncased-finetuned-xquadv1",
91
+ tokenizer="mrm8488/bert-multi-uncased-finetuned-xquadv1"
92
+ )
93
+
94
+
95
+ # context: Coronavirus is seeding panic in the West because it expands so fast.
96
+
97
+ # question: Where is seeding panic Coronavirus?
98
+ qa_pipeline({
99
+ 'context': "कोरोनावायरस पश्चिम में आतंक बो रहा है क्योंकि यह इतनी तेजी से फैलता है।",
100
+ 'question': "कोरोनावायरस घबराहट कहां है?"
101
+
102
+ })
103
+ # output: {'answer': 'पश्चिम', 'end': 18, 'score': 0.7037217439689059, 'start': 12}
104
+
105
+ qa_pipeline({
106
+ 'context': "Manuel Romero has been working hardly in the repository hugginface/transformers lately",
107
+ 'question': "Who has been working hard for hugginface/transformers lately?"
108
+
109
+ })
110
+ # output: {'answer': 'Manuel Romero', 'end': 13, 'score': 0.7254485993702389, 'start': 0}
111
+
112
+ qa_pipeline({
113
+ 'context': "Manuel Romero a travaillé à peine dans le référentiel hugginface / transformers ces derniers temps",
114
+ 'question': "Pour quel référentiel a travaillé Manuel Romero récemment?"
115
+
116
+ })
117
+ #output: {'answer': 'hugginface / transformers', 'end': 79, 'score': 0.6482061613915384, 'start': 54}
118
+ ```
119
+ ![model in action](https://media.giphy.com/media/MBlire8Wj7ng73VBQ5/giphy.gif)
120
+
121
+ Try it on a Colab:
122
+
123
+ <a href="https://colab.research.google.com/github/mrm8488/shared_colab_notebooks/blob/master/Try_mrm8488_xquad_finetuned_uncased_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>
124
+
125
+
126
+
127
+ > Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488)
128
+
129
+ > Made with <span style="color: #e25555;">&hearts;</span> in Spain