模型:
此模型在一个新颖的金融新闻数据集上进行了微调,该数据集包含来自 Bloomberg 的2K篇文章,涉及股票、市场、货币、利率和加密货币等主题。
它基于 PEGASUS 模型,特别是在极端摘要(XSum)数据集上微调的PEGASUS: google/pegasus-xsum model 。PEGASUS最初由Jingqing Zhang、Yao Zhao、Mohammad Saleh和Peter J. Liu在 PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization 中提出。
我们提供了一个简单的代码片段,用于在PyTorch中使用此模型进行金融摘要的任务。
from transformers import PegasusTokenizer, PegasusForConditionalGeneration, TFPegasusForConditionalGeneration
# Let's load the model and the tokenizer
model_name = "human-centered-summarization/financial-summarization-pegasus"
tokenizer = PegasusTokenizer.from_pretrained(model_name)
model = PegasusForConditionalGeneration.from_pretrained(model_name) # If you want to use the Tensorflow model
# just replace with TFPegasusForConditionalGeneration
# Some text to summarize here
text_to_summarize = "National Commercial Bank (NCB), Saudi Arabia’s largest lender by assets, agreed to buy rival Samba Financial Group for $15 billion in the biggest banking takeover this year.NCB will pay 28.45 riyals ($7.58) for each Samba share, according to a statement on Sunday, valuing it at about 55.7 billion riyals. NCB will offer 0.739 new shares for each Samba share, at the lower end of the 0.736-0.787 ratio the banks set when they signed an initial framework agreement in June.The offer is a 3.5% premium to Samba’s Oct. 8 closing price of 27.50 riyals and about 24% higher than the level the shares traded at before the talks were made public. Bloomberg News first reported the merger discussions.The new bank will have total assets of more than $220 billion, creating the Gulf region’s third-largest lender. The entity’s $46 billion market capitalization nearly matches that of Qatar National Bank QPSC, which is still the Middle East’s biggest lender with about $268 billion of assets."
# Tokenize our text
# If you want to run the code in Tensorflow, please remember to return the particular tensors as simply as using return_tensors = 'tf'
input_ids = tokenizer(text_to_summarize, return_tensors="pt").input_ids
# Generate the output (Here, we use beam search but you can also use any other strategy you like)
output = model.generate(
input_ids,
max_length=32,
num_beams=5,
early_stopping=True
)
# Finally, we can print the generated summary
print(tokenizer.decode(output[0], skip_special_tokens=True))
# Generated Output: Saudi bank to pay a 3.5% premium to Samba share price. Gulf region’s third-largest lender will have total assets of $220 billion
以下是我们在数据集上微调之前和之后的结果:
| Fine-tuning | R-1 | R-2 | R-L | R-S |
|---|---|---|---|---|
| Yes | 23.55 | 6.99 | 18.14 | 21.36 |
| No | 13.8 | 2.4 | 10.63 | 12.03 |
您可以在以下研讨会论文中找到有关此工作的更多详细信息。如果您在研究中使用了我们的模型,请考虑引用我们的论文:
T. Passali,A. Gidiotis,E. Chatzikyriakidis和G. Tsoumakas。2021。Towards Human-Centered Summarization: A Case Study on Financial News.《Proceedings of the First Workshop on Bridging Human-Computer Interaction and Natural Language Processing》(第21-27页)。计算语言学协会。
BibTeX条目:
@inproceedings{passali-etal-2021-towards,
title = "Towards Human-Centered Summarization: A Case Study on Financial News",
author = "Passali, Tatiana and Gidiotis, Alexios and Chatzikyriakidis, Efstathios and Tsoumakas, Grigorios",
booktitle = "Proceedings of the First Workshop on Bridging Human{--}Computer Interaction and Natural Language Processing",
month = apr,
year = "2021",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/2021.hcinlp-1.4",
pages = "21--27",
}
如果您对模型的更复杂版本感兴趣,即基于更多文章并根据您的需求进行调整,请通过info@medoid.ai与我们联系!
有关Medoid AI的更多信息: