Downloads · 30 days
1.2K
10% of all-time downloads
Jinuuuu/KoELECTRA_fine_tunning_emotion
KoELECTRA_fine_tunning_emotion is a text classification model from Jinuuuu. 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.
이 모델은 한국어 감정 분류를 위해 KoELECTRA를 파인튜닝한 모델입니다. 6가지 주요 감정(분노, 행복, 불안, 당황, 슬픔, 상처)을 분류할 수 있습니다.
Downloads · 30 days
1.2K
10% of all-time downloads
All-time downloads
12.4K
Public
Parameters
113M
452 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors452 MB · 100%
From the Hugging Face model README
이 모델은 한국어 감정 분류를 위해 KoELECTRA를 파인튜닝한 모델입니다. 6가지 주요 감정(분노, 행복, 불안, 당황, 슬픔, 상처)을 분류할 수 있습니다.
Base Model: KoELECTRA (Korean ELECTRA)
Task: Multi-class Emotion Classification
Language: Korean (한국어)
License: MIT
모델은 다음 6가지 감정을 분류합니다:
| Label | Korean | Description |
|---|---|---|
angry | 분노 | 화남, 짜증, 분개 |
happy | 행복 | 기쁨, 즐거움, 만족 |
anxious | 불안 | 걱정, 근심, 두려움 |
embarrassed | 당황 | 놀람, 혼란, 어리둥절 |
sad | 슬픔 | 우울, 슬픔, 낙담 |
heartache | 상처 | 마음의 아픔, 배신감, 실망 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# 모델과 토크나이저 로드
model_name = "Jinuuuu/KoELECTRA_fine_tunning_emotion"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# 감정 분석 함수
def analyze_emotion(text):
# 토크나이징
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
max_length=512,
padding=True
)
# 예측
with torch.no_grad():
outputs = model(**inputs)
# 확률 계산
probs = torch.softmax(outputs.logits, dim=1)
# 감정 레이블
emotion_labels = ['angry', 'anxious', 'embarrassed', 'happy', 'heartache', 'sad']
# 결과 반환
emotion_probs = {}
for i, label in enumerate(emotion_labels):
emotion_probs[label] = float(probs[0][i])
return emotion_probs
# 사용 예시
text = "오늘은 정말 행복한 하루였다."
result = analyze_emotion(text)
print("감정 분석 결과:")
for emotion, prob in sorted(result.items(), key=lambda x: x[1], reverse=True):
print(f"{emotion}: {prob:.3f}")
from transformers import pipeline
# 파이프라인 생성
classifier = pipeline(
"text-classification",
model="Jinuuuu/KoELECTRA_fine_tunning_emotion",
tokenizer="Jinuuuu/KoELECTRA_fine_tunning_emotion"
)
# 감정 분석
texts = [
"오늘은 정말 행복한 하루였다.",
"너무 화가 나서 참을 수 없다.",
"내일 시험이 걱정된다."
]
results = classifier(texts)
for text, result in zip(texts, results):
print(f"텍스트: {text}")
print(f"감정: {result['label']} (확률: {result['score']:.3f})")
print()
widget:
| Metric | Score |
|---|---|
| Accuracy | 0.85+ |
| F1-Score (Macro) | 0.83+ |
| F1-Score (Weighted) | 0.85+ |
| Emotion | Precision | Recall | F1-Score |
|---|---|---|---|
| angry | 0.87 | 0.84 | 0.85 |
| happy | 0.89 | 0.91 | 0.90 |
| anxious | 0.82 | 0.79 | 0.80 |
| embarrassed | 0.78 | 0.76 | 0.77 |
| sad | 0.85 | 0.87 | 0.86 |
| heartache | 0.81 | 0.83 | 0.82 |
이 모델은 다음과 같은 용도로 활용할 수 있습니다:
이 모델은 학습 데이터의 편향을 반영할 수 있습니다. 특정 주제나 표현에 대해 편향된 결과를 보일 수 있으므로, 실제 서비스에 적용할 때는 충분한 검증과 모니터링이 필요합니다.
@misc{koelectra_emotion_2024,
title={KoELECTRA Fine-tuned for Korean Emotion Classification},
author={Jinuuuu},
year={2024},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/Jinuuuu/KoELECTRA_fine_tunning_emotion}}
}
모델에 대한 문의사항이나 개선 제안이 있으시면 GitHub 이슈나 Hugging Face 모델 페이지를 통해 연락주세요.
이 모델은 연구 및 교육 목적으로 개발되었습니다. 상업적 사용 시에는 충분한 검증과 테스트를 거쳐 사용하시기 바랍니다.