Amod/mental_health_counseling_conversations
Viewer • Updated • 3.51k • 3.01k • 483
How to use junsung86/model_mental_care_v0.1 with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/gpt-oss-20b-unsloth-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "junsung86/model_mental_care_v0.1")How to use junsung86/model_mental_care_v0.1 with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for junsung86/model_mental_care_v0.1 to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for junsung86/model_mental_care_v0.1 to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for junsung86/model_mental_care_v0.1 to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="junsung86/model_mental_care_v0.1",
max_seq_length=2048,
)이 모델은 unsloth/gpt-oss-20b를 기반으로 Amod/mental_health_counseling_conversations 데이터셋으로 파인튜닝된 심리 상담 및 정신 건강 지원 전용 모델입니다. LoRA(Low-Rank Adaptation) 기술을 사용하여 효율적으로 학습되었으며, 내담자의 감정에 공감하고 비판단적인(non-judgemental)조언을 제공하는데 특화되어 있습니다.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# 베이스 모델 로드
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/gpt-oss-20b-unsloth-bnb-4bit", # 4bit 양자화 모델 사용 권장
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
# LoRA 어댑터 로드
model = PeftModel.from_pretrained(base_model, "junsung86/model_mental_care_v0.1")
# 토크나이저 로드
tokenizer = AutoTokenizer.from_pretrained("junsung86/model_mental_care_v0.1")
# 시스템 프롬프트: 공감하는 상담사 역할 부여
system_prompt = "You are an empathetic and supportive mental health counselor. Listen to the user and provide helpful, non-judgmental responses."
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "I feel like I'm failing at everything and I don't know how to handle this stress."}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True
reasoning_effort="medium" # GPT-OSS 추론 강도 설정
).to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.7, # 창의적이고 부드러운 답변을 위해 설정
top_p=0.9,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
이 모델은 다음과 같은 정신 건강 관련 대화 시나리오에서 활용될 수 있습니다:
이 모델은 베이스 모델인 unsloth/gpt-oss-20b의 라이선스 및 데이터셋의 라이선스 정책을 따릅니다.