Xabier Cadenas Yoldi
04/12/2024, 12:31 PMFile "/usr/local/lib/python3.8/dist-packages/bentoml/_internal/runner/runner.py", line 52, in run
return self.runner._runner_handle.run_method(self, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/bentoml/_internal/runner/runner_handle/remote.py", line 346, in run_method
anyio.from_thread.run(
File "/usr/local/lib/python3.8/dist-packages/anyio/from_thread.py", line 48, in run
return async_backend.run_async_from_thread(func, args, token=token)
File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 2143, in run_async_from_thread
return f.result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 2130, in task_wrapper
return await func(*args)
File "/usr/local/lib/python3.8/dist-packages/bentoml/_internal/runner/runner_handle/remote.py", line 242, in async_run_method
raise RemoteException(
bentoml.exceptions.RemoteException: An unexpected exception occurred in remote runner textbox_ocr_recognition: [404] Not Found
"POST http%3A//127.0.0.1%3A8000/model_response HTTP/1.1" 404
I can't replicate the issue locally. Is there some configuration I'm doing wrong? This is my configuration.yml:
api_server:
workers: 1
traffic:
timeout: 100
http:
port: 5000
And this is how I define the runners:
class RunnableClass(bentoml.Runnable):
SUPPORTED_RESOURCES = ("cpu",)
SUPPORTS_CPU_MULTI_THREADING = True
def __init__(self, model_artifact):
self.artifact = model_artifact
self.artifact.load(self.artifact.models_path)
@bentoml.Runnable.method(batchable=False)
def model_response(self, process_info):
"""
"""
logger = get_logger(__name__)
logger.info("%s detection request started",
process_info.get("process_name"))
image_str = process_info.get("image")
image = image_str2numpy(image_str)
result = self.artifact.recognize(image)
return result
model_runner = bentoml.Runner(
RunnableClass,
name="image_recognition",
runnable_init_params={"model_name": "image_recognition",})
svc = bentoml.Service("service", runners=[model_runner])
@svc.api(input=JSON(), output=JSON())
def image_recognition(annotations: JSON, ctx: bentoml.Context):
"""
"""
try:
annotations["process_name"] = "image_recognition"
with StopWatch(annotations["process_name"]):
response = model_runner.\
model_response.run(process_info=annotations)
except Exception as exception:
response = error_handler(exception)
return response
Do you have any idea where the issue might be coming from?