Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -112,25 +112,6 @@ def initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db, pr
|
|
112 |
top_k = top_k,
|
113 |
load_in_8bit = True,
|
114 |
)
|
115 |
-
elif llm_model in ["HuggingFaceH4/zephyr-7b-gemma-v0.1","mosaicml/mpt-7b-instruct"]:
|
116 |
-
raise gr.Error("LLM model is too large to be loaded automatically on free inference endpoint")
|
117 |
-
llm = HuggingFaceEndpoint(
|
118 |
-
repo_id=llm_model,
|
119 |
-
temperature = temperature,
|
120 |
-
max_new_tokens = max_tokens,
|
121 |
-
top_k = top_k,
|
122 |
-
)
|
123 |
-
elif llm_model == "microsoft/phi-2":
|
124 |
-
raise gr.Error("phi-2 model requires 'trust_remote_code=True', currently not supported by langchain HuggingFaceHub...")
|
125 |
-
llm = HuggingFaceEndpoint(
|
126 |
-
repo_id=llm_model,
|
127 |
-
# model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k, "trust_remote_code": True, "torch_dtype": "auto"}
|
128 |
-
temperature = temperature,
|
129 |
-
max_new_tokens = max_tokens,
|
130 |
-
top_k = top_k,
|
131 |
-
trust_remote_code = True,
|
132 |
-
torch_dtype = "auto",
|
133 |
-
)
|
134 |
elif llm_model == "TinyLlama/TinyLlama-1.1B-Chat-v1.0":
|
135 |
llm = HuggingFaceEndpoint(
|
136 |
repo_id=llm_model,
|
@@ -182,7 +163,8 @@ def initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db, pr
|
|
182 |
retriever=retriever,
|
183 |
chain_type="stuff",
|
184 |
memory=memory,
|
185 |
-
|
|
|
186 |
return_source_documents=True,
|
187 |
#return_generated_question=False,
|
188 |
verbose=False,
|
|
|
112 |
top_k = top_k,
|
113 |
load_in_8bit = True,
|
114 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
elif llm_model == "TinyLlama/TinyLlama-1.1B-Chat-v1.0":
|
116 |
llm = HuggingFaceEndpoint(
|
117 |
repo_id=llm_model,
|
|
|
163 |
retriever=retriever,
|
164 |
chain_type="stuff",
|
165 |
memory=memory,
|
166 |
+
prompt = prompt_template,
|
167 |
+
#combine_docs_chain_kwargs={"prompt": prompt_template},
|
168 |
return_source_documents=True,
|
169 |
#return_generated_question=False,
|
170 |
verbose=False,
|