Edit model card

Model Card for bart-base-kp20k

This is a BART-base model for keyphrase generation.

Model Details

Model Description

This is a BART-base model for keyphrase generation. We specifically, we fine-tuned bart-base on the KP20k dataset in a ONE2MANY setting, that is, given a source text as input, the task is to generate keyphrases as a single sequence of delimiter-separated phrases. During fine-tuning, gold keyphrases are arranged in the present-absent order which was found to give the best results.

  • Developed by: boudinfl
  • Model type: Language model
  • Language(s) (NLP): en
  • License: apache-2.0
  • Parent Model: bart-base

Usage

from transformers import BartForConditionalGeneration, AutoTokenizer

model = BartForConditionalGeneration.from_pretrained('taln-ls2n/bart-base-kp20k')

tokenizer = AutoTokenizer.from_pretrained('taln-ls2n/bart-base-kp20k')

# inputs are formatted as "title<s>abstract"
input_text = "BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension<s>We present BART, a denoising autoencoder for pretraining sequence-to-sequence models. BART is trained by (1) corrupting text with an arbitrary noising function, and (2) learning a model to reconstruct the original text. It uses a standard Tranformer-based neural machine translation architecture which, despite its simplicity, can be seen as generalizing BERT (due to the bidirectional encoder), GPT (with the left-to-right decoder), and other recent pretraining schemes. We evaluate a number of noising approaches, finding the best performance by both randomly shuffling the order of sentences and using a novel in-filling scheme, where spans of text are replaced with a single mask token. BART is particularly effective when fine tuned for text generation but also works well for comprehension tasks. It matches the performance of RoBERTa on GLUE and SQuAD, and achieves new state-of-the-art results on a range of abstractive dialogue, question answering, and summarization tasks, with gains of up to 3.5 ROUGE. BART also provides a 1.1 BLEU increase over a back-translation system for machine translation, with only target language pretraining. We also replicate other pretraining schemes within the BART framework, to understand their effect on end-task performance."
input_ids = tokenizer(input_text, return_tensors="pt")

outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# denoising;natural language generation;machine translation;machine learning;sequence-to

Bias, Risks, and Limitations

Significant research has explored bias and fairness issues with language models (see, e.g., Sheng et al. (2021) and Bender et al. (2021)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.

Training Details

Training Data

This model was fine-tuned on the training split of the KP20k dataset.

Training Procedure

We fine-tuned bart-base on the training split of the KP20k dataset in a ONE2MANY setting, that is, given a source text as input, the task is to generate keyphrases as a single sequence of delimiter-separated phrases. During fine-tuning, gold keyphrases are arranged in the present-absent order which was found to give the best results. The model is trained for 15 epochs.

Evaluation

We evaluate the performance of this model on the test split of the KP20K dataset in terms of F1F_1 score using exact match between gold and predicted keyphrases. Stemming (Porter stemmer) is applied to reduce the number of mismatches and duplicates are removed. We compute the scores both at the top-k predicted keyphrases with k∈5,10k \in 5, 10, and at the number MM of keyphrases predicted by the models. For F1@kF_1@k scores, if the number of predicted keyphrases is below kk, we append incorrect predictions until it reaches exactly kk keyphrases. We also report scores for present and absent keyphrases separately to get more insights about the extractive and generative capabilities of the model.

Eval F1@MF_1@M F1@5F_1@5 F1@10F_1@10
all 28.7 28.0 25.4
present 37.3 35.5 29.2
absent 2.4 5.9 5.8

Environmental Impact

Experiments were conducted using a private infrastructure, which has a carbon efficiency of 0.432 kgCO2eq/kWh. A cumulative of 63 hours of computation was performed on hardware of type RTX 2080 Ti (TDP of 250W).

Total emissions are estimated to be 6.8 kgCO2eq of which 0 percents were directly offset.

Estimations were conducted using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

Downloads last month
78
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train taln-ls2n/bart-base-kp20k