onnxmltools icon indicating copy to clipboard operation
onnxmltools copied to clipboard

LightGBM conversion to ONNX error

Open SughasiniRaviKumar opened this issue 5 years ago • 4 comments

Hi

I am facing below error ValueError: No proper operator name found for '<class 'lightgbm.basic.Booster'>' while converting my LGBMClassifier model to ONNX. The model was trained using LightGBM.

Python - 3.7.1 installed through Anaconda on Win 10 used convert_lightgbm onnx_model = onnxmltools.convert_lightgbm(lgb_model,initial_types=initial_type)

also we used convert_sklearn to see if this works onnx_model = onnxmltools.convert_sklearn(lgb_model,initial_types=initial_type) RuntimeError: Unable to find a shape calculator for type '<class 'lightgbm.basic.Booster'>'.

Any thoughts on this error?

Thanks Su

SughasiniRaviKumar avatar Jun 04 '19 12:06 SughasiniRaviKumar

Ironically I had the same question. The documentation is not particularly clear in the case of LightGBM

onacrame avatar Jun 04 '19 13:06 onacrame

Hello Su and @MotoRZR, sorry for any difficulties you've had with the conversion process! In the convert_sklearn case, have you registered the lightgbm converters to be used with skl2onnx? Which version of onnxmltools/skl2onnx are you using?

vinitra-zz avatar Jun 12 '19 21:06 vinitra-zz

With https://github.com/onnx/onnxmltools/pull/329 merged, you might be able to convert a Booster instance to ONNX now. Try with the master branch, and let me know of any issues.

hongzmsft avatar Aug 30 '19 00:08 hongzmsft

@vinitra I am facing the same issue with lightgbm to onnx coversion RuntimeError: Options ['nocl'] are not registerd for model 'LGBMClassifier'.

since this issue is old I thought it got solved 1.5.1 but it still exist.

I am having following versions of libraries. onnxmltools (1.7.0) INSTALLED: 1.7.0 (latest)

skl2onnx (1.7.0) INSTALLED: 1.7.0 (latest)

divatemangesh avatar Aug 27 '20 06:08 divatemangesh