Mlong T5 Large Sumstew
M
Mlong T5 Large Sumstew
由 Joemgu 开发
这是一个支持多语言、长文本(最高支持16k输入标记)的抽象摘要生成模型。基于sumstew数据集训练,可为给定输入文档生成标题和摘要。
下载量 103
发布时间 : 6/11/2023
模型简介
该模型基于T5架构,专门用于多语言文本摘要生成任务,特别擅长处理长文本输入(最高16k标记)。支持英语、德语、法语、意大利语和西班牙语五种语言,能够同时生成标题和摘要。
模型特点
多语言支持
支持英语、德语、法语、意大利语和西班牙语五种语言的摘要生成
长文本处理能力
最高支持16k输入标记,适合处理长文档摘要任务
标题+摘要联合生成
可同时生成文档标题和摘要,输出格式灵活
预训练+微调架构
基于T5架构,在sumstew数据集上进行了专门微调
模型能力
文本摘要生成
标题生成
多语言文本处理
长文本理解
使用案例
内容摘要
新闻文章摘要
自动生成新闻文章的关键摘要
ROUGE-1得分29.7108(在samsum测试集上)
学术论文摘要
为长篇幅学术论文生成简明摘要
内容管理
文档标题生成
自动为文档生成有意义的标题
🚀 mLong-T5-large-sumstew
mLong-T5-large-sumstew 是一个多语言、长文本(支持最多 16k 输入标记)的抽象摘要模型。该模型在 sumstew 数据集上进行训练,能够为给定的输入文档生成标题和摘要。
🚀 快速开始
✨ 主要特性
- 多语言支持:支持英语、德语、法语、意大利语和西班牙语等多种语言。
- 长文本处理:能够处理最多 16k 输入标记的长文本。
- 生成标题和摘要:可以为输入文档同时生成标题和摘要。
📦 安装指南
文档未提供安装步骤,跳过该章节。
💻 使用示例
基础用法
使用 pipeline
进行摘要生成,这种方式简单易用:
from transformers import pipeline
summarizer = pipeline("summarization", "joemgu/mlong-t5-large-sumstew")
text = "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice 'without pictures or conversations?' So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her. There was nothing so very remarkable in that; nor did Alice think it so very much out of the way to hear the Rabbit say to itself, 'Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually took a watch out of its waistcoat-pocket, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to take out of it, and burning with curiosity, she ran across the field after it, and fortunately was just in time to see it pop down a large rabbit-hole under the hedge. In another moment down went Alice after it, never once considering how in the world she was to get out again."
summary = summarizer(text)[0]["summary_text"]
print(summary)
输出结果:
Title: Alice and the White Rabbit Summary: Alice is a bored and curious girl who follows a White Rabbit with a watch into a rabbit-hole. She enters a strange world where she has many adventures and meets many peculiar creatures.
高级用法
使用 .from_pretrained
方法进行更精细的控制:
from transformers import LongT5ForConditionalGeneration, T5Tokenizer
checkpoint = "joemgu/mlong-t5-large-sumstew"
gen_kwargs = {
"max_length": 1024,
"do_sample": False,
"num_beams": 4, # higher = better, but uses more memory
"use_cache": True, # Set to False if running out of memory, but will be MUCH slower
"early_stopping": True,
"num_return_sequences": 1,
"repetition_penalty": 3.5,
"encoder_repetition_penalty": 2.0,
"length_penalty": 1.0, # higher = longer summaries
"encoder_no_repeat_ngram_size": 4,
"no_repeat_ngram_size": 6,
}
model = LongT5ForConditionalGeneration.from_pretrained(checkpoint)
tokenizer = T5Tokenizer.from_pretrained(checkpoint)
prefix = "Write a title and summarize: "
input_document = "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice 'without pictures or conversations?' So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her. There was nothing so very remarkable in that; nor did Alice think it so very much out of the way to hear the Rabbit say to itself, 'Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually took a watch out of its waistcoat-pocket, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to take out of it, and burning with curiosity, she ran across the field after it, and fortunately was just in time to see it pop down a large rabbit-hole under the hedge. In another moment down went Alice after it, never once considering how in the world she was to get out again."
inputs = tokenizer(prefix + input_document, return_tensors="pt", max_length=16384, truncation=True, add_special_tokens=True)
outputs = model.generate(**inputs, **gen_kwargs)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
在输入文档前添加前缀,根据不同的前缀,输出结果会有所不同:
- 若前缀为
"Summarize: " + INPUT_TEXT
,输出为"Summary: SUMMARY OF INPUT_TEXT"
。 - 若前缀为
"Write a title and summarize: " + INPUT_TEXT
,输出为"Title: TITLE OF INPUT_TEXT Summary: SUMMARY OF INPUT_TEXT"
。
📚 详细文档
属性 | 详情 |
---|---|
模型类型 | 多语言长文本摘要模型 |
训练数据集 | Joemgu/sumstew |
评估指标 | ROUGE |
任务类型 | 摘要生成 |
🔧 技术细节
文档未提供具体的技术实现细节,跳过该章节。
📄 许可证
本项目采用 Apache-2.0 许可证。
Bart Large Cnn
MIT
基于英语语料预训练的BART模型,专门针对CNN每日邮报数据集进行微调,适用于文本摘要任务
文本生成 英语
B
facebook
3.8M
1,364
Parrot Paraphraser On T5
Parrot是一个基于T5的释义框架,专为加速训练自然语言理解(NLU)模型而设计,通过生成高质量释义实现数据增强。
文本生成
Transformers

P
prithivida
910.07k
152
Distilbart Cnn 12 6
Apache-2.0
DistilBART是BART模型的蒸馏版本,专门针对文本摘要任务进行了优化,在保持较高性能的同时显著提升了推理速度。
文本生成 英语
D
sshleifer
783.96k
278
T5 Base Summarization Claim Extractor
基于T5架构的模型,专门用于从摘要文本中提取原子声明,是摘要事实性评估流程的关键组件。
文本生成
Transformers 英语

T
Babelscape
666.36k
9
Unieval Sum
UniEval是一个统一的多维评估器,用于自然语言生成任务的自动评估,支持多个可解释维度的评估。
文本生成
Transformers

U
MingZhong
318.08k
3
Pegasus Paraphrase
Apache-2.0
基于PEGASUS架构微调的文本复述模型,能够生成语义相同但表达不同的句子。
文本生成
Transformers 英语

P
tuner007
209.03k
185
T5 Base Korean Summarization
这是一个基于T5架构的韩语文本摘要模型,专为韩语文本摘要任务设计,通过微调paust/pko-t5-base模型在多个韩语数据集上训练而成。
文本生成
Transformers 韩语

T
eenzeenee
148.32k
25
Pegasus Xsum
PEGASUS是一种基于Transformer的预训练模型,专门用于抽象文本摘要任务。
文本生成 英语
P
google
144.72k
198
Bart Large Cnn Samsum
MIT
基于BART-large架构的对话摘要模型,专为SAMSum语料库微调,适用于生成对话摘要。
文本生成
Transformers 英语

B
philschmid
141.28k
258
Kobart Summarization
MIT
基于KoBART架构的韩语文本摘要模型,能够生成韩语新闻文章的简洁摘要。
文本生成
Transformers 韩语

K
gogamza
119.18k
12
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98