问题描述
还有其他人对带有ML模型的GM版本有疑问,并且对此有解决方案吗?我收到以下错误:
Anyone else having issues with the GM release with ML models and has a solution for this? I get the following error:
Type 'MLModel' has no member '__loadContents'
我已经清理了Project +删除的派生数据(这是一个生成的文件,放在派生数据文件夹中)
I have cleaned the Project + deleted derived data (this is a generated file that is put into the derived data folder)
我注意到该方法不适用于我使用的mac OS 10.15,但是由于某种原因而存在.
I notice that the method should not be there for mac OS 10.15 which I use, but it there for some reason.
我还注意到,当GM是量产版本时,此API仍处于beta版吗? https://developer.apple.com/documentation/coreml/mlmodel
I also noticed that this API is still in beta while the GM is a production build? https://developer.apple.com/documentation/coreml/mlmodel
我应该重新生成ML模型吗?
Should I regenerate the ML model?
推荐答案
根本原因是:
修复步骤:
- 在目标构建设置中,您可以将COREML_CODEGEN_LANGUAGE设置为无"
- 打开终端,然后转到您的.mlmodel文件夹
- 键入"xcrun coremlcompiler生成< YourModel.mlmodel>" --language Swift."
- 这将创建< YourModel.swift>文件放在同一文件夹中.
- 打开Xcode并添加< YourModel.swift>在您的项目中.
- 点击< YourModel.swift>并注释掉编译器抱怨的方法.
就我而言,我将其注释掉:
In my case I comment out :
class func load(contentsOf modelURL: URL, configuration: MLModelConfiguration = MLModelConfiguration(), completionHandler handler: @escaping (Swift.Result<Nudity, Error>) -> Void)
和
class func load(configuration: MLModelConfiguration = MLModelConfiguration(), completionHandler handler: @escaping (Swift.Result<Nudity, Error>) -> Void)
修复快速文件的方法.
这篇关于Catalyst的ML构建错误(Xcode 12 GM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!