From 8eed4b7ceb574c635fb1f586e9a6af13a7a5b0f5 Mon Sep 17 00:00:00 2001 From: agunapal Date: Thu, 11 May 2023 18:44:27 +0000 Subject: [PATCH 1/4] re-run kserve build because of runner issue --- .github/workflows/official_release.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/official_release.yml b/.github/workflows/official_release.yml index a42cb6f986..241ae7f468 100644 --- a/.github/workflows/official_release.yml +++ b/.github/workflows/official_release.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-20.04, macOS-latest, windows-latest] + os: [ubuntu-20.04] steps: - name: Setup Conda uses: s-weigand/setup-conda@v1 @@ -32,30 +32,11 @@ jobs: with: distribution: 'zulu' java-version: '17' - - name: Build PyPI & conda binaries - run: python binaries/build.py - - name: Push conda binaries - env: - ANACONDA_API_TOKEN: ${{ secrets.CONDA_PASSWORD }} - run: python binaries/upload.py --upload-conda-packages - - name: Push PyPI binaries - env: - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - if: matrix.os == 'ubuntu-20.04' - run: python binaries/upload.py --upload-pypi-packages - name: Login to Docker env: DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} - if: matrix.os == 'ubuntu-20.04' run: docker login --username pytorchbot --password "$DOCKER_PASSWORD" - - name: Build & Upload pytorch/torchserve Docker images - if: matrix.os == 'ubuntu-20.04' - run: | - cd docker - python build_upload_release.py - cd .. - name: Build & Upload pytorch/torchserve-kfs Docker images - if: matrix.os == 'ubuntu-20.04' run: | cd kubernetes/kserve python build_upload_release.py From 2f4995753d8eab17cc64ad2087d4d83436c3f040 Mon Sep 17 00:00:00 2001 From: agunapal Date: Thu, 11 May 2023 21:33:28 +0000 Subject: [PATCH 2/4] Fixes missing dependencies --- docker/Dockerfile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a6d6382d7a..a7c49c49f2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -47,6 +47,7 @@ RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \ python$PYTHON_VERSION-venv \ openjdk-17-jdk \ curl \ + git \ && rm -rf /var/lib/apt/lists/* # Make the virtual environment and "activating" it by adding it first to the path. @@ -62,26 +63,29 @@ RUN export USE_CUDA=1 ARG CUDA_VERSION="" -RUN TORCH_VER=$(curl --silent --location https://pypi.org/pypi/torch/json | python -c "import sys, json, pkg_resources; releases = json.load(sys.stdin)['releases']; print(sorted(releases, key=pkg_resources.parse_version)[-1])") && \ - TORCH_VISION_VER=$(curl --silent --location https://pypi.org/pypi/torchvision/json | python -c "import sys, json, pkg_resources; releases = json.load(sys.stdin)['releases']; print(sorted(releases, key=pkg_resources.parse_version)[-1])") && \ +RUN git clone https://github.com/pytorch/serve.git + +WORKDIR "serve" + +RUN \ if echo "$BASE_IMAGE" | grep -q "cuda:"; then \ # Install CUDA version specific binary when CUDA version is specified as a build arg if [ "$CUDA_VERSION" ]; then \ - python -m pip install --no-cache-dir torch==$TORCH_VER+$CUDA_VERSION torchvision==$TORCH_VISION_VER+$CUDA_VERSION -f https://download.pytorch.org/whl/torch_stable.html; \ - # Install the binary with the latest CUDA version support + python ./ts_scripts/install_dependencies.py --cuda $CUDA_VERSION; \ + # Install the binary with the latest CPU image on a CUDA base image else \ - python -m pip install --no-cache-dir torch torchvision; \ + python ./ts_scripts/install_dependencies.py; \ fi; \ - python -m pip install --no-cache-dir -r https://raw.githubusercontent.com/pytorch/serve/master/requirements/common.txt; \ # Install the CPU binary else \ - python -m pip install --no-cache-dir torch==$TORCH_VER+cpu torchvision==$TORCH_VISION_VER+cpu -f https://download.pytorch.org/whl/torch_stable.html; \ + python ./ts_scripts/install_dependencies.py; \ fi -RUN python -m pip install --no-cache-dir captum torchtext torchserve torch-model-archiver pyyaml +# Make sure latest version of torchserve is uploaded before running this +RUN python -m pip install --no-cache-dir torchserve torch-model-archiver torch-workflow-archiver # Final image for production -FROM ${BASE_IMAGE} AS runtime-image +FROM ${BASE_IMAGE} AS runtime-image # Re-state ARG PYTHON_VERSION to make it active in this build-stage (uses default define at the top) ARG PYTHON_VERSION ENV PYTHONUNBUFFERED TRUE From 5e386db3d5b60e8524246622cf4acf3480ef5200 Mon Sep 17 00:00:00 2001 From: agunapal Date: Thu, 11 May 2023 21:34:56 +0000 Subject: [PATCH 3/4] Fixes missing dependencies --- .github/workflows/official_release.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/official_release.yml b/.github/workflows/official_release.yml index 241ae7f468..a42cb6f986 100644 --- a/.github/workflows/official_release.yml +++ b/.github/workflows/official_release.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-20.04] + os: [ubuntu-20.04, macOS-latest, windows-latest] steps: - name: Setup Conda uses: s-weigand/setup-conda@v1 @@ -32,11 +32,30 @@ jobs: with: distribution: 'zulu' java-version: '17' + - name: Build PyPI & conda binaries + run: python binaries/build.py + - name: Push conda binaries + env: + ANACONDA_API_TOKEN: ${{ secrets.CONDA_PASSWORD }} + run: python binaries/upload.py --upload-conda-packages + - name: Push PyPI binaries + env: + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + if: matrix.os == 'ubuntu-20.04' + run: python binaries/upload.py --upload-pypi-packages - name: Login to Docker env: DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} + if: matrix.os == 'ubuntu-20.04' run: docker login --username pytorchbot --password "$DOCKER_PASSWORD" + - name: Build & Upload pytorch/torchserve Docker images + if: matrix.os == 'ubuntu-20.04' + run: | + cd docker + python build_upload_release.py + cd .. - name: Build & Upload pytorch/torchserve-kfs Docker images + if: matrix.os == 'ubuntu-20.04' run: | cd kubernetes/kserve python build_upload_release.py From 8cf487542d7c03f5505b32c1804a85af12e8e004 Mon Sep 17 00:00:00 2001 From: agunapal Date: Thu, 11 May 2023 22:37:38 +0000 Subject: [PATCH 4/4] added depth 1 to reduce clone size by 50 MB --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a7c49c49f2..333f585047 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -63,7 +63,7 @@ RUN export USE_CUDA=1 ARG CUDA_VERSION="" -RUN git clone https://github.com/pytorch/serve.git +RUN git clone --depth 1 https://github.com/pytorch/serve.git WORKDIR "serve"