Compiling CoreML on watchOS

Hi,


I'm building a watch application that uses CoreML models. The watch application does have a counterpart iPhone app. I would like to be able to download these CoreML models from the cloud and run on the watch without needing to bundle the ml models in the app and resubmit everytime they change or we add new ones.


I was happy to find the method `MLModel.compileModel(at modelURL: URL)`, however, when I discovered that it is not available on watchOS, it threw a huge wrench into the plan.


Is there a way to accomplish what I need? Will the compile method ever be available on watchOS?


Thanks for any help!

Hi @Doogles1,

You might be interested to know that CoreML supports model deployment starting on watchOS 7.0. Here’s a good starting point : https://developer.apple.com/documentation/coreml
To learn more about Core ML model deployment check out this session: https://developer.apple.com/videos/play/wwdc2020/10152/

Also note that you can compile your model with Xcode and deploy that compiled model:

Code Block
xcrun coremlcompiler compile <YourModel.mlmodel> <OutputDir> --platform watchos --deployment-target <minWatchOSDeploymentVersion>

Compiling CoreML on watchOS
 
 
Q