Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,179 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
-
base_model:
|
4 |
- google/gemma-3-270m
|
5 |
pipeline_tag: text-generation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
---
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
base_model:
|
4 |
- google/gemma-3-270m
|
5 |
pipeline_tag: text-generation
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
tags:
|
9 |
+
- mental-health
|
10 |
+
- cbt
|
11 |
+
- therapy
|
12 |
+
- conversational-ai
|
13 |
+
- gemma-3
|
14 |
+
- unsloth
|
15 |
+
- lora
|
16 |
+
- psychology
|
17 |
+
---
|
18 |
+
|
19 |
+
# Gemma-3 270M Mental Health Fine-tuned Model
|
20 |
+
|
21 |
+
## Model Description
|
22 |
+
|
23 |
+
This model is a fine-tuned version of Google's Gemma-3 270M, specifically trained for mental health conversational support using Cognitive Behavioral Therapy (CBT) principles. The model has been trained on 5M+ tokens of high-quality mental health conversational data to provide empathetic, supportive, and therapeutically-informed responses.
|
24 |
+
|
25 |
+
**Developed by:** Saurav Kumar Srivastava
|
26 |
+
|
27 |
+
## Model Details
|
28 |
+
|
29 |
+
- **Base Model:** google/gemma-3-270m
|
30 |
+
- **Model Size:** 270M parameters
|
31 |
+
- **Training Data:** 5M+ tokens of CBT-based therapeutic conversations
|
32 |
+
- **Training Method:** LoRA fine-tuning using Unsloth
|
33 |
+
- **Quantization:** BF16 GGUF format available
|
34 |
+
- **License:** MIT
|
35 |
+
|
36 |
+
## Training Configuration
|
37 |
+
|
38 |
+
The model was fine-tuned using the following specifications:
|
39 |
+
|
40 |
+
- **LoRA Rank (r):** 8
|
41 |
+
- **LoRA Alpha:** 8
|
42 |
+
- **Target Modules:** All attention and MLP modules
|
43 |
+
- **Batch Size:** 2 (per device) with 4 gradient accumulation steps
|
44 |
+
- **Learning Rate:** 2e-4
|
45 |
+
- **Training Steps:** 30 (optimized for efficiency)
|
46 |
+
- **Optimizer:** AdamW 8-bit
|
47 |
+
- **Framework:** Unsloth + TRL SFTTrainer
|
48 |
+
|
49 |
+
## Intended Use
|
50 |
+
|
51 |
+
### Primary Use Cases
|
52 |
+
- **Mental Health Support:** Providing empathetic conversations and CBT-based guidance
|
53 |
+
- **Therapeutic Assistance:** Supporting individuals with anxiety, depression, and stress management
|
54 |
+
- **Educational Tool:** Teaching CBT techniques and mental health awareness
|
55 |
+
- **Research:** Studying conversational AI in mental health applications
|
56 |
+
|
57 |
+
### Limitations
|
58 |
+
- **Not a Replacement for Professional Help:** This model should not replace licensed mental health professionals
|
59 |
+
- **Crisis Situations:** Not suitable for handling severe mental health crises or suicidal ideation
|
60 |
+
- **General Limitations:** As with all language models, may occasionally generate inappropriate or inaccurate responses
|
61 |
+
|
62 |
+
## Usage
|
63 |
+
|
64 |
+
### Basic Inference
|
65 |
+
|
66 |
+
```python
|
67 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
68 |
+
import torch
|
69 |
+
|
70 |
+
# Load model and tokenizer
|
71 |
+
model = AutoModelForCausalLM.from_pretrained("Skshackster/gemma3-270m-mental-health-fine-tuned-gguf")
|
72 |
+
tokenizer = AutoTokenizer.from_pretrained("Skshackster/gemma3-270m-mental-health-fine-tuned-gguf")
|
73 |
+
|
74 |
+
# Prepare conversation
|
75 |
+
messages = [{
|
76 |
+
"role": "user",
|
77 |
+
"content": [{"type": "text", "text": "I've been feeling really anxious lately about work."}]
|
78 |
+
}]
|
79 |
+
|
80 |
+
# Generate response
|
81 |
+
text = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
|
82 |
+
inputs = tokenizer([text], return_tensors="pt")
|
83 |
+
|
84 |
+
with torch.no_grad():
|
85 |
+
outputs = model.generate(
|
86 |
+
**inputs,
|
87 |
+
max_new_tokens=128,
|
88 |
+
temperature=1.0,
|
89 |
+
top_p=0.95,
|
90 |
+
top_k=64,
|
91 |
+
do_sample=True
|
92 |
+
)
|
93 |
+
|
94 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
95 |
+
print(response)
|
96 |
+
```
|
97 |
+
|
98 |
+
### Recommended Inference Settings
|
99 |
+
- **Temperature:** 1.0
|
100 |
+
- **Top-p:** 0.95
|
101 |
+
- **Top-k:** 64
|
102 |
+
- **Max New Tokens:** 64-256 (depending on desired response length)
|
103 |
+
|
104 |
+
## Training Data
|
105 |
+
|
106 |
+
The model was trained on a carefully curated dataset of mental health conversations incorporating:
|
107 |
+
- CBT-based therapeutic dialogues
|
108 |
+
- Empathetic response patterns
|
109 |
+
- Crisis de-escalation techniques
|
110 |
+
- Mindfulness and coping strategies
|
111 |
+
- Educational mental health content
|
112 |
+
|
113 |
+
**Data Volume:** 5M+ tokens of high-quality conversational data
|
114 |
+
|
115 |
+
## Evaluation and Performance
|
116 |
+
|
117 |
+
The model demonstrates strong performance in:
|
118 |
+
- Empathetic response generation
|
119 |
+
- CBT technique application
|
120 |
+
- Maintaining therapeutic conversation flow
|
121 |
+
- Appropriate boundary setting
|
122 |
+
- Educational content delivery
|
123 |
+
|
124 |
+
## Ethical Considerations
|
125 |
+
|
126 |
+
### Safety Measures
|
127 |
+
- Trained to redirect users to professional help when appropriate
|
128 |
+
- Designed to avoid giving specific medical advice
|
129 |
+
- Incorporates safety guidelines for mental health conversations
|
130 |
+
- Includes appropriate disclaimers about professional treatment
|
131 |
+
|
132 |
+
### Bias and Fairness
|
133 |
+
- Efforts made to ensure inclusive and culturally sensitive responses
|
134 |
+
- Regular evaluation for potential biases in mental health recommendations
|
135 |
+
- Continuous monitoring for harmful or inappropriate outputs
|
136 |
+
|
137 |
+
## Technical Specifications
|
138 |
+
|
139 |
+
- **Architecture:** Gemma-3 (Transformer-based)
|
140 |
+
- **Context Length:** 4000 tokens
|
141 |
+
- **Precision:** BF16
|
142 |
+
- **Hardware Requirements:** Compatible with consumer GPUs (4GB+ VRAM recommended)
|
143 |
+
- **Inference Speed:** Optimized for real-time conversation
|
144 |
+
|
145 |
+
## Files and Formats
|
146 |
+
|
147 |
+
- **Standard Model:** PyTorch format compatible with Transformers library
|
148 |
+
- **GGUF Format:** Available for llama.cpp and Ollama integration
|
149 |
+
- **Quantization:** BF16 precision maintained for quality
|
150 |
+
|
151 |
+
## Citation
|
152 |
+
|
153 |
+
If you use this model in your research or applications, please cite:
|
154 |
+
|
155 |
+
```bibtex
|
156 |
+
@misc{srivastava2025gemma3mentalhealth,
|
157 |
+
title={Gemma-3 270M Mental Health Fine-tuned Model},
|
158 |
+
author={Saurav Kumar Srivastava},
|
159 |
+
year={2025},
|
160 |
+
howpublished={\url{https://huggingface.co/Skshackster/gemma3-270m-mental-health-fine-tuned-gguf}},
|
161 |
+
}
|
162 |
+
```
|
163 |
+
|
164 |
+
## Contact and Support
|
165 |
+
|
166 |
+
**Developer:** Saurav Kumar Srivastava
|
167 |
+
- For questions, issues, or collaboration inquiries, please open an issue in the model repository
|
168 |
+
|
169 |
+
## Acknowledgments
|
170 |
+
|
171 |
+
- **Google** for the Gemma-3 base model
|
172 |
+
- **Unsloth** for the efficient fine-tuning framework
|
173 |
+
- **Mental Health Community** for supporting ethical AI development in therapeutic applications
|
174 |
+
|
175 |
+
## Disclaimer
|
176 |
+
|
177 |
+
This model is designed for educational and supportive purposes only. It should not be used as a substitute for professional mental health treatment. If you are experiencing a mental health crisis, please contact a licensed mental health professional or emergency services immediately.
|
178 |
+
|
179 |
---
|