Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: ko
|
| 3 |
+
tags:
|
| 4 |
+
- hate-speech
|
| 5 |
+
- binary-classification
|
| 6 |
+
- electra
|
| 7 |
+
- korean
|
| 8 |
+
- transformers
|
| 9 |
+
license: cc-by-4.0
|
| 10 |
+
datasets:
|
| 11 |
+
- jeanlee/kmhas_korean_hate_speech
|
| 12 |
+
model-index:
|
| 13 |
+
- name: kmhas_electra_binary
|
| 14 |
+
results:
|
| 15 |
+
- task:
|
| 16 |
+
name: Text Classification
|
| 17 |
+
type: text-classification
|
| 18 |
+
dataset:
|
| 19 |
+
name: KMHAS Korean Hate Speech
|
| 20 |
+
type: jeanlee/kmhas_korean_hate_speech
|
| 21 |
+
metrics:
|
| 22 |
+
- name: Accuracy
|
| 23 |
+
type: accuracy
|
| 24 |
+
value: 0.91
|
| 25 |
+
- name: F1
|
| 26 |
+
type: f1
|
| 27 |
+
value: 0.91
|
| 28 |
+
- name: Precision
|
| 29 |
+
type: precision
|
| 30 |
+
value: 0.91
|
| 31 |
+
- name: Recall
|
| 32 |
+
type: recall
|
| 33 |
+
value: 0.91
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
# KMHAS 한국어 혐오 발언 분류기 (이진 분류)
|
| 37 |
+
|
| 38 |
+
한국어 문장에서 혐오 발언 여부를 분류하는 이진 텍스트 분류 모델.
|
| 39 |
+
기반 모델: [`beomi/KcELECTRA-base-v2022`](https://huggingface.co/beomi/KcELECTRA-base-v2022)
|
| 40 |
+
학습에는 [KMHAS 한국어 혐오 표현 데이터셋](https://huggingface.co/datasets/jeanlee/kmhas_korean_hate_speech) 사용
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## 학습 정보
|
| 45 |
+
|
| 46 |
+
- **Train Set**: 78,977개
|
| 47 |
+
- **Validation Set**: 8,776개
|
| 48 |
+
- **Test Set**: 21,939개
|
| 49 |
+
- **Base Model**: `beomi/KcELECTRA-base-v2022`
|
| 50 |
+
- **Epochs**: 5
|
| 51 |
+
- **Batch Size**: 16 (train/eval)
|
| 52 |
+
- **Evaluation Strategy**: 매 epoch마다 성능 평가
|
| 53 |
+
- **Save Strategy**: 매 epoch마다 저장 (최대 1개 유지)
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## 성능 평가 (Test Set 기준)
|
| 58 |
+
|
| 59 |
+
| Metric | Value |
|
| 60 |
+
|------------|-------|
|
| 61 |
+
| Accuracy | 0.91 |
|
| 62 |
+
| Precision | 0.91 |
|
| 63 |
+
| Recall | 0.91 |
|
| 64 |
+
| F1-score | 0.91 |
|
| 65 |
+
|
| 66 |
+
클래스별 성능:
|
| 67 |
+
|
| 68 |
+
- **hate**: Precision 0.92 / Recall 0.91 / F1 0.92
|
| 69 |
+
- **non-hate**: Precision 0.90 / Recall 0.91 / F1 0.90
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## 사용 예시
|
| 74 |
+
|
| 75 |
+
```python
|
| 76 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 77 |
+
|
| 78 |
+
model = AutoModelForSequenceClassification.from_pretrained("jeanlee/kmhas_electra_binary")
|
| 79 |
+
tokenizer = AutoTokenizer.from_pretrained("jeanlee/kmhas_electra_binary")
|
| 80 |
+
|
| 81 |
+
text = "전교조 개새끼들이 나라를 망치고 있다."
|
| 82 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 83 |
+
outputs = model(**inputs)
|
| 84 |
+
|
| 85 |
+
label = outputs.logits.argmax(dim=1).item()
|
| 86 |
+
print("예측 결과:", "non-hate" if label == 1 else "hate")
|
| 87 |
+
```
|