microsoft / hummingbird

Hummingbird compiles trained ML models into tensor computation for faster inference.
MIT License
3.34k stars 278 forks source link

New LGBM Version 4.0.0 changes #725

Closed ksaur closed 9 months ago

ksaur commented 1 year ago

LGBM 4.0.0 was released 3 days ago. From Friday runner test_onnxml_lightgbm_converter.py:

>       from lightgbm.basic import (
            _LIB, FEATURE_IMPORTANCE_TYPE_MAPPER, _safe_call,
            json_default_with_numpy)
E       ImportError: cannot import name 'FEATURE_IMPORTANCE_TYPE_MAPPER' from 'lightgbm.basic' (C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\lightgbm\basic.py)

C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\onnxmltools\convert\lightgbm\operator_converters\LightGbm.py:267: ImportError

They have added an underscore to many things. Ex: FEATURE_IMPORTANCE_TYPE_MAPPER becomes _FEATURE_IMPORTANCE_TYPE_MAPPER. See https://github.com/microsoft/LightGBM/pull/5654

Also in test_onnxml_lightgbm_converter.py:

FAILED tests/test_onnxml_lightgbm_converter.py::TestONNXLightGBMConverter::test_lightgbm_booster_classifier - AttributeError: 'Booster' object has no attribute 'attr'

Need to investigate what other breaking changes for us.

ksaur commented 1 year ago

The errors are coming from within onnxmltools ( self.booster_.attr('objective') and FEATURE_IMPORTANCE_TYPE_MAPPER ) which doesn't yet match the new lightgbm version. Opened https://github.com/onnx/onnxmltools/issues/632

Will pin for now!

ksaur commented 1 year ago

https://github.com/onnx/onnxmltools/pull/634 was merged ! :)
So we can either wait for release, or change pipeline to pull from main