Skip to content

Commit

Permalink
Changes made to Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
casparemiljensen committed Dec 14, 2023
1 parent a2e0e0e commit 7aff7a5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ WORKDIR /code

COPY . .

# Install necessary build tools and dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
&& rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir -r requirements_docker.txt

CMD ["python", "-u", "-m", "server.server", "--host", "0.0.0.0", "--port", "4444", "--reload"]
4 changes: 2 additions & 2 deletions concept_linking/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Tools
#Requirements for LlamaServer
-r tools/LlamaServer/requirements.txt
#-r tools/LlamaServer/requirements.txt

#Requirements for OntologyGraphBuilder
-r tools/OntologyGraphBuilder/requirements.txt
#-r tools/OntologyGraphBuilder/requirements.txt

# Solutions
#Requirements for MachineLearning
Expand Down
16 changes: 10 additions & 6 deletions concept_linking/tools/LlamaServer/Dockerfile
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"]
12 changes: 5 additions & 7 deletions concept_linking/tools/LlamaServer/docker-compose.yml
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"

0 comments on commit 7aff7a5

Please sign in to comment.