-
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
1 parent
a2e0e0e
commit 7aff7a5
Showing
4 changed files
with
17 additions
and
21 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
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,22 +1,26 @@ | ||
# Use python as base image | ||
FROM python | ||
|
||
FROM python:3.11-slim | ||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy only the necessary files | ||
COPY llama_cpu_server.py . | ||
COPY requirements.txt . | ||
|
||
#Install necessary build tools and dependencies for running C++(llama_cpp) | ||
# This can be removed when app is in production and remote llama api server is reliable and used instead of local llama | ||
# Install dependencies and curl | ||
RUN apt-get update && apt-get install -y build-essential cmake curl && rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
# Install dependencies | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Check if the model file exists, and if not, download it using the provided function | ||
RUN python -c "from llama_cpu_server import download_model; download_model('llama-2-7b-chat.Q2_K.gguf', 'https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q2_K.gguf?download=true')" | ||
|
||
# Download the model file from the URL if it doesn't exist | ||
RUN test -e /app/llama-2-7b-chat.Q2_K.gguf || curl -o llama-2-7b-chat.Q2_K.gguf -LJO 'https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q2_K.gguf?download=true' | ||
|
||
# Expose port 5000 outside of the container | ||
EXPOSE 5000 | ||
|
||
# Run llama_cpu_server.py when the container launches | ||
CMD ["python", "llama_cpu_server.py"] | ||
CMD ["python", "-u", "-m", "llama_cpu_server", "--host", "0.0.0.0", "--port", "5000", "--reload"] |
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,11 +1,9 @@ | ||
version: '3' | ||
|
||
services: | ||
llama-cpu-server: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "5000:5000" | ||
build: . | ||
container_name: llama-server | ||
command: python -u -m llama_cpu_server --host 0.0.0.0 --port 5000 --reload | ||
volumes: | ||
- ./concept_linking/tools/LlamaServer/llama-2-7b-chat.Q2_K.gguf:/app/concept_linking/tools/LlamaServer/llama-2-7b-chat.Q2_K.gguf | ||
ports: | ||
- "5000:5000" |