Korean News Stance Classifier (ํ๊ตญ์ด ๋ด์ค ์คํ ์ค ๋ถ๋ฅ๊ธฐ)
KoBERT ๊ธฐ๋ฐ ํ๊ตญ์ด ์ ์น ๋ด์ค ์คํ ์ค(์ ์ฅ) ๋ถ๋ฅ ๋ชจ๋ธ์ ๋๋ค.
Model Description
- Base Model: skt/kobert-base-v1
- Tokenizer: monologg/kobert (์ค์!)
- Task: 3-class stance classification (์นํธ/์ค๋ฆฝ/๋นํ)
- Language: Korean
Performance
- Test Accuracy: 91.6%
- Validation Accuracy: 93.9%
- Training Samples: 5253
Labels
| Label | Korean | English | Description |
|---|---|---|---|
| 0 | ์นํธ | support | ์ ๋ถ/์ฌ๋น ์ ์ฑ ์ ์ฐํธ์ |
| 1 | ์ค๋ฆฝ | neutral | ๊ฐ๊ด์ ์ฌ์ค ์ ๋ฌ |
| 2 | ๋นํ | oppose | ์ ๋ถ/์ฌ๋น ์ ์ฑ ์ ๋นํ์ |
Usage
import torch
from transformers import AutoTokenizer
# ํ ํฌ๋์ด์ ๋ก๋ (๋ฐ๋์ monologg/kobert ์ฌ์ฉ!)
tokenizer = AutoTokenizer.from_pretrained("monologg/kobert", trust_remote_code=True)
# ๋ชจ๋ธ ๋ก๋
model = torch.load("pytorch_model.bin")
# ๋๋ state_dict ๋ก๋
# model.load_state_dict(torch.load("model.pth"))
# ์์ธก
text = "์ ๋ถ์ ์ ์ ์ฑ
์ด ๊ฒฝ์ ์ฑ์ฅ์ ํฌ๊ฒ ๊ธฐ์ฌํ ๊ฒ์ผ๋ก ๊ธฐ๋๋๋ค"
inputs = tokenizer(text, return_tensors="pt", max_length=512, truncation=True, padding="max_length")
with torch.no_grad():
outputs = model(inputs["input_ids"], inputs["attention_mask"])
probs = torch.softmax(outputs, dim=1)
pred = torch.argmax(probs, dim=1).item()
labels = ["์นํธ", "์ค๋ฆฝ", "๋นํ"]
print(f"Predicted: {labels[pred]} ({probs[0][pred].item()*100:.1f}%)")
Important Notes
ํ ํฌ๋์ด์ ์ฃผ์์ฌํญ: ์ด ๋ชจ๋ธ์ monologg/kobert ํ ํฌ๋์ด์ ๋ก ํ์ต๋์์ต๋๋ค.
๋ฐ๋์ ๋์ผํ ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํด์ผ ์ ํํ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์ต๋๋ค.
# ์ฌ๋ฐ๋ฅธ ์ฌ์ฉ๋ฒ
tokenizer = AutoTokenizer.from_pretrained("monologg/kobert", trust_remote_code=True)
# ์๋ชป๋ ์ฌ์ฉ๋ฒ (๊ฒฐ๊ณผ๊ฐ ๋ถ์ ํํจ)
# tokenizer = AutoTokenizer.from_pretrained("skt/kobert-base-v1")
Training Details
- Epochs: 16
- Batch Size: 16
- Learning Rate: 2e-05
- Max Length: 512
- Dropout: 0.3
Citation
If you use this model, please cite:
@misc{korean-news-stance-classifier,
title={Korean News Stance Classifier},
author={Politics News Analysis Team},
year={2024},
publisher={HuggingFace}
}
- Downloads last month
- 4
Space using gaaahee/political-news-stance-classifier 1
Evaluation results
- Test Accuracyself-reported91.600