将SageMaker XGBoost模型转换为ONNX模型时出错

时间:2019-11-22 19:42:59

标签: python machine-learning xgboost amazon-sagemaker onnx

我正在尝试将SageMaker XGBoost模型转换为ONNX,以便在使用ML.NET的.Net应用程序中使用ONNX模型。我尝试使用winmltoolsonnxmltools转换模型,但是两个工具都返回了相似的错误。

在业务领域中有很好的资源来使用机器学习。我已经尝试在SageMaker中使用Using Machine Learning to Improve Sales创建模型,然后将模型转换为ONNX模型。该示例在SageMaker中运行良好。

enter image description here

运行示例后,我得到了一个模型,该模型的类型为sagemaker.estimator.Estimator。我尝试使用winmltoolsonnxmltools转换模型。但是两者都返回相同的错误。

ValueError: No proper operator name found for '<class 'sagemaker.estimator.Estimator'>'

enter image description here

我尝试遵循Convert ML models to ONNX with WinMLToolsONNXMLTools enables conversion of models to ONNX将SageMaker模型转换为ONNX模型。

此后,我使用xgb.create_model()命令创建SageMaker模型。然后使用工具将模型转换为ONNX。但没有运气。这次我遇到了同样的错误。只是型号不同。

ValueError: No proper operator name found for '<class 'sagemaker.model.Model'>'

enter image description here

然后,我使用pickle加载模型并尝试转换模型。我遇到了同样的错误,只是型号不同。

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

enter image description here

此刻,我对这些问题一无所知。我应该如何解决这些问题。我已附上Improve Sales Classification to ONNX notebook file供参考。 您能否看一下这些问题,让我知道解决这些问题的方法? 预先感谢!

0 个答案:

没有答案