Downloads · 30 days
57
12% of all-time downloads
TomokiFujihara/twhin-bert-large-japanese-offensiveness-estimation
twhin-bert-large-japanese-offensiveness-estimation is a text classification model from TomokiFujihara. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
このモデルは、 Twitter/twhin-bert-large をSNS上のコメントに人手で攻撃性評価を行ったデータセットでFine-tuningすることで作成しました。
Downloads · 30 days
57
12% of all-time downloads
All-time downloads
483
Public
Repo size
2.2 GB
Likes
0
Public
Click a slice to open those files.
.bin2.2 GB · 100%
From the Hugging Face model README
このモデルは、 Twitter/twhin-bert-large をSNS上のコメントに人手で攻撃性評価を行ったデータセットでFine-tuningすることで作成しました。
Summary
| 評価指標 | スコア |
|---|---|
| F値_NOT | 75.0 % |
| F値_GRY | 57.3 % |
| F値_OFF | 62.0 % |
| マクロ平均F値 | 64.8 % |
| 正解率 | 66.1 % |
Confusion matrix
| 正解ラベル \ 予測結果 | Not Offensive | Gray-area | Offensive |
|---|---|---|---|
| Not Offensive | 274 | 68 | 2 |
| Gray-area | 106 | 176 | 38 |
| Offensive | 7 | 50 | 79 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import numpy as np
tokenizer = AutoTokenizer.from_pretrained("Twitter/twhin-bert-large")
model = AutoModelForSequenceClassification.from_pretrained("TomokiFujihara/twhin-bert-large-japanese-offensiveness-estimation", trust_remote_code=True)
inputs = tokenizer.encode_plus(text, return_tensors='pt')
outputs = model(inputs['input_ids'], inputs['attention_mask']).detach().numpy()[0][:3]
minimum = np.min(outputs)
if minimum < 0:
outputs = outputs - minimum
score = outputs / np.sum(outputs)
print(f'攻撃的でない発言: {score[0]:.1%},\nグレーゾーンの発言: {score[1]:.1%},\n攻撃的な発言: {score[2]:.1%}')
E-mail: [email protected]