Downloads · 30 days
3
8% of all-time downloads
ax3lrod/ultra-accurate-emotion-classifier
ultra-accurate-emotion-classifier is a machine learning model from ax3lrod. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model was trained for multi-label emotion classification with 14 emotion categories.
Downloads · 30 days
3
8% of all-time downloads
All-time downloads
36
Public
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.bin514 MB · 99%
From the Hugging Face model README
This model was trained for multi-label emotion classification with 14 emotion categories.
['amusement', 'anger', 'annoyance', 'caring', 'confusion', 'disappointment', 'disgust', 'embarrassment', 'excitement', 'fear', 'gratitude', 'joy', 'love', 'sadness']
from transformers import AutoTokenizer, AutoModel
import torch
import json
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("ax3lrod/ultra-accurate-emotion-classifier")
model = AutoModel.from_pretrained("ax3lrod/ultra-accurate-emotion-classifier", trust_remote_code=True)
# Load thresholds
with open("best_thresholds.json", "r") as f:
thresholds = json.load(f)
# Inference
text = "Your text here"
inputs = tokenizer(text, return_tensors="pt", max_length=128, truncation=True, padding=True)
outputs = model(**inputs)
probabilities = torch.sigmoid(outputs.logits)
# Apply thresholds
predictions = []
for i, prob in enumerate(probabilities[0]):
if prob > thresholds[i]:
predictions.append(i)