haritzpuerto
commited on
Commit
路
8d073f1
1
Parent(s):
e25d7bf
model upload
Browse files- README.md +62 -0
- config.json +79 -0
- model.onnx +3 -0
- model_quant.onnx +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +14 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
inference: false
|
3 |
+
tags:
|
4 |
+
- onnx
|
5 |
+
- question-answering
|
6 |
+
- bert
|
7 |
+
- adapterhub:qa/squad2
|
8 |
+
- adapter-transformers
|
9 |
+
datasets:
|
10 |
+
- squad_v2
|
11 |
+
language:
|
12 |
+
- en
|
13 |
+
---
|
14 |
+
|
15 |
+
# ONNX export of Adapter `AdapterHub/bert-base-uncased-pf-squad_v2` for bert-base-uncased
|
16 |
+
## Conversion of [AdapterHub/bert-base-uncased-pf-squad_v2](https://huggingface.co/AdapterHub/bert-base-uncased-pf-squad_v2) for UKP SQuARE
|
17 |
+
|
18 |
+
|
19 |
+
## Usage
|
20 |
+
```python
|
21 |
+
onnx_path = hf_hub_download(repo_id='UKP-SQuARE/bert-base-uncased-pf-squad_v2-onnx', filename='model.onnx') # or model_quant.onnx for quantization
|
22 |
+
onnx_model = InferenceSession(onnx_path, providers=['CPUExecutionProvider'])
|
23 |
+
|
24 |
+
context = 'ONNX is an open format to represent models. The benefits of using ONNX include interoperability of frameworks and hardware optimization.'
|
25 |
+
question = 'What are advantages of ONNX?'
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained('UKP-SQuARE/bert-base-uncased-pf-squad_v2-onnx')
|
27 |
+
|
28 |
+
inputs = tokenizer(question, context, padding=True, truncation=True, return_tensors='np')
|
29 |
+
inputs_int64 = {key: np.array(inputs[key], dtype=np.int64) for key in inputs}
|
30 |
+
outputs = onnx_model.run(input_feed=dict(inputs_int64), output_names=None)
|
31 |
+
```
|
32 |
+
|
33 |
+
## Architecture & Training
|
34 |
+
|
35 |
+
The training code for this adapter is available at https://github.com/adapter-hub/efficient-task-transfer.
|
36 |
+
In particular, training configurations for all tasks can be found [here](https://github.com/adapter-hub/efficient-task-transfer/tree/master/run_configs).
|
37 |
+
|
38 |
+
|
39 |
+
## Evaluation results
|
40 |
+
|
41 |
+
Refer to [the paper](https://arxiv.org/pdf/2104.08247) for more information on results.
|
42 |
+
|
43 |
+
## Citation
|
44 |
+
|
45 |
+
If you use this adapter, please cite our paper ["What to Pre-Train on? Efficient Intermediate Task Selection"](https://arxiv.org/pdf/2104.08247):
|
46 |
+
|
47 |
+
```bibtex
|
48 |
+
@inproceedings{poth-etal-2021-pre,
|
49 |
+
title = "{W}hat to Pre-Train on? {E}fficient Intermediate Task Selection",
|
50 |
+
author = {Poth, Clifton and
|
51 |
+
Pfeiffer, Jonas and
|
52 |
+
R{"u}ckl{'e}, Andreas and
|
53 |
+
Gurevych, Iryna},
|
54 |
+
booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing",
|
55 |
+
month = nov,
|
56 |
+
year = "2021",
|
57 |
+
address = "Online and Punta Cana, Dominican Republic",
|
58 |
+
publisher = "Association for Computational Linguistics",
|
59 |
+
url = "https://aclanthology.org/2021.emnlp-main.827",
|
60 |
+
pages = "10585--10605",
|
61 |
+
}
|
62 |
+
```
|
config.json
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "bert-base-uncased",
|
3 |
+
"adapters": {
|
4 |
+
"adapters": {
|
5 |
+
"squad_v2": "9076f36a74755ac4"
|
6 |
+
},
|
7 |
+
"config_map": {
|
8 |
+
"9076f36a74755ac4": {
|
9 |
+
"adapter_residual_before_ln": false,
|
10 |
+
"cross_adapter": false,
|
11 |
+
"factorized_phm_W": true,
|
12 |
+
"factorized_phm_rule": false,
|
13 |
+
"hypercomplex_nonlinearity": "glorot-uniform",
|
14 |
+
"init_weights": "bert",
|
15 |
+
"inv_adapter": null,
|
16 |
+
"inv_adapter_reduction_factor": null,
|
17 |
+
"is_parallel": false,
|
18 |
+
"learn_phm": true,
|
19 |
+
"leave_out": [],
|
20 |
+
"ln_after": false,
|
21 |
+
"ln_before": false,
|
22 |
+
"mh_adapter": false,
|
23 |
+
"non_linearity": "relu",
|
24 |
+
"original_ln_after": true,
|
25 |
+
"original_ln_before": true,
|
26 |
+
"output_adapter": true,
|
27 |
+
"phm_bias": true,
|
28 |
+
"phm_c_init": "normal",
|
29 |
+
"phm_dim": 4,
|
30 |
+
"phm_init_range": 0.0001,
|
31 |
+
"phm_layer": false,
|
32 |
+
"phm_rank": 1,
|
33 |
+
"reduction_factor": 16,
|
34 |
+
"residual_before_ln": true,
|
35 |
+
"scaling": 1.0,
|
36 |
+
"shared_W_phm": false,
|
37 |
+
"shared_phm_rule": true,
|
38 |
+
"use_gating": false
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"fusion_config_map": {},
|
42 |
+
"fusions": {}
|
43 |
+
},
|
44 |
+
"architectures": [
|
45 |
+
"BertModelWithHeads"
|
46 |
+
],
|
47 |
+
"attention_probs_dropout_prob": 0.1,
|
48 |
+
"classifier_dropout": null,
|
49 |
+
"gradient_checkpointing": false,
|
50 |
+
"hidden_act": "gelu",
|
51 |
+
"hidden_dropout_prob": 0.1,
|
52 |
+
"hidden_size": 768,
|
53 |
+
"initializer_range": 0.02,
|
54 |
+
"intermediate_size": 3072,
|
55 |
+
"layer_norm_eps": 1e-12,
|
56 |
+
"max_position_embeddings": 512,
|
57 |
+
"model_type": "bert",
|
58 |
+
"num_attention_heads": 12,
|
59 |
+
"num_hidden_layers": 12,
|
60 |
+
"pad_token_id": 0,
|
61 |
+
"position_embedding_type": "absolute",
|
62 |
+
"prediction_heads": {
|
63 |
+
"squad_v2": {
|
64 |
+
"activation_function": "tanh",
|
65 |
+
"head_type": "question_answering",
|
66 |
+
"label2id": {
|
67 |
+
"LABEL_0": 0,
|
68 |
+
"LABEL_1": 1
|
69 |
+
},
|
70 |
+
"layers": 1,
|
71 |
+
"num_labels": 2
|
72 |
+
}
|
73 |
+
},
|
74 |
+
"torch_dtype": "float32",
|
75 |
+
"transformers_version": "4.21.3",
|
76 |
+
"type_vocab_size": 2,
|
77 |
+
"use_cache": false,
|
78 |
+
"vocab_size": 30522
|
79 |
+
}
|
model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c9945ea827365508fab468c67b88ece7248dd96535ee56cc6ad4eb6f55995e51
|
3 |
+
size 439473675
|
model_quant.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2ea7f0fc981aef2c6ed759555b7b5b6ed7a499cff269fed23640838b738be85c
|
3 |
+
size 110590829
|
special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"mask_token": "[MASK]",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"sep_token": "[SEP]",
|
6 |
+
"unk_token": "[UNK]"
|
7 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"do_lower_case": true,
|
4 |
+
"mask_token": "[MASK]",
|
5 |
+
"model_max_length": 512,
|
6 |
+
"name_or_path": "bert-base-uncased",
|
7 |
+
"pad_token": "[PAD]",
|
8 |
+
"sep_token": "[SEP]",
|
9 |
+
"special_tokens_map_file": null,
|
10 |
+
"strip_accents": null,
|
11 |
+
"tokenize_chinese_chars": true,
|
12 |
+
"tokenizer_class": "BertTokenizer",
|
13 |
+
"unk_token": "[UNK]"
|
14 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|