From 0f1659765aea616adb277386c31402b9d791ab67 Mon Sep 17 00:00:00 2001 From: tylertitsworth Date: Tue, 26 Mar 2024 08:54:14 -0700 Subject: [PATCH 1/7] update containers --- ChatQnA/README.md | 37 ++----------- ChatQnA/langchain/docker/Dockerfile | 55 +++++++------------ ChatQnA/langchain/docker/build_docker.sh | 3 - .../docker/docker-compose-langchain.yml | 9 ++- ChatQnA/langchain/docker/requirements.txt | 15 +++++ CodeGen/README.md | 17 ++---- CodeGen/codegen/build_docker.sh | 23 +++++++- CodeGen/codegen/requirements.txt | 5 ++ DocSum/README.md | 4 +- DocSum/langchain/docker/Dockerfile | 44 +++++---------- DocSum/langchain/docker/requirements.txt | 14 +++++ VisualQnA/README.md | 4 +- VisualQnA/serving/Dockerfile | 22 +++++--- VisualQnA/serving/requirements.txt | 4 ++ 14 files changed, 130 insertions(+), 126 deletions(-) delete mode 100755 ChatQnA/langchain/docker/build_docker.sh create mode 100644 ChatQnA/langchain/docker/requirements.txt create mode 100644 CodeGen/codegen/requirements.txt create mode 100644 DocSum/langchain/docker/requirements.txt create mode 100644 VisualQnA/serving/requirements.txt diff --git a/ChatQnA/README.md b/ChatQnA/README.md index f44bd1f5..4e6dc322 100644 --- a/ChatQnA/README.md +++ b/ChatQnA/README.md @@ -3,16 +3,7 @@ This ChatQnA use case performs RAG using LangChain, Redis vectordb and Text Gene # Environment Setup To use [🤗 text-generation-inference](https://github.com/huggingface/text-generation-inference) on Habana Gaudi/Gaudi2, please follow these steps: -## Prepare Docker - -Getting started is straightforward with the official Docker container. Simply pull the image using: - -```bash -docker pull ghcr.io/huggingface/tgi-gaudi:1.2.1 -``` - -Alternatively, you can build the Docker image yourself with: - +## Build TGI Gaudi Docker Image ```bash bash ./serving/tgi_gaudi/build_docker.sh ``` @@ -77,7 +68,7 @@ docker cp 262e04bbe466:/usr/src/optimum-habana/examples/text-generation/quantiza ```bash docker run -d -p 8080:80 -e QUANT_CONFIG=/data/maxabs_quant.json -e HUGGING_FACE_HUB_TOKEN= -v $volume:/data -- -runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host tgi_gaudi -- +runtime=habana -e HABANA_VISIBLE_DEVICES="4,5,6" -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host tgi_gaudi -- model-id meta-llama/Llama-2-7b-hf ``` @@ -86,21 +77,11 @@ Now the TGI Gaudi will launch the FP8 model by default. Please note that current ## Launch Redis ```bash -docker pull redis/redis-stack:latest docker compose -f langchain/docker/docker-compose-redis.yml up -d ``` ## Launch LangChain Docker -### Build LangChain Docker Image - -```bash -cd langchain/docker/ -bash ./build_docker.sh -``` - -### Lanuch LangChain Docker - Update the `HUGGINGFACEHUB_API_TOKEN` environment variable with your huggingface token in the `docker-compose-langchain.yml` ```bash @@ -108,6 +89,9 @@ docker compose -f docker-compose-langchain.yml up -d cd ../../ ``` +> [!NOTE] +> If you modified any files and want that change introduced in this step, add `--build` to the end of the command to build the container image instead of pulling it from dockerhub. + ## Ingest data into redis After every time of redis container is launched, data should be ingested in the container ingestion steps: @@ -122,17 +106,6 @@ Note: `ingest.py` will download the embedding model, please set the proxy if nec # Start LangChain Server -## Enable GuardRails using Meta's Llama Guard model (Optional) - -We offer content moderation support utilizing Meta's [Llama Guard](https://huggingface.co/meta-llama/LlamaGuard-7b) model. To activate GuardRails, kindly follow the instructions below to deploy the Llama Guard model on TGI Gaudi. - -```bash -volume=$PWD/data -model_id="meta-llama/LlamaGuard-7b" -docker run -p 8088:80 -v $volume:/data --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e HUGGING_FACE_HUB_TOKEN= -e HTTPS_PROXY=$https_proxy -e HTTP_PROXY=$https_proxy tgi_gaudi --model-id $model_id -export SAFETY_GUARD_ENDPOINT="http://xxx.xxx.xxx.xxx:8088" -``` - ## Start the Backend Service Make sure TGI-Gaudi service is running and also make sure data is populated into Redis. Launch the backend service: diff --git a/ChatQnA/langchain/docker/Dockerfile b/ChatQnA/langchain/docker/Dockerfile index 910adfd9..19ff8105 100644 --- a/ChatQnA/langchain/docker/Dockerfile +++ b/ChatQnA/langchain/docker/Dockerfile @@ -1,36 +1,23 @@ -FROM langchain/langchain - -ARG http_proxy -ARG https_proxy -ENV http_proxy=$http_proxy -ENV https_proxy=$https_proxy - -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y \ - libgl1-mesa-glx \ - libjemalloc-dev - -RUN pip install --upgrade pip \ - sentence-transformers \ - redis \ - unstructured \ - unstructured[all-docs] \ - langchain-cli \ - pydantic==1.10.13 \ - langchain==0.1.12 \ - poetry \ - pymupdf \ - easyocr \ - langchain_benchmarks \ - pyarrow \ - jupyter \ - intel-extension-for-pytorch \ - intel-openmp - -ENV PYTHONPATH=/ws:/qna-app/app - -COPY qna-app /qna-app -WORKDIR /qna-app +FROM langchain/langchain:latest + +RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ + libgl1-mesa-glx \ + libjemalloc-dev + +RUN useradd -m -s /bin/bash user && \ + mkdir -p /home/user && \ + chown -R user /home/user/ + +USER user + +COPY requirements.txt /tmp/requirements.txt + +RUN pip install --upgrade pip && \ + pip install -r /tmp/requirements.txt + +ENV PYTHONPATH=/home/user:/home/user/qna-app/app + +WORKDIR /home/user/qna-app +COPY qna-app /home/user/qna-app ENTRYPOINT ["/usr/bin/sleep", "infinity"] diff --git a/ChatQnA/langchain/docker/build_docker.sh b/ChatQnA/langchain/docker/build_docker.sh deleted file mode 100755 index 3401898c..00000000 --- a/ChatQnA/langchain/docker/build_docker.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker build . -t qna-rag-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy diff --git a/ChatQnA/langchain/docker/docker-compose-langchain.yml b/ChatQnA/langchain/docker/docker-compose-langchain.yml index 984c65ec..35bd8f2e 100644 --- a/ChatQnA/langchain/docker/docker-compose-langchain.yml +++ b/ChatQnA/langchain/docker/docker-compose-langchain.yml @@ -1,9 +1,16 @@ version: '3' services: qna-rag-redis-server: - image: qna-rag-redis:latest + build: + args: + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + dockerfile: Dockerfile + image: intel/gen-ai-examples:qna-rag-redis-server container_name: qna-rag-redis-server environment: + - http_proxy=${http_proxy} + - https_proxy=${https_proxy} - "REDIS_PORT=6379" - "EMBED_MODEL=BAAI/bge-base-en-v1.5" - "REDIS_SCHEMA=schema_dim_768.yml" diff --git a/ChatQnA/langchain/docker/requirements.txt b/ChatQnA/langchain/docker/requirements.txt new file mode 100644 index 00000000..bb90580a --- /dev/null +++ b/ChatQnA/langchain/docker/requirements.txt @@ -0,0 +1,15 @@ +easyocr +intel-extension-for-pytorch +intel-openmp +jupyter +langchain_benchmarks +langchain-cli +langchain==0.1.12 +poetry +pyarrow +pydantic==1.10.13 +pymupdf +redis +sentence-transformers +unstructured +unstructured[pdf] diff --git a/CodeGen/README.md b/CodeGen/README.md index 487bb511..b45d919d 100644 --- a/CodeGen/README.md +++ b/CodeGen/README.md @@ -4,17 +4,9 @@ Code generation is a noteworthy application of Large Language Model (LLM) techno # Environment Setup To use [🤗 text-generation-inference](https://github.com/huggingface/text-generation-inference) on Intel Gaudi2, please follow these steps: -## Prepare Gaudi Image -Getting started is straightforward with the official Docker container. Simply pull the image using: - -```bash -docker pull ghcr.io/huggingface/tgi-gaudi:1.2.1 -``` - -Alternatively, you can build the Docker image yourself with: - +## Build TGI Gaudi Docker Image ```bash -bash ./serving/tgi_gaudi/build_docker.sh +bash ./tgi_gaudi/build_docker.sh ``` ## Launch TGI Gaudi Service @@ -43,7 +35,7 @@ export TGI_ENDPOINT="xxx.xxx.xxx.xxx:8080" ## Launch Copilot Docker -### Build Copilot Docker Image +### Build Copilot Docker Image (Optional) ```bash cd codegen @@ -54,10 +46,9 @@ cd .. ### Lanuch Copilot Docker ```bash -docker run -it --net=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock copilot:latest +docker run -it -e http_proxy=${http_proxy} -e https_proxy=${https_proxy} --net=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock intel/gen-ai-examples:copilot bash ``` - # Start Copilot Server ## Start the Backend Service diff --git a/CodeGen/codegen/build_docker.sh b/CodeGen/codegen/build_docker.sh index d649a5c4..c410331d 100644 --- a/CodeGen/codegen/build_docker.sh +++ b/CodeGen/codegen/build_docker.sh @@ -12,6 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash +FROM langchain/langchain:latest -docker build . -t copilot:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy +RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ + libgl1-mesa-glx \ + libjemalloc-dev + +RUN useradd -m -s /bin/bash user && \ + mkdir -p /home/user && \ + chown -R user /home/user/ + +USER user + +COPY requirements.txt /tmp/requirements.txt + +RUN pip install -U -r /tmp/requirements.txt + +ENV PYTHONPATH=/home/user:/home/user/codegen-app + +WORKDIR /home/user/codegen-app +COPY codegen-app /home/user/codegen-app + +SHELL ["/bin/bash", "-c"] diff --git a/CodeGen/codegen/requirements.txt b/CodeGen/codegen/requirements.txt new file mode 100644 index 00000000..e57acd28 --- /dev/null +++ b/CodeGen/codegen/requirements.txt @@ -0,0 +1,5 @@ +huggingface_hub +langchain-cli +langchain==0.1.11 +pydantic==1.10.13 +shortuuid diff --git a/DocSum/README.md b/DocSum/README.md index 8c73a2fe..9951a571 100644 --- a/DocSum/README.md +++ b/DocSum/README.md @@ -42,7 +42,7 @@ export TGI_ENDPOINT="http://xxx.xxx.xxx.xxx:8080" ## Launch Document Summary Docker -### Build Document Summary Docker Image +### Build Document Summary Docker Image (Optional) ```bash cd langchain/docker/ @@ -53,7 +53,7 @@ cd ../../ ### Lanuch Document Summary Docker ```bash -docker run -it --net=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock document-summarize:latest +docker run -it --net=host --ipc=host -e http_proxy=${http_proxy} -e https_proxy=${https_proxy} -v /var/run/docker.sock:/var/run/docker.sock intel/gen-ai-examples:document-summarize bash ``` diff --git a/DocSum/langchain/docker/Dockerfile b/DocSum/langchain/docker/Dockerfile index b91c264c..1ff2d0a2 100644 --- a/DocSum/langchain/docker/Dockerfile +++ b/DocSum/langchain/docker/Dockerfile @@ -1,35 +1,21 @@ -FROM langchain/langchain +FROM langchain/langchain:latest -ARG http_proxy -ARG https_proxy -ENV http_proxy=$http_proxy -ENV https_proxy=$https_proxy +RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ + libgl1-mesa-glx \ + libjemalloc-dev -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y \ - libgl1-mesa-glx \ - libjemalloc-dev +RUN useradd -m -s /bin/bash user && \ + mkdir -p /home/user && \ + chown -R user /home/user/ -RUN pip install --upgrade pip \ - sentence-transformers \ - langchain-cli \ - pydantic==1.10.13 \ - langchain==0.1.12 \ - poetry \ - langchain_benchmarks \ - pyarrow \ - jupyter \ - docx2txt \ - pypdf \ - beautifulsoup4 \ - python-multipart \ - intel-extension-for-pytorch \ - intel-openmp +USER user -ENV PYTHONPATH=/ws:/summarize-app/app +COPY requirements.txt /tmp/requirements.txt -COPY summarize-app /summarize-app -WORKDIR /summarize-app +RUN pip install --upgrade pip && \ + pip install -r /tmp/requirements.txt -CMD ["/bin/bash"] +ENV PYTHONPATH=/home/user:/home/user/summarize-app/app + +WORKDIR /home/user/summarize-app +COPY summarize-app /home/user/summarize-app diff --git a/DocSum/langchain/docker/requirements.txt b/DocSum/langchain/docker/requirements.txt new file mode 100644 index 00000000..ff1dd0c9 --- /dev/null +++ b/DocSum/langchain/docker/requirements.txt @@ -0,0 +1,14 @@ +beautifulsoup4 +docx2txt +intel-extension-for-pytorch +intel-openmp +jupyter +langchain_benchmarks +langchain-cli +langchain==0.1.12 +poetry +pyarrow +pydantic==1.10.13 +pypdf +python-multipart +sentence-transformers diff --git a/VisualQnA/README.md b/VisualQnA/README.md index 08d3ff9b..8fb575be 100644 --- a/VisualQnA/README.md +++ b/VisualQnA/README.md @@ -12,13 +12,13 @@ This example guides you through how to deploy a [LLaVA](https://llava-vl.github. ``` cd serving/ -docker build . --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${http_proxy} -t llava_gaudi:latest +docker build . --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${http_proxy} -t intel/gen-ai-examples:llava-gaudi ``` 2. Start the LLaVA service on Intel Gaudi2 ``` -docker run -d -p 8084:80 -p 8085:8000 -v ./data:/root/.cache/huggingface/hub/ -e http_proxy=$http_proxy -e https_proxy=$http_proxy -v $PWD/llava_server:/llava_server --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host llava_gaudi +docker run -d -p 8084:80 -p 8085:8000 -v ./data:/root/.cache/huggingface/hub/ -e http_proxy=$http_proxy -e https_proxy=$http_proxy -v $PWD/llava_server:/llava_server --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host intel/gen-ai-examples:llava-gaudi ``` Here are some explanation about the above parameters: diff --git a/VisualQnA/serving/Dockerfile b/VisualQnA/serving/Dockerfile index 954888af..a01719dd 100644 --- a/VisualQnA/serving/Dockerfile +++ b/VisualQnA/serving/Dockerfile @@ -13,22 +13,28 @@ # limitations under the License. # HABANA environment -FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.1 as hpu +FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.1 AS hpu # Set environment variables ENV LANG=en_US.UTF-8 -ENV PYTHONPATH=/root:/usr/lib/habanalabs/:/optimum-habana +ENV PYTHONPATH=/home/user:/usr/lib/habanalabs/:/optimum-habana + +RUN useradd -m -s /bin/bash user && \ + mkdir -p /home/user && \ + chown -R user /home/user/ + +USER user # Install required branch -RUN git clone https://github.com/lkk12014402/optimum-habana.git && \ - cd optimum-habana && \ - git checkout enable_llava_generation +RUN git clone https://github.com/lkk12014402/optimum-habana.git /optimum-habana -b enable_llava_generation + +COPY requirements.txt /tmp/requirements.txt # Install dependency -RUN pip install --upgrade-strategy eager optimum[habana] && \ - pip install fastapi uvicorn +RUN pip install --no-cache-dir -U -r /tmp/requirements.txt # work dir should contains the server WORKDIR /llava_server +COPY llava_server /llava_server -ENTRYPOINT ["python", "llava_server.py"] \ No newline at end of file +ENTRYPOINT ["python", "llava_server.py"] diff --git a/VisualQnA/serving/requirements.txt b/VisualQnA/serving/requirements.txt new file mode 100644 index 00000000..82ab73be --- /dev/null +++ b/VisualQnA/serving/requirements.txt @@ -0,0 +1,4 @@ +eager +fastapi +optimum[habana] +uvicorn \ No newline at end of file From eef8d49d20fe643a8a469ac04a9df7ecd30195ae Mon Sep 17 00:00:00 2001 From: tylertitsworth Date: Tue, 26 Mar 2024 09:00:07 -0700 Subject: [PATCH 2/7] merge readme updates --- ChatQnA/README.md | 24 ++++++++++++++++++++-- CodeGen/README.md | 10 ++++++++- CodeGen/codegen/Dockerfile | 33 ++++++++++++++++++++---------- CodeGen/codegen/build_docker.sh | 23 ++------------------- VisualQnA/serving/Dockerfile | 6 +++--- VisualQnA/serving/requirements.txt | 2 +- 6 files changed, 59 insertions(+), 39 deletions(-) diff --git a/ChatQnA/README.md b/ChatQnA/README.md index 4e6dc322..4ad0bec4 100644 --- a/ChatQnA/README.md +++ b/ChatQnA/README.md @@ -3,7 +3,16 @@ This ChatQnA use case performs RAG using LangChain, Redis vectordb and Text Gene # Environment Setup To use [🤗 text-generation-inference](https://github.com/huggingface/text-generation-inference) on Habana Gaudi/Gaudi2, please follow these steps: -## Build TGI Gaudi Docker Image +## Prepare Docker + +Getting started is straightforward with the official Docker container. Simply pull the image using: + +```bash +docker pull ghcr.io/huggingface/tgi-gaudi:1.2.1 +``` + +Alternatively, you can build the Docker image yourself with: + ```bash bash ./serving/tgi_gaudi/build_docker.sh ``` @@ -68,7 +77,7 @@ docker cp 262e04bbe466:/usr/src/optimum-habana/examples/text-generation/quantiza ```bash docker run -d -p 8080:80 -e QUANT_CONFIG=/data/maxabs_quant.json -e HUGGING_FACE_HUB_TOKEN= -v $volume:/data -- -runtime=habana -e HABANA_VISIBLE_DEVICES="4,5,6" -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host tgi_gaudi -- +runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host tgi_gaudi -- model-id meta-llama/Llama-2-7b-hf ``` @@ -106,6 +115,17 @@ Note: `ingest.py` will download the embedding model, please set the proxy if nec # Start LangChain Server +## Enable GuardRails using Meta's Llama Guard model (Optional) + +We offer content moderation support utilizing Meta's [Llama Guard](https://huggingface.co/meta-llama/LlamaGuard-7b) model. To activate GuardRails, kindly follow the instructions below to deploy the Llama Guard model on TGI Gaudi. + +```bash +volume=$PWD/data +model_id="meta-llama/LlamaGuard-7b" +docker run -p 8088:80 -v $volume:/data --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e HUGGING_FACE_HUB_TOKEN= -e HTTPS_PROXY=$https_proxy -e HTTP_PROXY=$https_proxy tgi_gaudi --model-id $model_id +export SAFETY_GUARD_ENDPOINT="http://xxx.xxx.xxx.xxx:8088" +``` + ## Start the Backend Service Make sure TGI-Gaudi service is running and also make sure data is populated into Redis. Launch the backend service: diff --git a/CodeGen/README.md b/CodeGen/README.md index b45d919d..ae533877 100644 --- a/CodeGen/README.md +++ b/CodeGen/README.md @@ -4,7 +4,15 @@ Code generation is a noteworthy application of Large Language Model (LLM) techno # Environment Setup To use [🤗 text-generation-inference](https://github.com/huggingface/text-generation-inference) on Intel Gaudi2, please follow these steps: -## Build TGI Gaudi Docker Image +## Prepare Gaudi Image +Getting started is straightforward with the official Docker container. Simply pull the image using: + +```bash +docker pull ghcr.io/huggingface/tgi-gaudi:1.2.1 +``` + +Alternatively, you can build the Docker image yourself with: + ```bash bash ./tgi_gaudi/build_docker.sh ``` diff --git a/CodeGen/codegen/Dockerfile b/CodeGen/codegen/Dockerfile index 22e37745..c410331d 100644 --- a/CodeGen/codegen/Dockerfile +++ b/CodeGen/codegen/Dockerfile @@ -12,14 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM langchain/langchain -RUN apt-get update && apt-get -y install libgl1-mesa-glx -RUN pip install -U langchain-cli pydantic==1.10.13 -RUN pip install langchain==0.1.11 -RUN pip install shortuuid -RUN pip install huggingface_hub -RUN mkdir -p /ws -ENV PYTHONPATH=/ws -COPY codegen-app /codegen-app -WORKDIR /codegen-app -CMD ["/bin/bash"] +FROM langchain/langchain:latest + +RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ + libgl1-mesa-glx \ + libjemalloc-dev + +RUN useradd -m -s /bin/bash user && \ + mkdir -p /home/user && \ + chown -R user /home/user/ + +USER user + +COPY requirements.txt /tmp/requirements.txt + +RUN pip install -U -r /tmp/requirements.txt + +ENV PYTHONPATH=/home/user:/home/user/codegen-app + +WORKDIR /home/user/codegen-app +COPY codegen-app /home/user/codegen-app + +SHELL ["/bin/bash", "-c"] diff --git a/CodeGen/codegen/build_docker.sh b/CodeGen/codegen/build_docker.sh index c410331d..d649a5c4 100644 --- a/CodeGen/codegen/build_docker.sh +++ b/CodeGen/codegen/build_docker.sh @@ -12,25 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM langchain/langchain:latest +#!/bin/bash -RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ - libgl1-mesa-glx \ - libjemalloc-dev - -RUN useradd -m -s /bin/bash user && \ - mkdir -p /home/user && \ - chown -R user /home/user/ - -USER user - -COPY requirements.txt /tmp/requirements.txt - -RUN pip install -U -r /tmp/requirements.txt - -ENV PYTHONPATH=/home/user:/home/user/codegen-app - -WORKDIR /home/user/codegen-app -COPY codegen-app /home/user/codegen-app - -SHELL ["/bin/bash", "-c"] +docker build . -t copilot:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy diff --git a/VisualQnA/serving/Dockerfile b/VisualQnA/serving/Dockerfile index a01719dd..3d8a15fc 100644 --- a/VisualQnA/serving/Dockerfile +++ b/VisualQnA/serving/Dockerfile @@ -19,15 +19,15 @@ FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installe ENV LANG=en_US.UTF-8 ENV PYTHONPATH=/home/user:/usr/lib/habanalabs/:/optimum-habana +# Install required branch +RUN git clone https://github.com/lkk12014402/optimum-habana.git /optimum-habana -b enable_llava_generation + RUN useradd -m -s /bin/bash user && \ mkdir -p /home/user && \ chown -R user /home/user/ USER user -# Install required branch -RUN git clone https://github.com/lkk12014402/optimum-habana.git /optimum-habana -b enable_llava_generation - COPY requirements.txt /tmp/requirements.txt # Install dependency diff --git a/VisualQnA/serving/requirements.txt b/VisualQnA/serving/requirements.txt index 82ab73be..a93c455d 100644 --- a/VisualQnA/serving/requirements.txt +++ b/VisualQnA/serving/requirements.txt @@ -1,4 +1,4 @@ eager fastapi optimum[habana] -uvicorn \ No newline at end of file +uvicorn From f1cb30cee4448678d788ecfcb59f14b51e584d29 Mon Sep 17 00:00:00 2001 From: tylertitsworth Date: Tue, 26 Mar 2024 09:06:22 -0700 Subject: [PATCH 3/7] add no caching to pip --- ChatQnA/langchain/docker/Dockerfile | 4 ++-- CodeGen/codegen/Dockerfile | 2 +- DocSum/langchain/docker/Dockerfile | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ChatQnA/langchain/docker/Dockerfile b/ChatQnA/langchain/docker/Dockerfile index 19ff8105..8b05ec5f 100644 --- a/ChatQnA/langchain/docker/Dockerfile +++ b/ChatQnA/langchain/docker/Dockerfile @@ -12,8 +12,8 @@ USER user COPY requirements.txt /tmp/requirements.txt -RUN pip install --upgrade pip && \ - pip install -r /tmp/requirements.txt +RUN pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir -r /tmp/requirements.txt ENV PYTHONPATH=/home/user:/home/user/qna-app/app diff --git a/CodeGen/codegen/Dockerfile b/CodeGen/codegen/Dockerfile index c410331d..b0bc0502 100644 --- a/CodeGen/codegen/Dockerfile +++ b/CodeGen/codegen/Dockerfile @@ -26,7 +26,7 @@ USER user COPY requirements.txt /tmp/requirements.txt -RUN pip install -U -r /tmp/requirements.txt +RUN pip install --no-cache-dir -U -r /tmp/requirements.txt ENV PYTHONPATH=/home/user:/home/user/codegen-app diff --git a/DocSum/langchain/docker/Dockerfile b/DocSum/langchain/docker/Dockerfile index 1ff2d0a2..92c906e6 100644 --- a/DocSum/langchain/docker/Dockerfile +++ b/DocSum/langchain/docker/Dockerfile @@ -12,8 +12,8 @@ USER user COPY requirements.txt /tmp/requirements.txt -RUN pip install --upgrade pip && \ - pip install -r /tmp/requirements.txt +RUN pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir -r /tmp/requirements.txt ENV PYTHONPATH=/home/user:/home/user/summarize-app/app From 669fcb158cf01a875890c8198613d65085364b59 Mon Sep 17 00:00:00 2001 From: tylertitsworth Date: Tue, 26 Mar 2024 09:26:57 -0700 Subject: [PATCH 4/7] fix crypto vuln --- ChatQnA/langchain/docker/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ChatQnA/langchain/docker/requirements.txt b/ChatQnA/langchain/docker/requirements.txt index bb90580a..5e2a420d 100644 --- a/ChatQnA/langchain/docker/requirements.txt +++ b/ChatQnA/langchain/docker/requirements.txt @@ -1,3 +1,4 @@ +cryptography==42.0.4 easyocr intel-extension-for-pytorch intel-openmp From 97bc86601b4a78d01d7e969c7325512a41092d67 Mon Sep 17 00:00:00 2001 From: tylertitsworth Date: Tue, 26 Mar 2024 09:35:14 -0700 Subject: [PATCH 5/7] remove ssh keys --- VisualQnA/serving/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/VisualQnA/serving/Dockerfile b/VisualQnA/serving/Dockerfile index 3d8a15fc..69bca036 100644 --- a/VisualQnA/serving/Dockerfile +++ b/VisualQnA/serving/Dockerfile @@ -14,6 +14,7 @@ # HABANA environment FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.1 AS hpu +RUN rm -rf /etc/ssh/ssh_host* # Set environment variables ENV LANG=en_US.UTF-8 From 035b63fbb4de68758b754db5f16faa4adab1bc24 Mon Sep 17 00:00:00 2001 From: Tyler Titsworth Date: Tue, 26 Mar 2024 21:32:38 -0700 Subject: [PATCH 6/7] Update README.md --- ChatQnA/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ChatQnA/README.md b/ChatQnA/README.md index 4ad0bec4..7dceb631 100644 --- a/ChatQnA/README.md +++ b/ChatQnA/README.md @@ -94,6 +94,7 @@ docker compose -f langchain/docker/docker-compose-redis.yml up -d Update the `HUGGINGFACEHUB_API_TOKEN` environment variable with your huggingface token in the `docker-compose-langchain.yml` ```bash +cd langchain/docker docker compose -f docker-compose-langchain.yml up -d cd ../../ ``` From 39348cb15b594a32823e1b446111dddde62ae8f5 Mon Sep 17 00:00:00 2001 From: Tyler Titsworth Date: Tue, 26 Mar 2024 21:33:06 -0700 Subject: [PATCH 7/7] Update requirements.txt --- ChatQnA/langchain/docker/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChatQnA/langchain/docker/requirements.txt b/ChatQnA/langchain/docker/requirements.txt index 5e2a420d..cd4d60bd 100644 --- a/ChatQnA/langchain/docker/requirements.txt +++ b/ChatQnA/langchain/docker/requirements.txt @@ -13,4 +13,4 @@ pymupdf redis sentence-transformers unstructured -unstructured[pdf] +unstructured[all-docs]