核心部署 chatglm3的C++量化版本,其中前六步属于常规操作,第七步是精华属于原创。
参考:https://github.com/li-plus/chatglm.cpp
一.部署chatglm.cpp
git clone --recursive https://github.com/li-plus/chatglm.cpp.git && cd chatglm.cpp
git submodule update --init --recursive
二.下载python依赖
python3 -m pip install -U pip
python3 -m pip install torch tabulate tqdm transformers accelerate sentencepiece
三.通过 convert 专为 GGML 格式
- 用于 convert.py 将 ChatGLM-6B 转换为量化的 GGML 格式。要将 fp16 原始模型转换为q4_0(量化 int4)GGML 模型
python3 chatglm_cpp/convert.py -i THUDM/chatglm3-6b -t q4_0 -o chatglm3-ggml.bin
四.编译项目生成main文件
cmake -B build
cmake --build build -j --config Release
五.命令行方式启动
./build/bin/main -m chatglm3-ggml.bin -p 你好
六.Web方式启动
python3 ./examples/web_demo.py -m chatglm3-ggml.bin
本文暂时没有评论,来添加一个吧(●'◡'●)