Update README.md
Browse files
README.md
CHANGED
@@ -1,22 +1,144 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# phi3
|
2 |
+
|
3 |
+
[![Model Card](https://img.shields.io/badge/Hugging%20Face-Model%20Card-blue)](https://huggingface.co/username/phi3)
|
4 |
+
|
5 |
+
## Description
|
6 |
+
|
7 |
+
**phi3** is a fine-tuned version of phi-3, specifically trained on mental health therapist conversational data. This model is designed to assist in mental health support, providing empathetic and knowledgeable responses in a conversational setting.
|
8 |
+
|
9 |
+
## Installation
|
10 |
+
|
11 |
+
To use this model, you will need to install the following dependencies:
|
12 |
+
|
13 |
+
```bash
|
14 |
+
pip install transformers
|
15 |
+
pip install torch # or tensorflow depending on your preference
|
16 |
+
```
|
17 |
+
|
18 |
+
## Usage
|
19 |
+
|
20 |
+
Here is how you can load and use the model in your code:
|
21 |
+
|
22 |
+
```python
|
23 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
24 |
+
|
25 |
+
tokenizer = AutoTokenizer.from_pretrained("username/phi3")
|
26 |
+
model = AutoModelForCausalLM.from_pretrained("username/phi3")
|
27 |
+
|
28 |
+
# Example usage
|
29 |
+
chat_template = """
|
30 |
+
<|system|>
|
31 |
+
You are a compassionate mental health therapist. You listen to your clients attentively and provide thoughtful, empathetic responses to help them navigate their emotions and mental health challenges.
|
32 |
+
<|end|>
|
33 |
+
<|user|>
|
34 |
+
I've been feeling really down lately. What should I do?
|
35 |
+
<|end|>
|
36 |
+
<|assistant|>
|
37 |
+
"""
|
38 |
+
|
39 |
+
inputs = tokenizer(chat_template, return_tensors="pt")
|
40 |
+
outputs = model.generate(**inputs)
|
41 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
42 |
+
|
43 |
+
print(response)
|
44 |
+
```
|
45 |
+
|
46 |
+
### Inference
|
47 |
+
|
48 |
+
Provide example code for performing inference with your model:
|
49 |
+
|
50 |
+
```python
|
51 |
+
# Example inference
|
52 |
+
user_input = "I've been feeling really down lately. What should I do?"
|
53 |
+
chat_template = f"""
|
54 |
+
<|system|>
|
55 |
+
You are a compassionate mental health therapist. You listen to your clients attentively and provide thoughtful, empathetic responses to help them navigate their emotions and mental health challenges.
|
56 |
+
<|end|>
|
57 |
+
<|user|>
|
58 |
+
I've been feeling really down lately. What should I do?
|
59 |
+
<|end|>
|
60 |
+
<|assistant|>
|
61 |
+
"""
|
62 |
+
|
63 |
+
inputs = tokenizer(chat_template, return_tensors="pt")
|
64 |
+
outputs = model.generate(**inputs)
|
65 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
66 |
+
|
67 |
+
print(response)
|
68 |
+
```
|
69 |
+
|
70 |
+
### Training
|
71 |
+
|
72 |
+
If your model can be trained further, provide instructions for training:
|
73 |
+
|
74 |
+
```python
|
75 |
+
# Example training code
|
76 |
+
from transformers import Trainer, TrainingArguments
|
77 |
+
|
78 |
+
training_args = TrainingArguments(
|
79 |
+
output_dir="./results",
|
80 |
+
evaluation_strategy="epoch",
|
81 |
+
per_device_train_batch_size=8,
|
82 |
+
per_device_eval_batch_size=8,
|
83 |
+
num_train_epochs=3,
|
84 |
+
weight_decay=0.01,
|
85 |
+
)
|
86 |
+
|
87 |
+
trainer = Trainer(
|
88 |
+
model=model,
|
89 |
+
args=training_args,
|
90 |
+
train_dataset=train_dataset,
|
91 |
+
eval_dataset=eval_dataset,
|
92 |
+
)
|
93 |
+
|
94 |
+
trainer.train()
|
95 |
+
```
|
96 |
+
|
97 |
+
## Training Details
|
98 |
+
|
99 |
+
### Training Data
|
100 |
+
|
101 |
+
The model was fine-tuned on a dataset of conversational data from mental health therapy sessions. This dataset includes a variety of scenarios and responses typical of therapeutic interactions to ensure the model provides empathetic and helpful advice.
|
102 |
+
|
103 |
+
### Training Procedure
|
104 |
+
|
105 |
+
The model was fine-tuned using a standard training approach, optimizing for empathy and relevance in responses. Training was conducted on [describe hardware, e.g., GPUs, TPUs] over [number of epochs] epochs with [any relevant hyperparameters].
|
106 |
+
|
107 |
+
## Evaluation
|
108 |
+
|
109 |
+
### Metrics
|
110 |
+
|
111 |
+
The model was evaluated using the following metrics:
|
112 |
+
|
113 |
+
- **Accuracy**: X%
|
114 |
+
- **Empathy Score**: Y%
|
115 |
+
- **Relevance Score**: Z%
|
116 |
+
|
117 |
+
### Comparison
|
118 |
+
|
119 |
+
The performance of phi3 was benchmarked against other conversational models in the mental health domain, demonstrating superior empathy and contextual understanding.
|
120 |
+
|
121 |
+
## Limitations and Biases
|
122 |
+
|
123 |
+
While phi3 is highly effective, it may have limitations in the following areas:
|
124 |
+
- It may not be suitable for providing critical mental health interventions.
|
125 |
+
- There may be biases present in the training data that could affect responses.
|
126 |
+
|
127 |
+
## How to Contribute
|
128 |
+
|
129 |
+
We welcome contributions! Please see our [contributing guidelines](link_to_contributing_guidelines) for more information on how to contribute to this project.
|
130 |
+
|
131 |
+
## License
|
132 |
+
|
133 |
+
This model is licensed under the [MIT License](LICENSE).
|
134 |
+
|
135 |
+
## Acknowledgements
|
136 |
+
|
137 |
+
We would like to thank the contributors and the creators of the datasets used for training this model.
|
138 |
+
```
|
139 |
+
|
140 |
+
### Tips for Completing the Template
|
141 |
+
|
142 |
+
1. **Replace placeholders** (like `username`, `training data`, `evaluation metrics`) with your actual data.
|
143 |
+
2. **Include any additional information** specific to your model or training process.
|
144 |
+
3. **Keep the document updated** as the model evolves or more information becomes available.
|