-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable convert_lightgbm to output tensor type #451
Comments
@xadupre , can you help with that? |
It is possible to remove zipmap operator by using options. The example shows how to use sklearn-onnx for lightgbm Convert a pipeline with a LightGBM model. The second one shows how to remove zipmap node One model, many possible conversions with options. |
thanks @xadupre. |
It could be but I could probably choose a more simple way, just adding a parameter |
@xadupre, actually we have tried sklearn-onnx, but always failed due to some issue. So it is better if we can implemented here. |
Ok I have two bugs to fix then. I'll start by adding a parameter zipmap to convert_lightgbm. |
I started to work on this on PR #452. |
very appreciated for your kind help, @xadupre |
@xadupre, sorry I forgot to mention that my model type is lightgbm.basic.Booster The code snippet is as follows:
I found that here does not consider Booster type. |
Hi, I am having the same issue. What is the solution for this? |
A new version was released two days ago. Did you with this one? |
verified the following versions, and the fix works well:
onnx_model = convert_lightgbm(
clf,
initial_types=initial_type,
zipmap=False) i suppose we can close this issue. thanks @xadupre for this fix. |
Description
![lightgbm](https://user-images.githubusercontent.com/23181889/110765870-9237d980-828f-11eb-966c-79a108639cb7.png)
When I used convert_lightgbm, I got a graph:
which includes a probabilities map type (for example, [{0: 0.9, 1: 0.1}, {0: 0.2, 1: 0.8}]) that is not supported by onnxruntime server so far (see: microsoft/onnxruntime#2385)
As comparison, when I used convert_xgboost, I got a graph:
![xgboost](https://user-images.githubusercontent.com/23181889/110766285-f5297080-828f-11eb-8df1-b3de5d36e081.png)
which includes a probabilities tensor (ie, [0.1, 0.8]) that is supported by onnxruntime server.
Very probably the map type in convert_lightgbm is caused by https://github.com/onnx/onnxmltools/blob/master/onnxmltools/convert/lightgbm/operator_converters/LightGbm.py#L454.
In convert_xgboost, it is https://github.com/onnx/onnxmltools/blob/master/onnxmltools/convert/xgboost/operator_converters/XGBoost.py#L291, which seemingly does not have zipmap.
Describe the solution you'd like
Conversion of lightgbm into onnx models can output the tensor type of probabilities.
The text was updated successfully, but these errors were encountered: