Views
No views yet
klue/roberta-base 기반으로 파인튜닝되었습니다.| Emotion | Precision | Recall | F1-Score |
|---|---|---|---|
| 분노 | 0.9801 | 0.9788 | 0.9795 |
| 불안 | 0.9864 | 0.9848 | 0.9856 |
| 슬픔 | 0.9837 | 0.9854 | 0.9845 |
| 평온 | 0.9782 | 0.9750 | 0.9766 |
| 당황 | 0.9607 | 0.9668 | 0.9652 |
| 기쁨 | 0.9857 | 0.9886 | 0.9872 |
1from transformers import pipeline
2import torch
3
4model_id = "Seonghaa/korean-emotion-classifier-roberta"
5
6device = 0 if torch.cuda.is_available() else -1 # GPU 있으면 0, 없으면 CPU(-1)
7
8clf = pipeline(
9 "text-classification",
10 model=model_id,
11 tokenizer=model_id,
12 device=device
13)
14
15texts = [
16 "오늘 길에서 10만원을 주웠어",
17 "오늘 친구들이랑 노래방에 갔어",
18 "오늘 시험 망쳤어",
19]
20
21for t in texts:
22 pred = clf(t, truncation=True, max_length=256)[0]
23 print(f"입력: {t}")
24 print(f"→ 예측 감정: {pred['label']}, 점수: {pred['score']:.4f}
25")
26