1 Star 0 Fork 1

cdy1996 / langchain-ChatGLM_1

forked from novicel / langchain-ChatGLM 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
fastchat.md 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
imClumsyPanda 提交于 2023-05-31 22:50 . add fastchat.md

fastchat 调用实现教程

langchain-ChatGLM 现已支持通过调用 FastChat API 进行 LLM 调用,支持的 API 形式为 OpenAI API 形式

  1. 首先请参考 FastChat 官方文档 进行 FastChat OpenAI 形式 API 部署

  2. 依据 FastChat API 启用时的 model_nameapi_base 链接,在本项目的 configs/model_config.pyllm_model_dict 中增加选项。如:

    llm_model_dict = {
            
        # 通过 fastchat 调用的模型请参考如下格式
        "fastchat-chatglm-6b": {
            "name": "chatglm-6b",  # "name"修改为fastchat服务中的"model_name"
            "pretrained_model_name": "chatglm-6b",
            "local_model_path": None,
            "provides": "FastChatOpenAILLM",  # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLM"
            "api_base_url": "http://localhost:8000/v1"  # "name"修改为fastchat服务中的"api_base_url"
        },
    }

    其中 api_base_url 根据 FastChat 部署时的 ip 地址和端口号得到,如 ip 地址设置为 localhost,端口号为 8000,则应设置的 api_base_urlhttp://localhost:8000/v1

  3. configs/model_config.py 中的 LLM_MODEL 修改为对应模型名。如:

    LLM_MODEL = "fastchat-chatglm-6b"
  4. 根据需求运行 api.py, cli_demo.pywebui.py

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/cdy1996/langchain-ChatGLM_1.git
git@gitee.com:cdy1996/langchain-ChatGLM_1.git
cdy1996
langchain-ChatGLM_1
langchain-ChatGLM_1
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891