Seldon Core Loading sklearn/irir failed

482 views Asked by At

I tried to load the iris model using seldon core, and unfortunately the following error occurred. SKLEARN_SERVER loads seldon’s sklearn/iris model with the following error.

starting microservice
2021-09-02 02:43:19,363 - seldon_core.microservice:main:206 - INFO:  Starting microservice.py:main
2021-09-02 02:43:19,363 - seldon_core.microservice:main:207 - INFO:  Seldon Core version: 1.10.0
2021-09-02 02:43:19,463 - seldon_core.microservice:main:362 - INFO:  Parse JAEGER_EXTRA_TAGS []
2021-09-02 02:43:19,463 - seldon_core.microservice:load_annotations:158 - INFO:  Found annotation kubernetes.io/config.seen:2021-09-02T02:41:35.820784600Z
2021-09-02 02:43:19,463 - seldon_core.microservice:load_annotations:158 - INFO:  Found annotation kubernetes.io/config.source:api
2021-09-02 02:43:19,463 - seldon_core.microservice:load_annotations:158 - INFO:  Found annotation prometheus.io/path:/stats/prometheus
2021-09-02 02:43:19,463 - seldon_core.microservice:load_annotations:158 - INFO:  Found annotation prometheus.io/port:15020
2021-09-02 02:43:19,463 - seldon_core.microservice:load_annotations:158 - INFO:  Found annotation prometheus.io/scrape:true
2021-09-02 02:43:19,464 - seldon_core.microservice:load_annotations:158 - INFO:  Found annotation sidecar.istio.io/status:{\"initContainers\":[\"istio-init\"],\"containers\":[\"istio-proxy\"],\"volumes\":[\"istio-envoy\",\"istio-data\",\"istio-podinfo\",\"istio-token\",\"istiod-ca-cert\"],\"imagePullSecrets\":null}
2021-09-02 02:43:19,559 - seldon_core.microservice:main:365 - INFO:  Annotations: {'kubernetes.io/config.seen': '2021-09-02T02:41:35.820784600Z', 'kubernetes.io/config.source': 'api', 'prometheus.io/path': '/stats/prometheus', 'prometheus.io/port': '15020', 'prometheus.io/scrape': 'true', 'sidecar.istio.io/status': '{\\"initContainers\\":[\\"istio-init\\"],\\"containers\\":[\\"istio-proxy\\"],\\"volumes\\":[\\"istio-envoy\\",\\"istio-data\\",\\"istio-podinfo\\",\\"istio-token\\",\\"istiod-ca-cert\\"],\\"imagePullSecrets\\":null}'}
2021-09-02 02:43:19,559 - seldon_core.microservice:main:369 - INFO:  Importing SKLearnServer
2021-09-02 02:43:20,562 - SKLearnServer:__init__:21 - INFO:  Model uri: /mnt/models
2021-09-02 02:43:20,563 - SKLearnServer:__init__:22 - INFO:  method: predict_proba
2021-09-02 02:43:20,564 - SKLearnServer:load:26 - INFO:  load
2021-09-02 02:43:20,565 - root:download:31 - INFO:  Copying contents of /mnt/models to local
2021-09-02 02:43:20,659 - SKLearnServer:load:30 - INFO:  model file: /mnt/models/model.joblib
Traceback (most recent call last):
  File "/opt/conda/bin/seldon-core-microservice", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.7/site-packages/seldon_core/microservice.py", line 379, in main
    user_object = user_class(**parameters)
  File "/microservice/SKLearnServer.py", line 23, in __init__
    self.load()
  File "/microservice/SKLearnServer.py", line 31, in load
    self._joblib = joblib.load(model_file)
  File "/opt/conda/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 585, in load
    obj = _unpickle(fobj, filename, mmap_mode)
  File "/opt/conda/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 504, in _unpickle
    obj = unpickler.load()
  File "/opt/conda/lib/python3.7/pickle.py", line 1088, in load
    dispatch[key[0]](self)
  File "/opt/conda/lib/python3.7/pickle.py", line 1376, in load_global
    klass = self.find_class(module, name)
  File "/opt/conda/lib/python3.7/pickle.py", line 1426, in find_class
    __import__(module, level=0)
ModuleNotFoundError: No module named 'sklearn.linear_model.logistic'

It looks like a version issue with the sklearn package in seldon's sklearn inference server. This is my seldonDeployment file:

apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
  name: "sklearn"
spec:
  name: "sklearn"
  predictors:
    - componentSpecs:
      - spec:
          containers:
          - name: classifier
            env:
            - name: GUNICORN_THREADS
              value: "10"
            - name: GUNICORN_WORKERS
              value: "1"
            resources:
              requests:
                cpu: 5m
                memory: 10Mi
              limits:
                cpu: 50m
                memory: 100Mi
      graph:
        children: []
        implementation: SKLEARN_SERVER
        modelUri: gs://seldon-models/sklearn/iris
        name: classifier
      name: default
      replicas: 2

This is my sklearn Inference server configuration:

    "SKLEARN_SERVER":{
        "protocols":{
            "kfserving":{
                "defaultImageVersion":"0.3.2",
                "image":"seldonio/mlserver"
            },
            "seldon":{
                "defaultImageVersion":"1.10.0",
                "image":"seldonio/sklearnserver"
            }
        }
    }

Is there something wrong with me?

1

There are 1 answers

0
xm lian On BEST ANSWER

This is because the version of the seldon core does not match the version of the model. Note that the example model for seldon-core version 1.10.0 is under gs://seldon-models/v1.11.0-dev.