adityakumar commited on
Commit
8534ef7
1 Parent(s): 328d783

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -89,8 +89,17 @@ def main():
89
 
90
  # loading remote llama model
91
  #llm = LlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf")
92
- llm = AutoModelForCausalLM.from_pretrained("google/gemma-1.1-2b-it")
93
 
 
 
 
 
 
 
 
 
 
94
  # custom prompt
95
  custom_template="""
96
  You are a smart personal assistant and your task is to provide the answer of the given question based only on the given context. \n
@@ -111,7 +120,7 @@ Helpful Answer:
111
  qa = ConversationalRetrievalChain.from_llm(llm,
112
  #chain_type = "stuff",
113
  chain_type = "stuff",
114
- verbose=True,
115
  #retriever=docsearch.as_retriever()
116
  retriever=docsearch.as_retriever(search_kwargs = {"k" : 4, "search_type" : "similarity"}),
117
  combine_docs_chain_kwargs={"prompt": QA_PROMPT}
 
89
 
90
  # loading remote llama model
91
  #llm = LlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf")
92
+ #llm = AutoModelForCausalLM.from_pretrained("google/gemma-1.1-2b-it")
93
 
94
+ token = os.environ["HF_TOKEN"]
95
+ llm = AutoModelForCausalLM.from_pretrained(
96
+ "google/gemma-7b-it",
97
+ # torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
98
+ torch_dtype=torch.float16,
99
+ token=token,
100
+ )
101
+
102
+
103
  # custom prompt
104
  custom_template="""
105
  You are a smart personal assistant and your task is to provide the answer of the given question based only on the given context. \n
 
120
  qa = ConversationalRetrievalChain.from_llm(llm,
121
  #chain_type = "stuff",
122
  chain_type = "stuff",
123
+ #verbose=True,
124
  #retriever=docsearch.as_retriever()
125
  retriever=docsearch.as_retriever(search_kwargs = {"k" : 4, "search_type" : "similarity"}),
126
  combine_docs_chain_kwargs={"prompt": QA_PROMPT}