在Linux服务器上编译mlmodel

Cer*_*ise 3 ios coreml

我想知道是否有解决方案可以在 Linux 服务器上将 .mlmodel 编译为 .mlmodelc ?

我知道这可以用

xcrun coremlcompiler compile /path/to/MyModel.mlmodel /path/to/
Run Code Online (Sandbox Code Playgroud)

但 xcrun 不适用于 Linux。最好的解决方案是什么?我是否被迫在应用程序内构建它?

let compiledModelUrl = try? MLModel.compileModel(at: destinationFileUrl)
Run Code Online (Sandbox Code Playgroud)

我应该为此使用 OSX 服务器吗?

Mat*_*ans 5

你为什么要这样做?那么您可以在 Linux 上从 Swift 运行 Core ML 模型,还是出于其他原因?

如果您想在 Linux 上从 Swift 运行 Core ML 模型,那么您就不走运了,因为 Core ML 是仅限 macOS/iOS 的框架。

但是,您可能想查看 NNVM,这是一个编译器,可以将 Core ML 模型文件转换为在 CUDA、OpenCL 等上运行的代码。

https://aws.amazon.com/blogs/ai/introducing-nnvm-compiler-a-new-open-end-to-end-compiler-for-ai-frameworks/