Views
No views yet
| 라벨 | 설명 |
|---|---|
therapeutic_exaggeration (0) | 치료적 과장 — 강하지만 한정·가역적, 관점 복귀 가능 |
borderline (1) | 경계 — 방향 모호, 보수적 처리 필요 |
harmful_amplification (2) | 해로운 증폭 — 무망감·무가치·자해 방향으로 이동 |
| 항목 | 값 |
|---|---|
| Base model | klue/bert-base |
| 학습 데이터 | 한국어 극단 페르소나 토론 발화 9,756건 (group-split) |
| Epochs | 4 |
| Weighted CE | 클래스 불균형 보정 |
| Accuracy | 0.786 |
| Macro F1 | 0.733 |
| Harmful F1 | 0.842 (recall 0.81) |
| Therapeutic F1 | 0.870 |
| Borderline F1 | 0.488 (라벨 노이즈·경계 클래스) |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tok = AutoTokenizer.from_pretrained("thlee00/ct-nlp")
5model = AutoModelForSequenceClassification.from_pretrained("thlee00/ct-nlp")
6model.eval()
7
8text = "어차피 나는 뭘 해도 안 돼. 이번에도 망했고 앞으로도 그럴 거야."
9inputs = tok(text, return_tensors="pt", truncation=True, max_length=512)
10with torch.no_grad():
11 logits = model(**inputs).logits
12label = model.config.id2label[logits.argmax(-1).item()]
13print(label) # harmful_amplification1from ctnlp.safeguard.safeguard import Safeguard
2
3sg = Safeguard() # models/harm_direction 자동 로드
4result = sg.gate_input("걱정 문장")
5# {"action": "allow" | "route" | "block", "label": ..., "score": ...}