0

我创建了 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"))
4

0 回答 0