Downloads · 30 days
18
2% of all-time downloads
Mizuiro-sakura/t5-CAMERA-title-generation
t5-CAMERA-title-generation is a text generation model from Mizuiro-sakura. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Downloads · 30 days
18
2% of all-time downloads
All-time downloads
1K
Public
Parameters
223M
3.6 GB on disk
Likes
1
Public
Click a slice to open those files.
.pt1.8 GB · 50%
From the Hugging Face model README
文章を入力すると、生成型要約を行い、タイトルを生成します。
If you input the text, this model ouput the title of the text.
This is a T5 (Text-to-Text Transfer Transformer) model pretrained on Japanese corpus.
次の日本語コーパス(約100GB)を用いて事前学習を行ったT5 (Text-to-Text Transfer Transformer) モデルです。
Wikipediaの日本語ダンプデータ (2020年7月6日時点のもの) OSCARの日本語コーパス CC-100の日本語コーパス このモデルは事前学習のみを行なったものであり、特定のタスクに利用するにはファインチューニングする必要があります。 本モデルにも、大規模コーパスを用いた言語モデルにつきまとう、学習データの内容の偏りに由来する偏った(倫理的ではなかったり、有害だったり、バイアスがあったりする)出力結果になる問題が潜在的にあります。 この問題が発生しうることを想定した上で、被害が発生しない用途にのみ利用するよう気をつけてください。
SentencePieceトークナイザーの学習には上記Wikipediaの全データを用いました。
https://huggingface.co/sonoisa/t5-base-japanese/blob/main/README.md より引用
transformers, datasets, sentencepieceをinstallして、下記のコードを実行してください。 After install transformers, datasets and sentencepiece, please execute this code.
from transformers import T5Tokenizer, T5ForConditionalGeneration
import torch
tokenizer = T5Tokenizer.from_pretrained('sonoisa/t5-base-japanese')
model = T5ForConditionalGeneration.from_pretrained('Mizuiro-sakura/t5-CAMERA-title-generation')
text = "ニューラルネットワークとは人間の脳の神経回路の構造を数学的に表現する手法です。ニューラルネットワークはPythonによって構成されることが多いです。"
max_seq_length=256
token=tokenizer(text,
truncation=True,
max_length=max_seq_length,
padding="max_length")
output=model.generate(input_ids = torch.tensor(token['input_ids']).unsqueeze(0), attention_mask = torch.tensor(token['attention_mask']).unsqueeze(0))
output_decode=tokenizer.decode(output[0], skip_special_tokens=True)
print(output_decode)