From 4b568ec444ccbf862ca9f213b5672693bf0cbf6f Mon Sep 17 00:00:00 2001 From: jagadeesh Date: Thu, 24 Aug 2023 13:14:29 +0530 Subject: [PATCH 1/2] fix kserve storage optional package Signed-off-by: jagadeesh --- kubernetes/kserve/kserve_wrapper/TorchserveModel.py | 3 ++- kubernetes/kserve/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kubernetes/kserve/kserve_wrapper/TorchserveModel.py b/kubernetes/kserve/kserve_wrapper/TorchserveModel.py index aa28a50aa7..b85aa52e01 100644 --- a/kubernetes/kserve/kserve_wrapper/TorchserveModel.py +++ b/kubernetes/kserve/kserve_wrapper/TorchserveModel.py @@ -6,6 +6,7 @@ import kserve from kserve.errors import ModelMissingError from kserve.model import Model as Model +from kserve.storage import Storage logging.basicConfig(level=kserve.constants.KSERVE_LOGLEVEL) @@ -53,7 +54,7 @@ def load(self) -> bool: """This method validates model availabilty in the model directory and sets ready flag to true. """ - model_path = pathlib.Path(kserve.Storage.download(self.model_dir)) + model_path = pathlib.Path(Storage.download(self.model_dir)) paths = list(pathlib.Path(model_path).glob("*.mar")) existing_paths = [path for path in paths if path.exists()] if len(existing_paths) == 0: diff --git a/kubernetes/kserve/requirements.txt b/kubernetes/kserve/requirements.txt index 81199e737f..d38cdf548e 100644 --- a/kubernetes/kserve/requirements.txt +++ b/kubernetes/kserve/requirements.txt @@ -1,3 +1,3 @@ -kserve>=0.9.0 +kserve[storage]>=0.11.0 transformers captum From 4fdd7b2d23f75bfbb3517c236cbb5f5686912b5a Mon Sep 17 00:00:00 2001 From: jagadeesh Date: Thu, 24 Aug 2023 13:37:40 +0530 Subject: [PATCH 2/2] upgrade kserve at Docker dev Signed-off-by: jagadeesh --- kubernetes/kserve/Dockerfile.dev | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kubernetes/kserve/Dockerfile.dev b/kubernetes/kserve/Dockerfile.dev index 4e7970c11e..731a0e8e2b 100644 --- a/kubernetes/kserve/Dockerfile.dev +++ b/kubernetes/kserve/Dockerfile.dev @@ -17,7 +17,6 @@ FROM ${BASE_IMAGE} AS compile-image ARG BASE_IMAGE ARG BRANCH_NAME=master ARG MACHINE_TYPE=cpu -ARG BRANCH_NAME_KF=master ENV PYTHONUNBUFFERED TRUE RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \ @@ -46,7 +45,7 @@ RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \ && rm -rf /var/lib/apt/lists/* \ && cd /tmp \ -RUN update-alternatives --remove python /usr/bin/python \ + RUN update-alternatives --remove python /usr/bin/python \ && update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 #ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache @@ -62,7 +61,7 @@ RUN if [ "$MACHINE_TYPE" = "gpu" ]; then export USE_CUDA=1; fi \ && git checkout ${BRANCH_NAME} \ && if [ -z "$CUDA_VERSION" ]; then python ts_scripts/install_dependencies.py --environment=dev; else python ts_scripts/install_dependencies.py --environment=dev --cuda $CUDA_VERSION; fi \ && python ts_scripts/install_from_src.py \ - && python -m pip install captum transformers kserve \ + && python -m pip install captum transformers kserve[storage]>=0.11.0 \ && python -m pip install . \ && useradd -m model-server \ && mkdir -p /home/model-server/tmp \