Skip to content
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

Xgboost conversion to ONNX error #349

Closed
chengnignzhang opened this issue Nov 6, 2019 · 5 comments
Closed

Xgboost conversion to ONNX error #349

chengnignzhang opened this issue Nov 6, 2019 · 5 comments

Comments

@chengnignzhang
Copy link

Hi

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

used convert_xgboost
onx = onnxmltools.convert.convert_xgboost(loaded_model, initial_types=initial_type)
Any thoughts on this error?

Does this mean xgboost.core.Booster is not supported for now?

Thanks
Chengning

@jiafatom
Copy link
Collaborator

jiafatom commented Nov 6, 2019

cc @xadupre @prabhat00155

@xadupre
Copy link
Collaborator

xadupre commented Nov 18, 2019

It is not. This conversion is implemented for LightGbm and not for XGBoost. We could replicate the same trick if needed.

@ankit1200
Copy link

ankit1200 commented Jan 23, 2020

@xadupre do you have an example on how this would work? I'm trying to convert a xgb model to onnx and getting a similar error.

Error
ValueError: No proper operator name found for '<class 'xgboost.core.Booster'>'

Code

    initial_types = [('float_input', FloatTensorType([1, len(features)]))]
    onnx_model = convert_xgboost(xgb_model,'tree-based classifier', initial_types = initial_types)
    
    with open("model_files/test_xgb.onnx", "wb") as f:
        f.write(onnx_model.SerializeToString())

@xadupre
Copy link
Collaborator

xadupre commented Jan 23, 2020

I wrote a unit test to make sure it was passing: https://github.com/onnx/onnxmltools/blob/master/tests/xgboost/test_xgboost_converters.py#L188. How do you train your model?

@ankit1200
Copy link

ankit1200 commented Jan 24, 2020

@xadupre We're using dask_xgboost: <class 'dask_xgboost.core.XGBRegressor'>. I've tried to convert the dask_xgboost model to onnx and the booster too: <class 'xgboost.core.Booster'>. Your help on this issue will be much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants