Downloads · 30 days
2
9% of all-time downloads
kumo24/bert-sentiment
bert-sentiment is a machine learning model from kumo24. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This BERT was fined-tuned on +672k tweets from twitter/X. The classification accuracy obtained is 98%. \ The number of labels is 3: {0: Negative, 1: Neutral, 2: Positive}
Downloads · 30 days
2
9% of all-time downloads
All-time downloads
22
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This BERT was fined-tuned on +672k tweets from twitter/X. The classification accuracy obtained is 98%.
The number of labels is 3: {0: Negative, 1: Neutral, 2: Positive}
This is an example to use it
from transformers import AutoTokenizer
from transformers import pipeline
from transformers import AutoModelForSequenceClassification
import torch
checkpoint = 'kumo24/bert-sentiment'
tokenizer=AutoTokenizer.from_pretrained(checkpoint)
id2label = {0: "negative", 1: "neutral", 2: "positive"}
label2id = {"negative": 0, "neutral": 1, "positive": 2}
if tokenizer.pad_token is None:
tokenizer.add_special_tokens({'pad_token': '[PAD]'})
model = AutoModelForSequenceClassification.from_pretrained(checkpoint,
num_labels=3,
id2label=id2label,
label2id=label2id)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
sentiment_task = pipeline("sentiment-analysis",
model=model,
tokenizer=tokenizer,
device =device)
print(sentiment_task("Michigan Wolverines are Champions, Go Blue!"))