This model is a fine-tuned version of Llama-3.2-1B-Instruct, optimized for empathetic and supportive conversations in the mental health domain.
It was trained on the ShenLab/MentalChat16K dataset, which includes over 16,000 counseling-style Q&A examples, combining real clinical paraphrases and synthetic mental health dialogues.
The model is designed to understand and respond to emotionally nuanced prompts related to stress, anxiety, relationships, and personal well-being.
This model is intended for research and experimentation in AI-driven mental health support. Key use cases include:
This model is NOT intended for clinical diagnosis, therapy, or real-time intervention. It must not replace licensed mental health professionals.
Use the code below to get started with the model.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3tokenizer = AutoTokenizer.from_pretrained("khazarai/MentalChat-16K")
4model = AutoModelForCausalLM.from_pretrained(
5 "khazarai/MentalChat-16K",
6 device_map={"": 0}
7)
8
9system = """You are a helpful mental health counselling assistant, please answer the mental health questions based on the patient's description.
10The assistant gives helpful, comprehensive, and appropriate answers to the user's questions.
11"""
12
13question = """
14I've been feeling overwhelmed by my responsibilities at work and caring for my aging parents. I've reached a point where I don't know what else I can do, and I'm struggling to communicate this to my boss and family members. I feel guilty for even considering saying no, but I know I need to take care of myself.
15"""
16
17messages = [
18 {"role" : "system", "content" : system},
19 {"role" : "user", "content" : question}
20]
21text = tokenizer.apply_chat_template(
22 messages,
23 tokenize = False,
24 add_generation_prompt = True,
25)
26
27from transformers import TextStreamer
28_ = model.generate(
29 **tokenizer(text, return_tensors = "pt").to("cuda"),
30 max_new_tokens = 900,
31 temperature = 0.7,
32 top_p = 0.8,
33 top_k = 20,
34 streamer = TextStreamer(tokenizer, skip_prompt = True),
35)
36