Model serving using Seldon
Seldon-core provides deployment for any machine learning runtime that can be packaged in a Docker container.
Install the seldon package:
ks pkg install kubeflow/seldon
Generate the core components for v1alpha2 of Seldon’s CRD:
ks generate seldon seldon
If you wish to use Seldon’s previous v1alpha1 version of its CRD you need to set the seldonVersion
parameter to one in the 0.1.x range, for example:
ks param set seldon seldonVersion 0.1.8
ks generate seldon seldon
Seldon allows complex runtime graphs for model inference to be deployed. Some example prototypes have been provided to help you get started. Follow the Seldon docs to wrap your model code into an image that can be managed by Seldon. In the examples below we will use a model image seldonio/mock_classifier
; replace this with your actual model image. You will also need to choose between the v1alpha2 and v1alpha1 prototype examples depending on which version of Seldon you generated above. The following prototypes are available:
ks generate seldon-serve-simple-<seldonVersion> mymodel --image <image>
ks generate seldon-serve-simple-v1alpha2 mymodel --image seldonio/mock_classifier:1.0
ks generate seldon-abtest-<seldonVersion> myabtest --imageA <imageA> --imageB <imageB>
ks generate seldon-abtest-v1alpha2 myabtest --imageA seldonio/mock_classifier:1.0 --imageB seldonio/mock_classifier:1.0
ks generate seldon-mab-<seldonVersion> mymab --imageA <imageA> --imageB <imageB>
ks generate seldon-mab-v1alpha2 mymab --imageA seldonio/mock_classifier:1.0 --imageB seldonio/mock_classifier:1.0
ks generate seldon-outlier-detector-<seldonVersion> myout --image <image>
ks generate seldon-outlier-detector-v1alpha2 myout --image seldonio/mock_classifier:1.0
Seldon exposes your prediction graph via REST and gRPC endpoints. Within Kubeflow these will be available via the Ambassador reverse proxy or via Seldon’s OAuth API gateway if you installed it (set the withApife
parameter to ‘true’ in the seldon component).
Assuming Ambassador is exposed at <ambassadorEndpoint>
and with a Seldon deployment name <deploymentName>
:
http://<ambassadorEndpoint>/seldon/<deploymentName>/api/v0.1/predictions
<ambassadorEndpoint>
and you should send metadata in your request with key seldon
and value <deploymentName>
.Example Jupyter notebooks are provided in Seldon’s docs that show code that can be used as a basis to test the endpoints.