arsiba commited on
Commit
debd23a
Β·
1 Parent(s): b4ecbb9

feat: use microsoft phi-2

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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 = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
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\nAnswer:"
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):