--- language: ko license: mit tags: - pytorch - bert - text-classification - stance-detection - korean - news datasets: - custom metrics: - accuracy model-index: - name: political-news-stance-classifier results: - task: type: text-classification name: Stance Classification metrics: - type: accuracy value: 91.6 name: Test Accuracy --- # 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 ```python 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` 토크나이저로 학습되었습니다. 반드시 동일한 토크나이저를 사용해야 정확한 결과를 얻을 수 있습니다. ```python # 올바른 사용법 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: ```bibtex @misc{korean-news-stance-classifier, title={Korean News Stance Classifier}, author={Politics News Analysis Team}, year={2024}, publisher={HuggingFace} } ```