julien-c HF staff commited on
Commit
425742f
·
1 Parent(s): 2db9d1e

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/deepset/xlm-roberta-large-squad2/README.md

Files changed (1) hide show
  1. README.md +131 -0
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: multilingual
3
+ tags:
4
+ - question-answering
5
+ datasets:
6
+ - squad_v2
7
+ ---
8
+
9
+ # Multilingual XLM-RoBERTa large for QA on various languages
10
+
11
+ ## Overview
12
+ **Language model:** xlm-roberta-large
13
+ **Language:** Multilingual
14
+ **Downstream-task:** Extractive QA
15
+ **Training data:** SQuAD 2.0
16
+ **Eval data:** SQuAD dev set - German MLQA - German XQuAD
17
+ **Training run:** [MLFlow link](https://public-mlflow.deepset.ai/#/experiments/124/runs/3a540e3f3ecf4dd98eae8fc6d457ff20)
18
+ **Infrastructure**: 4x Tesla v100
19
+
20
+ ## Hyperparameters
21
+
22
+ ```
23
+ batch_size = 32
24
+ n_epochs = 3
25
+ base_LM_model = "xlm-roberta-large"
26
+ max_seq_len = 256
27
+ learning_rate = 1e-5
28
+ lr_schedule = LinearWarmup
29
+ warmup_proportion = 0.2
30
+ doc_stride=128
31
+ max_query_length=64
32
+ ```
33
+
34
+ ## Performance
35
+ Evaluated on the SQuAD 2.0 English dev set with the [official eval script](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/).
36
+ ```
37
+ "exact": 79.45759285774446,
38
+ "f1": 83.79259828925511,
39
+ "total": 11873,
40
+ "HasAns_exact": 71.96356275303644,
41
+ "HasAns_f1": 80.6460053117963,
42
+ "HasAns_total": 5928,
43
+ "NoAns_exact": 86.93019343986543,
44
+ "NoAns_f1": 86.93019343986543,
45
+ "NoAns_total": 5945
46
+ ```
47
+
48
+ Evaluated on German [MLQA: test-context-de-question-de.json](https://github.com/facebookresearch/MLQA)
49
+ ```
50
+ "exact": 49.34691166703564,
51
+ "f1": 66.15582561674236,
52
+ "total": 4517,
53
+ ```
54
+
55
+ Evaluated on German [XQuAD: xquad.de.json](https://github.com/deepmind/xquad)
56
+ ```
57
+ "exact": 61.51260504201681,
58
+ "f1": 78.80206098332569,
59
+ "total": 1190,
60
+ ```
61
+
62
+ ## Usage
63
+
64
+ ### In Transformers
65
+ ```python
66
+ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
67
+
68
+ model_name = "deepset/xlm-roberta-large-squad2"
69
+
70
+ # a) Get predictions
71
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
72
+ QA_input = {
73
+ 'question': 'Why is model conversion important?',
74
+ 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
75
+ }
76
+ res = nlp(QA_input)
77
+
78
+ # b) Load model & tokenizer
79
+ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
80
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
81
+ ```
82
+
83
+ ### In FARM
84
+
85
+ ```python
86
+ from farm.modeling.adaptive_model import AdaptiveModel
87
+ from farm.modeling.tokenization import Tokenizer
88
+ from farm.infer import QAInferencer
89
+
90
+ model_name = "deepset/xlm-roberta-large-squad2"
91
+
92
+ # a) Get predictions
93
+ nlp = QAInferencer.load(model_name)
94
+ QA_input = [{"questions": ["Why is model conversion important?"],
95
+ "text": "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."}]
96
+ res = nlp.inference_from_dicts(dicts=QA_input, rest_api_schema=True)
97
+
98
+ # b) Load model & tokenizer
99
+ model = AdaptiveModel.convert_from_transformers(model_name, device="cpu", task_type="question_answering")
100
+ tokenizer = Tokenizer.load(model_name)
101
+ ```
102
+
103
+ ### In haystack
104
+ For doing QA at scale (i.e. many docs instead of single paragraph), you can load the model also in [haystack](https://github.com/deepset-ai/haystack/):
105
+ ```python
106
+ reader = FARMReader(model_name_or_path="deepset/xlm-roberta-large-squad2")
107
+ # or
108
+ reader = TransformersReader(model="deepset/xlm-roberta-large-squad2",tokenizer="deepset/xlm-roberta-large-squad2")
109
+ ```
110
+
111
+
112
+ ## Authors
113
+ Branden Chan: `branden.chan [at] deepset.ai`
114
+ Timo Möller: `timo.moeller [at] deepset.ai`
115
+ Malte Pietsch: `malte.pietsch [at] deepset.ai`
116
+ Tanay Soni: `tanay.soni [at] deepset.ai`
117
+
118
+ ## About us
119
+ ![deepset logo](https://raw.githubusercontent.com/deepset-ai/FARM/master/docs/img/deepset_logo.png)
120
+
121
+ We bring NLP to the industry via open source!
122
+ Our focus: Industry specific language models & large scale QA systems.
123
+
124
+ Some of our work:
125
+ - [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
126
+ - [FARM](https://github.com/deepset-ai/FARM)
127
+ - [Haystack](https://github.com/deepset-ai/haystack/)
128
+
129
+ Get in touch:
130
+ [Twitter](https://twitter.com/deepset_ai) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Website](https://deepset.ai)
131
+