Spaces:
Runtime error
Runtime error
thomas-yanxin
commited on
Commit
·
ed22028
1
Parent(s):
38a1665
fix bug
Browse files
app.py
CHANGED
|
@@ -102,11 +102,13 @@ def get_knowledge_based_answer(query,
|
|
| 102 |
prompt = PromptTemplate(template=prompt_template,
|
| 103 |
input_variables=["context", "question"])
|
| 104 |
chatLLM = ChatLLM()
|
| 105 |
-
chatLLM.load_model(model_name_or_path=llm_model_dict[large_language_model])
|
| 106 |
chatLLM.history = chat_history[-history_len:] if history_len > 0 else []
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
knowledge_chain = RetrievalQA.from_llm(
|
| 112 |
llm=chatLLM,
|
|
@@ -177,14 +179,14 @@ if __name__ == "__main__":
|
|
| 177 |
large_language_model = gr.Dropdown(
|
| 178 |
list(llm_model_dict.keys()),
|
| 179 |
label="large language model",
|
| 180 |
-
value="ChatGLM-6B-
|
| 181 |
|
| 182 |
embedding_model = gr.Dropdown(list(embedding_model_dict.keys()),
|
| 183 |
label="Embedding model",
|
| 184 |
value="text2vec-base")
|
| 185 |
|
| 186 |
file = gr.File(label='请上传知识库文件',
|
| 187 |
-
file_types=['.txt', '.md', '.docx'
|
| 188 |
|
| 189 |
use_web = gr.Radio(["True", "False"], label="Web Search",
|
| 190 |
value="False"
|
|
|
|
| 102 |
prompt = PromptTemplate(template=prompt_template,
|
| 103 |
input_variables=["context", "question"])
|
| 104 |
chatLLM = ChatLLM()
|
|
|
|
| 105 |
chatLLM.history = chat_history[-history_len:] if history_len > 0 else []
|
| 106 |
+
if large_language_model == "Minimax":
|
| 107 |
+
chatLLM.model = 'Minimax'
|
| 108 |
+
else:
|
| 109 |
+
chatLLM.load_model(model_name_or_path=llm_model_dict[large_language_model])
|
| 110 |
+
chatLLM.temperature = temperature
|
| 111 |
+
chatLLM.top_p = top_p
|
| 112 |
|
| 113 |
knowledge_chain = RetrievalQA.from_llm(
|
| 114 |
llm=chatLLM,
|
|
|
|
| 179 |
large_language_model = gr.Dropdown(
|
| 180 |
list(llm_model_dict.keys()),
|
| 181 |
label="large language model",
|
| 182 |
+
value="ChatGLM-6B-int4")
|
| 183 |
|
| 184 |
embedding_model = gr.Dropdown(list(embedding_model_dict.keys()),
|
| 185 |
label="Embedding model",
|
| 186 |
value="text2vec-base")
|
| 187 |
|
| 188 |
file = gr.File(label='请上传知识库文件',
|
| 189 |
+
file_types=['.txt', '.md', '.docx'])
|
| 190 |
|
| 191 |
use_web = gr.Radio(["True", "False"], label="Web Search",
|
| 192 |
value="False"
|