wrime-sentiment-analyzer

モデルについて

このモデルは、日本語の文章に対して −1 (ネガティブ) 〜 +1 (ポジティブ) の感情スコアを予測する回帰モデルです。

tohoku-nlp/bert-base-japanese-v3をベースに、WRIME v2 データセットの読者の平均感情スコア(avg_readers.sentiment) を用いてファインチューニングしています。

使用方法

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

model_id = "katsutaku/wrime-sentiment-analyzer"
tokenizer = AutoTokenizer.from_pretrained(model_id)
# trust_remote_code=True は必須.モデルが独自のクラス(TanhBertRegressor)を使用
model = AutoModelForSequenceClassification.from_pretrained(model_id, trust_remote_code=True)
model.to(device)
model.eval()

text = "とても助かりました、ありがとうございます!"

inputs = tokenizer(text, return_tensors="pt", 
                   truncation=True, 
                   max_length=512) 
inputs.to(device)

with torch.no_grad():
    outputs = model(**inputs)

score = outputs.logits.squeeze().item()
Downloads last month
101
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for katsutaku/wrime-sentiment-analyzer

Finetuned
(41)
this model

Dataset used to train katsutaku/wrime-sentiment-analyzer