Downloads · 30 days
60
44% of all-time downloads
Fynman-stack/raven-emotion-distilbert
raven-emotion-distilbert is a text classification model from Fynman-stack. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
A fine-tuned DistilBERT model for 6-class emotion classification, built for Raven AI — an emotionally aware AI assistant.
Downloads · 30 days
60
44% of all-time downloads
All-time downloads
136
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
A fine-tuned DistilBERT model for 6-class emotion classification, built for Raven AI — an emotionally aware AI assistant.
This model classifies text into 6 emotions: happy, sad, anxious, angry, confused, neutral.
| Model / Method | Dataset | Accuracy | F1 Score |
|---|---|---|---|
| Zero-Shot LLM (LLama 3.3 70B) | GoEmotions | 66.67% | 0.6691 |
| Few-Shot LLM (LLama 3.3 70B) | GoEmotions | 73.00% | 0.7331 |
| This model (initial training) | GoEmotions | 77.33% | 0.7724 |
| This model (after domain adaptation) | Custom Dataset | 97.62% | 0.9762 |
Key result: This 67M parameter model outperforms a 70B parameter LLM by +4.33% on emotion classification, proving that task-specific fine-tuning beats general-purpose prompting.
from transformers import pipeline
classifier = pipeline("text-classification", model="Fynman-stack/raven-emotion-distilbert", top_k=None)
result = classifier("I'm so stressed about my exam tomorrow")
print(result)
# [[{'label': 'anxious', 'score': 0.95}, {'label': 'sad', 'score': 0.02}, ...]]
Or load the model directly:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("Fynman-stack/raven-emotion-distilbert")
model = AutoModelForSequenceClassification.from_pretrained("Fynman-stack/raven-emotion-distilbert")
EMOTIONS = ["happy", "sad", "anxious", "angry", "confused", "neutral"]
def detect_emotion(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128, padding=True)
with torch.no_grad():
outputs = model(**inputs)
return EMOTIONS[torch.argmax(outputs.logits, dim=1).item()]
print(detect_emotion("I just cleared my exam!")) # happy
print(detect_emotion("I'm furious at this situation")) # angry
| ID | Label | Description |
|---|---|---|
| 0 | happy | Joy, excitement, gratitude, love, pride, amusement |
| 1 | sad | Sadness, grief, disappointment, remorse |
| 2 | anxious | Fear, nervousness, worry, stress |
| 3 | angry | Anger, annoyance, frustration, disgust |
| 4 | confused | Confusion, surprise, curiosity, realization |
| 5 | neutral | Neutral, calm, indifferent |
distilbert-base-uncased (67M parameters)| Epoch | Train Loss | Val Accuracy | Val F1 |
|---|---|---|---|
| 1 | 1.1599 | 66.93% | 0.6671 |
| 2 | 0.8031 | 67.37% | 0.6737 |
| 3 | 0.6494 | 67.64% | 0.6747 |
The model was further trained on ~12,343 samples of Indian English, Hinglish (Hindi-English), American English, and British English conversational text to adapt it for real-world student conversations.
| Epoch | Train Loss | Val Accuracy | Val F1 |
|---|---|---|---|
| 1 | 0.6765 | 90.99% | 0.9093 |
| 2 | 0.2549 | 93.15% | 0.9311 |
| 3 | 0.1625 | 94.08% | 0.9406 |
| 4 | 0.1147 | 94.46% | 0.9444 |
| 5 | 0.0940 | 94.65% | 0.9463 |
Domain adaptation impact: Accuracy jumped from 64.38% to 97.62% (+33.24%) on the target domain.
The original 28 GoEmotions labels were mapped to 6 categories:
| Raven Label | GoEmotions Labels |
|---|---|
happy | joy, amusement, excitement, gratitude, love, optimism, pride, relief, admiration, approval, caring |
sad | sadness, grief, disappointment, remorse, embarrassment |
anxious | fear, nervousness |
angry | anger, annoyance, disgust |
confused | confusion, surprise, realization, curiosity |
neutral | neutral, desire |
This model powers Raven AI, an emotionally aware AI assistant that adapts its tone, persona, and response style based on detected user emotion. Raven includes crisis detection, multi-chat management, image understanding, voice input, document processing, and 20+ other features.
@misc{raha2026raven,
title={Raven AI: An Emotionally Aware AI Assistant with Fine-tuned DistilBERT},
author={Soumyadip Raha},
year={2026},
url={https://huggingface.co/Fynman-stack/raven-emotion-distilbert}
}
MIT