@@ -18,7 +18,6 @@ get_apis:
1818 $(MAKE ) -C ${SELDON_CORE_DIR} /proto/tensorflow clean
1919
2020build_apis : get_apis
21- pip install -r requirements-apis.txt
2221 cd alibiexplainer && python \
2322 -m grpc.tools.protoc \
2423 -I./ \
4948docker-build :
5049 docker build --platform=linux/amd64 --file=Dockerfile --build-arg BASE_IMAGE=${BASE_IMAGE} --build-arg VERSION=${VERSION} -t ${IMAGE} :${VERSION} .
5150
52- docker-build-gpu :
53- docker build --file=Dockerfile.gpu -t ${IMAGE} -gpu:${VERSION} .
54-
5551docker-push :
5652 docker push ${IMAGE} :${VERSION}
5753
58- docker-push-gpu :
59- docker push ${IMAGE} -gpu:${VERSION}
60-
6154kind_load : docker-build
6255 kind load docker-image ${IMAGE} :${VERSION} --name ${KIND_NAME}
6356
7871#
7972# Test Tabular Explanations
8073#
81-
8274test_models/sklearn/iris :
8375 mkdir -p test_models/sklearn/iris
8476 gsutil cp -r gs://seldon-models/v1.11.0-dev/sklearn/iris test_models/sklearn
@@ -88,7 +80,7 @@ test_models/explainers/anchor_tabular:
8880 python tests/make_test_models.py --model anchor_tabular --model_dir test_models/explainers/anchor_tabular
8981
9082anchor_tabular_model : test_models/sklearn/iris
91- docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/iris"}]' ${REPO } /sklearnserver:${VERSION}
83+ docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/iris"}]' ${DOCKER_REGISTRY } /sklearnserver:${VERSION}
9284
9385anchor_tabular_predict :
9486 curl -d ' {"data": {"ndarray":[[5.964, 4.006, 2.081, 1.031]]}}' -X POST http://localhost:9000/api/v1.0/predictions -H " Content-Type: application/json"
@@ -102,19 +94,15 @@ anchor_tabular_docker: test_models/explainers/anchor_tabular
10294anchor_tabular_explain :
10395 curl -d ' {"data": {"ndarray":[[5.964, 4.006, 2.081, 1.031]]}}' -X POST http://localhost:8080/api/v1.0/explain -H " Content-Type: application/json"
10496
105-
10697#
10798# Test Text Explanations
10899#
109-
110-
111100test_models/sklearn/moviesentiment :
112101 mkdir -p test_models/sklearn
113102 gsutil cp -r gs://seldon-models/sklearn/moviesentiment_sklearn_0.24.2 test_models/sklearn
114103
115104anchor_text_model : test_models/sklearn/moviesentiment
116- docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/moviesentiment_sklearn_0.24.2"}]' ${REPO} /sklearnserver:${VERSION}
117-
105+ docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/moviesentiment_sklearn_0.24.2"}]' ${DOCKER_REGISTRY} /sklearnserver:${VERSION}
118106
119107anchor_text_predict :
120108 curl -d ' {"data": {"ndarray":["a visually exquisite but narratively opaque and emotionally vapid experience of style and mystification"]}}' -X POST http://localhost:9000/api/v1.0/predictions -H " Content-Type: application/json"
@@ -128,11 +116,9 @@ anchor_text_docker:
128116anchor_text_explain :
129117 curl -d ' {"data": {"ndarray":["a visually exquisite but narratively opaque and emotionally vapid experience of style and mystification"]}}' -X POST http://localhost:8080/api/v1.0/explain -H " Content-Type: application/json"
130118
131-
132119#
133120# Test Image Explanation
134121#
135-
136122test_models/tfserving/cifar10/resnet32 :
137123 mkdir -p test_models/tfserving/cifar10
138124 gsutil cp -r gs://seldon-models/tfserving/cifar10/resnet32 test_models/tfserving/cifar10
@@ -144,11 +130,9 @@ test_models/explainers/anchor_image:
144130anchor_images_model : test_models/tfserving/cifar10/resnet32
145131 docker run --name tfserver -it --rm -p 8501:8501 -p 8500:8500 -v " ${PWD} /test_models/tfserving/cifar10:/models" -e MODEL_NAME=resnet32 tensorflow/serving
146132
147-
148133anchor_images_predict :
149134 curl -d @./tests/data/input.json -X POST http://localhost:8501/v1/models/resnet32:predict -H " Content-Type: application/json"
150135
151-
152136anchor_images : test_models/explainers/anchor_image
153137 python -m alibiexplainer --model_name resnet32 --protocol tensorflow.http --storage_uri " ${PWD} /test_models/explainers/anchor_image" --predictor_host localhost:8501 AnchorImages
154138
@@ -158,12 +142,9 @@ anchor_images_docker: test_models/explainers/anchor_image
158142anchor_images_explain :
159143 curl -d @./tests/data/input.json -X POST http://localhost:8080/v1/models/resnet32:explain -H " Content-Type: application/json"
160144
161-
162145#
163146# Test Kernel Shap Explanation
164147#
165-
166-
167148test_models/sklearn/wine/model-py36-0.23.2 :
168149 mkdir -p test_models/sklearn/wine
169150 gsutil cp -r gs://seldon-models/sklearn/wine/model-py36-0.23.2 test_models/sklearn/wine
@@ -173,24 +154,20 @@ test_models/explainers/kernel_shap:
173154 python tests/make_test_models.py --model kernel_shap --model_dir test_models/explainers/kernel_shap
174155
175156kernel_shap_model : test_models/sklearn/wine/model-py36-0.23.2
176- docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/wine/model-py36-0.23.2"},{"type":"STRING","name":"method","value":"decision_function"}]' ${REPO } /sklearnserver:${VERSION}
157+ docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/wine/model-py36-0.23.2"},{"type":"STRING","name":"method","value":"decision_function"}]' ${DOCKER_REGISTRY } /sklearnserver:${VERSION}
177158
178159kernel_shap_predict :
179160 curl -d ' {"data": {"ndarray":[[-0.24226334, 0.26757916, 0.42085937, 0.7127641 , 0.84067236, -1.27747161, -0.60582812, -0.9706341 , -0.5873972 , 2.42611713, -2.06608025, -1.55017035, -0.86659858]]}}' -X POST http://localhost:9000/api/v1.0/predictions -H " Content-Type: application/json"
180161
181-
182162kernel_shap : test_models/explainers/kernel_shap
183163 python -m alibiexplainer --model_name wine --protocol seldon.http --storage_uri " ${PWD} /test_models/explainers/kernel_shap" --predictor_host localhost:9000 KernelShap
184164
185-
186165kernel_shap_docker : test_models/explainers/kernel_shap
187166 docker run -it --rm --name " explainer" --network=host -p 8080:8080 -v ${PWD} /test_models:/models ${IMAGE} :${VERSION} --model_name wine --protocol seldon.http --storage_uri /models/explainers/kernel_shap --predictor_host localhost:9000 KernelShap
188167
189-
190168kernel_shap_explain :
191169 curl -d ' {"data": {"ndarray":[[-0.24226334, 0.26757916, 0.42085937, 0.7127641 , 0.84067236, -1.27747161, -0.60582812, -0.9706341 , -0.5873972 , 2.42611713, -2.06608025, -1.55017035, -0.86659858]]}}' -X POST http://localhost:8080/api/v1.0/explain -H " Content-Type: application/json"
192170
193-
194171#
195172# Test Integrated Gradients
196173#
@@ -201,15 +178,12 @@ test_models/keras/imdb:
201178integrated_gradients : test_models/keras/imdb
202179 python -m alibiexplainer --model_name imdb --protocol seldon.http --storage_uri ${PWD} /test_models/keras/imdb IntegratedGradients IntegratedGradients --layer 1
203180
204-
205181integrated_gradients_docker : test_models/keras/imdb
206182 docker run -it --rm --name " explainer" --network=host -p 8080:8080 -v ${PWD} /test_models:/models ${IMAGE} :${VERSION} --model_name adult --protocol seldon.http --storage_uri /models/keras/imdb IntegratedGradients --layer 1
207183
208184integrated_gradients_explain :
209185 curl -d ' {"data": {"ndarray":[[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 591, 202, 14, 31, 6, 717, 10, 10, 2, 2, 5, 4, 360, 7, 4, 177, 5760, 394, 354, 4, 123, 9, 1035, 1035, 1035, 10, 10, 13, 92, 124, 89, 488, 7944, 100, 28, 1668, 14, 31, 23, 27, 7479, 29, 220, 468, 8, 124, 14, 286, 170, 8, 157, 46, 5, 27, 239, 16, 179, 2, 38, 32, 25, 7944, 451, 202, 14, 6, 717]]}}' -X POST http://localhost:8080/api/v1.0/explain -H " Content-Type: application/json"
210186
211-
212-
213187#
214188# Test Tree Shap
215189# This is an odd case where we do not need a separate model (yet)
@@ -240,50 +214,16 @@ test_models/explainers/ale:
240214 python tests/make_test_models.py --model ale --model_dir test_models/explainers/ale
241215
242216ale_model : test_models/sklearn/iris-0.23.2/lr_model
243- docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/iris-0.23.2/lr_model"},{"type":"STRING","name":"method","value":"decision_function"}]' ${REPO } /sklearnserver:${VERSION}
217+ docker run -it --rm --name " sklearnserver" -p 9000:9000 -v ${PWD} /test_models:/models -e PREDICTIVE_UNIT_PARAMETERS=' [{"type":"STRING","name":"model_uri","value":"/models/sklearn/iris-0.23.2/lr_model"},{"type":"STRING","name":"method","value":"decision_function"}]' ${DOCKER_REGISTRY } /sklearnserver:${VERSION}
244218
245219ale_predict :
246220 curl -d ' {"data": {"ndarray":[[6.1, 2.8, 4.7, 1.2]]}}' -X POST http://localhost:9000/api/v1.0/predictions -H " Content-Type: application/json"
247221
248-
249222ale : test_models/explainers/ale
250223 python -m alibiexplainer --model_name iris --protocol seldon.http --storage_uri " ${PWD} /test_models/explainers/ale" --predictor_host localhost:9000 ALE
251224
252-
253225ale_docker : test_models/explainers/ale
254226 docker run -it --rm --name " explainer" --network=host -p 8080:8080 -v ${PWD} /test_models:/models ${IMAGE} :${VERSION} --model_name iris --protocol seldon.http --storage_uri /models/explainers/ale --predictor_host localhost:9000 ALE
255227
256-
257228ale_explain :
258229 curl -d ' {"data": {"ndarray":[[6.1, 2.8, 4.7, 1.2]]}}' -X POST http://localhost:8080/api/v1.0/explain -H " Content-Type: application/json"
259-
260-
261-
262- #
263- # Test Triton Cifar10
264- #
265- # TODO: move the below in relevant place
266- # as we are moving to mlserver alibi runtime for V2 protocol
267-
268- # test_models/triton/cifar10/tf_cifar10:
269- # mkdir -p test_models/triton/tf_cifar10
270- # gsutil cp -r gs://seldon-models/triton/tf_cifar10 test_models/triton
271- #
272- #
273- # anchor_images_triton_model: test_models/triton/cifar10/tf_cifar10
274- # docker run --rm --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 -p9000:9000 -p8001:8001 -p8002:8002 -p5001:5001 -v ${PWD}/test_models/triton/tf_cifar10:/models nvcr.io/nvidia/tritonserver:21.08-py3 /opt/tritonserver/bin/tritonserver --model-repository=/models --http-port=9000 --grpc-port=5001
275- #
276- # anchor_images_triton_predict:
277- # curl -H "Content-Type: application/json" http://0.0.0.0:9000/v2/models/cifar10/infer -d '@tests/data/truck-v2.json'
278- #
279- #
280- # anchor_images_triton: test_models/explainers/anchor_image
281- # python -m alibiexplainer --model_name cifar10 --protocol kfserving.http --storage_uri ${PWD}/explainers/anchor_image --predictor_host localhost:9000 AnchorImages
282- #
283- #
284- # anchor_images_triton_docker: test_models/explainers/anchor_image
285- # docker run -it --rm --name "explainer" --network=host -p 8080:8080 -v ${PWD}/test_models:/models ${IMAGE}:${VERSION} --model_name cifar10 --protocol kfserving.http --storage_uri /models/explainers/anchor_image --predictor_host localhost:9000 AnchorImages
286- #
287- #
288- # anchor_images_triton_explain:
289- # curl -d @tests/data/truck-v2.json -X POST http://localhost:8080/v2/models/cifar10/explain -H "Content-Type: application/json"
0 commit comments