user11741656
user11741656

Reputation: 61

Unable to load CoreML model using MLModel.compileModel

The CoreML couldn't be loaded. The first line is successful, but the second line gives an error called: The file couldn’t be saved. The model does exist and modelUrl is correct. The same issue is also found here Unable to load CoreML model using MLModel.compileModel(at:)

Does someone know what the cause is?

var modelUrl = NSBundle.MainBundle.GetUrlForResource("SentimentPolarity", "mlmodel");
var compiledModelUrl = MLModel.CompileModel(modelUrl, out var error);

Upvotes: 1

Views: 1119

Answers (1)

user11741656
user11741656

Reputation: 61

I found the answer just now. I encountered this problem when I deploy an app to an iphone from Mac in debug mode. Actually, there is nothing wrong with the code, it is something else. I did two things, first sign in to icloud(does icloud have anything to do with the iphone's provisioning profile for development?), secondly delete the app and re-deploy the app to the iphone. It solves the problem now. Although I am not sure which one solves my problem, I assume it is the second thing I did. Let me know if anyone found the reason behind.

Upvotes: 1

Related Questions