Skip to content

Commit b07a6f4

Browse files
authored
[colossalqa] fix pangu api (#5170)
* fix pangu api * add comment
1 parent 21aa5de commit b07a6f4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

applications/ColossalQA/colossalqa/memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def load_memory_variables(self, inputs: Dict[str, Any]) -> Dict[str, str]:
154154
remain = self.max_tokens - prompt_length
155155
while self.get_conversation_length() > remain:
156156
if len(self.buffered_history.messages) <= 2:
157-
raise RuntimeError("Exeeed max_tokens, trunck size of retrieved documents is too large")
157+
raise RuntimeError("Exceed max_tokens, trunk size of retrieved documents is too large")
158158
temp = self.buffered_history.messages.pop(0)
159159
self.summarized_history_temp.messages.append(temp)
160160
temp = self.buffered_history.messages.pop(0)

applications/ColossalQA/examples/webui_demo/server.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,16 @@ def generate(data: GenerationTaskReq, request: Request):
7777
colossal_api = ColossalAPI(model_name, all_config["model"]["model_path"])
7878
llm = ColossalLLM(n=1, api=colossal_api)
7979
elif all_config["model"]["mode"] == "api":
80-
all_config["chain"]["mem_llm_kwargs"] = None
81-
all_config["chain"]["disambig_llm_kwargs"] = None
82-
all_config["chain"]["gen_llm_kwargs"] = None
8380
if model_name == "pangu_api":
8481
from colossalqa.local.pangu_llm import Pangu
85-
llm = Pangu(id=1)
82+
83+
gen_config = {
84+
"user": "User",
85+
"max_tokens": all_config["chain"]["disambig_llm_kwargs"]["max_new_tokens"],
86+
"temperature": all_config["chain"]["disambig_llm_kwargs"]["temperature"],
87+
"n": 1 # the number of responses generated
88+
}
89+
llm = Pangu(gen_config=gen_config)
8690
llm.set_auth_config() # verify user's auth info here
8791
elif model_name == "chatgpt_api":
8892
from langchain.llms import OpenAI

0 commit comments

Comments
 (0)