turboLJY / Transfer-Prompts-for-Text-Generation

16 stars 1 forks source link

Transfer-Prompts-for-Text-Generation

This is the repository for NAACL 2022 paper "Learning to Transfer Prompts for Text Generation". The implementation is completely based on our newly-developed text generation library TextBox 2.0

Prompt Source

The prompt_source.pth in this repository contains the source task prompts (i.e., tensors of shape [200,1024]) trained on 14 datasets as introduced in our paper:

You can also download these datasets here.

Installation

First, you should clone the TextBox repository and follow its instructions.

Then, you may copy the prompt_source.pth into the TextBox folder (i.e., \<your clone dir>/TextBox).

Running PTG based on TextBox

For example, you can conduct our cross-dataset experiments on cnndm dataset using this command:

python run_textbox.py --model=PTG --dataset=cnndm --model_path=facebook/bart-large

In this default case, the source tasks (datasets) is msn, mn, and nr.

You can use --dataset=xxx to specify the dataset name.

In addition, you can also specify the source tasks using --source_task=list_of_task. The default setting is equivalent to --source_task=\[\'msn\',\'mn\',\'nr\'\].

We also provide several cases used in our paper:

Reference

@inproceedings{li-etal-2022-learning-transfer,
    title = "Learning to Transfer Prompts for Text Generation",
    author = "Li, Junyi  and
      Tang, Tianyi  and
      Nie, Jian-Yun  and
      Wen, Ji-Rong  and
      Zhao, Xin",
    booktitle = "Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
    month = jul,
    year = "2022",
    address = "Seattle, United States",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.naacl-main.257",
    doi = "10.18653/v1/2022.naacl-main.257",
    pages = "3506--3518",
}