thillaic commited on
Commit
46b7b92
Β·
verified Β·
1 Parent(s): e51236b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +86 -42
README.md CHANGED
@@ -1,67 +1,111 @@
 
 
 
 
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
- datasets:
17
- - Lumiiree/therapod-dpo
18
- base_model:
19
- - meta-llama/Llama-3.2-3B-Instruct
20
  ---
21
 
22
- # CBT-Copilot 🧠
 
 
23
 
24
- 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.
 
 
 
25
 
26
- The model is now compatible with `transformers`, `vLLM`, and other inference frameworks.
27
 
28
- ## πŸš€ How to Use (vLLM)
29
 
30
- You can serve it with [vLLM](https://github.com/vllm-project/vllm):
31
 
32
- ```bash
33
- python3 -m vllm.entrypoints.openai.api_server --model your-username/CBT-Copilot
 
 
 
 
 
 
 
 
34
  ```
35
 
36
- Then query it like this:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  ```python
39
- import openai
40
 
41
- openai.api_key = "EMPTY"
42
- openai.api_base = "http://localhost:8000/v1"
 
43
 
44
- response = openai.ChatCompletion.create(
45
- model="CBT-Copilot",
46
- messages=[
47
- {"role": "user", "content": "I've been feeling really anxious lately. What can I do?"}
48
- ]
49
- )
50
 
51
- print(response["choices"][0]["message"]["content"])
52
  ```
53
 
54
- ## 🧠 Intended Use
55
 
56
- This model is intended for educational and prototyping purposes in mental health-related chatbot systems. It is **not a substitute for professional therapy**.
57
 
58
- ## πŸ“œ License
 
 
 
 
59
 
60
- This model is licensed under the Apache 2.0 license.
61
 
 
62
 
63
  ---
64
 
65
- *Model prepared and fine-tuned by **ThillaiC***
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
- ---
 
1
+ # 🧠 CBT-Copilot: LLaMA 3.2B Fine-Tuned for Cognitive Therapy
2
+
3
+ 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.
4
+
5
  ---
6
+
7
+ ## πŸ”§ Model Details
8
+
9
+ - **Base Model**: [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct)
10
+ - **Fine-Tuning Method**: LoRA (Low-Rank Adaptation)
11
+ - **Dataset**: [`Lumiiree/therapod-dpo`](https://huggingface.co/datasets/Lumiiree/therapod-dpo)
12
+ - **Use Case**: Empathetic responses, journaling prompts, CBT-style thought reframing
13
+ - **Trained by**: [Thillai Chithambaram](https://huggingface.co/thillaic)
14
+
 
 
 
 
 
 
 
 
 
15
  ---
16
 
17
+ ## 🧠 Intended Use
18
+
19
+ This model can be integrated into:
20
 
21
+ - πŸ’¬ **Mental health chatbots**
22
+ - πŸ“” **Journaling apps with AI reflections**
23
+ - 🧘 **Self-help tools for cognitive restructuring**
24
+ - πŸ§‘β€βš•οΈ **Therapist assistants (non-clinical use)**
25
 
26
+ > ⚠️ **Disclaimer**: This model is not a replacement for licensed mental health professionals. It should be used only as an assistant or for research.
27
 
28
+ ---
29
 
30
+ ## πŸ—οΈ Training Configuration
31
 
32
+ ### βœ… LoRA Settings
33
+ ```python
34
+ peft_config = LoraConfig(
35
+ r=8,
36
+ lora_alpha=16,
37
+ target_modules=["q_proj", "v_proj"],
38
+ lora_dropout=0.05,
39
+ bias="none",
40
+ task_type="CAUSAL_LM",
41
+ )
42
  ```
43
 
44
+ ### βœ… TrainingArguments
45
+ ```python
46
+ args = TrainingArguments(
47
+ output_dir="llama-cbt-checkpoints",
48
+ per_device_train_batch_size=1,
49
+ gradient_accumulation_steps=4,
50
+ learning_rate=2e-5,
51
+ num_train_epochs=1,
52
+ logging_steps=100,
53
+ save_strategy="epoch",
54
+ bf16=True,
55
+ optim="paged_adamw_8bit",
56
+ )
57
+ ```
58
+
59
+ > Training was performed using Hugging Face's `transformers` + `peft` libraries with LoRA applied to key attention modules for lightweight adaptation.
60
+
61
+ ---
62
+
63
+ ## πŸš€ How to Use
64
 
65
  ```python
66
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
67
 
68
+ model_id = "thillaic/CBT-Copilot"
69
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
70
+ model = AutoModelForCausalLM.from_pretrained(model_id)
71
 
72
+ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
73
+
74
+ prompt = "I feel overwhelmed and stuck lately. What should I do?"
75
+ response = pipe(prompt, max_new_tokens=200, do_sample=True, temperature=0.7)
 
 
76
 
77
+ print(response[0]['generated_text'])
78
  ```
79
 
80
+ ---
81
 
82
+ ## πŸ’‘ Example Prompts
83
 
84
+ - "I often feel like I’m not good enough. Help me reframe this thought."
85
+ - "Give me a CBT-style journaling prompt for today."
86
+ - "How can I deal with negative self-talk?"
87
+
88
+ ---
89
 
90
+ ## 🧾 License
91
 
92
+ This project is open-sourced for educational and research purposes under the **MIT License**.
93
 
94
  ---
95
 
96
+ ## πŸ™ Acknowledgements
97
+
98
+ - Fine-tuned on the excellent [`therapod-dpo`](https://huggingface.co/datasets/Lumiiree/therapod-dpo) dataset
99
+ - Built using Meta’s LLaMA 3.2B base model
100
+ - LoRA integration powered by Hugging Face PEFT
101
+
102
+ ---
103
+
104
+ ## πŸ”— Links
105
+
106
+ - πŸ€— Model: [huggingface.co/thillaic/CBT-Copilot](https://huggingface.co/thillaic/CBT-Copilot)
107
+ - πŸ““ Dataset: [Lumiiree/therapod-dpo](https://huggingface.co/datasets/Lumiiree/therapod-dpo)
108
+
109
+ ---
110
 
111
+ *Crafted with care by Thillai Chithambaram for the future of compassionate AI.*