Views
No views yet
0: negative (악재/부정) - 해당 기업에 대한 부정적 내용1: neutral (중립) - 해당 기업에 대한 중립적 내용2: positive (호재/긍정) - 해당 기업에 대한 긍정적 내용| Metric | Score |
|---|---|
| Accuracy | 0.8426 |
| F1-Macro | 0.8468 |
| F1-Weighted | 0.8422 |
1{
2 "learning_rate": 9.78310992630157e-06,
3 "num_train_epochs": 8,
4 "weight_decay": 0.06436845335086991,
5 "warmup_ratio": 0.10859899755289561,
6 "per_device_train_batch_size": 32
7}1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# 모델 로드
5model_name = "FISA-conclave/klue-roberta-news-sentiment"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# 예측
10text = "삼성전자의 3분기 실적이 시장 예상을 크게 상회했다."
11inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
12
13with torch.no_grad():
14 outputs = model(**inputs)
15 probs = torch.softmax(outputs.logits, dim=1)[0]
16 pred = torch.argmax(probs).item()
17
18labels = {0: "negative", 1: "neutral", 2: "positive"}
19print(f"예측: {labels[pred]} ({probs[pred]:.2%})")1@misc{klue-roberta-news-sentiment,
2 author = {Tobykim},
3 title = {KLUE-RoBERTa News Sentiment Analysis},
4 year = {2024},
5 publisher = {HuggingFace},
6 howpublished = {\url{https://huggingface.co/FISA-conclave/klue-roberta-news-sentiment}}
7}