executorch
executorch copied to clipboard
Support CoreML export on Linux
Allow exporting to CoreML backends on Linux. Running the model on Linux is not an expectation. More context: https://github.com/pytorch/executorch/issues/9019
cc @larryliu0820 @lucylq @mergennachin @byjlw
Here's the use case I'm thinking of:
Model developers want to export a model and create .pte file with coreml delegate embedded using directly on colab notebook and/or on their linux laptop.
And give the .pte model file to iOS application developers, so that they can just take it and embed as part of their app
As far as prioritizing this appropriately, I thought I'd mention that coremltools can produce pre-compiled models when run from Mac, but not when run from Linux. Using pre-compiled models can mean faster first-time inference, and if this is important using linux to produce a CoreML PTE vs. Mac may be undesirable.
In more details, the CoreML PTE file can either have an uncompiled coreml model inside of it, or a compiled coreml model inside of it. If it has an uncompiled model inside of it, the compilation must happen on device (the phone). The resulting model is cached, but it can make first inference slow.
The determination of whether a CoreML PTE file has a compiled or uncompiled model is a partitioner option, but on linux the compiled option could not be supported.
The required work for OSS is probably creating a cmake target similar to this buck one: https://github.com/pytorch/executorch/blob/bf272de13f936628c895d4723d07f3296ace0366/backends/apple/coreml/TARGETS#L61
The required work for OSS is probably creating a cmake target similar to this buck one:
executorch/backends/apple/coreml/TARGETS
Line 61 in bf272de
runtime.cxx_python_extension(
Thanks for the pointer. Yeah this should be feasible, we have pybind working properly on Mac.