简体   繁体   English

在 linux 服务器上编译 mlmodel

[英]Compile mlmodel on a linux server

I'm wondering if there is a solution out there to compile a .mlmodel to a .mlmodelc on a linux server ?我想知道是否有解决方案可以在 linux 服务器上将 .mlmodel 编译为 .mlmodelc ?

I know this can be done with我知道这可以做到

xcrun coremlcompiler compile /path/to/MyModel.mlmodel /path/to/

But xcrun isn't available for linux.但是 xcrun 不适用于 Linux。 What would be the best solution ?最好的解决方案是什么? Am I forced to build it in-app ?我是否被迫在应用程序中构建它?

let compiledModelUrl = try? MLModel.compileModel(at: destinationFileUrl)

Should I use an OSX server just for this ?我应该为此使用 OSX 服务器吗?

Why do you want to do this?你为什么要这样做? So you can run the Core ML model from Swift on Linux, or for some other reason?所以你可以在 Linux 上从 Swift 运行 Core ML 模型,还是出于其他原因?

If you want to run Core ML models from Swift on Linux, you're out of luck, as Core ML is a macOS/iOS-only framework.如果你想在 Linux 上从 Swift 运行 Core ML 模型,那你就不走运了,因为 Core ML 是一个仅限 macOS/iOS 的框架。

However, you may want to check out NNVM, a compiler that can convert Core ML model files into code that runs on CUDA, OpenCL, etc.但是,您可能想查看 NNVM,这是一种编译器,可以将 Core ML 模型文件转换为在 CUDA、OpenCL 等上运行的代码。

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

I've been researching this for some time now and am not sure it's possible. 我已经对此进行了一段时间的研究,但不确定是否可行。 Did you manage to do it? 你做到了吗?

I think a possible solution would be sending images to the server and getting the result from there rather than creating an .mlmodel on the device or getting one from the server, both of which I couldn't do. 我认为可能的解决方案是将图像发送到服务器并从那里获取结果,而不是在设备上创建.mlmodel或从服务器获取一个,而我都做不到。 What did you end up doing? 你最终做了什么? I'm new to stackoverflow and most features aren't unlocked. 我是stackoverflow的新手,并且大多数功能尚未解锁。 If you have Telegram, could you contact me @skinminers ? 如果您有电报,可以与我联系@skinminers吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM