Edit model card

sonoisa/t5-base-japaneseをファインチューニングして、タイトル生成に用いれるようにしたモデルです。

文章を入力すると、生成型要約を行い、タイトルを生成します。

This model is a title generation model which is based on sonoisa/t5-base-japanese.

If you input the text, this model ouput the title of the text.

sonoisa/t5-base-japaneseとは? what is sonoisa/t5-base-japanese?

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 より引用

使い方 how to use

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)
Downloads last month
32
Safetensors
Model size
223M params
Tensor type
F32
·

Dataset used to train Mizuiro-sakura/t5-CAMERA-title-generation