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
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using gaaahee/political-news-stance-classifier 1

Evaluation results