zementalist
commited on
Commit
•
5189f32
1
Parent(s):
ccf61ca
Update README.md
Browse files
README.md
CHANGED
@@ -70,18 +70,29 @@ If applicable, mention any limitations of the model, such as inability to diagno
|
|
70 |
## How to Get Started with the Model
|
71 |
Use the code below to get started with the model.
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
```
|
74 |
|
75 |
-
|
|
|
76 |
|
77 |
-
|
78 |
-
model = AutoModel.from_pretrained("zementalist/llama-3-8B-chat-psychotherapist")
|
79 |
|
80 |
-
|
81 |
|
82 |
messages = [
|
83 |
-
{"role": "system", "content": "
|
84 |
-
{"role": "user", "content":
|
85 |
]
|
86 |
|
87 |
input_ids = tokenizer.apply_chat_template(
|
|
|
70 |
## How to Get Started with the Model
|
71 |
Use the code below to get started with the model.
|
72 |
|
73 |
+
### Read model
|
74 |
+
|
75 |
+
```
|
76 |
+
from peft import PeftModel, PeftConfig
|
77 |
+
from transformers import AutoModelForCausalLM
|
78 |
+
|
79 |
+
model_id = "zementalist/llama-3-8B-chat-psychotherapist"
|
80 |
+
config = PeftConfig.from_pretrained(model_id)
|
81 |
+
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path)
|
82 |
+
model = PeftModel.from_pretrained(model, model_id)
|
83 |
+
|
84 |
```
|
85 |
|
86 |
+
### Inference
|
87 |
+
|
88 |
|
89 |
+
```
|
|
|
90 |
|
91 |
+
question = "I feel like I don't exist and my body is not my own, I'm sombody else observing me, what causes these ideas?"
|
92 |
|
93 |
messages = [
|
94 |
+
{"role": "system", "content": "Answer the following inquiry:"},
|
95 |
+
{"role": "user", "content": question}
|
96 |
]
|
97 |
|
98 |
input_ids = tokenizer.apply_chat_template(
|