Skip to content

Commit 0c41b7f

Browse files
committed
Single-file Deployment
Add libggml.so and libllama.so under `llama_cpp/lib` (path expected in `_load_shared_library` in `llama_cpp.py`). This means that will be able to locate once bundled. Also prevent from adding *full* OpenBLAS dir (unnecessary) and just the `libopenblas.so` onece built. This shrinks binary size from 200 MB to 40 MB.
1 parent 93f8c88 commit 0c41b7f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN mv /OpenBLAS /opt/OpenBLAS && cd /opt/OpenBLAS && make install PREFIX=/usr/
1515
RUN PKG_CONFIG_PATH="/opt/OpenBLAS/install/lib/pkgconfig" CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DGGML_LLAMAFILE=1" pip install -e .[server]
1616

1717
RUN cd /root && pyinstaller -DF /llama_cpp/server/__main__.py \
18-
--add-data /opt/OpenBLAS/:. \
19-
--add-data /llama_cpp/:. \
18+
--add-data /usr/lib/libopenblas.so:. \
19+
--add-data /llama_cpp/lib/libllama.so:llama_cpp/lib \
20+
--add-data /llama_cpp/lib/libggml.so:llama_cpp/lib \
2021
-n llama-cpp-py-server

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ deploy.docker:
6969
CONTAINER_ID=$$(docker ps -lq --filter ancestor=openblas_server_$(COMMIT)) ; \
7070
echo Container ID: $$CONTAINER_ID ; \
7171
docker cp $$CONTAINER_ID:/root/dist/llama-cpp-py-server - | pigz -9 > llama-cpp-py-server.tgz ; \
72-
docker cp $$CONTAINER_ID:/llama_cpp/lib/libllama.so - | pigz -9 > libllama.so.tgz ; \
7372
docker rm $$CONTAINER_ID
7473

7574
# More cleanup

0 commit comments

Comments
 (0)