NSMC 감정 뢄석 (LoRA Fine-tuned)

이 λͺ¨λΈμ€ LoRAλ₯Ό μ‚¬μš©ν•˜μ—¬ NSMC(Naver Sentiment Movie Corpus) λ°μ΄ν„°μ…‹μœΌλ‘œ νŒŒμΈνŠœλ‹λœ 감정 뢄석 λͺ¨λΈμž…λ‹ˆλ‹€.

λͺ¨λΈ 정보

  • 베이슀 λͺ¨λΈ: klue/bert-base
  • νŒŒμΈνŠœλ‹ 방법: LoRA (Low-Rank Adaptation)
  • ν•™μŠ΅ νŒŒλΌλ―Έν„°: μ•½ 0.3% (~300K)
  • 데이터셋: NSMC (넀이버 μ˜ν™” 리뷰)
  • Task: 이진 λΆ„λ₯˜ (긍정/λΆ€μ •)

μ‚¬μš© 방법

from transformers import AutoModelForSequenceClassification, AutoTokenizer
from peft import PeftModel
import torch

# 베이슀 λͺ¨λΈ λ‘œλ“œ
base_model = AutoModelForSequenceClassification.from_pretrained(
    "klue/bert-base",
    num_labels=2
)

# LoRA μ–΄λŒ‘ν„° λ‘œλ“œ
model = PeftModel.from_pretrained(base_model, "JINIIII/nsmc-sentiment-lora")
tokenizer = AutoTokenizer.from_pretrained("JINIIII/nsmc-sentiment-lora")

# μΆ”λ‘ 
text = "이 μ˜ν™” 정말 μž¬λ―Έμžˆμ–΄μš”!"

inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
outputs = model(**inputs)

probs = torch.softmax(outputs.logits, dim=-1)
pred = torch.argmax(probs, dim=-1).item()

label = "긍정" if pred == 1 else "λΆ€μ •"
confidence = probs[0][pred].item()

print(f"κ²°κ³Ό: {label} (확신도: {confidence:.2%})")

ν•™μŠ΅ 세뢀사항

  • LoRA Rank (r): 8
  • LoRA Alpha: 16
  • Target Modules: query, value
  • Dropout: 0.1
  • ν•™μŠ΅ 에폭: 5
  • ν•™μŠ΅λ₯ : 5e-4

μ„±λŠ₯

  • ν•™μŠ΅ 데이터: 10,000개
  • 평가 데이터: 2,000개
  • 평가 정확도: ~85-90%

ν™œμš© μ˜ˆμ‹œ

  • μ˜ν™” 리뷰 감정 뢄석
  • μƒν’ˆ 리뷰 뢄석
  • SNS 감정 λͺ¨λ‹ˆν„°λ§
  • 고객 ν”Όλ“œλ°± μžλ™ λΆ„λ₯˜

μ œν•œμ‚¬ν•­

  • μ˜ν™” 리뷰 도메인에 νŠΉν™”λ˜μ–΄ 있음
  • 짧은 ν…μŠ€νŠΈμ—μ„œ κ°€μž₯ 쒋은 μ„±λŠ₯
  • 극단적인 감정 ν‘œν˜„μ—μ„œ 정확도가 λ†’μŒ

λΌμ΄μ„ μŠ€

MIT License

μž‘μ„±μž

JINIIII

인용

@misc{nsmc-sentiment-lora,
  author = {JINIIII},
  title = {NSMC Sentiment Analysis with LoRA},
  year = {2024},
  publisher = {Hugging Face},
  url = {https://huggingface.co/JINIIII/nsmc-sentiment-lora}
}

Note: 이 λͺ¨λΈμ€ ꡐ윑 λͺ©μ μœΌλ‘œ λ§Œλ“€μ–΄μ‘ŒμŠ΅λ‹ˆλ‹€.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for JINIIII/nsmc-sentiment-lora

Base model

klue/bert-base
Adapter
(26)
this model

Dataset used to train JINIIII/nsmc-sentiment-lora

Spaces using JINIIII/nsmc-sentiment-lora 2