forked from abetlen/llama-cpp-python
-
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.
Merge pull request #2 from ZenHubHQ/llm-monitoring
Use 'ai_service' parameter to differentiate Prometheus metrics
- Loading branch information
Showing
11 changed files
with
184 additions
and
41 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,44 @@ | ||
# Define the image argument and provide a default value | ||
ARG IMAGE=python:3.11.8 | ||
|
||
# Use the image as specified | ||
FROM ${IMAGE} | ||
|
||
# Re-declare the ARG after FROM | ||
ARG IMAGE | ||
|
||
# Update and upgrade the existing packages | ||
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \ | ||
python3 \ | ||
python3-pip \ | ||
ninja-build \ | ||
libopenblas-dev \ | ||
build-essential \ | ||
git | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY . /app | ||
|
||
RUN python3 -m pip install --upgrade pip | ||
|
||
RUN make deps && make build && make clean | ||
|
||
# Set environment variable for the host | ||
ENV GH_TOKEN=$GH_TOKEN | ||
ENV HOST=0.0.0.0 | ||
ENV PORT=8000 | ||
ENV MODEL=/app/models/mistral-7b-openorca.Q5_K_M.gguf | ||
|
||
# # Install depencencies | ||
# RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings starlette-context psutil prometheus_client | ||
|
||
# # Install llama-cpp-python (build with METAL) | ||
# RUN CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 pip install git+https://${GH_TOKEN}@github.com/ZenHubHQ/llama-cpp-python.git --force-reinstall --upgrade --no-cache-dir --verbose | ||
|
||
# Expose a port for the server | ||
EXPOSE 8000 | ||
|
||
# Run the server start script | ||
CMD ["/bin/sh", "/app/docker/simple/run.sh"] | ||
# CMD python3 -m llama_cpp.server --n_gpu_layers -1 |
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,15 @@ | ||
version: '3' | ||
services: | ||
dev-llama-cpp-python: | ||
build: | ||
context: . | ||
dockerfile: dev.Dockerfile | ||
ports: | ||
- 8000:8000 | ||
volumes: | ||
- ./llama_cpp:/app/llama_cpp | ||
networks: | ||
- zh-service-network | ||
networks: | ||
zh-service-network: | ||
external: true |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/bash | ||
|
||
make build | ||
uvicorn --factory llama_cpp.server.app:create_app --host $HOST --port $PORT | ||
# uvicorn --factory llama_cpp.server.app:create_app --host $HOST --port $PORT --reload | ||
python3 -m llama_cpp.server --model $MODEL --n_gpu_layers -1 |
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
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
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
Oops, something went wrong.