thillaic commited on
Commit
923b532
Β·
verified Β·
1 Parent(s): c273a1f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -127
README.md CHANGED
@@ -1,162 +1,65 @@
1
  ---
 
 
 
2
  tags:
3
- - llama
4
- - llama-3
5
- - vllm
6
- - causal-lm
7
- - cognitive-therapy
8
- - mental-health
9
- - conversational
10
- - peft
11
- - lora
12
- license: mit
13
- datasets:
14
- - Lumiiree/therapod-dpo
15
- inference: true
16
  ---
17
 
18
- # 🧠 CBT-Copilot: LLaMA 3.2B Fine-Tuned for Cognitive Therapy
19
 
20
- Welcome to **CBT-Copilot**, an open-source LLM fine-tuned on therapy-aligned dialogues using the [Lumiiree/therapod-dpo](https://huggingface.co/datasets/Lumiiree/therapod-dpo) dataset. This model is designed to act as a **compassionate and supportive AI assistant**, trained in the tone of cognitive behavioral therapy (CBT), and suitable for mental health support applications.
21
 
22
- ---
23
-
24
- ## πŸ”§ Model Details
25
-
26
- - **Base Model**: [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct)
27
- - **Fine-Tuning Method**: LoRA (Low-Rank Adaptation)
28
- - **Dataset**: [`Lumiiree/therapod-dpo`](https://huggingface.co/datasets/Lumiiree/therapod-dpo)
29
- - **Use Case**: Empathetic responses, journaling prompts, CBT-style thought reframing
30
- - **Trained by**: [Thillai Chithambaram](https://huggingface.co/thillaic)
31
-
32
- ---
33
-
34
- ## 🧠 Intended Use
35
-
36
- This model can be integrated into:
37
-
38
- - πŸ’¬ **Mental health chatbots**
39
- - πŸ“” **Journaling apps with AI reflections**
40
- - 🧘 **Self-help tools for cognitive restructuring**
41
- - πŸ§‘β€βš•οΈ **Therapist assistants (non-clinical use)**
42
-
43
- > ⚠️ **Disclaimer**: This model is not a replacement for licensed mental health professionals. It should be used only as an assistant or for research.
44
-
45
- ---
46
 
47
- ## πŸ—οΈ Training Configuration
48
-
49
- ### βœ… LoRA Settings
50
- ```python
51
- peft_config = LoraConfig(
52
- r=8,
53
- lora_alpha=16,
54
- target_modules=["q_proj", "v_proj"],
55
- lora_dropout=0.05,
56
- bias="none",
57
- task_type="CAUSAL_LM",
58
- )
59
- ```
60
-
61
- ### βœ… TrainingArguments
62
- ```python
63
- args = TrainingArguments(
64
- output_dir="llama-cbt-checkpoints",
65
- per_device_train_batch_size=1,
66
- gradient_accumulation_steps=4,
67
- learning_rate=2e-5,
68
- num_train_epochs=1,
69
- logging_steps=100,
70
- save_strategy="epoch",
71
- bf16=True,
72
- optim="paged_adamw_8bit",
73
- )
74
- ```
75
-
76
- > Training was performed using Hugging Face's `transformers` + `peft` libraries with LoRA applied to key attention modules for lightweight adaptation.
77
-
78
- ---
79
 
80
- ## πŸš€ How to Use
81
-
82
- ```python
83
- from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
84
-
85
- model_id = "thillaic/CBT-Copilot"
86
- tokenizer = AutoTokenizer.from_pretrained(model_id)
87
- model = AutoModelForCausalLM.from_pretrained(model_id)
88
-
89
- pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
90
-
91
- prompt = "I feel overwhelmed and stuck lately. What should I do?"
92
- response = pipe(prompt, max_new_tokens=200, do_sample=True, temperature=0.7)
93
-
94
- print(response[0]['generated_text'])
95
- ```
96
-
97
- ---
98
-
99
- ## πŸ’‘ Example Prompts
100
-
101
- - "I often feel like I’m not good enough. Help me reframe this thought."
102
- - "Give me a CBT-style journaling prompt for today."
103
- - "How can I deal with negative self-talk?"
104
-
105
- ---
106
-
107
- ## ⚑ Inference with vLLM
108
-
109
- This model is **compatible with [vLLM](https://github.com/vllm-project/vllm)** β€” a fast and memory-efficient inference engine for LLMs.
110
-
111
- ### πŸš€ Quick Start with vLLM
112
 
113
  ```bash
114
- pip install "vllm[serve]"
115
-
116
- python -m vllm.entrypoints.api_server \
117
- --model thillaic/CBT-Copilot
118
  ```
119
 
120
- ### OpenAI-Compatible API Example
121
 
122
  ```python
123
  import openai
124
 
 
125
  openai.api_base = "http://localhost:8000/v1"
126
- openai.api_key = "EMPTY" # not needed for local use
127
 
128
  response = openai.ChatCompletion.create(
129
- model="thillaic/CBT-Copilot",
130
  messages=[
131
- {"role": "system", "content": "You are a compassionate CBT therapist."},
132
- {"role": "user", "content": "I'm feeling anxious lately. What should I do?"}
133
  ]
134
  )
135
 
136
- print(response.choices[0].message["content"])
137
  ```
138
 
139
- ---
140
 
141
- ## 🧾 License
142
 
143
- This project is open-sourced for educational and research purposes under the **MIT License**.
144
 
145
- ---
146
 
147
- ## πŸ™ Acknowledgements
148
-
149
- - Fine-tuned on the excellent [`therapod-dpo`](https://huggingface.co/datasets/Lumiiree/therapod-dpo) dataset
150
- - Built using Meta’s LLaMA 3.2B base model
151
- - LoRA integration powered by Hugging Face PEFT
152
 
153
  ---
154
 
155
- ## πŸ”— Links
156
-
157
- - πŸ€— Model: [huggingface.co/thillaic/CBT-Copilot](https://huggingface.co/thillaic/CBT-Copilot)
158
- - πŸ““ Dataset: [Lumiiree/therapod-dpo](https://huggingface.co/datasets/Lumiiree/therapod-dpo)
159
 
160
  ---
161
 
162
- *Crafted with care by Thillai Chithambaram for the future of compassionate AI.*
 
1
  ---
2
+ language: en
3
+ license: apache-2.0
4
+ library_name: transformers
5
  tags:
6
+ - llama
7
+ - causal-lm
8
+ - merged
9
+ - vllm
10
+ inference:
11
+ parameters:
12
+ max_new_tokens: 256
13
+ temperature: 0.7
14
+ top_p: 0.9
15
+ repetition_penalty: 1.1
 
 
 
16
  ---
17
 
18
+ # CBT-Copilot 🧠
19
 
20
+ CBT-Copilot is a fine-tuned version of `meta-llama/Llama-3.2-3B-Instruct`, designed to simulate conversations for cognitive behavioral therapy (CBT) support. It has been trained using LoRA and merged into a standalone model.
21
 
22
+ The model is now compatible with `transformers`, `vLLM`, and other inference frameworks.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ ## πŸš€ How to Use (vLLM)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ You can serve it with [vLLM](https://github.com/vllm-project/vllm):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  ```bash
29
+ python3 -m vllm.entrypoints.openai.api_server --model your-username/CBT-Copilot
 
 
 
30
  ```
31
 
32
+ Then query it like this:
33
 
34
  ```python
35
  import openai
36
 
37
+ openai.api_key = "EMPTY"
38
  openai.api_base = "http://localhost:8000/v1"
 
39
 
40
  response = openai.ChatCompletion.create(
41
+ model="CBT-Copilot",
42
  messages=[
43
+ {"role": "user", "content": "I've been feeling really anxious lately. What can I do?"}
 
44
  ]
45
  )
46
 
47
+ print(response["choices"][0]["message"]["content"])
48
  ```
49
 
50
+ ## 🧠 Intended Use
51
 
52
+ This model is intended for educational and prototyping purposes in mental health-related chatbot systems. It is **not a substitute for professional therapy**.
53
 
54
+ ## πŸ“œ License
55
 
56
+ This model is licensed under the Apache 2.0 license.
57
 
 
 
 
 
 
58
 
59
  ---
60
 
61
+ *Model prepared and fine-tuned by **Thillai Chithambaram***
 
 
 
62
 
63
  ---
64
 
65
+ **Made by ThillaiC**