File size: 5,927 Bytes
179ab6b 14b68df 179ab6b 14b68df 179ab6b 14b68df 179ab6b 14b68df 179ab6b 14b68df 179ab6b 14b68df 179ab6b 91e6d8b 179ab6b 14b68df 179ab6b 14b68df 179ab6b 14b68df 179ab6b 14b68df 179ab6b 14b68df 179ab6b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
---
license: apache-2.0
datasets:
- taln-ls2n/kp20k
language:
- en
library_name: transformers
tags:
- keyphrase-generation
---
# Model Card for bart-base-kp20k
<!-- Provide a quick summary of what the model is/does. [Optional] -->
This is a BART-base model for keyphrase generation.
# Model Details
## Model Description
<!-- Provide a longer summary of what this model is/does. -->
This is a BART-base model for keyphrase generation.
We specifically, we fine-tuned [bart-base](https://huggingface.co/facebook/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](https://boudinfl.github.io/)
- **Model type:** Language model
- **Language(s) (NLP):** en
- **License:** apache-2.0
- **Parent Model:** [bart-base](https://huggingface.co/facebook/bart-base)
# Usage
```python
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
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). 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 should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
This model was fine-tuned on the training split of the [KP20k dataset](https://huggingface.co/datasets/taln-ls2n/kp20k).
## Training Procedure
We fine-tuned [bart-base](https://huggingface.co/facebook/bart-base) on the training split of the [KP20k dataset](https://huggingface.co/datasets/taln-ls2n/kp20k) 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 \\(F_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 \in 5, 10\\), and at the number \\(M\\) of keyphrases predicted by the models.
For \\(F_1@k\\) scores, if the number of predicted keyphrases is below \\(k\\), we append incorrect predictions until it reaches exactly \\(k\\) 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 | \\(F_1@M\\) | \\(F_1@5\\) | \\(F_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](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). |