Hello xlmr-qa
Browse files- README.md +118 -0
- config.json +31 -0
- pytorch_model.bin +3 -0
- sentencepiece.bpe.model +3 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
README.md
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- sv
|
4 |
+
- multilingual
|
5 |
+
tags:
|
6 |
+
- question-answering
|
7 |
+
- xlm-roberta
|
8 |
+
- roberta
|
9 |
+
- squad
|
10 |
+
metrics:
|
11 |
+
- squad_v2
|
12 |
+
widget:
|
13 |
+
- text: "Vad är den svenska nationaldagen?"
|
14 |
+
context: "Sveriges nationaldag och svenska flaggans dag firas den 6 juni varje år och är en helgdag i Sverige. Tidigare firades 6 juni enbart som "svenska flaggans dag" och det var först 1983 som dagen även fick status som nationaldag."
|
15 |
+
- text: "Vad är den svenska nationaldagen?"
|
16 |
+
context: "Sveriges nationaldag och svenska flaggans dag firas den 6 juni varje år och är en helgdag i Sverige. Tidigare firades 6 juni enbart som "svenska flaggans dag" och det var först 1983 som dagen även fick status som nationaldag."
|
17 |
+
- text: "Vilket år tillkom Sveriges nationaldag?"
|
18 |
+
context: "Sveriges nationaldag och svenska flaggans dag firas den 6 juni varje år och är en helgdag i Sverige. Tidigare firades 6 juni enbart som "svenska flaggans dag" och det var först 1983 som dagen även fick status som nationaldag."
|
19 |
+
model-index:
|
20 |
+
- name: XLM-RoBERTa large for QA (SwedishQA - 🇸🇪)
|
21 |
+
results:
|
22 |
+
- task:
|
23 |
+
type: question-answering
|
24 |
+
name: Question Answering
|
25 |
+
dataset:
|
26 |
+
name: SwedishQA
|
27 |
+
args: sv
|
28 |
+
metrics:
|
29 |
+
- type: squad_v2
|
30 |
+
value: 87.97
|
31 |
+
name: Eval F1
|
32 |
+
args: max_order
|
33 |
+
- type: squad_v2
|
34 |
+
value: 78.79
|
35 |
+
name: Eval Exact
|
36 |
+
args: max_order
|
37 |
+
---
|
38 |
+
|
39 |
+
# XLM-RoBERTa large for QA (SwedishQA - 🇸🇪)
|
40 |
+
|
41 |
+
This model is a fine-tuned version of [xlm-roberta-large](https://huggingface.co/xlm-roberta-large) on the [SwedishQA](https://github.com/Vottivott/building-a-swedish-qa-model) dataset.
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
## Hyperparameters
|
46 |
+
|
47 |
+
The following hyperparameters were used during training:
|
48 |
+
- learning_rate: 1e-05
|
49 |
+
- train_batch_size: 8
|
50 |
+
- eval_batch_size: 8
|
51 |
+
- seed: 42
|
52 |
+
- gradient_accumulation_steps: 8
|
53 |
+
- total_train_batch_size: 64
|
54 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
55 |
+
- lr_scheduler_type: linear
|
56 |
+
- lr_scheduler_warmup_ratio: 0.1
|
57 |
+
- num_epochs: 2.0
|
58 |
+
- mixed_precision_training: Native AMP
|
59 |
+
|
60 |
+
|
61 |
+
## Performance
|
62 |
+
|
63 |
+
Evaluation results on the eval set with the official [eval script](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/).
|
64 |
+
|
65 |
+
### Evalset
|
66 |
+
|
67 |
+
```text
|
68 |
+
"exact": 78.79554655870446,
|
69 |
+
"f1": 87.97339064752278,
|
70 |
+
"total": 5928
|
71 |
+
```
|
72 |
+
|
73 |
+
|
74 |
+
## Usage
|
75 |
+
|
76 |
+
```python
|
77 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
78 |
+
|
79 |
+
model_name_or_path = "m3hrdadfi/xlmr-large-qa-sv"
|
80 |
+
nlp = pipeline('question-answering', model=model_name_or_path, tokenizer=model_name_or_path)
|
81 |
+
|
82 |
+
context = """
|
83 |
+
Sveriges nationaldag och svenska flaggans dag firas den 6 juni
|
84 |
+
varje år och är en helgdag i Sverige.
|
85 |
+
Tidigare firades 6 juni enbart som "svenska flaggans dag" och det
|
86 |
+
var först 1983 som dagen även fick status som nationaldag.
|
87 |
+
"""
|
88 |
+
|
89 |
+
questions = [
|
90 |
+
"Vad är den svenska nationaldagen?",
|
91 |
+
"Vad är helgdag i Sverige?",
|
92 |
+
"Vilket år tillkom Sveriges nationaldag?"
|
93 |
+
]
|
94 |
+
kwargs = {}
|
95 |
+
|
96 |
+
for question in questions:
|
97 |
+
r = nlp(question=question, context=context, **kwargs)
|
98 |
+
answer = " ".join([token.strip() for token in r["answer"].strip().split() if token.strip()])
|
99 |
+
print(f"{question} {answer}")
|
100 |
+
```
|
101 |
+
|
102 |
+
**Output**
|
103 |
+
|
104 |
+
```text
|
105 |
+
Vad är den svenska nationaldagen? 6 juni
|
106 |
+
Vad är helgdag i Sverige? svenska flaggans dag
|
107 |
+
Vilket år tillkom Sveriges nationaldag? 1983
|
108 |
+
```
|
109 |
+
|
110 |
+
## Authors
|
111 |
+
- [Mehrdad Farahani](https://github.com/m3hrdadfi)
|
112 |
+
|
113 |
+
### Framework versions
|
114 |
+
|
115 |
+
- Transformers 4.12.0.dev0
|
116 |
+
- Pytorch 1.9.1+cu111
|
117 |
+
- Datasets 1.12.1
|
118 |
+
- Tokenizers 0.10.3
|
config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "deepset/xlm-roberta-large-squad2",
|
3 |
+
"architectures": [
|
4 |
+
"XLMRobertaForQuestionAnswering"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"classifier_dropout": null,
|
9 |
+
"eos_token_id": 2,
|
10 |
+
"gradient_checkpointing": false,
|
11 |
+
"hidden_act": "gelu",
|
12 |
+
"hidden_dropout_prob": 0.1,
|
13 |
+
"hidden_size": 1024,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"intermediate_size": 4096,
|
16 |
+
"language": "english",
|
17 |
+
"layer_norm_eps": 1e-05,
|
18 |
+
"max_position_embeddings": 514,
|
19 |
+
"model_type": "xlm-roberta",
|
20 |
+
"name": "XLMRoberta",
|
21 |
+
"num_attention_heads": 16,
|
22 |
+
"num_hidden_layers": 24,
|
23 |
+
"output_past": true,
|
24 |
+
"pad_token_id": 1,
|
25 |
+
"position_embedding_type": "absolute",
|
26 |
+
"torch_dtype": "float32",
|
27 |
+
"transformers_version": "4.12.0.dev0",
|
28 |
+
"type_vocab_size": 1,
|
29 |
+
"use_cache": true,
|
30 |
+
"vocab_size": 250002
|
31 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:80402e45eac843c09fa82643e0558df4d54e5814c6e7ad26a0bd2e43aa8aecb1
|
3 |
+
size 2235534897
|
sentencepiece.bpe.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
|
3 |
+
size 5069051
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": "<mask>"}
|
tf_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d8eb137314ae9145b11fc50a05464e3760f6174ffc638e57b5535c66a674c69c
|
3 |
+
size 2235922536
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": "<s>", "eos_token": "</s>", "sep_token": "</s>", "cls_token": "<s>", "unk_token": "<unk>", "pad_token": "<pad>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "do_lower_case": false, "model_max_length": 512, "special_tokens_map_file": "germanQA/saved_models/xlm-roberta-large-squad2/special_tokens_map.json", "full_tokenizer_file": null, "name_or_path": "deepset/xlm-roberta-large-squad2", "sp_model_kwargs": {}, "tokenizer_class": "XLMRobertaTokenizer"}
|