I am trying to create a service using the quickstart guide and getting issues around sklearn -
Error: [cli] `build` failed: sklearn is required in order to use the module `bentoml.sklearn`, install sklearn with `pip install sklearn`. For more information, refer to https://scikit-learn.org/stable/install.html
To reproduce
Create a conda environment (python= 3.9.12) and install the following requirements.
I am using pyenv to manage different environments of python
scikit-learn
pandas
bentoml>=1.0.0
Create the model using the following code-
import bentoml
from sklearn import svm, datasets
load the data
iris = datasets.load_iris()
X, y = iris.data, iris.target
Model training
clf = svm.SVC()
clf.fit(X,y)
Save the bentoml model to loacal model store
bentoml.sklearn.save_model("iris_clf_rj", clf)
``` bentoml models list``` shows the model I create using the above. I am also able to call the runner to predict using the saved data.
3. Create the service using the code-
import numpy as np
import bentoml
from bentoml.io import NumpyNdarray
Describe the bug
I am trying to create a service using the quickstart guide and getting issues around sklearn -
To reproduce
Create a conda environment (python= 3.9.12) and install the following requirements. I am using pyenv to manage different environments of python
Create the model using the following code-
load the data
iris = datasets.load_iris() X, y = iris.data, iris.target
Model training
clf = svm.SVC() clf.fit(X,y)
Save the bentoml model to loacal model store
bentoml.sklearn.save_model("iris_clf_rj", clf)
import numpy as np import bentoml from bentoml.io import NumpyNdarray
iris_clf_runner = bentoml.sklearn.get("iris_clf_rj:latest").to_runner()
svc = bentoml.Service("iris_classifier", runners=[iris_clf_runner])
@svc.api(input=NumpyNdarray(), output=NumpyNdarray()) def classify(input_series: np.ndarray) -> np.ndarray: return iris_clf_runner.predict.run(input_series)