我创建了Cocoa应用程序(不是游乐场),并尝试创建和保存MLRegressorModel。但是,当我尝试保存成功创建的.mlmodel时,出现错误:
Could not export model: validator error: unable to open file for write
错误,当我使用try时! :
Fatal error: 'try!' expression unexpectedly raised an error: CreateML.MLCreateError.generic(reason: "Saving .mlmodel failed.")
如何将.mlmodel保存到磁盘?现在,我使用代码:
let homePath = FileManager.default.homeDirectoryForCurrentUser
let desktopPath = homePath.appendingPathComponent("Desktop")
try! regressor.write(to: desktopPath.appendingPathComponent("Regressor.mlmodel"))