hummingbird: AttributeError: 'XGBClassifier' object has no attribute 'raw_operator'
Code:
hummingmodel = hummingbird.ml.operator_converters.xgb.convert_sklearn_xgb_classifier(model, ‘pytorch’,extra_config={“n_features”:18})
Error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/var/folders/f2/9tbmpg411hndwc482xn850br0000gn/T/ipykernel_2889/1708670718.py in <module>
1 # Use Hummingbird to convert the model to PyTorch
----> 2 hummingmodel = hummingbird.ml.operator_converters.xgb.convert_sklearn_xgb_classifier(model, 'pytorch',extra_config={"n_features":18})
~/opt/anaconda3/lib/python3.9/site-packages/hummingbird/ml/operator_converters/xgb.py in convert_sklearn_xgb_classifier(operator, device, extra_config)
102 Please pass "n_features:N" as extra configuration to the converter or fill a bug report.'
103 )
--> 104 tree_infos = operator.raw_operator.get_booster().get_dump()
105 n_classes = operator.raw_operator.n_classes_
106
AttributeError: 'XGBClassifier' object has no attribute 'raw_operator'
XGB Version: 1.6.1 Hummingbird Version: 0.4.7
Any idea about this issue? What other configurations are required to make this work?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17
Hi! I think you are calling the wrong API. If you want to convert and XGBoost model you can just call
hummingbird.ml.convert. Please look at our notebook for an example.Feel free to look at our examples of it working with dataframes and open a new one (with code and a full example) if you still have issues. Thanks!