Downloads · 30 days
58
26% of all-time downloads
TomokiFujihara/twhin-bert-base-japanese-offensiveness-estimation
twhin-bert-base-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-base をSNS上のコメントに人手で攻撃性評価を行ったデータセットでFine-tuningすることで作成しました。
Downloads · 30 days
58
26% of all-time downloads
All-time downloads
221
Public
Repo size
1.1 GB
Likes
0
Public
Click a slice to open those files.
.bin1.1 GB · 100%
From the Hugging Face model README
このモデルは、 Twitter/twhin-bert-base をSNS上のコメントに人手で攻撃性評価を行ったデータセットでFine-tuningすることで作成しました。
Summary
| 評価指標 | スコア |
|---|---|
| F値_NOT | 73.8 % |
| F値_GRY | 56.8 % |
| F値_OFF | 63.7 % |
| マクロ平均F値 | 64.7 % |
| 正解率 | 65.6 % |
Confusion matrix
| 正解ラベル \ 予測結果 | Not Offensive | Gray-area | Offensive |
|---|---|---|---|
| Not Offensive | 267 | 73 | 4 |
| Gray-area | 105 | 173 | 42 |
| Offensive | 8 | 43 | 85 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import numpy as np
tokenizer = AutoTokenizer.from_pretrained("Twitter/twhin-bert-base")
model = AutoModelForSequenceClassification.from_pretrained("TomokiFujihara/twhin-bert-base-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]