From c3078e64ddb2b685731e85d0aa774e48e2b4eafd Mon Sep 17 00:00:00 2001 From: GuangJie1 Date: Sat, 30 Nov 2024 10:26:50 +0800 Subject: [PATCH] ChatAna: support for multi architectures --- .../0.3.3-npu/24.03-lts/Dockerfile | 7 ++- .../0.3.3-redis5.1.1/24.03-lts/Dockerfile | 16 +++++- retriever-redis-langchain/meta.yml | 3 +- .../1.5/24.03-lts/Dockerfile | 54 ++++++------------- text-embeddings-inference-cpu/meta.yml | 3 +- .../22.03-lts/Dockerfile | 11 ++++ vllm/meta.yml | 4 +- 7 files changed, 51 insertions(+), 47 deletions(-) create mode 100644 vllm/0.6.3-cann8.0.rc3.alpha002-910b-py3.9/22.03-lts/Dockerfile diff --git a/llm-vllm-langchain/0.3.3-npu/24.03-lts/Dockerfile b/llm-vllm-langchain/0.3.3-npu/24.03-lts/Dockerfile index 5b01ae7..897f61c 100644 --- a/llm-vllm-langchain/0.3.3-npu/24.03-lts/Dockerfile +++ b/llm-vllm-langchain/0.3.3-npu/24.03-lts/Dockerfile @@ -19,9 +19,7 @@ USER user WORKDIR /home/user/ -RUN git clone --depth=1 --branch v1.0 https://github.com/opea-project/GenAIComps.git && \ - cp -r GenAIComps/comps . && \ - rm -rf GenAIComps +RUN git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout v1.0 RUN cd /tmp && git clone --depth 1 https://github.com/trimesh/vhacdx && cd vhacdx && \ CFLAGS="-I /tmp/vhacdx" pip install . && \ @@ -30,7 +28,8 @@ RUN cd /tmp && git clone --depth 1 https://github.com/trimesh/vhacdx && cd vhacd RUN python -m pip install scikit-build-core numpy && \ cd /tmp && git clone --depth 1 https://github.com/elalish/manifold.git && \ cd manifold && git clone --depth 1 --branch v2021.10.0 https://github.com/oneapi-src/oneTBB.git && \ - python -m pip install --upgrade pip setuptools wheel build nanobind ninja && \ + python -m pip install --upgrade pip setuptools wheel build ninja && \ + pip install "nanobind>=1.8.0,<=2.2.0" && \ python -m build --no-isolation --sdist --wheel && \ python -m pip install dist/manifold3d-*.whl && \ rm -rf /tmp/manifold diff --git a/retriever-redis-langchain/0.3.3-redis5.1.1/24.03-lts/Dockerfile b/retriever-redis-langchain/0.3.3-redis5.1.1/24.03-lts/Dockerfile index ca061bb..78d43bf 100644 --- a/retriever-redis-langchain/0.3.3-redis5.1.1/24.03-lts/Dockerfile +++ b/retriever-redis-langchain/0.3.3-redis5.1.1/24.03-lts/Dockerfile @@ -7,12 +7,26 @@ ARG ARCH="cpu" RUN yum update -y && \ yum install -y --setopt=install_weak_deps=False \ - python-pip python \ + python-pip python python3-devel \ + cmake gcc-c++ git \ shadow-utils \ mesa-libGL \ jemalloc-devel \ git +RUN cd /tmp && git clone --depth 1 https://github.com/trimesh/vhacdx && cd vhacdx && \ + CFLAGS="-I /tmp/vhacdx" pip install . && \ + rm -rf /tmp/vhacdx + +RUN python -m pip install scikit-build-core numpy && \ + cd /tmp && git clone --depth 1 https://github.com/elalish/manifold.git && \ + cd manifold && git clone --depth 1 --branch v2021.10.0 https://github.com/oneapi-src/oneTBB.git && \ + python -m pip install --upgrade pip setuptools wheel build ninja && \ + pip install "nanobind>=1.8.0,<=2.2.0" && \ + python -m build --no-isolation --sdist --wheel && \ + python -m pip install dist/manifold3d-*.whl && \ + rm -rf /tmp/manifold + RUN useradd -m -s /bin/bash user && \ mkdir -p /home/user && \ chown -R user /home/user/ diff --git a/retriever-redis-langchain/meta.yml b/retriever-redis-langchain/meta.yml index f07b1cb..b491223 100644 --- a/retriever-redis-langchain/meta.yml +++ b/retriever-redis-langchain/meta.yml @@ -1,3 +1,2 @@ 0.3.3-redis5.1.1-oe2403lts: - path: retriever-redis-langchain/0.3.3-redis5.1.1/24.03-lts/Dockerfile - arch: x86_64 \ No newline at end of file + path: retriever-redis-langchain/0.3.3-redis5.1.1/24.03-lts/Dockerfile \ No newline at end of file diff --git a/text-embeddings-inference-cpu/1.5/24.03-lts/Dockerfile b/text-embeddings-inference-cpu/1.5/24.03-lts/Dockerfile index 7fb6efd..79c5e9f 100644 --- a/text-embeddings-inference-cpu/1.5/24.03-lts/Dockerfile +++ b/text-embeddings-inference-cpu/1.5/24.03-lts/Dockerfile @@ -1,13 +1,12 @@ FROM openeuler/openeuler:24.03-lts AS chef +ARG TARGETARCH +ARG BUILDARCH WORKDIR /usr/src - -ENV SCCACHE=0.5.4 -ENV RUSTC_WRAPPER=/usr/local/bin/sccache - RUN yum update -y && \ yum install -y \ --setopt=install_weak_deps=False \ openssl-devel \ + ca-certificates \ gcc \ g++ \ git @@ -16,62 +15,46 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init && chmod +x rustup-init && \ ./rustup-init -y && \ rm rustup-init - ENV PATH="/root/.cargo/bin:$PATH" - -# Donwload, configure sccache -RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v$SCCACHE/sccache-v$SCCACHE-x86_64-unknown-linux-musl.tar.gz | tar -xzv --strip-components=1 -C /usr/local/bin sccache-v$SCCACHE-x86_64-unknown-linux-musl/sccache && \ - chmod +x /usr/local/bin/sccache - RUN cargo install cargo-chef --locked FROM chef AS planner - RUN git clone https://github.com/huggingface/text-embeddings-inference.git - WORKDIR /usr/src/text-embeddings-inference - RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder - +RUN yum update -y && \ + yum install -y \ + --setopt=install_weak_deps=False \ + ca-certificates \ + openssl-devel ARG GIT_SHA ARG DOCKER_LABEL - -# sccache specific variables ARG ACTIONS_CACHE_URL ARG ACTIONS_RUNTIME_TOKEN -ARG SCCACHE_GHA_ENABLED - COPY --from=planner /usr/src/text-embeddings-inference/recipe.json recipe.json - -RUN cargo chef cook --release --features ort --no-default-features --recipe-path recipe.json && sccache -s - +RUN cargo chef cook --release --features ort --no-default-features --recipe-path recipe.json RUN git clone https://github.com/huggingface/text-embeddings-inference.git FROM builder AS http-builder WORKDIR /usr/src/text-embeddings-inference - -RUN cargo build --release --bin text-embeddings-router -F ort -F http --no-default-features && sccache -s +RUN cargo build --release --bin text-embeddings-router -F ort -F http --no-default-features FROM builder AS grpc-builder WORKDIR /usr/src/text-embeddings-inference - -RUN PROTOC_ZIP=protoc-21.12-linux-x86_64.zip && \ +RUN PROTOC_ARCH=$(if [ "$TARGETARCH" = "amd64" ]; then echo "x86_64"; elif [ "$TARGETARCH" = "arm64" ]; then echo "aarch64"; fi) && \ + PROTOC_ZIP=protoc-21.12-linux-$PROTOC_ARCH.zip && \ curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \ unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \ unzip -o $PROTOC_ZIP -d /usr/local 'include/*' && \ rm -f $PROTOC_ZIP - COPY proto proto - -RUN cargo build --release --bin text-embeddings-router -F grpc -F ort --no-default-features && sccache -s +RUN cargo build --release --bin text-embeddings-router -F grpc -F ort --no-default-features FROM openeuler/openeuler:24.03-lts AS base - ENV HUGGINGFACE_HUB_CACHE=/data \ PORT=80 - RUN yum update -y && \ yum install -y \ --setopt=install_weak_deps=False \ @@ -79,24 +62,21 @@ RUN yum update -y && \ openssl-devel FROM base AS grpc - -COPY --from=grpc-builder /usr/src/text-embeddings-inference/target/release/text-embeddings-router /usr/local/bin/text-embeddings-router - +COPY --from=grpc-builder /usr/src/text-embeddings-inference/target/release/text-embeddings-router \ +/usr/local/bin/text-embeddings-router ENTRYPOINT ["text-embeddings-router"] CMD ["--json-output"] FROM base AS http - -COPY --from=http-builder /usr/src/text-embeddings-inference/target/release/text-embeddings-router /usr/local/bin/text-embeddings-router +COPY --from=http-builder /usr/src/text-embeddings-inference/target/release/text-embeddings-router \ +/usr/local/bin/text-embeddings-router # Amazon SageMaker compatible image FROM http AS sagemaker COPY --chmod=775 sagemaker-entrypoint.sh entrypoint.sh - ENTRYPOINT ["./entrypoint.sh"] # Default image FROM http - ENTRYPOINT ["text-embeddings-router"] CMD ["--json-output"] diff --git a/text-embeddings-inference-cpu/meta.yml b/text-embeddings-inference-cpu/meta.yml index fa1a239..0677c90 100644 --- a/text-embeddings-inference-cpu/meta.yml +++ b/text-embeddings-inference-cpu/meta.yml @@ -1,3 +1,2 @@ 1.5-oe2403lts: - path: text-embeddings-inference-cpu/1.5/24.03-lts/Dockerfile - arch: x86_64 \ No newline at end of file + path: text-embeddings-inference-cpu/1.5/24.03-lts/Dockerfile \ No newline at end of file diff --git a/vllm/0.6.3-cann8.0.rc3.alpha002-910b-py3.9/22.03-lts/Dockerfile b/vllm/0.6.3-cann8.0.rc3.alpha002-910b-py3.9/22.03-lts/Dockerfile new file mode 100644 index 0000000..8b15ddf --- /dev/null +++ b/vllm/0.6.3-cann8.0.rc3.alpha002-910b-py3.9/22.03-lts/Dockerfile @@ -0,0 +1,11 @@ +FROM ascendai/cann:8.0.rc3.alpha002-910b-openeuler22.03-py3.9 +RUN dnf update -y && \ + dnf install -y python3-pip git +WORKDIR /workspace +RUN git clone -b npu_support --depth 1 https://github.com/GuangJie1/vllm.git +# install build requirements +RUN PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu" python3 -m pip install -r /workspace/vllm/requirements-build.txt +# build vLLM with NPU backend +RUN PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu" VLLM_TARGET_DEVICE="npu" python3 -m pip install /workspace/vllm/ +ENV HF_ENDPOINT=https://hf-mirror.com +ENTRYPOINT ["bash", "-c", "source /root/.bashrc && exec python3 -m vllm.entrypoints.openai.api_server \"$@\"", "--"] \ No newline at end of file diff --git a/vllm/meta.yml b/vllm/meta.yml index f7f8162..af53a6a 100644 --- a/vllm/meta.yml +++ b/vllm/meta.yml @@ -1,3 +1,5 @@ 0.6.3-oe2403lts: path: vllm/0.6.3/24.03-lts/Dockerfile - arch: x86_64 \ No newline at end of file + arch: x86_64 +0.6.3-cann8.0.rc3.alpha002-910b-py3.9-oe2203lts: + path: vllm-npu-openai/0.6.3-cann8.0.rc3.alpha002-910b-py3.9/22.03-lts/Dockerfile \ No newline at end of file -- Gitee