英文摘要生成bart-large-cnn 很强
Published on Aug. 22, 2023, 12:11 p.m.
CNN Daily Mail训练的摘要模型权重
BART (large-sized model), fine-tuned on CNN Daily Mail
BART model pre-trained on English language, and fine-tuned on CNN Daily Mail. It was introduced in the paper BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension by Lewis et al. and first released in [this repository (https://github.com/pytorch/fairseq/tree/master/examples/bart).
bart模型在摘要任务上的表现一直不错,这里有官方给的示例。
from transformers import pipeline
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
ARTICLE = """ New York (CNN)When Liana Barrientos was 23 years old, she got married in Westchester County, New York.
A year later, she got married again in Westchester County, but to a different man and without divorcing her first husband.
Only 18 days after that marriage, she got hitched yet again. Then, Barrientos declared "I do" five more times, sometimes only within two weeks of each other.
In 2010, she married once more, this time in the Bronx. In an application for a marriage license, she stated it was her "first and only" marriage.
Barrientos, now 39, is facing two criminal counts of "offering a false instrument for filing in the first degree," referring to her false statements on the
2010 marriage license application, according to court documents.
Prosecutors said the marriages were part of an immigration scam.
On Friday, she pleaded not guilty at State Supreme Court in the Bronx, according to her attorney, Christopher Wright, who declined to comment further.
After leaving court, Barrientos was arrested and charged with theft of service and criminal trespass for allegedly sneaking into the New York subway through an emergency exit, said Detective
Annette Markowski, a police spokeswoman. In total, Barrientos has been married 10 times, with nine of her marriages occurring between 1999 and 2002.
All occurred either in Westchester County, Long Island, New Jersey or the Bronx. She is believed to still be married to four men, and at one time, she was married to eight men at once, prosecutors say.
Prosecutors said the immigration scam involved some of her husbands, who filed for permanent residence status shortly after the marriages.
Any divorces happened only after such filings were approved. It was unclear whether any of the men will be prosecuted.
The case was referred to the Bronx District Attorney\'s Office by Immigration and Customs Enforcement and the Department of Homeland Security\'s
Investigation Division. Seven of the men are from so-called "red-flagged" countries, including Egypt, Turkey, Georgia, Pakistan and Mali.
Her eighth husband, Rashid Rajput, was deported in 2006 to his native Pakistan after an investigation by the Joint Terrorism Task Force.
If convicted, Barrientos faces up to four years in prison. Her next court appearance is scheduled for May 18.
"""
print(summarizer(ARTICLE, max_length=130, min_length=30, do_sample=False))
>>> [{'summary_text': 'Liana Barrientos, 39, is charged with two counts of "offering a false instrument for filing in the first degree" In total, she has been married 10 times, with nine of her marriages occurring between 1999 and 2002. She is believed to still be married to four men.'}]
from transformers import pipeline
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
ARTICLE = """
Key Features
Digital Noise Cancelling with HD Noise Cancelling Processor QN1e and Dual Noise Sensor Technology
Truly wireless design with BLUETOOTH wireless technology
Up to 24 hours of battery life for all-day listening
The Quick Attention function lets you chat easily without removing your headphones
Modern classic design sits securely in your ears
Driver unit: 6mm, dome type (CCAW Voice coil)
Frequency Response (Bluetooth Communication): 20Hz - 20,000Hz
"""
print(summarizer(ARTICLE, max_length=80, min_length=30, do_sample=False))
>>> [{'summary_text': 'Bluetooth wireless design with BLUETOOTH wireless technology. Up to 24 hours of battery life for all-day listening. Quick Attention function lets you chat easily without removing your headphones.'}]
另外还找了些自己的数据测试,在可读性和重要性上都不错。不得不说英文数据集真的是好,只要是有数据集和算力,深度学习的想象空间基本是无止境的。
如果把这些用在内容生成上,谷歌会不会将内容判断为低质量呢?如果不的话,对于高搜索引擎优化的来说无疑是巨大的利好。
另外一个使用xsum训练的也不错
https://huggingface.co/facebook/bart-large-xsum