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