1

我尝试使用 seldon core 加载 iris 模型,不幸的是出现了以下错误。SKLEARN_SERVER 加载 seldon 的 sklearn/iris 模型时出现以下错误。

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'

它看起来像是 seldon 的 sklearn 推理服务器中的 sklearn 包的版本问题。这是我的 seldonDeployment 文件:

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

这是我的 sklearn 推理服务器配置:

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

我有什么问题吗?

4

1 回答 1

1

这是因为seldon核心的版本与模型的版本不匹配。请注意,seldon-core 版本 1.10.0 的示例模型位于 gs://seldon-models/v1.11.0-dev 下。

于 2021-09-06T12:46:41.077 回答