Downloads · 30 days
7
24% of all-time downloads
dlckdfuf141/empathy-kogpt2
empathy-kogpt2 is a machine learning model from dlckdfuf141. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
KoGPT2 기반으로 감정 분류된 한국어 일기 데이터를 학습하여, 공감 메시지를 생성하는 감성 AI 언어모델입니다.
Downloads · 30 days
7
24% of all-time downloads
All-time downloads
29
Public
Parameters
125M
501 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors501 MB · 99%
From the Hugging Face model README
KoGPT2 기반으로 감정 분류된 한국어 일기 데이터를 학습하여, 공감 메시지를 생성하는 감성 AI 언어모델입니다.
skt/kogpt2-base-v2슬픔, 행복, 분노, 놀람, 공포, 중립, 혐오) + 일기 + 공감 메시지 쌍입력 텍스트는 다음 형식을 따릅니다:
감정: 슬픔
일기: 오늘 여자친구랑 헤어져서 너무 힘들어.
공감 메시지:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("dlckdfuf141/empathy-kogpt2")
model = AutoModelForCausalLM.from_pretrained("dlckdfuf141/empathy-kogpt2").to("cuda")
def generate_empathy(text, emotion):
prompt = f"감정: {emotion}\n일기: {text}\n공감 메시지:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=60,
do_sample=True,
top_p=0.95,
temperature=0.8,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id
)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
return result.split("공감 메시지:")[-1].strip()
# 예시 실행
print(generate_empathy("오늘 여자친구랑 헤어져서 너무 힘들어.", "슬픔"))