From 6700b0ced7ad2c069ff6b66039c7dd99bd617df1 Mon Sep 17 00:00:00 2001 From: Julien Date: Sun, 14 May 2023 15:05:38 +0200 Subject: [PATCH 01/19] addd dockerfile and dockercompose update readme --- .gitignore | 4 ---- Dockerfile | 11 +++++++++++ README.md | 19 +++++++++++++++++++ db/.gitignore | 3 +++ db/.gitkeep | 0 docker-compose-ingest.yaml | 16 ++++++++++++++++ docker-compose.yaml | 14 ++++++++++++++ models/.gitignore | 3 +++ models/.gitkeep | 0 source_documents/.gitignore | 3 +++ source_documents/.gitkeep | 0 constants.py => src/constants.py | 0 example.env => src/example.env | 0 ingest.py => src/ingest.py | 0 privateGPT.py => src/privateGPT.py | 0 requirements.txt => src/requirements.txt | 0 16 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 Dockerfile create mode 100644 db/.gitignore create mode 100644 db/.gitkeep create mode 100644 docker-compose-ingest.yaml create mode 100644 docker-compose.yaml create mode 100644 models/.gitignore create mode 100644 models/.gitkeep create mode 100644 source_documents/.gitignore create mode 100644 source_documents/.gitkeep rename constants.py => src/constants.py (100%) rename example.env => src/example.env (100%) rename ingest.py => src/ingest.py (100%) rename privateGPT.py => src/privateGPT.py (100%) rename requirements.txt => src/requirements.txt (100%) diff --git a/.gitignore b/.gitignore index 240b29e5a..7c344d69a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,8 @@ # OSX .DS_STORE -# Models -models/ - # Local Chroma db .chroma/ -db/ # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..051c35d74 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.10.11 + +RUN groupadd -g 10009 -o privategpt && useradd -m -u 10009 -g 10009 -o -s /bin/bash privategpt +USER privategpt +WORKDIR /home/privategpt + +COPY ./src src + +RUN cd src && pip install -r requirements.txt + +# ENTRYPOINT ["python", "src/privateGPT.py"] \ No newline at end of file diff --git a/README.md b/README.md index ee27a9022..3eab8e42f 100644 --- a/README.md +++ b/README.md @@ -104,5 +104,24 @@ To install a C++ compiler on Windows 10/11, follow these steps: 3. Download the MinGW installer from the [MinGW website](https://sourceforge.net/projects/mingw/). 4. Run the installer and select the `gcc` component. +## Docker Version + +1. Build the image +``` +docker build . -t privategpt:test +``` + +2. Put your data in models / source_documents in the project root folder (Can be customized changing the corresponding value in the docker-compose.yaml) + +3. You can ingest your data using the docker-compose-ingest.yaml + ``` + docker compose -f docker-compose-ingest.yaml up + ``` + +4. You run it using the docker-compose.yaml + ``` + docker-compose run --rm privategpt + ``` + # Disclaimer This is a test project to validate the feasibility of a fully private solution for question answering using LLMs and Vector embeddings. It is not production ready, and it is not meant to be used in production. The models selection is not optimized for performance, but for privacy; but it is possible to use different models and vectorstores to improve performance. diff --git a/db/.gitignore b/db/.gitignore new file mode 100644 index 000000000..03188767c --- /dev/null +++ b/db/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.gitkeep \ No newline at end of file diff --git a/db/.gitkeep b/db/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/docker-compose-ingest.yaml b/docker-compose-ingest.yaml new file mode 100644 index 000000000..fc67db4ac --- /dev/null +++ b/docker-compose-ingest.yaml @@ -0,0 +1,16 @@ +version: "3.9" +services: + privategpt-ingest: + image: privategpt:test + command: [ "python", "src/ingest.py" ] + environment: + - PERSIST_DIRECTORY=/home/privategpt/db + - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin + - MODEL_TYPE=GPT4All + - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin + - MODEL_N_CTX=1000 + - SOURCE_DIRECTORY=/home/privategpt/source_documents + volumes: + - ./models:/home/privategpt/models + - ./source_documents:/home/privategpt/source_documents + - ./db:/home/privategpt/db diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..515fe5f57 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,14 @@ +version: "3.9" +services: + privategpt: + image: privategpt:test + command: [ "python", "src/privateGPT.py" ] + environment: + - PERSIST_DIRECTORY=/home/privategpt/db + - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin + - MODEL_TYPE=GPT4All + - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin + - MODEL_N_CTX=1000 + volumes: + - ./models:/home/privategpt/models + - ./db:/home/privategpt/db diff --git a/models/.gitignore b/models/.gitignore new file mode 100644 index 000000000..03188767c --- /dev/null +++ b/models/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.gitkeep \ No newline at end of file diff --git a/models/.gitkeep b/models/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/source_documents/.gitignore b/source_documents/.gitignore new file mode 100644 index 000000000..03188767c --- /dev/null +++ b/source_documents/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.gitkeep \ No newline at end of file diff --git a/source_documents/.gitkeep b/source_documents/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/constants.py b/src/constants.py similarity index 100% rename from constants.py rename to src/constants.py diff --git a/example.env b/src/example.env similarity index 100% rename from example.env rename to src/example.env diff --git a/ingest.py b/src/ingest.py similarity index 100% rename from ingest.py rename to src/ingest.py diff --git a/privateGPT.py b/src/privateGPT.py similarity index 100% rename from privateGPT.py rename to src/privateGPT.py diff --git a/requirements.txt b/src/requirements.txt similarity index 100% rename from requirements.txt rename to src/requirements.txt From 77ae6483b373bc7ade54e9b04bb492057d2f7b81 Mon Sep 17 00:00:00 2001 From: JulienA Date: Mon, 15 May 2023 11:28:31 +0200 Subject: [PATCH 02/19] build-in compose --- docker-compose-ingest.yaml | 33 +++++++++++++++++---------------- docker-compose.yaml | 29 +++++++++++++++-------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/docker-compose-ingest.yaml b/docker-compose-ingest.yaml index fc67db4ac..a360456e7 100644 --- a/docker-compose-ingest.yaml +++ b/docker-compose-ingest.yaml @@ -1,16 +1,17 @@ -version: "3.9" -services: - privategpt-ingest: - image: privategpt:test - command: [ "python", "src/ingest.py" ] - environment: - - PERSIST_DIRECTORY=/home/privategpt/db - - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin - - MODEL_TYPE=GPT4All - - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin - - MODEL_N_CTX=1000 - - SOURCE_DIRECTORY=/home/privategpt/source_documents - volumes: - - ./models:/home/privategpt/models - - ./source_documents:/home/privategpt/source_documents - - ./db:/home/privategpt/db +version: "3.9" +services: + privategpt-ingest: + build: . + image: privategpt:test + command: [ "python", "src/ingest.py" ] + environment: + - PERSIST_DIRECTORY=/home/privategpt/db + - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin + - MODEL_TYPE=GPT4All + - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin + - MODEL_N_CTX=1000 + - SOURCE_DIRECTORY=/home/privategpt/source_documents + volumes: + - ./models:/home/privategpt/models + - ./source_documents:/home/privategpt/source_documents + - ./db:/home/privategpt/db diff --git a/docker-compose.yaml b/docker-compose.yaml index 515fe5f57..cb41cafab 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,14 +1,15 @@ -version: "3.9" -services: - privategpt: - image: privategpt:test - command: [ "python", "src/privateGPT.py" ] - environment: - - PERSIST_DIRECTORY=/home/privategpt/db - - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin - - MODEL_TYPE=GPT4All - - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin - - MODEL_N_CTX=1000 - volumes: - - ./models:/home/privategpt/models - - ./db:/home/privategpt/db +version: "3.9" +services: + privategpt: + build: . + image: privategpt:test + command: [ "python", "src/privateGPT.py" ] + environment: + - PERSIST_DIRECTORY=/home/privategpt/db + - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin + - MODEL_TYPE=GPT4All + - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin + - MODEL_N_CTX=1000 + volumes: + - ./models:/home/privategpt/models + - ./db:/home/privategpt/db From df37b0992f95148efa4edad91b146f5fcf9e88cb Mon Sep 17 00:00:00 2001 From: JulienA Date: Mon, 15 May 2023 11:42:41 +0200 Subject: [PATCH 03/19] dockerfile --- Dockerfile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 051c35d74..9a9adf530 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ -FROM python:3.10.11 - -RUN groupadd -g 10009 -o privategpt && useradd -m -u 10009 -g 10009 -o -s /bin/bash privategpt -USER privategpt -WORKDIR /home/privategpt - -COPY ./src src - -RUN cd src && pip install -r requirements.txt - +FROM python:3.10.11 + +RUN groupadd -g 10009 -o privategpt && useradd -m -u 10009 -g 10009 -o -s /bin/bash privategpt +USER privategpt +WORKDIR /home/privategpt + +COPY ./src/requirements.txt src/requirements.txt +RUN pip install -r src/requirements.txt + +COPY ./src src + # ENTRYPOINT ["python", "src/privateGPT.py"] \ No newline at end of file From dff73aaac78bb565a6b0ee45c0f841bf368c7cb2 Mon Sep 17 00:00:00 2001 From: JulienA Date: Mon, 15 May 2023 19:42:30 +0200 Subject: [PATCH 04/19] using env for compose --- docker-compose-ingest.yaml | 18 +++++++++--------- docker-compose.yaml | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docker-compose-ingest.yaml b/docker-compose-ingest.yaml index a360456e7..f6b03b225 100644 --- a/docker-compose-ingest.yaml +++ b/docker-compose-ingest.yaml @@ -5,13 +5,13 @@ services: image: privategpt:test command: [ "python", "src/ingest.py" ] environment: - - PERSIST_DIRECTORY=/home/privategpt/db - - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin - - MODEL_TYPE=GPT4All - - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin - - MODEL_N_CTX=1000 - - SOURCE_DIRECTORY=/home/privategpt/source_documents + - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} + - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} + - MODEL_TYPE=${MODEL_TYPE:-GPT4All} + - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} + - MODEL_N_CTX=${MODEL_N_CTX:-1000} + - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} volumes: - - ./models:/home/privategpt/models - - ./source_documents:/home/privategpt/source_documents - - ./db:/home/privategpt/db + - ${MODEL_MOUNT:-./models}:/home/privategpt/models + - ${PERSIST_MOUNT:-./db}:/home/privategpt/db + - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents diff --git a/docker-compose.yaml b/docker-compose.yaml index cb41cafab..4365cfb34 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,11 +5,11 @@ services: image: privategpt:test command: [ "python", "src/privateGPT.py" ] environment: - - PERSIST_DIRECTORY=/home/privategpt/db - - LLAMA_EMBEDDINGS_MODEL=/home/privategpt/models/ggml-model-q4_0.bin - - MODEL_TYPE=GPT4All - - MODEL_PATH=/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin - - MODEL_N_CTX=1000 + - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} + - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} + - MODEL_TYPE=${MODEL_TYPE:-GPT4All} + - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} + - MODEL_N_CTX=${MODEL_N_CTX:-1000} volumes: - - ./models:/home/privategpt/models - - ./db:/home/privategpt/db + - ${MODEL_MOUNT:-./models}:/home/privategpt/models + - ${PERSIST_MOUNT:-./db}:/home/privategpt/db From 1a5c7dcc0abbff3ef76afb4d098a012a1754ccaa Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 15 May 2023 20:59:31 +0200 Subject: [PATCH 05/19] unix style --- Dockerfile | 22 +++++++++++----------- docker-compose-ingest.yaml | 34 +++++++++++++++++----------------- docker-compose.yaml | 30 +++++++++++++++--------------- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9a9adf530..5bfdd981d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM python:3.10.11 - -RUN groupadd -g 10009 -o privategpt && useradd -m -u 10009 -g 10009 -o -s /bin/bash privategpt -USER privategpt -WORKDIR /home/privategpt - -COPY ./src/requirements.txt src/requirements.txt -RUN pip install -r src/requirements.txt - -COPY ./src src - +FROM python:3.10.11 + +RUN groupadd -g 10009 -o privategpt && useradd -m -u 10009 -g 10009 -o -s /bin/bash privategpt +USER privategpt +WORKDIR /home/privategpt + +COPY ./src/requirements.txt src/requirements.txt +RUN pip install -r src/requirements.txt + +COPY ./src src + # ENTRYPOINT ["python", "src/privateGPT.py"] \ No newline at end of file diff --git a/docker-compose-ingest.yaml b/docker-compose-ingest.yaml index f6b03b225..2be704d11 100644 --- a/docker-compose-ingest.yaml +++ b/docker-compose-ingest.yaml @@ -1,17 +1,17 @@ -version: "3.9" -services: - privategpt-ingest: - build: . - image: privategpt:test - command: [ "python", "src/ingest.py" ] - environment: - - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} - - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} - - MODEL_TYPE=${MODEL_TYPE:-GPT4All} - - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} - - MODEL_N_CTX=${MODEL_N_CTX:-1000} - - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} - volumes: - - ${MODEL_MOUNT:-./models}:/home/privategpt/models - - ${PERSIST_MOUNT:-./db}:/home/privategpt/db - - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents +version: "3.9" +services: + privategpt-ingest: + build: . + image: privategpt:test + command: [ "python", "src/ingest.py" ] + environment: + - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} + - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} + - MODEL_TYPE=${MODEL_TYPE:-GPT4All} + - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} + - MODEL_N_CTX=${MODEL_N_CTX:-1000} + - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} + volumes: + - ${MODEL_MOUNT:-./models}:/home/privategpt/models + - ${PERSIST_MOUNT:-./db}:/home/privategpt/db + - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents diff --git a/docker-compose.yaml b/docker-compose.yaml index 4365cfb34..83f5614f9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,15 +1,15 @@ -version: "3.9" -services: - privategpt: - build: . - image: privategpt:test - command: [ "python", "src/privateGPT.py" ] - environment: - - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} - - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} - - MODEL_TYPE=${MODEL_TYPE:-GPT4All} - - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} - - MODEL_N_CTX=${MODEL_N_CTX:-1000} - volumes: - - ${MODEL_MOUNT:-./models}:/home/privategpt/models - - ${PERSIST_MOUNT:-./db}:/home/privategpt/db +version: "3.9" +services: + privategpt: + build: . + image: privategpt:test + command: [ "python", "src/privateGPT.py" ] + environment: + - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} + - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} + - MODEL_TYPE=${MODEL_TYPE:-GPT4All} + - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} + - MODEL_N_CTX=${MODEL_N_CTX:-1000} + volumes: + - ${MODEL_MOUNT:-./models}:/home/privategpt/models + - ${PERSIST_MOUNT:-./db}:/home/privategpt/db From 68210a9f1057b28915c10841ebcb3e2a13e00023 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 17 May 2023 23:57:33 +0200 Subject: [PATCH 06/19] Single Dockerfile, services for cuda --- Dockerfile | 11 ++++-- docker-compose.yaml | 83 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5bfdd981d..6082623b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,17 @@ -FROM python:3.10.11 +#FROM python:3.10.11 +#FROM wallies/python-cuda:3.10-cuda11.6-runtime + +# Using argument for base image to avoid multiplying Dockerfiles +ARG BASEIMAGE +FROM $BASEIMAGE RUN groupadd -g 10009 -o privategpt && useradd -m -u 10009 -g 10009 -o -s /bin/bash privategpt USER privategpt WORKDIR /home/privategpt COPY ./src/requirements.txt src/requirements.txt -RUN pip install -r src/requirements.txt +RUN pip install --no-cache-dir -r src/requirements.txt COPY ./src src -# ENTRYPOINT ["python", "src/privateGPT.py"] \ No newline at end of file +# ENTRYPOINT ["python", "src/privateGPT.py"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 83f5614f9..f91728187 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,16 @@ -version: "3.9" +--- +version: '3.9' services: + # + # Base service, without CUDA + # privategpt: - build: . + build: + context: . + dockerfile: ./Dockerfile + args: [--rm, BASEIMAGE=python:3.10.11] image: privategpt:test - command: [ "python", "src/privateGPT.py" ] + command: [python, src/privateGPT.py] environment: - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} @@ -13,3 +20,73 @@ services: volumes: - ${MODEL_MOUNT:-./models}:/home/privategpt/models - ${PERSIST_MOUNT:-./db}:/home/privategpt/db + + # + # To run with CUDA 11.6 + # + # docker compose run --rm --build privategpt-cuda-11.6 + # + privategpt-cuda-11.6: + extends: privategpt + build: + args: [BASEIMAGE=wallies/python-cuda:3.10-cuda11.6-runtime] + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + memory: 8G + + # + # To run with CUDA 11.7 + # + # docker compose run --rm --build privategpt-cuda-11.7 + # + privategpt-cuda-11.7: + extends: privategpt-cuda-11.6 + build: + args: [BASEIMAGE=wallies/python-cuda:3.10-cuda11.7-runtime] + + # + # To ingest using cuda 11.6: + # + # docker compose run --rm --build privategpt-cuda-11.6-ingest + # + privategpt-cuda-11.6-ingest: + extends: privategpt-cuda-11.6 + command: [python, src/ingest.py] + + # + # To ingest using cuda 11.7: + # + # docker compose run --rm --build privategpt-cuda-11.7-ingest + # + privategpt-cuda-11.7-ingest: + extends: privategpt-cuda-11.7 + command: [python, src/ingest.py] + + # Check your system's version using + # + # docker compose run --rm check-cuda-version + # + # then build and test the privateGPT container + # using + # + # docker compose run --rm check-cuda- + # + # Where is the version you found using 'check-cuda-version'. + # + # Example if CUDAVERSION == 11.6 + # + # docker compose run --rm --build check-cuda-11.6 + check-cuda-version: + image: ubuntu + command: [nvidia-smi] + check-cuda-11.6: + extends: privategpt-cuda-11.6 + command: [nvidia-smi] + check-cuda-11.7: + extends: privategpt-cuda-11.7 + command: [nvidia-smi] From b4f09d50309466e9ed2ca821b248eaccf0967238 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 18 May 2023 00:07:58 +0200 Subject: [PATCH 07/19] Add default ingest target --- docker-compose.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index f91728187..601185c72 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -49,6 +49,15 @@ services: build: args: [BASEIMAGE=wallies/python-cuda:3.10-cuda11.7-runtime] + # + # For ingest without cuda: + # + # docker compose run --rm --build privategpt-ingest + # + privategpt-ingest: + extends: privategpt + command: [python, src/ingest.py] + # # To ingest using cuda 11.6: # From a29a7a376f7cddbca443e01fa4f5251952073dd7 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 18 May 2023 00:38:11 +0200 Subject: [PATCH 08/19] Add EMBEDDINGS_MODEL_NAME following changes on main --- docker-compose.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 601185c72..c8b8ff5f4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,12 +8,13 @@ services: build: context: . dockerfile: ./Dockerfile - args: [--rm, BASEIMAGE=python:3.10.11] + args: [--rm, BASEIMAGE=python:3.10.11, LLAMA_CMAMAKE:"" ] image: privategpt:test command: [python, src/privateGPT.py] environment: - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} + - EMBEDDINGS_MODEL_NAME=${EMBEDDINGS_MODEL_NAME:-all-MiniLM-L6-v2} - MODEL_TYPE=${MODEL_TYPE:-GPT4All} - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} - MODEL_N_CTX=${MODEL_N_CTX:-1000} @@ -29,7 +30,9 @@ services: privategpt-cuda-11.6: extends: privategpt build: - args: [BASEIMAGE=wallies/python-cuda:3.10-cuda11.6-runtime] + args: + - BASEIMAGE=wallies/python-cuda:3.10-cuda11.6-runtime + - LLAMA_CMAKE="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1" deploy: resources: reservations: From 47cded956a268589c6c7b9100d844af0d41781b6 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 18 May 2023 02:30:58 +0200 Subject: [PATCH 09/19] Compile for CUDA, add some build logs to image --- Dockerfile | 5 ++++- docker-compose.yaml | 30 +++++++++++++++++------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6082623b1..a8422d90d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,10 @@ USER privategpt WORKDIR /home/privategpt COPY ./src/requirements.txt src/requirements.txt -RUN pip install --no-cache-dir -r src/requirements.txt +ARG LLAMA_CMAKE +#RUN CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 pip install $(grep llama-cpp-python src/requirements.txt) +RUN ( /bin/bash -c "${LLAMA_CMAKE} pip install \$(grep llama-cpp-python src/requirements.txt)" 2>&1 | tee llama-build.log ) && sleep 10 +RUN pip install --no-cache-dir -r src/requirements.txt 2>&1 | tee pip-install.log COPY ./src src diff --git a/docker-compose.yaml b/docker-compose.yaml index c8b8ff5f4..ee52f8f98 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,7 @@ services: build: context: . dockerfile: ./Dockerfile - args: [--rm, BASEIMAGE=python:3.10.11, LLAMA_CMAMAKE:"" ] + args: [--rm, "BASEIMAGE=python:3.10.11", LLAMA_CMAKE=] image: privategpt:test command: [python, src/privateGPT.py] environment: @@ -20,19 +20,23 @@ services: - MODEL_N_CTX=${MODEL_N_CTX:-1000} volumes: - ${MODEL_MOUNT:-./models}:/home/privategpt/models + - type: bind + source: ${MODEL_MOUNT:-./models}/cache/torch + target: /home/privategpt/.cache/torch - ${PERSIST_MOUNT:-./db}:/home/privategpt/db + - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents # # To run with CUDA 11.6 # # docker compose run --rm --build privategpt-cuda-11.6 - # + # privategpt-cuda-11.6: extends: privategpt build: args: - BASEIMAGE=wallies/python-cuda:3.10-cuda11.6-runtime - - LLAMA_CMAKE="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1" + - LLAMA_CMAKE=CMAKE_ARGS='-DLLAMA_OPENBLAS=on' FORCE_CMAKE=1 deploy: resources: reservations: @@ -46,41 +50,41 @@ services: # To run with CUDA 11.7 # # docker compose run --rm --build privategpt-cuda-11.7 - # + # privategpt-cuda-11.7: extends: privategpt-cuda-11.6 build: - args: [BASEIMAGE=wallies/python-cuda:3.10-cuda11.7-runtime] + args: ["BASEIMAGE=wallies/python-cuda:3.10-cuda11.7-runtime"] # # For ingest without cuda: - # + # # docker compose run --rm --build privategpt-ingest - # + # privategpt-ingest: extends: privategpt command: [python, src/ingest.py] # # To ingest using cuda 11.6: - # + # # docker compose run --rm --build privategpt-cuda-11.6-ingest - # + # privategpt-cuda-11.6-ingest: extends: privategpt-cuda-11.6 command: [python, src/ingest.py] # # To ingest using cuda 11.7: - # + # # docker compose run --rm --build privategpt-cuda-11.7-ingest - # + # privategpt-cuda-11.7-ingest: extends: privategpt-cuda-11.7 command: [python, src/ingest.py] # Check your system's version using - # + # # docker compose run --rm check-cuda-version # # then build and test the privateGPT container @@ -91,7 +95,7 @@ services: # Where is the version you found using 'check-cuda-version'. # # Example if CUDAVERSION == 11.6 - # + # # docker compose run --rm --build check-cuda-11.6 check-cuda-version: image: ubuntu From e5b33afb3bb677ed5c078068cd48ef2e74fdc498 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 18 May 2023 03:17:24 +0200 Subject: [PATCH 10/19] Add information about where to get an update for CUDA --- docker-compose.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index ee52f8f98..64836408d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -26,6 +26,7 @@ services: - ${PERSIST_MOUNT:-./db}:/home/privategpt/db - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents + # # To run with CUDA 11.6 # @@ -97,6 +98,15 @@ services: # Example if CUDAVERSION == 11.6 # # docker compose run --rm --build check-cuda-11.6 + # + # + # + # You can update your host's CUDA installation by downloading + # a recent version from + # + # https://developer.nvidia.com/cuda-downloads . + # + check-cuda-version: image: ubuntu command: [nvidia-smi] From 03ddd51b61d5cb60f3fe95ade5bafe8a7e846968 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 08:21:04 +0200 Subject: [PATCH 11/19] update readme --- README.md | 43 ++++++++++++++++------- docker-compose-ingest.yaml | 17 --------- docker-compose.yaml => docker-compose.yml | 28 +++++++-------- 3 files changed, 42 insertions(+), 46 deletions(-) delete mode 100644 docker-compose-ingest.yaml rename docker-compose.yaml => docker-compose.yml (82%) diff --git a/README.md b/README.md index 3eab8e42f..88be452e1 100644 --- a/README.md +++ b/README.md @@ -106,22 +106,39 @@ To install a C++ compiler on Windows 10/11, follow these steps: ## Docker Version -1. Build the image -``` -docker build . -t privategpt:test -``` +1. Put your data in models / source_documents in the project root folder (Can be customized changing the corresponding value in the docker-compose.yaml) + +2. You can ingest your data using the docker-compose + + 1. Without Cuda + + ```sh + docker compose run --rm --build privategpt-ingest + ``` + + 2. With Cuda 11.6 or 11.7 + + ```sh + docker compose run --rm --build privategpt-cuda-11.6-ingest + + docker compose run --rm --build privategpt-cuda-11.7-ingest + ``` + +3. You can run **after** ingesting your data or using an **existing db** with the docker-compose + + 1. Without Cuda + + ```sh + docker compose run --rm --build privategpt + ``` -2. Put your data in models / source_documents in the project root folder (Can be customized changing the corresponding value in the docker-compose.yaml) + 2. With Cuda 11.6 or 11.7 -3. You can ingest your data using the docker-compose-ingest.yaml - ``` - docker compose -f docker-compose-ingest.yaml up - ``` + ```sh + docker compose run --rm --build privategpt-cuda-11.6 -4. You run it using the docker-compose.yaml - ``` - docker-compose run --rm privategpt - ``` + docker compose run --rm --build privategpt-cuda-11.7 + ``` # Disclaimer This is a test project to validate the feasibility of a fully private solution for question answering using LLMs and Vector embeddings. It is not production ready, and it is not meant to be used in production. The models selection is not optimized for performance, but for privacy; but it is possible to use different models and vectorstores to improve performance. diff --git a/docker-compose-ingest.yaml b/docker-compose-ingest.yaml deleted file mode 100644 index 2be704d11..000000000 --- a/docker-compose-ingest.yaml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3.9" -services: - privategpt-ingest: - build: . - image: privategpt:test - command: [ "python", "src/ingest.py" ] - environment: - - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} - - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} - - MODEL_TYPE=${MODEL_TYPE:-GPT4All} - - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} - - MODEL_N_CTX=${MODEL_N_CTX:-1000} - - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} - volumes: - - ${MODEL_MOUNT:-./models}:/home/privategpt/models - - ${PERSIST_MOUNT:-./db}:/home/privategpt/db - - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents diff --git a/docker-compose.yaml b/docker-compose.yml similarity index 82% rename from docker-compose.yaml rename to docker-compose.yml index 64836408d..86721b5dc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yml @@ -8,9 +8,9 @@ services: build: context: . dockerfile: ./Dockerfile - args: [--rm, "BASEIMAGE=python:3.10.11", LLAMA_CMAKE=] + args: [ --rm, "BASEIMAGE=python:3.10.11", LLAMA_CMAKE= ] image: privategpt:test - command: [python, src/privateGPT.py] + command: [ python, src/privateGPT.py ] environment: - PERSIST_DIRECTORY=${PERSIST_DIRECTORY:-/home/privategpt/db} - LLAMA_EMBEDDINGS_MODEL=${LLAMA_EMBEDDINGS_MODEL:-/home/privategpt/models/ggml-model-q4_0.bin} @@ -20,12 +20,7 @@ services: - MODEL_N_CTX=${MODEL_N_CTX:-1000} volumes: - ${MODEL_MOUNT:-./models}:/home/privategpt/models - - type: bind - source: ${MODEL_MOUNT:-./models}/cache/torch - target: /home/privategpt/.cache/torch - ${PERSIST_MOUNT:-./db}:/home/privategpt/db - - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents - # # To run with CUDA 11.6 @@ -44,8 +39,7 @@ services: devices: - driver: nvidia count: 1 - capabilities: [gpu] - memory: 8G + capabilities: [ gpu ] # # To run with CUDA 11.7 @@ -55,7 +49,7 @@ services: privategpt-cuda-11.7: extends: privategpt-cuda-11.6 build: - args: ["BASEIMAGE=wallies/python-cuda:3.10-cuda11.7-runtime"] + args: [ "BASEIMAGE=wallies/python-cuda:3.10-cuda11.7-runtime" ] # # For ingest without cuda: @@ -64,7 +58,9 @@ services: # privategpt-ingest: extends: privategpt - command: [python, src/ingest.py] + command: [ python, src/ingest.py ] + volumes: + - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents # # To ingest using cuda 11.6: @@ -73,7 +69,7 @@ services: # privategpt-cuda-11.6-ingest: extends: privategpt-cuda-11.6 - command: [python, src/ingest.py] + command: [ python, src/ingest.py ] # # To ingest using cuda 11.7: @@ -82,7 +78,7 @@ services: # privategpt-cuda-11.7-ingest: extends: privategpt-cuda-11.7 - command: [python, src/ingest.py] + command: [ python, src/ingest.py ] # Check your system's version using # @@ -109,10 +105,10 @@ services: check-cuda-version: image: ubuntu - command: [nvidia-smi] + command: [ nvidia-smi ] check-cuda-11.6: extends: privategpt-cuda-11.6 - command: [nvidia-smi] + command: [ nvidia-smi ] check-cuda-11.7: extends: privategpt-cuda-11.7 - command: [nvidia-smi] + command: [ nvidia-smi ] From 41c26b9361f92d08e4ed678a801f6b9cc16d53fa Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 08:21:55 +0200 Subject: [PATCH 12/19] add ingest mount --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 86721b5dc..f5c2c6bef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,6 +70,8 @@ services: privategpt-cuda-11.6-ingest: extends: privategpt-cuda-11.6 command: [ python, src/ingest.py ] + volumes: + - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents # # To ingest using cuda 11.7: @@ -79,6 +81,8 @@ services: privategpt-cuda-11.7-ingest: extends: privategpt-cuda-11.7 command: [ python, src/ingest.py ] + volumes: + - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents # Check your system's version using # From b7c6db527382e703af05c06787d8fde6ded09999 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 08:58:03 +0200 Subject: [PATCH 13/19] change image for cuda --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index f5c2c6bef..a22a41f95 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,7 @@ services: # privategpt-cuda-11.6: extends: privategpt + image: privategpt:cuda-11.6 build: args: - BASEIMAGE=wallies/python-cuda:3.10-cuda11.6-runtime @@ -48,6 +49,7 @@ services: # privategpt-cuda-11.7: extends: privategpt-cuda-11.6 + image: privategpt:cuda-11.7 build: args: [ "BASEIMAGE=wallies/python-cuda:3.10-cuda11.7-runtime" ] @@ -69,6 +71,7 @@ services: # privategpt-cuda-11.6-ingest: extends: privategpt-cuda-11.6 + image: privategpt:cuda-11.6 command: [ python, src/ingest.py ] volumes: - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents @@ -80,6 +83,7 @@ services: # privategpt-cuda-11.7-ingest: extends: privategpt-cuda-11.7 + image: privategpt:cuda-11.7 command: [ python, src/ingest.py ] volumes: - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents From 59482a625650d0da028b43e82075b0b5ccf42373 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 09:05:06 +0200 Subject: [PATCH 14/19] missing ingest env --- docker-compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index a22a41f95..05310fe61 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,6 +61,8 @@ services: privategpt-ingest: extends: privategpt command: [ python, src/ingest.py ] + environment: + - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} volumes: - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents @@ -73,6 +75,8 @@ services: extends: privategpt-cuda-11.6 image: privategpt:cuda-11.6 command: [ python, src/ingest.py ] + environment: + - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} volumes: - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents @@ -85,6 +89,8 @@ services: extends: privategpt-cuda-11.7 image: privategpt:cuda-11.7 command: [ python, src/ingest.py ] + environment: + - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} volumes: - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents From c3b465cd2bf0e02b7c804b2ccc26884fd90fe632 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 09:55:39 +0200 Subject: [PATCH 15/19] add cache --- {db => cache}/.gitignore | 0 {db => cache}/.gitkeep | 0 docker-compose.yml | 1 + 3 files changed, 1 insertion(+) rename {db => cache}/.gitignore (100%) rename {db => cache}/.gitkeep (100%) diff --git a/db/.gitignore b/cache/.gitignore similarity index 100% rename from db/.gitignore rename to cache/.gitignore diff --git a/db/.gitkeep b/cache/.gitkeep similarity index 100% rename from db/.gitkeep rename to cache/.gitkeep diff --git a/docker-compose.yml b/docker-compose.yml index 05310fe61..9434c5c4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,7 @@ services: - MODEL_PATH=${MODEL_PATH:-/home/privategpt/models/ggml-gpt4all-j-v1.3-groovy.bin} - MODEL_N_CTX=${MODEL_N_CTX:-1000} volumes: + - ${CACHE_MOUNT:-./cache}:/home/privategpt/.cache/torch - ${MODEL_MOUNT:-./models}:/home/privategpt/models - ${PERSIST_MOUNT:-./db}:/home/privategpt/db From 52de272a2d9311c004a56490bb55d358c007d864 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 09:58:38 +0200 Subject: [PATCH 16/19] missing db --- db/.gitignore | 3 +++ db/.gitkeep | 0 2 files changed, 3 insertions(+) create mode 100644 db/.gitignore create mode 100644 db/.gitkeep diff --git a/db/.gitignore b/db/.gitignore new file mode 100644 index 000000000..03188767c --- /dev/null +++ b/db/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.gitkeep \ No newline at end of file diff --git a/db/.gitkeep b/db/.gitkeep new file mode 100644 index 000000000..e69de29bb From d4cfac2a2be1bb52063b0720b01977a6d0825fc7 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 13:18:27 +0200 Subject: [PATCH 17/19] source doc --- docker-compose.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9434c5c4c..9674d1341 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,13 +73,8 @@ services: # docker compose run --rm --build privategpt-cuda-11.6-ingest # privategpt-cuda-11.6-ingest: - extends: privategpt-cuda-11.6 + extends: privategpt-ingest image: privategpt:cuda-11.6 - command: [ python, src/ingest.py ] - environment: - - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} - volumes: - - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents # # To ingest using cuda 11.7: @@ -87,13 +82,8 @@ services: # docker compose run --rm --build privategpt-cuda-11.7-ingest # privategpt-cuda-11.7-ingest: - extends: privategpt-cuda-11.7 + extends: privategpt-ingest image: privategpt:cuda-11.7 - command: [ python, src/ingest.py ] - environment: - - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} - volumes: - - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents # Check your system's version using # From 06cce6fc822d35f8ed1aaabf0840c729113b3828 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 18 May 2023 13:37:51 +0200 Subject: [PATCH 18/19] anchor for ingest --- docker-compose.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9674d1341..9d14df338 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,13 @@ --- version: '3.9' + +x-ingest: &ingest + command: [ python, src/ingest.py ] + environment: + - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} + volumes: + - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents + services: # # Base service, without CUDA @@ -61,11 +69,7 @@ services: # privategpt-ingest: extends: privategpt - command: [ python, src/ingest.py ] - environment: - - SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-/home/privategpt/source_documents} - volumes: - - ${SOURCE_MOUNT:-./source_documents}:/home/privategpt/source_documents + <<: *ingest # # To ingest using cuda 11.6: @@ -73,8 +77,9 @@ services: # docker compose run --rm --build privategpt-cuda-11.6-ingest # privategpt-cuda-11.6-ingest: - extends: privategpt-ingest + extends: privategpt-cuda-11.6 image: privategpt:cuda-11.6 + <<: *ingest # # To ingest using cuda 11.7: @@ -82,8 +87,9 @@ services: # docker compose run --rm --build privategpt-cuda-11.7-ingest # privategpt-cuda-11.7-ingest: - extends: privategpt-ingest + extends: privategpt-cuda-11.7 image: privategpt:cuda-11.7 + <<: *ingest # Check your system's version using # From aaf8a79a6d479644f4aefab3a8fa164e2506ad86 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 19 May 2023 17:21:27 +0200 Subject: [PATCH 19/19] Add pip upgrade to avoid sha256 mismatches, also cleanup cache --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a8422d90d..5c0d23742 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,10 @@ WORKDIR /home/privategpt COPY ./src/requirements.txt src/requirements.txt ARG LLAMA_CMAKE #RUN CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 pip install $(grep llama-cpp-python src/requirements.txt) -RUN ( /bin/bash -c "${LLAMA_CMAKE} pip install \$(grep llama-cpp-python src/requirements.txt)" 2>&1 | tee llama-build.log ) && sleep 10 -RUN pip install --no-cache-dir -r src/requirements.txt 2>&1 | tee pip-install.log +RUN pip install --upgrade pip \ + && ( /bin/bash -c "${LLAMA_CMAKE} pip install \$(grep llama-cpp-python src/requirements.txt)" 2>&1 | tee llama-build.log ) \ + && ( pip install --no-cache-dir -r src/requirements.txt 2>&1 | tee pip-install.log ) \ + && pip cache purge COPY ./src src