diff --git a/Dockerfile_intel b/Dockerfile_intel index 05654167..0f0d4383 100644 --- a/Dockerfile_intel +++ b/Dockerfile_intel @@ -53,7 +53,7 @@ ARG MAMBA_VERSION=23.1.0-1 ARG PYTHON_VERSION='3.11.10' # Automatically set by buildx ARG TARGETPLATFORM -ENV PATH="/opt/conda/bin:$PATH" +ENV PATH=/opt/conda/bin:$PATH # TGI seem to require libssl.so.1.1 instead of libssl.so.3 so we can't use ubuntu 22.04. Ubuntu 20.04 has python==3.8, and TGI requires python>=3.9, hence the need for miniconda. # Install mamba @@ -97,29 +97,22 @@ ENV HF_HOME=/data \ WORKDIR /usr/src +RUN pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/torch-2.5.0a0%2Bgite84e33f-cp311-cp311-linux_x86_64.whl --no-cache-dir +RUN pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/torchaudio-2.5.0a0%2B56bc006-cp311-cp311-linux_x86_64.whl --no-cache-dir +RUN pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/torchvision-0.20.0a0%2B8e8a208-cp311-cp311-linux_x86_64.whl --no-cache-dir +RUN pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/oneccl_bind_pt-2.5.0%2Bxpu-cp311-cp311-linux_x86_64.whl --no-cache-dir + +RUN pip install triton-xpu==3.0.0b2 --no-cache-dir # Install server COPY proto proto COPY server server COPY server/Makefile server/Makefile +ENV UV_SYSTEM_PYTHON=1 RUN cd server && \ + make gen-server && \ pip install -U pip uv && \ - uv sync --frozen --extra gen --extra accelerate --extra compressed-tensors --extra quantize --extra peft --extra outlines --no-install-project && \ - . ./.venv/bin/activate && \ - make gen-server-raw - -RUN cd server && \ - uv sync --frozen --extra gen --extra accelerate --extra compressed-tensors --extra quantize --extra peft --extra outlines && \ - . ./.venv/bin/activate && \ - pwd && \ - text-generation-server --help - -RUN . ./server/.venv/bin/activate && uv pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/torch-2.5.0a0%2Bgite84e33f-cp311-cp311-linux_x86_64.whl --no-cache-dir -RUN . ./server/.venv/bin/activate && uv pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/torchaudio-2.5.0a0%2B56bc006-cp311-cp311-linux_x86_64.whl --no-cache-dir -# RUN . ./server/.venv/bin/activate && uv pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/torchvision-0.20.0a0%2B8e8a208-cp311-cp311-linux_x86_64.whl --no-cache-dir -# RUN . ./server/.venv/bin/activate && uv pip install https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/ipex_dev/xpu/oneccl_bind_pt-2.5.0%2Bxpu-cp311-cp311-linux_x86_64.whl --no-cache-dir - -RUN . ./server/.venv/bin/activate && uv pip install triton-xpu==3.0.0b2 --no-cache-dir + uv pip install -e ".[accelerate, compressed-tensors, peft, outlines]" --no-cache-dir ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/oneapi/pti/0.9/lib:/opt/conda/lib ENV CCL_ZE_IPC_EXCHANGE=sockets @@ -128,7 +121,7 @@ ENV CCL_ZE_IPC_EXCHANGE=sockets ENV TORCH_DEVICE_BACKEND_AUTOLOAD=0 RUN git clone https://github.com/intel/intel-extension-for-pytorch && cd intel-extension-for-pytorch && git checkout 1ccf72b2d11cd00b47aef6d6cd054c088aa6f083 -RUN . ./server/.venv/bin/activate && cd intel-extension-for-pytorch && git submodule update --init --recursive && USE_AOT_DEVLIST='pvc,ats-m150' BUILD_SEPARATE_OPS=OFF BUILD_WITH_CPU=OFF USE_XETLA=ON python setup.py install && rm -rf /usr/src/intel-extension-for-pytorch +RUN cd intel-extension-for-pytorch && git submodule update --init --recursive && USE_AOT_DEVLIST='pvc,ats-m150' BUILD_SEPARATE_OPS=OFF BUILD_WITH_CPU=OFF USE_XETLA=ON python setup.py install && rm -rf /usr/src/intel-extension-for-pytorch # Install benchmarker COPY --from=builder /usr/src/target/release-opt/text-generation-benchmark /usr/local/bin/text-generation-benchmark @@ -169,7 +162,7 @@ ARG MAMBA_VERSION=23.1.0-1 ARG PYTHON_VERSION='3.11.10' # Automatically set by buildx ARG TARGETPLATFORM -ENV PATH="/opt/conda/bin:$PATH" +ENV PATH /opt/conda/bin:$PATH # TGI seem to require libssl.so.1.1 instead of libssl.so.3 so we can't use ubuntu 22.04. Ubuntu 20.04 has python==3.8, and TGI requires python>=3.9, hence the need for miniconda. # Install mamba @@ -192,38 +185,22 @@ RUN case ${TARGETPLATFORM} in \ RUN conda install -c conda-forge gperftools mkl + +RUN pip install https://download.pytorch.org/whl/nightly/cpu/torch-2.5.0.dev20240815%2Bcpu-cp311-cp311-linux_x86_64.whl +RUN pip install https://download.pytorch.org/whl/nightly/cpu/torchvision-0.20.0.dev20240815%2Bcpu-cp311-cp311-linux_x86_64.whl +RUN pip install https://download.pytorch.org/whl/nightly/cpu/torchaudio-2.4.0.dev20240815%2Bcpu-cp311-cp311-linux_x86_64.whl + +RUN pip install triton py-libnuma + WORKDIR /usr/src -# Install server -COPY proto proto -COPY server server -COPY server/Makefile server/Makefile -RUN cd server && \ - pip install -U pip uv && \ - uv sync --frozen --extra gen --extra accelerate --extra compressed-tensors --extra quantize --extra peft --extra outlines --no-install-project && \ - . ./.venv/bin/activate && \ - make gen-server-raw - -RUN cd server && \ - uv sync --frozen --extra gen --extra accelerate --extra compressed-tensors --extra quantize --extra peft --extra outlines && \ - . ./.venv/bin/activate && \ - pwd && \ - text-generation-server --help - -RUN . ./server/.venv/bin/activate && uv pip install https://download.pytorch.org/whl/nightly/cpu/torch-2.5.0.dev20240815%2Bcpu-cp311-cp311-linux_x86_64.whl -RUN . ./server/.venv/bin/activate && uv pip install https://download.pytorch.org/whl/nightly/cpu/torchvision-0.20.0.dev20240815%2Bcpu-cp311-cp311-linux_x86_64.whl -RUN . ./server/.venv/bin/activate && uv pip install https://download.pytorch.org/whl/nightly/cpu/torchaudio-2.4.0.dev20240815%2Bcpu-cp311-cp311-linux_x86_64.whl - -RUN . ./server/.venv/bin/activate && uv pip install triton==3.1.0 py-libnuma - - RUN git clone https://github.com/intel/intel-extension-for-pytorch && cd intel-extension-for-pytorch && git checkout b7b552baf64283b594665b8687430fe92990e497 RUN git clone https://github.com/intel/torch-ccl.git && cd torch-ccl && git checkout v2.4.0+cpu+rc0 RUN sed -i 's/VERSION_MINOR 6/VERSION_MINOR 5/' intel-extension-for-pytorch/version.txt -RUN . ./server/.venv/bin/activate && cd intel-extension-for-pytorch && git submodule sync && git submodule update --init --recursive && python setup.py install +RUN cd intel-extension-for-pytorch && git submodule sync && git submodule update --init --recursive && python setup.py install -RUN . ./server/.venv/bin/activate && cd torch-ccl && git submodule sync && git submodule update --init --recursive && uv pip install . +RUN cd torch-ccl && git submodule sync && git submodule update --init --recursive && pip install . ENV LD_PRELOAD=/opt/conda/lib/libtcmalloc.so ENV CCL_ROOT=/opt/conda/lib/python3.11/site-packages/oneccl_bindings_for_pytorch @@ -232,6 +209,15 @@ ENV FI_PROVIDER_PATH=/opt/conda/lib/python3.11/site-packages/oneccl_bindings_for ENV LD_LIBRARY_PATH=/opt/conda/lib/python3.11/site-packages/oneccl_bindings_for_pytorch/opt/mpi/libfabric/lib:/opt/conda/lib/python3.11/site-packages/oneccl_bindings_for_pytorch/lib ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/conda/lib/" +# Install server +COPY proto proto +COPY server server +COPY server/Makefile server/Makefile +ENV UV_SYSTEM_PYTHON=1 +RUN cd server && \ + make gen-server && \ + pip install -U pip uv && \ + uv pip install -e ".[accelerate, compressed-tensors, peft, outlines]" --no-cache-dir # Install benchmarker COPY --from=builder /usr/src/target/release-opt/text-generation-benchmark /usr/local/bin/text-generation-benchmark @@ -245,8 +231,5 @@ ENV ATTENTION=flashdecoding-ipex ENV PREFIX_CACHING=1 ENV PREFILL_CHUNKING=1 ENV CUDA_GRAPHS=0 -COPY ./tgi-entrypoint.sh /tgi-entrypoint.sh -RUN chmod +x /tgi-entrypoint.sh - -ENTRYPOINT ["/tgi-entrypoint.sh"] +ENTRYPOINT ["text-generation-launcher"] CMD ["--json-output"]