Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3tokenizer = AutoTokenizer.from_pretrained("aglazkova/bart_finetuned_keyphrase_extraction")
4model = AutoModelForSeq2SeqLM.from_pretrained("aglazkova/bart_finetuned_keyphrase_extraction")
5
6text = "In this paper, we investigate cross-domain limitations of keyphrase generation using the models for abstractive text summarization.\
7 We present an evaluation of BART fine-tuned for keyphrase generation across three types of texts, \
8 namely scientific texts from computer science and biomedical domains and news texts. \
9 We explore the role of transfer learning between different domains to improve the model performance on small text corpora."
10
11tokenized_text = tokenizer.prepare_seq2seq_batch([text], return_tensors='pt')
12translation = model.generate(**tokenized_text)
13translated_text = tokenizer.batch_decode(translation, skip_special_tokens=True)[0]
14print(translated_text)@InProceedings{10.1007/978-3-031-67826-4_19,
author="Glazkova, Anna
and Morozov, Dmitry",
title="Cross-Domain Robustness of Transformer-Based Keyphrase Generation",
booktitle="Data Analytics and Management in Data Intensive Domains",
year="2024",
publisher="Springer Nature Switzerland",
address="Cham",
pages="249--265"
}