Spaces:
Runtime error
Runtime error
Commit
Β·
0d80a1b
1
Parent(s):
c192860
trying other model
Browse files- backend.py +9 -1
backend.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import torch
|
| 2 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
|
| 4 |
class MedicalAssistant:
|
| 5 |
def __init__(self, model_name="sethuiyer/Medichat-Llama3-8B", device="cuda"):
|
|
@@ -10,6 +10,14 @@ class MedicalAssistant:
|
|
| 10 |
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
|
| 11 |
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
|
| 12 |
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def format_prompt(self, question):
|
| 15 |
messages = [
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModel
|
| 3 |
|
| 4 |
class MedicalAssistant:
|
| 5 |
def __init__(self, model_name="sethuiyer/Medichat-Llama3-8B", device="cuda"):
|
|
|
|
| 10 |
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
|
| 11 |
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
|
| 12 |
'''
|
| 13 |
+
def __init__(self, model_name="sethuiyer/Medichat-Llama3-8B", device="cuda"):
|
| 14 |
+
# self.tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 15 |
+
# self.model = AutoModelForCausalLM.from_pretrained(model_name).to(self.device)
|
| 16 |
+
self.model = AutoModel.from_pretrained("ThisIs-Developer/Llama-2-GGML-Medical-Chatbot")
|
| 17 |
+
self.sys_message = '''
|
| 18 |
+
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
|
| 19 |
+
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
|
| 20 |
+
'''
|
| 21 |
|
| 22 |
def format_prompt(self, question):
|
| 23 |
messages = [
|