Slackbot
10/22/2022, 12:54 PMIsaac Hurwitz
10/22/2022, 12:59 PM2022-10-21T08:16:12+0000 [INFO] [runner:credit_risk_model:1] Service loaded from Bento directory: bentoml.Service(tag="credit_risk_classifier:ixasr6srdc2tmhqa", path="/home/bentoml/bento/")
2022-10-21T08:16:12+0000 [ERROR] [runner:credit_risk_model:1] Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 671, in lifespan
async with self.lifespan_context(app):
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 566, in __aenter__
await self._router.startup()
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 650, in startup
handler()
File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/runner/runner.py", line 230, in init_local
self._init_local()
File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/runner/runner.py", line 221, in _init_local
self._init(LocalRunnerRef)
File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/runner/runner.py", line 215, in _init
runner_handle = handle_class(self)
File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/runner/runner_handle/local.py", line 25, in __init__
self._runnable = runner.runnable_class(**runner.runnable_init_params) # type: ignore
File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/frameworks/xgboost.py", line 255, in __init__
self.model = load_model(bento_model)
File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/frameworks/xgboost.py", line 141, in load_model
model.load_model(model_file)
File "/usr/local/lib/python3.9/site-packages/xgboost/core.py", line 2294, in load_model
_check_call(_LIB.XGBoosterLoadModel(
File "/usr/local/lib/python3.9/site-packages/xgboost/core.py", line 246, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [08:16:12] /workspace/src/c_api/c_api.cc:911: Check failed: str[0] == '{' (b vs. {) :
Stack trace:
[bt] (0) /usr/local/lib/python3.9/site-packages/xgboost/lib/libxgboost.so(+0x55388) [0xffff64a0d388]
[bt] (1) /usr/local/lib/python3.9/site-packages/xgboost/lib/libxgboost.so(+0x60150) [0xffff64a18150]
[bt] (2) /usr/local/lib/python3.9/site-packages/xgboost/lib/libxgboost.so(XGBoosterLoadModel+0x16c) [0xffff64a183fc]
[bt] (3) /usr/lib/aarch64-linux-gnu/libffi.so.7(+0x6048) [0xffff73f9a048]
[bt] (4) /usr/lib/aarch64-linux-gnu/libffi.so.7(+0x5770) [0xffff73f99770]
[bt] (5) /usr/local/lib/python3.9/lib-dynload/_ctypes.cpython-39-aarch64-linux-gnu.so(+0x134a8) [0xffff73fc04a8]
[bt] (6) /usr/local/lib/python3.9/lib-dynload/_ctypes.cpython-39-aarch64-linux-gnu.so(+0x1194c) [0xffff73fbe94c]
[bt] (7) /usr/local/lib/libpython3.9.so.1.0(_PyObject_MakeTpCall+0x7c) [0xffff7fdf99fc]
[bt] (8) /usr/local/lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x446c) [0xffff7fe614ac]
2022-10-21T08:16:12+0000 [ERROR] [runner:credit_risk_model:1] Application startup failed. Exiting
any help would be appreciated.
here are the verisions I am using:
XGBoost: 1.5.0
bentoml, version 1.0.7Isaac Hurwitz
10/24/2022, 11:18 AMAaron Pham
10/24/2022, 7:12 PMIsaac Hurwitz
10/24/2022, 10:52 PM>>> platform.platform()
'macOS-12.6-arm64-arm-64bit'Aaron Pham
10/24/2022, 10:53 PMIsaac Hurwitz
10/24/2022, 11:02 PMbentoml build
bentoml containerize credit_risk_classifier:wh6pnkst56pu7ct7
docker run -it --rm -p 3000:3000 credit_risk_classifier:wh6pnkst56pu7ct7Aaron Pham
10/24/2022, 11:04 PM--platform=linux/amd64?
bentoml containerize ... --platform=linux/amd64
This will create a x86 container instead of an arm container.Isaac Hurwitz
10/24/2022, 11:15 PMWARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requestedIsaac Hurwitz
10/24/2022, 11:16 PM--platform=linux/amd64
as part of the docker run command as well?Aaron Pham
10/24/2022, 11:17 PMAaron Pham
10/24/2022, 11:18 PMdocker buildx ls?Isaac Hurwitz
10/24/2022, 11:19 PMNAME/NODE DRIVER/ENDPOINT STATUS PLATFORMS
desktop-linux docker
desktop-linux desktop-linux running linux/arm64, linux/amd64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
default * docker
default default running linux/arm64, linux/amd64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6Isaac Hurwitz
10/24/2022, 11:19 PMAaron Pham
10/24/2022, 11:20 PMAaron Pham
10/24/2022, 11:26 PMIsaac Hurwitz
10/24/2022, 11:28 PMIsaac Hurwitz
10/24/2022, 11:29 PMAaron Pham
10/24/2022, 11:30 PMpip install xgboostIsaac Hurwitz
10/24/2022, 11:31 PMAaron Pham
10/24/2022, 11:41 PMIsaac Hurwitz
10/24/2022, 11:59 PMAaron Pham
10/25/2022, 1:09 AMpip-compile to lock the dependency specified under python.pip_packages This internally uses pip dependency resolver, this means that it has one issue:
The locked version in this bento will use the latest library version instead of the current version in your local environmentIf you take a look, the locked xgboost version is actually 1.6.2 instead of the one you use to train (could be a different version) The issue that you encounter is that the model is trained in a different xgboost comparing to the xgboost built inside the container. One fix that you can do right now is to lock the xgboost version that is used to train your model into the bentofile.yaml
python:
pip_packages:
- xgboost==1.5.0 # or the version of xgboost in your system
This will ensure that the model inside the container will use the correct xgboost versionAaron Pham
10/25/2022, 1:10 AMIsaac Hurwitz
10/25/2022, 5:29 AMIsaac Hurwitz
10/25/2022, 5:32 AM