dair-ai/emotion
Viewer • Updated • 437k • 17.9k • 457
How to use neeraj-mO/bert-emotion-finetuned with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="neeraj-mO/bert-emotion-finetuned") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("neeraj-mO/bert-emotion-finetuned")
model = AutoModelForSequenceClassification.from_pretrained("neeraj-mO/bert-emotion-finetuned", device_map="auto")Fine-tuned bert-base-uncased for 6-class emotion classification on the dair-ai/emotion dataset.
bert-base-uncased| Metric | Score |
|---|---|
| Accuracy | 91.75% |
| Weighted F1 | 91.64% |
Evaluated on the validation split after training.
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="neeraj-miniOrange/bert-emotion-finetuned"
)
result = classifier("I am so happy today!")
print(result)
# [{'label': 'joy', 'score': 0.98...}]
| Hyperparameter | Value |
|---|---|
| Epochs | 2 |
| Learning rate | 2e-4 |
| Batch size | 64 |
| Weight decay | 0.01 |
| Optimizer | AdamW |
Data split: 70% train / 20% test / 10% validation (stratified)
If you use this model, please cite the BERT paper:
@article{devlin2019bert,
title={BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding},
author={Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina},
journal={NAACL},
year={2019}
}
Base model
google-bert/bert-base-uncased