Open ide-an opened 3 years ago
I identified the bug, the conversion works before the model is dumped in json format. After being restored, the converter cannot find some information it used to find (objective). The same information needs to be found with another way.
Facing the exact same issue. xgboost==1.4.2 onnxmltools==1.10.0
When using the xgboost Learning API (instead of the Sickit Learn one), the xgboost save_model() method does not save the best_ntree_limit attribute which the onnx conversion requires. A workaround to unblock oneself could be explicitly setting the best_ntree_limit as best_ntree_limit = model.num_boosted_rounds() if early stopping is not used during training. This does not occur when using the Sickit Learn wrapper which does saves the best_ntree_limit attribute, also does not occurs when directly saving the model via pickle which makes a more complete snapshot (but pickle dumping is not recommended by xgboost due to backward compatibility concerns).
Any updates on a resolution for this, please?
Hello.
I am trying to convert existing xgboost model file (which is created by
xgboost.Booster.save_model
) to onnx. While doing that I am getting the following error:AttributeError: 'Booster' object has no attribute 'best_ntree_limit'
my environment
reproduction code:
stack trace:
According to https://github.com/dmlc/xgboost/issues/805 loaded Booster doesn't have
best_ntree_limit
, it may cause this error.