-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.Python | ||
.env | ||
env | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
.tox | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.log | ||
.git | ||
.mypy_cache | ||
.pytest_cache | ||
.hypothesis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
trained/ | ||
ran/ | ||
.venv | ||
.ipynb_checkpoints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
ARG BASE_IMAGE=substratusai/base:latest | ||
FROM ${BASE_IMAGE} | ||
|
||
ENV MODEL_DIR="/content/saved-model" | ||
ENV HOST=0.0.0.0 | ||
ENV PORT=8080 | ||
|
||
WORKDIR /content | ||
|
||
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \ | ||
apt-get update && \ | ||
apt-get -y --no-install-recommends install \ | ||
python3 python3-pip git build-essential gcc wget \ | ||
ocl-icd-opencl-dev opencl-headers clinfo libclblast-dev libopenblas-dev && \ | ||
mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN ln -s /usr/bin/python3 /usr/bin/python | ||
|
||
# setting build related env vars | ||
ENV CUDA_DOCKER_ARCH=all | ||
ENV LLAMA_CUBLAS=1 | ||
|
||
# Install depencencies | ||
RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings | ||
|
||
# Install llama-cpp-python (build with cuda) | ||
RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python | ||
|
||
COPY scripts/ scripts/ | ||
|
||
CMD serve.sh | ||
EXPOSE $PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Substratus Server Llama.cpp | ||
|
||
This image can be used to serve models that are in GGML format. | ||
|
||
The image expects a single GGML model as a single bin file under the /content/saved-model/ directory. | ||
|
||
## Usage for testing | ||
|
||
### Building | ||
Build the image: | ||
```sh | ||
docker build -t substratusai/model-server-llama-cpp . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -xe | ||
|
||
ls ${MODEL_DIR} | ||
export MODEL=$(find "${MODEL_DIR}" -type f -iname "*.bin" | head -n 1) | ||
PYTHONUNBUFFERED=1 python3 -m llama_cpp.server |