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