YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Model Card: Emotion General

Model Overview

Model Name: sdd-emotion-general
Base Model: xlm-roberta-base
Task: Emotion classification (6-class)
Language: Indonesian


Model Description

Fine-tuned XLM-RoBERTa for detecting emotions in Indonesian text.

Emotions:

  • anger (Anger, frustration)
  • fear (Fear, anxiety)
  • happy (Happiness, joy)
  • love (Love, affection)
  • neutral (Neutral tone)
  • sadness (Sadness, grief)

Performance Metrics

Metric Value
Accuracy (EmoT test) 0.7364
Macro F1 0.7423
Latency (mean) 10.5 ms
Model Size 7.5 GB

Usage

Load Model

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_name = "AzrilFahmiardi/sdd-emotion-general"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)

Inference

def detect_emotion(text: str) -> dict:
    inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128).to(device)
    
    with torch.no_grad():
        outputs = model(**inputs)
        logits = outputs.logits
    
    probabilities = torch.softmax(logits, dim=-1)[0].cpu()
    predicted_class = logits.argmax(-1).item()
    predicted_label = model.config.id2label[predicted_class]
    confidence = probabilities[predicted_class].item()
    
    return {
        "emotion": predicted_label,
        "confidence": confidence
    }

# Example
text = "Saya sangat senang bisa bersama keluarga hari ini!"
result = detect_emotion(text)
print(f"Emotion: {result['emotion']} ({result['confidence']:.2%})")

Output Format

{
  "emotion": "happy",
  "confidence": 0.8934
}

Input/Output

Parameter Type Example
Input str Indonesian text, max 128 tokens
Output dict {"emotion": "happy", "confidence": 0.89}
Downloads last month
2
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including AzrilFahmiardi/sdd-emotion-general