Downloads · 30 days
0
khamrai/kogpt2-chatbot-lora
kogpt2-chatbot-lora is a machine learning model from khamrai. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as cc-by-nc-nd-4.0.
Downloads · 30 days
0
Access
Public
Updated Nov 5, 2025
Repo size
324 MB
Likes
0
Public
Click a slice to open those files.
.safetensors324 MB · 99%
From the Hugging Face model README
khamrai/nsmc-sentiment-lora
NSMC 데이터셋으로 파인튜닝된 한국어 감정 분석 모델입니다.
=== 챗봇 테스트 ===
질문: 안녕하세요? 답변: 저는 늘 사랑이에요.
질문: 오늘 날씨가 어때? 답변: 날씨가 참 따뜻하죠.
질문: 배고픈데 뭐 먹을까? 답변: 커피도 드세요.
질문: 주말에 뭐하지? 답변: 데이트 시간 빼곡하게 차려보세요.
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, "khamrai/nsmc-sentiment-lora")
tokenizer = AutoTokenizer.from_pretrained("khamrai/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%})")