From 90fe40b22106fdf53907318fc683cf8ef7813291 Mon Sep 17 00:00:00 2001 From: hzg0601 Date: Wed, 19 Jul 2023 10:00:23 +0800 Subject: [PATCH] debug for fastchat_openai_llm --- configs/model_config.py | 9 +++++++++ models/fastchat_openai_llm.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configs/model_config.py b/configs/model_config.py index 2e0f042c..0b3c7fb5 100644 --- a/configs/model_config.py +++ b/configs/model_config.py @@ -154,6 +154,15 @@ llm_model_dict = { "provides": "FastChatOpenAILLMChain", # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLMChain" "api_base_url": "http://localhost:8000/v1", # "name"修改为fastchat服务中的"api_base_url" "api_key": "EMPTY" + }, + # 通过 fastchat 调用的模型请参考如下格式 + "fastchat-chatglm-6b-int4": { + "name": "chatglm-6b-int4", # "name"修改为fastchat服务中的"model_name" + "pretrained_model_name": "chatglm-6b-int4", + "local_model_path": None, + "provides": "FastChatOpenAILLMChain", # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLMChain" + "api_base_url": "http://localhost:8001/v1", # "name"修改为fastchat服务中的"api_base_url" + "api_key": "EMPTY" }, "fastchat-chatglm2-6b": { "name": "chatglm2-6b", # "name"修改为fastchat服务中的"model_name" diff --git a/models/fastchat_openai_llm.py b/models/fastchat_openai_llm.py index 398364bd..4a7f342d 100644 --- a/models/fastchat_openai_llm.py +++ b/models/fastchat_openai_llm.py @@ -140,7 +140,7 @@ class FastChatOpenAILLMChain(RemoteRpcModel, Chain, ABC): # create a chat completion completion = openai.ChatCompletion.create( model=self.model_name, - messages=build_message_list(prompt) + messages=build_message_list(prompt,history=history) ) print(f"response:{completion.choices[0].message.content}") print(f"+++++++++++++++++++++++++++++++++++")