lenglaender
commited on
Commit
•
5c8f58f
1
Parent(s):
7178b43
Upload model
Browse files- README.md +74 -0
- adapter_config.json +40 -0
- pytorch_adapter.bin +3 -0
README.md
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- adapter-transformers
|
4 |
+
- xlm-roberta
|
5 |
+
datasets:
|
6 |
+
- UKPLab/m2qa
|
7 |
+
---
|
8 |
+
|
9 |
+
# M2QA Adapter: Language Adapter for MAD-X² Setup
|
10 |
+
This adapter is part of the M2QA publication to achieve language and domain transfer via adapters.
|
11 |
+
📃 Paper: [TODO](TODO)
|
12 |
+
🏗️ GitHub repo: [https://github.com/UKPLab/m2qa](https://github.com/UKPLab/m2qa)
|
13 |
+
💾 Hugging Face Dataset: [https://huggingface.co/UKPLab/m2qa](https://huggingface.co/UKPLab/m2qa)
|
14 |
+
|
15 |
+
**Important:** This adapter only works together with the MAD-X-2 domain and QA head adapter.
|
16 |
+
|
17 |
+
This [adapter](https://adapterhub.ml) for the `xlm-roberta-base` model that was trained using the **[Adapters](https://github.com/Adapter-Hub/adapters)** library. For detailed training details see our paper or GitHub repository: [https://github.com/UKPLab/m2qa](https://github.com/UKPLab/m2qa). You can find the evaluation results for this adapter on the M2QA dataset in the GitHub repo and in the paper.
|
18 |
+
|
19 |
+
|
20 |
+
## Usage
|
21 |
+
|
22 |
+
First, install `adapters`:
|
23 |
+
|
24 |
+
```
|
25 |
+
pip install -U adapters
|
26 |
+
```
|
27 |
+
|
28 |
+
Now, the adapter can be loaded and activated like this:
|
29 |
+
|
30 |
+
```python
|
31 |
+
from adapters import AutoAdapterModel
|
32 |
+
from adapters.composition import Stack
|
33 |
+
|
34 |
+
model = AutoAdapterModel.from_pretrained("xlm-roberta-base")
|
35 |
+
|
36 |
+
# 1. Load language adapter
|
37 |
+
language_adapter_name = model.load_adapter("AdapterHub/m2qa-xlm-roberta-base-mad-x-2-chinese")
|
38 |
+
|
39 |
+
# 2. Load domain adapter
|
40 |
+
domain_adapter_name = model.load_adapter("AdapterHub/m2qa-xlm-roberta-base-mad-x-2-creative-writing")
|
41 |
+
|
42 |
+
# 3. Load QA head adapter
|
43 |
+
qa_adapter_name = model.load_adapter("AdapterHub/m2qa-xlm-roberta-base-mad-x-2-qa-head")
|
44 |
+
|
45 |
+
# 4. Activate them via the adapter stack
|
46 |
+
model.active_adapters = Stack(language_adapter_name, domain_adapter_name, qa_adapter_name)
|
47 |
+
```
|
48 |
+
|
49 |
+
|
50 |
+
See our repository for more information: See https://github.com/UKPLab/m2qa/tree/main/Experiments/mad-x-2
|
51 |
+
|
52 |
+
|
53 |
+
## Contact
|
54 |
+
Leon Engländer:
|
55 |
+
- [HuggingFace Profile](https://huggingface.co/lenglaender)
|
56 |
+
- [GitHub](https://github.com/lenglaender)
|
57 |
+
- [Twitter](https://x.com/LeonEnglaender)
|
58 |
+
|
59 |
+
## Citation
|
60 |
+
|
61 |
+
```
|
62 |
+
@article{englaender-etal-2024-m2qa,
|
63 |
+
title="M2QA: Multi-domain Multilingual Question Answering",
|
64 |
+
author={Engl{"a}nder, Leon and
|
65 |
+
Sterz, Hannah and
|
66 |
+
Poth, Clifton and
|
67 |
+
Pfeiffer, Jonas and
|
68 |
+
Kuznetsov, Ilia and
|
69 |
+
Gurevych, Iryna},
|
70 |
+
journal={arXiv preprint},
|
71 |
+
url={TODO}
|
72 |
+
year="2024"
|
73 |
+
}
|
74 |
+
```
|
adapter_config.json
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"config": {
|
3 |
+
"adapter_residual_before_ln": false,
|
4 |
+
"cross_adapter": false,
|
5 |
+
"factorized_phm_W": true,
|
6 |
+
"factorized_phm_rule": false,
|
7 |
+
"hypercomplex_nonlinearity": "glorot-uniform",
|
8 |
+
"init_weights": "bert",
|
9 |
+
"inv_adapter": null,
|
10 |
+
"inv_adapter_reduction_factor": null,
|
11 |
+
"is_parallel": false,
|
12 |
+
"learn_phm": true,
|
13 |
+
"leave_out": [],
|
14 |
+
"ln_after": false,
|
15 |
+
"ln_before": false,
|
16 |
+
"mh_adapter": false,
|
17 |
+
"non_linearity": "relu",
|
18 |
+
"original_ln_after": true,
|
19 |
+
"original_ln_before": true,
|
20 |
+
"output_adapter": true,
|
21 |
+
"phm_bias": true,
|
22 |
+
"phm_c_init": "normal",
|
23 |
+
"phm_dim": 4,
|
24 |
+
"phm_init_range": 0.0001,
|
25 |
+
"phm_layer": false,
|
26 |
+
"phm_rank": 1,
|
27 |
+
"reduction_factor": 2,
|
28 |
+
"residual_before_ln": true,
|
29 |
+
"scaling": 1.0,
|
30 |
+
"shared_W_phm": false,
|
31 |
+
"shared_phm_rule": true,
|
32 |
+
"use_gating": false
|
33 |
+
},
|
34 |
+
"hidden_size": 768,
|
35 |
+
"model_class": "XLMRobertaAdapterModel",
|
36 |
+
"model_name": "xlm-roberta-base",
|
37 |
+
"model_type": "xlm-roberta",
|
38 |
+
"name": "mad-x-2 chinese",
|
39 |
+
"version": "3.2.1"
|
40 |
+
}
|
pytorch_adapter.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:432847a4982680a0f195d9c1b2bf4de9363341418aae3024f91409e9c9c623cc
|
3 |
+
size 28383781
|