mlprodict
mlprodict copied to clipboard
ImportError: cannot import name 'FEATURE_IMPORTANCE_TYPE_MAPPER' from 'lightgbm.basic'
This issue is caused when my poetry lock file was updated with lightgbm == 4.0.0. The relevant lightgbm issue is: https://github.com/microsoft/LightGBM/pull/5654 which updated FEATURE_IMPORTANCE_TYPE_MAPPER
to _FEATURE_IMPORTANCE_TYPE_MAPPER
.
This then affected the line https://github.com/sdpython/mlprodict/blame/27d6da4ecdd76e18292f265fde61d19b66937a5c/mlprodict/onnx_conv/helpers/lgbm_helper.py#L84
Maybe the solution here is to fix the dependency on LightGBM? ie. update https://github.com/sdpython/mlprodict/blob/27d6da4ecdd76e18292f265fde61d19b66937a5c/setup.py#L485 with <4.0.0
?
@fhaque Hello. Do you have the fix for this?
Not yet. The fix will be done in onnxmltools. The documentation of sklearn-onnx has been update to reflect that: https://onnx.ai/sklearn-onnx/auto_tutorial/plot_gexternal_lightgbm.html.
Hi, Any updates on this. I am experiencing the very same issue
If you cannot wait for the official releases of skl2onnx (v1.16.0) and onnxmltools (1.11.3), you can install them directly from GitHub:
pip install --upgrade git+https://github.com/onnx/sklearn-onnx.git
pip install --upgrade git+https://github.com/onnx/onnxmltools
or with the commits I tested that currently work:
pip install --upgrade git+https://github.com/onnx/sklearn-onnx.git@943cac213812a5ead520ac1edbbc5ddfa0fbb900
pip install --upgrade git+https://github.com/onnx/onnxmltools@19847127edd283dc0140e3fc5ec23e25a1f6dca6