Spaces:
Sleeping
Sleeping
Commit
·
2e856b1
1
Parent(s):
94fb59c
Update app.py
Browse files
app.py
CHANGED
@@ -18,12 +18,11 @@ secret_key = os.getenv("HUGGINGFACE_ACCESS_TOKEN")
|
|
18 |
|
19 |
from torch import nn
|
20 |
|
21 |
-
|
22 |
-
from transformers import
|
23 |
|
24 |
-
|
25 |
-
model = AutoModelForCausalLM.from_pretrained("
|
26 |
-
model = PeftModel.from_pretrained(model, "tmberooney/medllama", use_auth_token=secret_key)
|
27 |
device_map = {"transformer.word_embeddings": "cpu",
|
28 |
"transformer.word_embeddings_layernorm": "cpu",
|
29 |
"lm_head": "cpu",
|
@@ -54,7 +53,7 @@ llama_pipeline = pipeline(
|
|
54 |
)
|
55 |
|
56 |
SYSTEM_PROMPT = """<s>[INST] <<SYS>>
|
57 |
-
|
58 |
<</SYS>>
|
59 |
|
60 |
"""
|
|
|
18 |
|
19 |
from torch import nn
|
20 |
|
21 |
+
# Load model directly
|
22 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
23 |
|
24 |
+
tokenizer = AutoTokenizer.from_pretrained("tmberooney/medllama-merged")
|
25 |
+
model = AutoModelForCausalLM.from_pretrained("tmberooney/medllama-merged")
|
|
|
26 |
device_map = {"transformer.word_embeddings": "cpu",
|
27 |
"transformer.word_embeddings_layernorm": "cpu",
|
28 |
"lm_head": "cpu",
|
|
|
53 |
)
|
54 |
|
55 |
SYSTEM_PROMPT = """<s>[INST] <<SYS>>
|
56 |
+
ou are a Doctor, Who is trained to listen to patients claims about what they have been feeling. You are to notice their sypmtoms, the medications they have been taking and their medical history. Based on this You have made a appropriate Diagnosis.
|
57 |
<</SYS>>
|
58 |
|
59 |
"""
|