Initial version.
Browse files- README.md +62 -0
- adapter_config.json +23 -0
- head_config.json +20 -0
- pytorch_adapter.bin +3 -0
- pytorch_model_head.bin +3 -0
README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- roberta
|
4 |
+
- adapter-transformers
|
5 |
+
datasets:
|
6 |
+
- snli
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
---
|
10 |
+
|
11 |
+
# Adapter `AdapterHub/roberta-base-pf-snli` for roberta-base
|
12 |
+
|
13 |
+
An [adapter](https://adapterhub.ml) for the `roberta-base` model that was trained on the [snli](https://huggingface.co/datasets/snli/) dataset and includes a prediction head for classification.
|
14 |
+
|
15 |
+
This adapter was created for usage with the **[adapter-transformers](https://github.com/Adapter-Hub/adapter-transformers)** library.
|
16 |
+
|
17 |
+
## Usage
|
18 |
+
|
19 |
+
First, install `adapter-transformers`:
|
20 |
+
|
21 |
+
```
|
22 |
+
pip install -U adapter-transformers
|
23 |
+
```
|
24 |
+
_Note: adapter-transformers is a fork of transformers that acts as a drop-in replacement with adapter support. [More](https://docs.adapterhub.ml/installation.html)_
|
25 |
+
|
26 |
+
Now, the adapter can be loaded and activated like this:
|
27 |
+
|
28 |
+
```python
|
29 |
+
from transformers import AutoModelWithHeads
|
30 |
+
|
31 |
+
model = AutoModelWithHeads.from_pretrained("roberta-base")
|
32 |
+
adapter_name = model.load_adapter("AdapterHub/roberta-base-pf-snli", source="hf")
|
33 |
+
model.active_adapters = adapter_name
|
34 |
+
```
|
35 |
+
|
36 |
+
## Architecture & Training
|
37 |
+
|
38 |
+
The training code for this adapter is available at https://github.com/adapter-hub/efficient-task-transfer.
|
39 |
+
In particular, training configurations for all tasks can be found [here](https://github.com/adapter-hub/efficient-task-transfer/tree/master/run_configs).
|
40 |
+
|
41 |
+
|
42 |
+
## Evaluation results
|
43 |
+
|
44 |
+
Refer to [the paper](https://arxiv.org/pdf/2104.08247) for more information on results.
|
45 |
+
|
46 |
+
## Citation
|
47 |
+
|
48 |
+
If you use this adapter, please cite our paper ["What to Pre-Train on? Efficient Intermediate Task Selection"](https://arxiv.org/pdf/2104.08247):
|
49 |
+
|
50 |
+
```bibtex
|
51 |
+
@inproceedings{poth-etal-2021-what-to-pre-train-on,
|
52 |
+
title={What to Pre-Train on? Efficient Intermediate Task Selection},
|
53 |
+
author={Clifton Poth and Jonas Pfeiffer and Andreas Rücklé and Iryna Gurevych},
|
54 |
+
booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
|
55 |
+
month = nov,
|
56 |
+
year = "2021",
|
57 |
+
address = "Online",
|
58 |
+
publisher = "Association for Computational Linguistics",
|
59 |
+
url = "https://arxiv.org/abs/2104.08247",
|
60 |
+
pages = "to appear",
|
61 |
+
}
|
62 |
+
```
|
adapter_config.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"config": {
|
3 |
+
"adapter_residual_before_ln": false,
|
4 |
+
"cross_adapter": false,
|
5 |
+
"inv_adapter": null,
|
6 |
+
"inv_adapter_reduction_factor": null,
|
7 |
+
"leave_out": [],
|
8 |
+
"ln_after": false,
|
9 |
+
"ln_before": false,
|
10 |
+
"mh_adapter": false,
|
11 |
+
"non_linearity": "relu",
|
12 |
+
"original_ln_after": true,
|
13 |
+
"original_ln_before": true,
|
14 |
+
"output_adapter": true,
|
15 |
+
"reduction_factor": 16,
|
16 |
+
"residual_before_ln": true
|
17 |
+
},
|
18 |
+
"hidden_size": 768,
|
19 |
+
"model_class": "RobertaModelWithHeads",
|
20 |
+
"model_name": "roberta-base",
|
21 |
+
"model_type": "roberta",
|
22 |
+
"name": "snli"
|
23 |
+
}
|
head_config.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"config": {
|
3 |
+
"activation_function": "tanh",
|
4 |
+
"bias": true,
|
5 |
+
"head_type": "classification",
|
6 |
+
"label2id": {
|
7 |
+
"LABEL_0": 0,
|
8 |
+
"LABEL_1": 1,
|
9 |
+
"LABEL_2": 2
|
10 |
+
},
|
11 |
+
"layers": 2,
|
12 |
+
"num_labels": 3,
|
13 |
+
"use_pooler": false
|
14 |
+
},
|
15 |
+
"hidden_size": 768,
|
16 |
+
"model_class": "RobertaModelWithHeads",
|
17 |
+
"model_name": "roberta-base",
|
18 |
+
"model_type": "roberta",
|
19 |
+
"name": "snli"
|
20 |
+
}
|
pytorch_adapter.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2d705a55272354cf5e71f700bb4232533c8aaf43450b314eccabee239e1b079a
|
3 |
+
size 3594735
|
pytorch_model_head.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:930a7f89230b47739e126d34634f047e2ac4ef537b972ec6bd1dd6b3e477e1aa
|
3 |
+
size 2373247
|