🚀 t5-small-finetuned-summarization-xsum
このモデルは、xsumデータセットで微調整されたt5-smallのバージョンです。非常に高速で軽量で、1秒未満で全文を要約することができ、低リソースでの使用にも適しています。
🚀 クイックスタート
このモデルは、xsumデータセットで微調整されたt5-smallモデルです。非常に高速で軽量で、1秒未満で全文を要約することができます。
モデルのデモ
https://huggingface.co/spaces/Rahmat82/RHM-text-summarizer-light
評価セットでの結果は以下の通りです。
- 損失: 2.2425
- Rouge1: 31.3222
- Rouge2: 10.0614
- Rougel: 25.0513
- Rougelsum: 25.0446
- 生成長: 18.8044
✨ 主な機能
- 高速かつ軽量な要約モデルで、GPUまたはCPUでも1秒未満で要約が可能。
- optimumを使用すると、さらに高速化が期待できます。
📦 インストール
必要なライブラリをインストールします。
💻 使用例
基本的な使用法
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
model_id = "Rahmat82/t5-small-finetuned-summarization-xsum"
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=True)
summarizer = pipeline("summarization",model = model, tokenizer=tokenizer)
text_to_summarize = """
The koala is regarded as the epitome of cuddliness. However, animal lovers
will be saddened to hear that this lovable marsupial has been moved to the
endangered species list. The Australian Koala Foundation estimates there are
somewhere between 43,000-100,000 koalas left in the wild. Their numbers have
been dwindling rapidly due to disease, loss of habitat, bushfires, being hit
by cars, and other threats. Stuart Blanch from the World Wildlife Fund in
Australia said: "Koalas have gone from no listing to vulnerable to endangered
within a decade. That is a shockingly fast decline." He added that koalas risk
"sliding toward extinction"
"""
print(summarizer(text_to_summarize)[0]["summary_text"])
高度な使用法
optimum/onnxruntimeを使用した超高速な要約方法です。
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
from optimum.pipelines import pipeline
import accelerate
model_name = "Rahmat82/t5-small-finetuned-summarization-xsum"
model = ORTModelForSeq2SeqLM.from_pretrained(model_name, export=True)
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer,
device_map="auto", batch_size=12)
text_to_summarize = """
The koala is regarded as the epitome of cuddliness. However, animal lovers
will be saddened to hear that this lovable marsupial has been moved to the
endangered species list. The Australian Koala Foundation estimates there are
somewhere between 43,000-100,000 koalas left in the wild. Their numbers have
been dwindling rapidly due to disease, loss of habitat, bushfires, being hit
by cars, and other threats. Stuart Blanch from the World Wildlife Fund in
Australia said: "Koalas have gone from no listing to vulnerable to endangered
within a decade. That is a shockingly fast decline." He added that koalas risk
"sliding toward extinction"
"""
print(summarizer(text_to_summarize)[0]["summary_text"])
📚 ドキュメント
学習ハイパーパラメータ
学習時に使用されたハイパーパラメータは以下の通りです。
- 学習率: 0.0002
- 学習バッチサイズ: 28
- 評価バッチサイズ: 28
- シード: 42
- オプティマイザ: Adam (betas=(0.9,0.999), epsilon=1e-08)
- 学習率スケジューラーのタイプ: 線形
- エポック数: 2
- 混合精度学習: Native AMP
学習結果
学習損失 |
エポック |
ステップ |
検証損失 |
Rouge1 |
Rouge2 |
Rougel |
Rougelsum |
生成長 |
2.5078 |
1.0 |
7288 |
2.2860 |
30.9087 |
9.7673 |
24.6951 |
24.6927 |
18.7973 |
2.4245 |
2.0 |
14576 |
2.2425 |
31.3222 |
10.0614 |
25.0513 |
25.0446 |
18.8044 |
フレームワークのバージョン
- Transformers 4.37.0
- Pytorch 2.1.2
- Datasets 2.1.0
- Tokenizers 0.15.1
📄 ライセンス
このモデルは、Apache-2.0ライセンスの下で提供されています。