Spaces:
Runtime error
Runtime error
feat: use microsoft phi-2
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ with open("vector_db/metadata.pkl", "rb") as f:
|
|
16 |
|
17 |
ST = SentenceTransformer("BAAI/bge-large-en-v1.5")
|
18 |
|
19 |
-
model_id = "
|
20 |
bnb = BitsAndBytesConfig(
|
21 |
load_in_4bit=True,
|
22 |
bnb_4bit_use_double_quant=True,
|
@@ -58,7 +58,7 @@ def retrieve(q, k=3):
|
|
58 |
|
59 |
def make_prompt(q, docs):
|
60 |
context = "\n\n".join(f"Title: {doc['title']}\nPages: {doc['pages']}" for doc in docs)
|
61 |
-
return f"{SYS}\n\nContext:\n{context}\n\nQuestion:\n{q}\n\
|
62 |
|
63 |
@spaces.GPU()
|
64 |
def qa_fn(question, top_k, temperature, max_tokens):
|
|
|
16 |
|
17 |
ST = SentenceTransformer("BAAI/bge-large-en-v1.5")
|
18 |
|
19 |
+
model_id = "microsoft/phi-2"
|
20 |
bnb = BitsAndBytesConfig(
|
21 |
load_in_4bit=True,
|
22 |
bnb_4bit_use_double_quant=True,
|
|
|
58 |
|
59 |
def make_prompt(q, docs):
|
60 |
context = "\n\n".join(f"Title: {doc['title']}\nPages: {doc['pages']}" for doc in docs)
|
61 |
+
return f"Instruct:{SYS}\n\nContext:\n{context}\n\nQuestion:\n{q}\n\nOutput:"
|
62 |
|
63 |
@spaces.GPU()
|
64 |
def qa_fn(question, top_k, temperature, max_tokens):
|