dmlc / dmlc/xgboost

GBLinear: Inplace predict is not supported by current booster.

Open
#9,110 10 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
C++
Stars
28.8k
Forks
8.9k
Avg merge
1d 12h
Merged PRs (30d)
54

Description

GBLinear model is not thread-safe and cannot be easily deployed to production.

XGBRegressor(random_state=0, booster="gblinear")

```
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/mlserver/parallel/worker.py", line 136, in _process_request
return_value = await method(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mlserver_xgboost/xgboost.py", line 88, in predict
outputs = self._get_model_outputs(payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mlserver_xgboost/xgboost.py", line 79, in _get_model_outputs
y = predict_fn(decoded_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/xgboost/sklearn.py", line 1114, in predict
predts = self.get_booster().inplace_predict(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/xgboost/core.py", line 2292, in inplace_predict
_check_call(
File "/usr/local/lib/python3.11/site-packages/xgboost/core.py", line 279, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [22:57:35] /workspace/include/xgboost/gbm.h:120: Inplace predict is not supported by current booster.
Stack trace:
[bt] (0) /usr/local/lib/python3.11/site-packages/xgboost/lib/libxgboost.so(+0x1f69e0) [0xffff736569e0]
[bt] (1) /usr/local/lib/python3.11/site-packages/xgboost/lib/libxgboost.so(+0x2148a0) [0xffff736748a0]
[bt] (2) /usr/local/lib/python3.11/site-packages/xgboost/lib/libxgboost.so(+0x65938) [0xffff734c5938]
[bt] (3) /usr/local/lib/python3.11/site-packages/xgboost/lib/libxgboost.so(XGBoosterPredictFromDense+0xd4) [0xffff734c5db4]
[bt] (4) /usr/lib/aarch64-linux-gnu/libffi.so.7(+0x6048) [0xffff84b1b048]
[bt] (5) /usr/lib/aarch64-linux-gnu/libffi.so.7(+0x5770) [0xffff84b1a770]
[bt] (6) /usr/local/lib/python3.11/lib-dynload/_ctypes.cpython-311-aarch64-linux-gnu.so(+0x1235c) [0xffff84b4035c]
[bt] (7) /usr/local/lib/python3.11/lib-dynload/_ctypes.cpython-311-aarch64-linux-gnu.so(+0x12a90) [0xffff84b40a90]
[bt] (8) /usr/local/bin/../lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x2c8) [0xffff8abf7518]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with xgboost/sklearn.py at predict, xgboost/core.py at inplace_predict, and the GBLinear failure reported at include/xgboost/gbm.h:120. Reproduce the XGBRegressor booster="gblinear" case, then verify that prediction works for this booster and add or run coverage for the reported deployment scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.