🚀 ニュース記事のテキスト要約
最新の軽量事前学習済みTransformerベースのエンコーダ・デコーダモデルで、テキスト要約を行います。
このモデルは、入力長 = 512、出力長 = 150 のCNN-DailyMailニュースデータセットで学習されています。
🚀 クイックスタート
このモデルは、ニュース記事のテキスト要約に最適化された軽量の事前学習済みTransformerベースのエンコーダ・デコーダモデルです。CNN-DailyMailニュースデータセットで学習されています。
📦 インストール
このモデルはHugging FaceのTransformersライブラリを使用しています。以下のコマンドでインストールできます。
pip install transformers
💻 使用例
基本的な使用法
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("minhtoan/t5-finetune-cnndaily-news")
model = AutoModelForSeq2SeqLM.from_pretrained("minhtoan/t5-finetune-cnndaily-news")
model.cuda()
src = "summarize: Ever noticed how plane seats appear to be getting smaller and smaller? With increasing numbers of people taking to the skies, some experts are questioning if having such packed out planes is putting passengers at risk. They say that the shrinking space on aeroplanes is not only uncomfortable - it's putting our health and safety in danger. More than squabbling over the arm rest, shrinking space on planes putting our health and safety in danger? This week, a U.S consumer advisory group set up by the Department of Transportation said at a public hearing that while the government is happy to set standards for animals flying on planes, it doesn't stipulate a minimum amount of space for humans. 'In a world where animals have more rights to space and food than humans,' said Charlie Leocha, consumer representative on the committee.\xa0'It is time that the DOT and FAA take a stand for humane treatment of passengers.' But could crowding on planes lead to more serious issues than fighting for space in the overhead lockers, crashing elbows and seat back kicking? Tests conducted by the FAA use planes with a 31 inch pitch, a standard which on some airlines has decreased . Many economy seats on United Airlines have 30 inches of room, while some airlines offer as little as 28 inches . Cynthia Corbertt, a human factors researcher with the Federal Aviation Administration, that it conducts tests on how quickly passengers can leave a plane. But these tests are conducted using planes with 31 inches between each row of seats, a standard which on some airlines has decreased, reported the Detroit News. The distance between two seats from one point on a seat to the same point on the seat behind it is known as the pitch. While most airlines stick to a pitch of 31 inches or above, some fall below this. While United Airlines has 30 inches of space, Gulf Air economy seats have between 29 and 32 inches, Air Asia offers 29 inches and Spirit Airlines offers just 28 inches. British Airways has a seat pitch of 31 inches, while easyJet has 29 inches, Thomson's short haul seat pitch is 28 inches, and Virgin Atlantic's is 30-31."
tokenized_text = tokenizer.encode(src, return_tensors="pt").cuda()
model.eval()
summary_ids = model.generate(tokenized_text, max_length=150)
output = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
output
📚 ドキュメント
入力形式
モデルの入力は、接頭辞 summarize:
と要約するテキストを結合したものです。
推論パラメータ
推論時には、max_length
パラメータを設定して、要約の最大長を指定できます。
| プロパティ | 詳細 |
|----------|---------|
| モデルタイプ | 事前学習済みTransformerベースのエンコーダ・デコーダモデル |
| 学習データ | CNN-DailyMailニュースデータセット |
📄 ライセンス
このモデルはMITライセンスの下で提供されています。
👨💻 作者
Phan Minh Toan