Downloads · 30 days
20
6% of all-time downloads
jeongyoonhuh/koelectra-emotion-6class
koelectra-emotion-6class is a text classification model from jeongyoonhuh. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
Downloads · 30 days
20
6% of all-time downloads
All-time downloads
355
Public
Parameters
113M
452 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors452 MB · 100%
From the Hugging Face model README
한국어 감정 분류 모델 (6가지 감정)
이 모델은 AI Hub의 공감형 대화 데이터셋을 사용하여 파인튜닝된 한국어 감정 분류 모델입니다.
| Label | Emotion | English |
|---|---|---|
| 0 | 기쁨 | Joy |
| 1 | 슬픔 | Sadness |
| 2 | 분노 | Anger |
| 3 | 불안 | Anxiety |
| 4 | 당황 | Embarrassment |
| 5 | 상처 | Hurt |
| Metric | Score |
|---|---|
| Accuracy | 98.24% |
| F1 Score (weighted) | 98.24% |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "jeongyoonhuh/koelectra-emotion-6class"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "오늘 정말 기분이 좋아요!"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
outputs = model(**inputs)
prediction = torch.argmax(outputs.logits, dim=1).item()
emotions = ['기쁨', '슬픔', '분노', '불안', '당황', '상처']
print(f"Predicted emotion: {emotions[prediction]}")