Skip to content

Commit

Permalink
修复使用chatgpt等在线API服务时模型加载错误 (#1271)
Browse files Browse the repository at this point in the history
* close #1172: 给webui_page/utils添加一些log信息,方便定位错误

* 修复:重建知识库时页面未实时显示进度

* skip model_worker running when using online model api such as chatgpt

---------

Co-authored-by: liunux4odoo <liunu@qq.com>
  • Loading branch information
liunux4odoo and liunux4odoo committed Aug 27, 2023
1 parent 58d5787 commit 6ef8844
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion configs/model_config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ llm_model_dict = {
# 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI.
# 需要添加代理访问(正常开的代理软件可能会拦截不上)需要设置配置openai_proxy 或者 使用环境遍历OPENAI_PROXY 进行设置
"gpt-3.5-turbo": {
"local_model_path": "gpt-3.5-turbo",
"api_base_url": "https://api.openai.com/v1",
"api_key": os.environ.get("OPENAI_API_KEY"),
"openai_proxy": os.environ.get("OPENAI_PROXY")
Expand Down
18 changes: 10 additions & 8 deletions startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,16 @@ def dump_server_info(after_start=False):
processes["openai_api"] = process

if args.model_worker:
process = Process(
target=run_model_worker,
name=f"model_worker({os.getpid()})",
args=(args.model_name, args.controller_address, queue, len(processes) + 1),
daemon=True,
)
process.start()
processes["model_worker"] = process
model_path = llm_model_dict[args.model_name].get("local_model_path", "")
if os.path.isdir(model_path):
process = Process(
target=run_model_worker,
name=f"model_worker({os.getpid()})",
args=(args.model_name, args.controller_address, queue, len(processes) + 1),
daemon=True,
)
process.start()
processes["model_worker"] = process

if args.api:
process = Process(
Expand Down

0 comments on commit 6ef8844

Please sign in to comment.