This model is a
fine-tuned version of BERT
(
bert-base-uncased
) on the
GoEmotions
dataset for
multi-label emotion classification
. It can predict multiple emotions per input text.
📊 Performance
Metric
Score
Accuracy
46.57%
F1 Score
56.41%
Hamming Loss
3.39%
📂 Model Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "codewithdark/bert-Gomotions"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Emotion labels (adjust based on your dataset)
emotion_labels = [
"Admiration", "Amusement", "Anger", "Annoyance", "Approval", "Caring", "Confusion",
"Curiosity", "Desire", "Disappointment", "Disapproval", "Disgust", "Embarrassment",
"Excitement", "Fear", "Gratitude", "Grief", "Joy", "Love", "Nervousness", "Optimism",
"Pride", "Realization", "Relief", "Remorse", "Sadness", "Surprise", "Neutral"
]
# Example text
text = "I'm so happy today!"
inputs = tokenizer(text, return_tensors="pt")
# Predictwith torch.no_grad():
outputs = model(**inputs)
probs = torch.sigmoid(outputs.logits).squeeze(0) # Convert logits to probabilities# Get top 5 predictions
top5_indices = torch.argsort(probs, descending=True)[:5] # Get indices of top 5 labels
top5_labels = [emotion_labels[i] for i in top5_indices]
top5_probs = [probs[i].item() for i in top5_indices]
# Print resultsprint("Top 5 Predicted Emotions:")
for label, prob inzip(top5_labels, top5_probs):
print(f"{label}: {prob:.4f}")
'''output:Top 5 Predicted Emotions:Joy: 0.9478Love: 0.7854Optimism: 0.6342Admiration: 0.5678Excitement: 0.5231'''
Loss Function:
BCEWithLogitsLoss (Binary Cross-Entropy for multi-label classification)
Batch Size:
16
Epochs:
3
Evaluation Metrics:
Accuracy, F1 Score, Hamming Loss
📌 How to Use in Hugging Face
from transformers import pipeline
classifier = pipeline("text-classification", model="codewithdark/bert-Gomotions", top_k=None)
classifier("I'm so excited about the trip!")
🛠️ Citation
If you use this model, please cite:
@misc{your_model,
author = {codewithdark},
title = {Fine-tuned BERT on GoEmotions},
year = {2025},
url = {https://huggingface.co/codewithdark/bert-Gomotions}
}
Runs of codewithdark bert-Gomotions on huggingface.co
29
Total runs
0
24-hour runs
12
3-day runs
13
7-day runs
-231
30-day runs
More Information About bert-Gomotions huggingface.co Model
bert-Gomotions huggingface.co is an AI model on huggingface.co that provides bert-Gomotions's model effect (), which can be used instantly with this codewithdark bert-Gomotions model. huggingface.co supports a free trial of the bert-Gomotions model, and also provides paid use of the bert-Gomotions. Support call bert-Gomotions model through api, including Node.js, Python, http.
bert-Gomotions huggingface.co is an online trial and call api platform, which integrates bert-Gomotions's modeling effects, including api services, and provides a free online trial of bert-Gomotions, you can try bert-Gomotions online for free by clicking the link below.
codewithdark bert-Gomotions online free url in huggingface.co:
bert-Gomotions is an open source model from GitHub that offers a free installation service, and any user can find bert-Gomotions on GitHub to install. At the same time, huggingface.co provides the effect of bert-Gomotions install, users can directly use bert-Gomotions installed effect in huggingface.co for debugging and trial. It also supports api for free installation.