Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Alibi and Alibi-Detect versions and bump servers to Python 3.8 #4912

Merged
merged 16 commits into from
Jun 28, 2023
Merged
24 changes: 18 additions & 6 deletions .github/workflows/alibidetect_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
container: seldonio/python-builder:0.6

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.15
virtualenvs-create: false
- name: Install dependencies
run: |
pip install --upgrade pip setuptools
Expand All @@ -23,15 +30,20 @@ jobs:

python-tests:
runs-on: ubuntu-latest
container: seldonio/python-builder:0.6

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
version: 1.1.15
python-version: 3.8
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install dependencies
run: |
pip install --upgrade pip setuptools
apt-get update
apt-get -y install ffmpeg libsm6 libxext6
make -C components/alibi-detect-server dev_install
- name: Test
run: |
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/alibiexplainer_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
container: seldonio/python-builder:0.6

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
version: 1.1.15
python-version: 3.8
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install dependencies
run: |
pip install --upgrade pip setuptools
Expand All @@ -22,11 +29,18 @@ jobs:
make -C components/alibi-explain-server lint

python-tests:

runs-on: ubuntu-latest
container: seldonio/python-builder:0.6
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.15
virtualenvs-create: false
- name: Install dependencies
run: |
pip install --upgrade pip setuptools
Expand Down
21 changes: 9 additions & 12 deletions components/alibi-detect-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ LABEL name="Seldon Alibi Detect Server" \
description="The Alibi Detect Server provides outlier, drift and adversarial detection services for Seldon Core"

FROM base as builder
ARG PYTHON_VERSION
ARG CONDA_VERSION

RUN microdnf update -y && \
microdnf install -y \
Expand All @@ -23,19 +21,15 @@ RUN microdnf update -y && \
gcc-c++

# Install Rclone Binary to be present in the image
RUN wget https://downloads.rclone.org/v1.61.1/rclone-v1.61.1-linux-amd64.zip && \
unzip rclone-v1.61.1-linux-amd64.zip && \
mv rclone-v1.61.1-linux-amd64/rclone /usr/bin/rclone && \
rm -rf rclone-v1.61.1-linux-amd64.zip rclone-v1.61.1-linux-amd64
RUN wget https://downloads.rclone.org/v1.62.2/rclone-v1.62.2-linux-amd64.zip && \
unzip rclone-v1.62.2-linux-amd64.zip && \
mv rclone-v1.62.2-linux-amd64/rclone /usr/bin/rclone && \
rm -rf rclone-v1.62.2-linux-amd64.zip rclone-v1.62.2-linux-amd64

# Install Python / Conda
# Note that we need to force Conda to use the system's std-c++ library, as
# otherwise PyStan won't compile with Conda's older stdc++ library:
# https://github.com/stan-dev/pystan/issues/294#issuecomment-870711100
RUN conda install --yes -c conda-forge \
python=${PYTHON_VERSION} \
conda=${CONDA_VERSION} && \
pip install --upgrade pip setuptools wheel && \
RUN pip install --upgrade pip setuptools wheel && \
cd /opt/conda/lib && \
rm libstdc++.so libstdc++.so.6 && \
ln -s /usr/lib64/libstdc++.so.6.0.29 libstdc++.so && \
Expand Down Expand Up @@ -80,8 +74,11 @@ COPY --from=builder /opt/conda /opt/conda
COPY --from=builder /usr/bin/rclone /usr/bin/rclone
COPY --from=builder /licenses /licenses

# This is to have writable numba cache directory
# This is to have writable numba and keops cache directories
ENV NUMBA_CACHE_DIR /tmp/numba-cache
RUN mkdir /.cache && \
chown -R 8888:0 /.cache && \
chmod -R 776 /.cache

USER 8888
ENTRYPOINT ["python", "-m", "adserver"]
5 changes: 1 addition & 4 deletions components/alibi-detect-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ KIND_NAME=kind
SELDON_CORE_DIR=../..

BASE_IMAGE ?= seldonio/conda-ubi8
PYTHON_VERSION ?= 3.7.10
CONDA_VERSION ?= 4.13.0


get_local_repo: clean
cp $(SELDON_CORE_DIR)/version.txt version.txt
Expand Down Expand Up @@ -100,7 +97,7 @@ curl-metrics-server-metrics:
# image building logic

docker-build: get_local_repo
docker build -f Dockerfile --build-arg BASE_IMAGE=${BASE_IMAGE} --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg CONDA_VERSION=${CONDA_VERSION} --build-arg VERSION=${VERSION} -t ${REPO}/${IMAGE}:${VERSION} .
docker build -f Dockerfile --build-arg BASE_IMAGE=${BASE_IMAGE} --build-arg VERSION=${VERSION} -t ${REPO}/${IMAGE}:${VERSION} .

docker-build-gpu:
docker build -f Dockerfile.gpu -t ${REPO}/${IMAGE}-gpu:${VERSION} .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_basic(self):
model = DummyCDModel()
ad_model = AlibiDetectConceptDriftModel(
"imdb_text_drift",
"gs://seldon-models/alibi-detect/cd/ks/imdb-0_10_4",
"gs://seldon-models/alibi-detect/cd/ks/imdb-0_11_2",
drift_batch_size=2,
)
req = [
Expand Down
Loading