efficient-task-transfer

Research code for "What to Pre-Train on? Efficient Intermediate Task Selection", EMNLP 2021

https://github.com/adapter-hub/efficient-task-transfer

Science Score: 41.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.1%) to scientific vocabulary

Keywords

adapters bert nlp roberta transfer-learning transformers
Last synced: 6 months ago · JSON representation ·

Repository

Research code for "What to Pre-Train on? Efficient Intermediate Task Selection", EMNLP 2021

Basic Info
Statistics
  • Stars: 35
  • Watchers: 3
  • Forks: 4
  • Open Issues: 0
  • Releases: 0
Topics
adapters bert nlp roberta transfer-learning transformers
Created over 4 years ago · Last pushed about 4 years ago
Metadata Files
Readme License Citation

README.md

efficient-task-transfer

This repository contains code for the experiments in our paper "What to Pre-Train on? Efficient Intermediate Task Selection". Most importantly, this includes scripts for easy training of Transformers and Adapters across a wide range of NLU tasks.

Overview

The repository is structured as follows: - itrain holds the itrain package which allows easy setup, training and evaluation of Transformers and Adapters - run_configs provides default training configuration of all tasks currently supported by itrain - training_scripts provides scripts for sequential adapter fine-tuning and adapter fusion as used in the paper - task_selection provides scripts used for intermediate task selection in the paper

Setup & Requirements

The code in this repository was developed using Python v3.6.8, PyTorch v1.7.1 and adapter-transformers v1.1.1, which is based on HuggingFace Transformers v3.5.1. Using version different from the ones specified might not work.

After setting up Python and PyTorch (ideally in a virtual environment), all additional requirements together with the itrain package can be installed using: bash pip install -e .

Additional setup steps required for running some scripts are detailed below locations.

Transformer & Adapter Training

The itrain package provides a simple interface for configuring Transformer and Adapter training runs. itrain provides tools for: - downloading and preprocessing datasets via HuggingFace datasets - setting up Transformers and Adapter training - training and evaluating on different tasks - notifying on training start and results via mail or Telegram

itrain can be invoked from the command line by passing a run configuration file in json format. Example configurations for all currently supported tasks can be found in the run_configs folder. All supported configuration keys are defined in arguments.py.

Running a setup from the command line can look like this: bash itrain --id 42 run_configs/sst2.json This will train an adapter on the SST-2 task using robert-base as the base model (as specified in the config file).

Besides modifying configuration keys directly in the json file, they can be overriden using command line parameters. E.g., we can modify the previous training run to fully fine-tune a bert-base-uncased model: bash itrain --id <run_id> \ --model_name_or_path bert-base-uncased \ --train_adapter false \ --learning_rate 3e-5 \ --num_train_epochs 3 \ --patience 0 \ run_configs/<task>.json

Alternatively, training setups can be configured directly in Python by using the Setup class of itrain. An example for this is given in example.py.

Intermediate Task Transfer & Task Selection Experiments

Some scripts that helped running experiments presented in "What to Pre-Train on? Efficient Intermediate Task Selection" are provided: - See training_scripts for details on intermediate task transfer using sequential fine-tuning or adapter fusion - See task_selection for details on intermediate task selection methods.

All these scripts rely on pre-trained models/ adapters as described above and the following additional setup.

Setup

We used a configuration file to specify the pre-trained models/ adapters and tasks to be used as transfer sources and transfer targets for different task transfer strategies and task selection methods. The full configuration as used in the paper is given in task_map.json. It has to be modified to use self-trained models/ adapters: - from and to specify which tasks are used as transfer source and transfer targets (names as defined in run_configs) - source_path_format and target_path_format specify templates for the locations of pre-trained models/ adapters - adapters provides a mapping from pre-trained (source) models/ adapters to run ids

Finally, the path to this task map and the folder holding the run configurations have to be made available to the scripts:

bash export RUN_CONFIG_DIR="/path/to/run_configs" export DEFAULT_TASK_MAP="/path/to/task_map.json"

Credits

Citation & Contact

If you find this repository helpful, please cite our paper "What to Pre-Train on? Efficient Intermediate Task Selection":

bibtex @inproceedings{poth-etal-2021-pre, title = "{W}hat to Pre-Train on? {E}fficient Intermediate Task Selection", author = {Poth, Clifton and Pfeiffer, Jonas and R{\"u}ckl{\'e}, Andreas and Gurevych, Iryna}, booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing", month = nov, year = "2021", address = "Online and Punta Cana, Dominican Republic", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2021.emnlp-main.827", pages = "10585--10605", }

If you have any further questions, please feel free to open an issue or contact us directly.

Contact person: Clifton Poth, calpt@mail.de

Owner

  • Name: AdapterHub
  • Login: adapter-hub
  • Kind: organization
  • Location: Germany

Citation (CITATION.cff)

cff-version: "1.2.0"
message: "If you use this software, please cite it as below."
title: "What to Pre-Train on? Efficient Intermediate Task Selection"
url: "https://github.com/Adapter-Hub/efficient-task-transfer"
authors: 
  - family-names: Poth
    given-names: Clifton
  - family-names: Pfeiffer
    given-names: Jonas
  - family-names: Rücklé
    given-names: Andreas
  - family-names: Gurevych
    given-names: Iryna
preferred-citation:
  type: conference-paper
  authors:
   - family-names: Poth
     given-names: Clifton
   - family-names: Pfeiffer
     given-names: Jonas
   - family-names: Rücklé
     given-names: Andreas
   - family-names: Gurevych
     given-names: Iryna
  journal: "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP)"
  title: "What to Pre-Train on? Efficient Intermediate Task Selection"
  year: 2021
  month: 11
  publisher:
    name: "Association for Computational Linguistics"
  start: 10585
  end: 10605
  url: "https://aclanthology.org/2021.emnlp-main.827"

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 2
  • Total Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
calpt c****t@m****e 2
Committer Domains (Top 20 + Academic)
mail.de: 1

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: about 1 year
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ianupright (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels