How to convert from CoreML to ONNX?

149 views Asked by At

I have a already trained CoreML model and want to upload it to azure, how can I do the conversion from CoreML to ONNX?

import coremltools
import onnxmltools

# Load a Core ML model
coreml_model = coremltools.utils.load_spec('MobileNet.mlmodel')

# Convert the Core ML model into ONNX
onnx_model = onnxmltools.convert_coreml(coreml_model, 'Example Model')

# Save as protobuf
onnxmltools.utils.save_model(onnx_model, 'example.onnx')

I already tryed using coremltools and onnxmltools, but I'm ending up with this:

TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

0

There are 0 answers