li-plus / chatglm.cpp

C++ implementation of ChatGLM-6B & ChatGLM2-6B & ChatGLM3 & GLM4
MIT License
2.84k stars 327 forks source link

Fix: Dockerfile Building Locally #239

Open wangzhe258369 opened 6 months ago

wangzhe258369 commented 6 months ago

https://github.com/li-plus/chatglm.cpp/blob/3286db5306c5d3245ea147082e69313010617a92/Dockerfile#L49-L58

需要修改如下:

  1. 添加/chatglm.cpp/build/lib,否则对于For CUDA supportmain程序,会缺少libggml.so
  2. pip install添加--pre,否则pip install -f dist 'chatglm-cpp[api]'会忽略dist目录下的新构建的Python包,而是下载编译 pypi 里的正式版本
COPY --from=build /chatglm.cpp/build/bin/main /chatglm.cpp/build/bin/main
COPY --from=build /chatglm.cpp/build/lib /chatglm.cpp/build/lib
COPY --from=build /chatglm.cpp/dist/ /chatglm.cpp/dist/

ADD examples examples

RUN \
    python3 -m pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip && \
    python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
    python3 -m pip install --no-cache-dir --pre -f dist 'chatglm-cpp[api]' && \
    rm -rf dist