0
import bentoml
import numpy as np
from bentoml.io import NumpyNdarray

# Get the runner
xgb_runner = bentoml.models.get("xgb_booster:latest").to_runner()

# Create a Service object
svc = bentoml.Service("xgb_classifier", runners=[xgb_runner])

# Create an endpoint named classify
@svc.api(input=NumpyNdarray(), output=NumpyNdarray())
def classify(input_series) -> np.ndarray:
    # Convert the input string to numpy array
    label = xgb_runner.predict.run(input_series)

    return label

bentoml serve service.py:svc --reload

so this is my code and the error i am getting is

Error: [bentoml-cli] serve failed: Failed to load bento or import service 'Service.py:svc'. If you are attempting to import bento in local store: 'Failed to import module "Service.py": No module named 'Service.py''. If you are importing by python module path: 'Bento 'Service.py:svc' is not found in BentoML store <osfs '/root/bentoml/bentos'>'.

so i tried pip install service

neves
  • 33,186
  • 27
  • 159
  • 192
  • It feels to me that you have your file name as `service.py` but the actual script you ran is `bentoml serve Service.py:svc --reload`, and there's case mismatch. – TYZ Feb 03 '23 at 18:51

0 Answers0