Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/alibi-detect-server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_seldon_core/.tox
2 changes: 1 addition & 1 deletion components/alibi-detect-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL := /bin/bash
VERSION ?= $(shell cat ../../version.txt)
DOCKER_REGISTRY ?= seldonio

BASE_IMAGE ?= ${DOCKER_REGISTRY}/conda-ubi8
BASE_IMAGE ?= ${DOCKER_REGISTRY}/conda-ubi9
IMAGE ?= ${DOCKER_REGISTRY}/alibi-detect-server
KIND_NAME ?= kind

Expand Down
8 changes: 4 additions & 4 deletions components/alibi-detect-server/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[tool.poetry]
name = "adserver"
version = "1.18.0"
version = "1.19.0-dev"
description = "Model Explanation Server"
authors = ["Seldon Technologies Ltd. <hello@seldon.io>"]
license = "Business Source License 1.1"

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
python = ">=3.12, <3.13.0"
alibi-detect = {version = "^0.11.4", extras = ["all"]}
seldon-core = {path = "_seldon_core", develop = false}
numpy = "*"
cloudevents = "1.2.0"
tensorflow = "^2.12.0"
scikit-learn = "0.24.2"
tensorflow = "2.17.1"
scikit-learn = "1.7.2"

elasticsearch = "7.9.1"

Expand Down
18 changes: 10 additions & 8 deletions components/alibi-explain-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@ WORKDIR /microservice

# Install Poetry
ENV POETRY_HOME /microservice/.poetry
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.1.15
RUN /opt/conda/bin/pip install --no-cache-dir "poetry==2.1.2"

# Replace vulnerable pip wheel embedded inside virtualenv(CVE-2025-8869)
RUN find /opt/conda/lib/python3.12/site-packages/virtualenv/seed/wheels/embed/ -name "pip-*.whl" -delete && \
/opt/conda/bin/pip wheel pip==25.3.0 --wheel-dir /opt/conda/lib/python3.12/site-packages/virtualenv/seed/wheels/embed/

ENV PATH "$POETRY_HOME/bin:$PATH"
ENV POETRY_VIRTUALENVS_CREATE false

# Install the server
# Install the dependencies only
COPY poetry.lock pyproject.toml ./
## Disable Poetry's new installer to avoid JSONDecodeError
## https://github.com/python-poetry/poetry/issues/4210
## NOTE: Removing explicitly requirements.txt file from subdeps test
## dependencies causing false positives in Snyk.
RUN poetry config experimental.new-installer false && \
poetry install && \
rm ~/.cache/pip -rf && \
rm -f /opt/conda/lib/python3.8/site-packages/gslib/vendored/boto/requirements.txt \
/opt/conda/lib/python3.8/site-packages/gslib/vendored/oauth2client/docs/requirements.txt \
/opt/conda/lib/python3.8/site-packages/spacy/tests/package/requirements.txt
RUN poetry install --no-root


# Add licences
Expand All @@ -56,6 +55,9 @@ RUN python -m spacy download en_core_web_md
COPY alibiexplainer alibiexplainer
COPY README.md README.md

# Install the project code
RUN poetry install

FROM base as final
WORKDIR /microservice

Expand Down
4 changes: 2 additions & 2 deletions components/alibi-explain-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SHELL := /bin/bash
VERSION ?= $(shell cat ../../version.txt)
DOCKER_REGISTRY ?= seldonio

BASE_IMAGE ?= ${DOCKER_REGISTRY}/conda-ubi8
BASE_IMAGE ?= ${DOCKER_REGISTRY}/conda-ubi9
IMAGE ?= ${DOCKER_REGISTRY}/alibiexplainer
KIND_NAME ?= kind

Expand Down Expand Up @@ -36,7 +36,7 @@ test: #type_check
poetry run pytest -v -W ignore

type_check:
mypy --ignore-missing-imports alibiexplainer --exclude proto
mypy --ignore-missing-imports --check-untyped-defs alibiexplainer --exclude proto

lint: type_check
isort --profile black --check . --skip proto --skip .eggs --skip .tox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
predict_fn: Callable,
explainer: Optional[alibi.explainers.AnchorText],
spacy_language_model: str = "en_core_web_md",
**kwargs
**kwargs,
):
self.predict_fn = predict_fn
if EXPLAIN_RANDOM_SEED == "True" and str(EXPLAIN_RANDOM_SEED_VALUE).isdigit():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
# and since modified
#

from typing import Dict, List, Optional
from typing import Any, List, Optional

from alibi.api.interfaces import Explanation


class ExplainerWrapper(object):
def validate(self, training_data_url: Optional[str]):
def validate(self, training_data_url: Optional[str]) -> Optional[Any]:
pass

def explain(self, inputs: List) -> Dict:
def explain(self, inputs: List) -> Explanation:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(
internal_batch_size: int = 100,
method: str = "gausslegendre",
layer: Optional[int] = None,
**kwargs
**kwargs,
):
if keras_model is None:
raise Exception("Integrated Gradients requires a Keras model")
Expand Down
1,570 changes: 84 additions & 1,486 deletions components/alibi-explain-server/alibiexplainer/proto/prediction_pb2.py

Large diffs are not rendered by default.

Loading