匿名用户2024年07月31日
58阅读

技术信息

开源地址
https://modelscope.cn/models/hankwang/chatglm.cpp
授权协议
Apache License 2.0

作品详情

模型文件和权重,请浏览“模型文件”页面获取。
当前模型的贡献者未提供更加详细的模型介绍,但是您可以通过如下git cloe命令,或者ModelScope SDK来下载模型。
Cloe with HTTP
git cloe https://www.modelscope.c/hakwag/chatglm.cpp.git
如果您是本模型的贡献者,我们邀请您根据模型贡献文档说明,及时完善模型卡片内容。

API Server

We support various kids of API servers to itegrate with popular froteds. Extra depedecies ca be istalled by:

pip istall 'chatglm-cpp[api]'

Remember to add the correspodig CMAKE_ARGS to eable acceleratio.

LagChai API

Start the api server for LagChai:

MODEL=./chatglm-ggml.bi uvicor chatglm_cpp.lagchai_api:app --host 127.0.0.1 --port 8000

Test the api edpoit with curl:

curl http://127.0.0.1:8000 -H 'Cotet-Type: applicatio/jso' -d '{"prompt": "你好"}'

Ru with LagChai:

>>> from lagchai.llms import ChatGLM
>>> 
>>> llm = ChatGLM(edpoit_url="http://127.0.0.1:8000")
>>> llm.predict("你好")
'你好?!我是人工智能助手 ChatGLM2-6B,很高兴见到你,欢迎问我任何问题。'

For more optios, please refer to examples/lagchai_cliet.py ad LagChai ChatGLM Itegratio.

OpeAI API

Start a API server compatible with OpeAI chat completios protocol:

MODEL=./chatglm-ggml.bi uvicor chatglm_cpp.opeai_api:app --host 0.0.0.0 --port 8000
或
MODEL=./chatglm-ggml.bi daphe chatglm_cpp.opeai_api:app --b 127.0.0.1 --port 8000

Test your edpoit with curl:

curl http://127.0.0.1:8000/v1/chat/completios -H 'Cotet-Type: applicatio/jso' \
    -d '{"messages": [{"role": "user", "cotet": "你好"}]}'

Use the OpeAI cliet to chat with your model:

>>> import opeai
>>> 
>>> opeai.api_base = "http://127.0.0.1:8000/v1"
>>> respose = opeai.ChatCompletio.create(model="default-model", messages=[{"role": "user", "cotet": "你好"}])
>>> respose["choices"][0]["message"]["cotet"]
'你好?!我是人工智能助手 ChatGLM2-6B,很高兴见到你,欢迎问我任何问题。'

For stream respose, check out the example cliet script:

OPENAI_API_BASE=http://127.0.0.1:8000/v1 pytho3 examples/opeai_cliet.py --stream --prompt 你好

With this API server as backed, ChatGLM.cpp models ca be seamlessly itegrated ito ay froted that uses OpeAI-style API, icludig mckaywrigley/chatbot-ui, fuergaosi233/wechat-chatgpt, Yidadaa/ChatGPT-Next-Web, ad more.

功能介绍

模型文件和权重,请浏览“模型文件”页面获取。 当前模型的贡献者未提供更加详细的模型介绍,但是您可以通过如下git clone命令,或者ModelScope SDK来下载模型。 Clone with H

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论