Downloads · 30 days
14
18% of all-time downloads
SkyAsl/Bert-Emotion_classifier
Bert-Emotion_classifier is a text classification model from SkyAsl. 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.
https://huggingface.co/datasets/dair-ai/emotion
Downloads · 30 days
14
18% of all-time downloads
All-time downloads
80
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
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "SkyAsl/Bert-Emotion_classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "I am so happy to see you!"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
predicted_class = torch.argmax(outputs.logits, dim=1).item()
id2label = {
0: "sadness", 1: "joy", 2: "love",
3: "anger", 4: "fear", 5: "surprise"
}
print("Predicted emotion:", id2label[predicted_class])
https://huggingface.co/datasets/dair-ai/emotion
lr = 2e-4 batch_size = 128 epochs = 5 weight_decay = 0.01
training_loss: 0.106100 validation_loss: 0.143851 accuracy: 0.940000