Skip to content

Commit

Permalink
install torch cpu before install sentence_transformers to avoid nv …
Browse files Browse the repository at this point in the history
…components (opea-project#221)

* install torch cpu before install `sentence_transformers` to avoid nv components

Signed-off-by: chensuyue <suyue.chen@intel.com>

* add dataprep/redis/langchain test

Signed-off-by: chensuyue <suyue.chen@intel.com>

* add torch vision for retrievers langchain redis

Signed-off-by: chensuyue <suyue.chen@intel.com>

* expand test wait time

Signed-off-by: chensuyue <suyue.chen@intel.com>

* remove test

Signed-off-by: chensuyue <suyue.chen@intel.com>

* support torch cpu install

Signed-off-by: chensuyue <suyue.chen@intel.com>

* support torch cpu install

Signed-off-by: chensuyue <suyue.chen@intel.com>

* fix bug

Signed-off-by: chensuyue <suyue.chen@intel.com>

---------

Signed-off-by: chensuyue <suyue.chen@intel.com>
Signed-off-by: sharanshirodkar7 <ssharanshirodkar7@gmail.com>
  • Loading branch information
chensuyue authored and sharanshirodkar7 committed Jul 9, 2024
1 parent 1fd319f commit 928f720
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/reuse-get-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
if [[ "${path_level_1[@]}" =~ "${service}" ]]; then
run_matrix="${run_matrix}{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},"
else
vendors=$(printf '%s\n' "${changed_files[@]}" | grep ${service} | cut -d'/' -f3 | grep -vE '*.py|Dockerfile|*.md' | sort -u)
vendors=$(printf '%s\n' "${changed_files[@]}" | grep ${service} | cut -d'/' -f3 | grep -vE '*.py|Dockerfile|*.md|*.sh' | sort -u)
for vendor in ${vendors}; do
if [[ "${path_level_3[@]}" =~ "${service}/${vendor}" ]]; then
sub_vendors=$(printf '%s\n' "${changed_files[@]}" | grep ${service} | grep ${vendor} | cut -d'/' -f4 | grep -vE '*.py' | sort -u)
Expand Down
3 changes: 3 additions & 0 deletions comps/dataprep/milvus/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM python:3.11-slim

ENV LANG C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
libgl1-mesa-glx \
Expand All @@ -21,6 +23,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/dataprep/milvus/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/dataprep/qdrant/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM python:3.11-slim

ENV LANG C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
libgl1-mesa-glx \
Expand All @@ -21,6 +23,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/dataprep/qdrant/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/dataprep/redis/langchain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM python:3.11-slim

ENV LANG C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
libgl1-mesa-glx \
Expand All @@ -21,6 +23,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip setuptools && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/dataprep/redis/langchain/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/dataprep/redis/langchain_ray/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM python:3.11-slim

ENV LANG C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
libgl1-mesa-glx \
Expand All @@ -21,6 +23,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip setuptools && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/dataprep/redis/langchain_ray/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/dataprep/redis/llama_index/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM python:3.11-slim

ENV LANG C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
libgl1-mesa-glx \
Expand All @@ -21,6 +23,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip setuptools && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/dataprep/redis/llama_index/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/embeddings/langchain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

FROM langchain/langchain:latest

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
libgl1-mesa-glx \
libjemalloc-dev \
Expand All @@ -18,6 +20,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/embeddings/langchain/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/reranks/langchain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM python:3.11-slim

ENV LANG C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
libgl1-mesa-glx \
libjemalloc-dev \
Expand All @@ -20,6 +22,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/reranks/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/retrievers/langchain/milvus/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM python:3.11-slim

ENV LANG C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
libgl1-mesa-glx \
Expand All @@ -21,6 +23,7 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/retrievers/langchain/milvus/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
3 changes: 3 additions & 0 deletions comps/retrievers/langchain/redis/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

FROM langchain/langchain:latest

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
libgl1-mesa-glx \
libjemalloc-dev \
Expand All @@ -20,6 +22,7 @@ RUN chmod +x /home/user/comps/retrievers/langchain/redis/run.sh
USER user

RUN pip install --no-cache-dir --upgrade pip && \
if [ ${ARCH} = "cpu" ]; then pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/retrievers/langchain/redis/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down

0 comments on commit 928f720

Please sign in to comment.