Views
No views yet
| Parameter | Value |
|---|---|
| Base model | roberta-base |
| Dataset | GoEmotions (43,410 train / 5,426 val / 5,427 test) |
| Loss function | Clipped Asymmetric Loss (γ_pos=1, γ_neg=3, clip=0.04) |
| Learning rate | 2e-5 |
| Batch size | 32 |
| Best epoch | 3 |
| Threshold | 0.5 |
| Metric | Value |
|---|---|
| Macro-F1 | 0.5335 |
| Micro-F1 | 0.5912 |
| Precision | 0.5101 |
| Recall | 0.5752 |
| Zero-F1 classes | 0 |
| Grief F1 | 0.5333 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4LABELS = [
5 "admiration", "amusement", "anger", "annoyance", "approval",
6 "caring", "confusion", "curiosity", "desire", "disappointment",
7 "disapproval", "disgust", "embarrassment", "excitement", "fear",
8 "gratitude", "grief", "joy", "love", "nervousness",
9 "optimism", "pride", "realization", "relief", "remorse",
10 "sadness", "surprise", "neutral"
11]
12
13tokenizer = AutoTokenizer.from_pretrained("hoorSobh/roberta-goemotions-ablation4-asl")
14model = AutoModelForSequenceClassification.from_pretrained(
15 "hoorSobh/roberta-goemotions-ablation4-asl",
16 num_labels=28,
17 problem_type="multi_label_classification"
18)
19model.eval()
20
21text = "I finally understood how recursion works — this is so satisfying!"
22inputs = tokenizer(text, return_tensors="pt", max_length=128, truncation=True)
23with torch.no_grad():
24 logits = model(**inputs).logits
25probs = torch.sigmoid(logits).squeeze()
26top1 = LABELS[probs.argmax().item()]
27print(f"Dominant emotion: {top1}")