示例#1
0
 def from_lightgbm(model,
                   inputs: Iterable[IOShape],
                   opset: int = DEFAULT_OPSET):
     initial_type = ONNXConverter.convert_initial_type(inputs)
     return onnxmltools.convert_lightgbm(model,
                                         initial_types=initial_type,
                                         target_opset=opset)
示例#2
0
 def from_lightgbm(model,
                   inputs: Iterable[IOShape],
                   opset: int = DEFAULT_OPSET):
     initial_type = ONNXConverter.convert_initial_type(inputs)
     onnx_model = onnxmltools.convert_lightgbm(model,
                                               initial_types=initial_type,
                                               target_opset=opset)
     logger.info('lightgbm to onnx converted successfully')
     return onnx_model
示例#3
0
 def test_root_leave(self):
     this = os.path.abspath(os.path.dirname(__file__))
     for name in ["example.pkl"]:
         with open(os.path.join(this, name), "rb") as f:
             model = pickle.load(f)
         X = [[0., 1.], [1., 1.], [2., 0.]]
         X = numpy.array(X, dtype=numpy.float32)
         model_onnx = convert_lightgbm(
             model.steps[1][1], 'pkl1',
             [('input', FloatTensorType([1, X.shape[1]]))])
         dump_data_and_model(X,
                             model.steps[1][1],
                             model_onnx,
                             basename="LightGbmPkl1")