A fine-tuned Gemma-2B model specialized for empathetic mental health counseling conversations. This model provides supportive, understanding responses to mental health and emotional well-being queries.
⚠️ Important Disclaimer
This model is for educational and research purposes only. It should NOT be used as a replacement for professional mental health services. If you or someone you know is in crisis or needs professional help, please contact:
National Suicide Prevention Lifeline: 988 or 1-800-273-8255
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
34# Load model and tokenizer5model = AutoModelForCausalLM.from_pretrained(6"ThatITGuy/gemma-counseling-chat-model",7 torch_dtype=torch.float16,8 device_map="auto"9)10tokenizer = AutoTokenizer.from_pretrained("ThatITGuy/gemma-counseling-chat-model")1112# Prepare your prompt13user_message ="I'm feeling overwhelmed with work stress. Any advice?"14prompt =f"<start_of_turn>user\n{user_message}<end_of_turn>\n<start_of_turn>model\n"1516# Generate response17inputs = tokenizer(prompt, return_tensors="pt").to(model.device)18outputs = model.generate(19**inputs,20 max_new_tokens=256,21 temperature=0.7,22 top_p=0.9,23 do_sample=True,24 repetition_penalty=1.125)2627response = tokenizer.decode(outputs[0], skip_special_tokens=True)28print(response.split("<start_of_turn>model\n")[-1])
Using with Pipeline
python
1from transformers import pipeline
23# Create a text generation pipeline4pipe = pipeline(5"text-generation",6 model="ThatITGuy/gemma-counseling-chat-model",7 torch_dtype=torch.float16,8 device_map="auto"9)1011# Format and generate12prompt ="<start_of_turn>user\nI've been having trouble sleeping lately.<end_of_turn>\n<start_of_turn>model\n"13response = pipe(prompt, max_new_tokens=256, temperature=0.7)[0]['generated_text']
1generation_config ={2"max_new_tokens":256,3"temperature":0.7,# Adjust for more/less creative responses4"top_p":0.9,5"top_k":50,6"repetition_penalty":1.1,7"do_sample":True,8"pad_token_id": tokenizer.eos_token_id
9}
Example Conversations
Example 1: Stress Management
User: "I'm feeling overwhelmed with work stress. Any advice?"
Model: "I understand that work stress can be really challenging. Here are some strategies that might help: Try breaking large tasks into smaller, manageable steps. Take regular short breaks to breathe deeply and reset. Consider setting boundaries between work and personal time. Remember, it's okay to ask for help when needed. What specific aspect of work is causing you the most stress?"
Example 2: Communication Skills
User: "I don't know how to tell someone how I feel about them."
Model: "Expressing feelings can be difficult, and it's completely normal to feel uncertain. Start by being honest with yourself about what you want to communicate. Choose a comfortable, private setting for the conversation. Use 'I' statements to express your feelings without placing blame. Remember, being vulnerable takes courage, and the right person will appreciate your honesty."
Limitations and Biases
Training Data Limitations: The model was trained on a limited dataset and for only 100 steps, which may affect response quality and diversity.
Not a Healthcare Professional: This model cannot diagnose, treat, or provide medical advice. It's designed for supportive conversation only.
Potential Biases: The model may reflect biases present in the training data, including cultural, demographic, or therapeutic approach biases.
Context Limitations: The model has a maximum context length of 2048 tokens and may lose track of very long conversations.
Crisis Handling: While trained on counseling conversations, the model is NOT equipped to handle crisis situations appropriately.
Ethical Considerations
Privacy: Never share personal identifying information in conversations
Professional Boundaries: This model is not a replacement for professional therapy
Crisis Situations: Always direct users in crisis to appropriate professional resources
Informed Use: Users should understand this is an AI model, not a human counselor
Future Improvements
Extended training with more diverse counseling datasets
Implementation of safety filters for crisis detection
Multi-turn conversation optimization
Validation with mental health professionals
Integration of evidence-based therapeutic techniques
Citation
If you use this model in your research, please cite: