RichardErkhov commited on
Commit
39f970a
1 Parent(s): 2321ffb

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +163 -0
README.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ xlm-roberta-base-squad2 - bnb 8bits
11
+ - Model creator: https://huggingface.co/deepset/
12
+ - Original model: https://huggingface.co/deepset/xlm-roberta-base-squad2/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ license: cc-by-4.0
20
+ datasets:
21
+ - squad_v2
22
+ model-index:
23
+ - name: deepset/xlm-roberta-base-squad2
24
+ results:
25
+ - task:
26
+ type: question-answering
27
+ name: Question Answering
28
+ dataset:
29
+ name: squad_v2
30
+ type: squad_v2
31
+ config: squad_v2
32
+ split: validation
33
+ metrics:
34
+ - type: exact_match
35
+ value: 74.0354
36
+ name: Exact Match
37
+ verified: true
38
+ verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMWMxNWQ2ODJkNWIzZGQwOWI4OTZjYjU3ZDVjZGQzMjI5MzljNjliZTY4Mzk4YTk4OTMzZWYxZjUxYmZhYTBhZSIsInZlcnNpb24iOjF9.eEeFYYJ30BfJDd-JYfI1kjlxJrRF6OFtj2GnkTCOO4kqX31inFy8ptDWusVlLFsUphm4dNWfTKXC5e-gytLBDA
39
+ - type: f1
40
+ value: 77.1833
41
+ name: F1
42
+ verified: true
43
+ verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMjg4MjNkOTA4Y2I5OGFlYTk1NWZjMWFlNjI5M2Y0NGZhMThhN2M4YmY2Y2RhZjcwYzU0MGNjN2RkZDljZmJmNiIsInZlcnNpb24iOjF9.TX42YMXpH4e0qu7cC4ARDlZWSkd55dwwyeyFXmOlXERNnEicDuFBCsy8WHLaqQCLUkzODJ22Hw4zhv81rwnlAQ
44
+ ---
45
+
46
+ # Multilingual XLM-RoBERTa base for QA on various languages
47
+
48
+ ## Overview
49
+ **Language model:** xlm-roberta-base
50
+ **Language:** Multilingual
51
+ **Downstream-task:** Extractive QA
52
+ **Training data:** SQuAD 2.0
53
+ **Eval data:** SQuAD 2.0 dev set - German MLQA - German XQuAD
54
+ **Code:** See [example](https://github.com/deepset-ai/FARM/blob/master/examples/question_answering.py) in [FARM](https://github.com/deepset-ai/FARM/blob/master/examples/question_answering.py)
55
+ **Infrastructure**: 4x Tesla v100
56
+
57
+ ## Hyperparameters
58
+
59
+ ```
60
+ batch_size = 22*4
61
+ n_epochs = 2
62
+ max_seq_len=256,
63
+ doc_stride=128,
64
+ learning_rate=2e-5,
65
+ ```
66
+
67
+ Corresponding experiment logs in mlflow: [link](https://public-mlflow.deepset.ai/#/experiments/2/runs/b25ec75e07614accb3f1ce03d43dbe08)
68
+
69
+
70
+ ## Performance
71
+ Evaluated on the SQuAD 2.0 dev set with the [official eval script](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/).
72
+ ```
73
+ "exact": 73.91560683904657
74
+ "f1": 77.14103746689592
75
+ ```
76
+
77
+ Evaluated on German MLQA: test-context-de-question-de.json
78
+ "exact": 33.67279167589108
79
+ "f1": 44.34437105434842
80
+ "total": 4517
81
+
82
+ Evaluated on German XQuAD: xquad.de.json
83
+ "exact": 48.739495798319325
84
+ "f1": 62.552615701071495
85
+ "total": 1190
86
+
87
+
88
+ ## Usage
89
+
90
+ ### In Transformers
91
+ ```python
92
+ from transformers.pipelines import pipeline
93
+ from transformers.modeling_auto import AutoModelForQuestionAnswering
94
+ from transformers.tokenization_auto import AutoTokenizer
95
+
96
+ model_name = "deepset/xlm-roberta-base-squad2"
97
+
98
+ # a) Get predictions
99
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
100
+ QA_input = {
101
+ 'question': 'Why is model conversion important?',
102
+ 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
103
+ }
104
+ res = nlp(QA_input)
105
+
106
+ # b) Load model & tokenizer
107
+ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
108
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
109
+ ```
110
+
111
+ ### In FARM
112
+
113
+ ```python
114
+ from farm.modeling.adaptive_model import AdaptiveModel
115
+ from farm.modeling.tokenization import Tokenizer
116
+ from farm.infer import Inferencer
117
+
118
+ model_name = "deepset/xlm-roberta-base-squad2"
119
+
120
+ # a) Get predictions
121
+ nlp = Inferencer.load(model_name, task_type="question_answering")
122
+ QA_input = [{"questions": ["Why is model conversion important?"],
123
+ "text": "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."}]
124
+ res = nlp.inference_from_dicts(dicts=QA_input, rest_api_schema=True)
125
+
126
+ # b) Load model & tokenizer
127
+ model = AdaptiveModel.convert_from_transformers(model_name, device="cpu", task_type="question_answering")
128
+ tokenizer = Tokenizer.load(model_name)
129
+ ```
130
+
131
+ ### In haystack
132
+ 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/):
133
+ ```python
134
+ reader = FARMReader(model_name_or_path="deepset/xlm-roberta-base-squad2")
135
+ # or
136
+ reader = TransformersReader(model="deepset/roberta-base-squad2",tokenizer="deepset/xlm-roberta-base-squad2")
137
+ ```
138
+
139
+
140
+ ## Authors
141
+ Branden Chan: `branden.chan [at] deepset.ai`
142
+ Timo Möller: `timo.moeller [at] deepset.ai`
143
+ Malte Pietsch: `malte.pietsch [at] deepset.ai`
144
+ Tanay Soni: `tanay.soni [at] deepset.ai`
145
+
146
+ ## About us
147
+ ![deepset logo](https://workablehr.s3.amazonaws.com/uploads/account/logo/476306/logo)
148
+
149
+ We bring NLP to the industry via open source!
150
+ Our focus: Industry specific language models & large scale QA systems.
151
+
152
+ Some of our work:
153
+ - [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
154
+ - [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
155
+ - [FARM](https://github.com/deepset-ai/FARM)
156
+ - [Haystack](https://github.com/deepset-ai/haystack/)
157
+
158
+ Get in touch:
159
+ [Twitter](https://twitter.com/deepset_ai) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Discord](https://haystack.deepset.ai/community/join) | [GitHub Discussions](https://github.com/deepset-ai/haystack/discussions) | [Website](https://deepset.ai)
160
+
161
+ By the way: [we're hiring!](http://www.deepset.ai/jobs)
162
+
163
+