midav commited on
Commit
aaf6a33
1 Parent(s): 6587ae8

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ inference: false
3
+ tags:
4
+ - onnx
5
+ - adapterhub:rc/race
6
+ - bert
7
+ - adapter-transformers
8
+ datasets:
9
+ - race
10
+ language:
11
+ - en
12
+ ---
13
+
14
+ # ONNX export of Adapter `AdapterHub/bert-base-uncased-pf-race` for bert-base-uncased
15
+ ## Conversion of [AdapterHub/bert-base-uncased-pf-race](https://huggingface.co/AdapterHub/bert-base-uncased-pf-race) for UKP SQuARE
16
+
17
+
18
+ ## Usage
19
+ ```python
20
+ onnx_path = hf_hub_download(repo_id='UKP-SQuARE/bert-base-uncased-pf-race-onnx', filename='model.onnx') # or model_quant.onnx for quantization
21
+ onnx_model = InferenceSession(onnx_path, providers=['CPUExecutionProvider'])
22
+
23
+ context = 'ONNX is an open format to represent models. The benefits of using ONNX include interoperability of frameworks and hardware optimization.'
24
+ question = 'What are advantages of ONNX?'
25
+ choices = ["Cat", "Horse", "Tiger", "Fish"]tokenizer = AutoTokenizer.from_pretrained('UKP-SQuARE/bert-base-uncased-pf-race-onnx')
26
+
27
+ raw_input = [[context, question + + choice] for choice in choices]
28
+ inputs = tokenizer(raw_input, padding=True, truncation=True, return_tensors="np")
29
+ inputs['token_type_ids'] = np.expand_dims(inputs['token_type_ids'], axis=0)
30
+ inputs['input_ids'] = np.expand_dims(inputs['input_ids'], axis=0)
31
+ inputs['attention_mask'] = np.expand_dims(inputs['attention_mask'], axis=0)
32
+ outputs = onnx_model.run(input_feed=dict(inputs), output_names=None)
33
+ ```
34
+
35
+ ## Architecture & Training
36
+
37
+ The training code for this adapter is available at https://github.com/adapter-hub/efficient-task-transfer.
38
+ In particular, training configurations for all tasks can be found [here](https://github.com/adapter-hub/efficient-task-transfer/tree/master/run_configs).
39
+
40
+
41
+ ## Evaluation results
42
+
43
+ Refer to [the paper](https://arxiv.org/pdf/2104.08247) for more information on results.
44
+
45
+ ## Citation
46
+
47
+ If you use this adapter, please cite our paper ["What to Pre-Train on? Efficient Intermediate Task Selection"](https://arxiv.org/pdf/2104.08247):
48
+
49
+ ```bibtex
50
+ @inproceedings{poth-etal-2021-what-to-pre-train-on,
51
+ title={What to Pre-Train on? Efficient Intermediate Task Selection},
52
+ author={Clifton Poth and Jonas Pfeiffer and Andreas Rücklé and Iryna Gurevych},
53
+ booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
54
+ month = nov,
55
+ year = "2021",
56
+ address = "Online",
57
+ publisher = "Association for Computational Linguistics",
58
+ url = "https://arxiv.org/abs/2104.08247",
59
+ pages = "to appear",
60
+ }
61
+ ```