Spaces:
Runtime error
Runtime error
Volker Janz
commited on
Commit
·
ce2e69b
1
Parent(s):
308ee31
Add adapter
Browse files- app.py +5 -2
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
from transformers import
|
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
@@ -7,7 +8,9 @@ title = "Mental Health Chatbot"
|
|
7 |
description = "This bot is using a fine-tuned version of meta-llama/Llama-2-7b-chat-hf"
|
8 |
|
9 |
tokenizer = AutoTokenizer.from_pretrained("vojay/Llama-2-7b-chat-hf-mental-health")
|
10 |
-
model =
|
|
|
|
|
11 |
|
12 |
|
13 |
def predict(input, history=[]):
|
|
|
1 |
+
from transformers import AutoTokenizer
|
2 |
+
from adapters import AutoAdapterModel
|
3 |
import gradio as gr
|
4 |
import torch
|
5 |
|
|
|
8 |
description = "This bot is using a fine-tuned version of meta-llama/Llama-2-7b-chat-hf"
|
9 |
|
10 |
tokenizer = AutoTokenizer.from_pretrained("vojay/Llama-2-7b-chat-hf-mental-health")
|
11 |
+
model = AutoAdapterModel.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
|
12 |
+
adapter = model.load_adapter("vojay/Llama-2-7b-chat-hf-mental-health")
|
13 |
+
model.active_adapters = adapter
|
14 |
|
15 |
|
16 |
def predict(input, history=[]):
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
transformers
|
|
|
2 |
torch
|
|
|
1 |
transformers
|
2 |
+
adapters
|
3 |
torch
|