Posts

Post not yet marked as solved
4 Replies
1.1k Views
Xcode Version: 12.4 (Used Xcode 12.5 to create encryption key as 12.4 is bugged and will not let you) I am bundling a ML model into my app, and have encrypted ML model via Xcode 12 encryption method shown here. Model loads and works fine without encryption. After adding model encryption key and setting it as compiler flag, the model encryption/decryption works fine in a demo app, but using the same load method in my main app fails with this error message: Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=com.apple.CoreML Code=0 "Unable to load model at /path_to_model/my_model.mlmodelc/ with error: failed to invoke mremap_encrypted with result = -1, error = 12" I have tried all variations of the load method available within my swift generated model file, all produce the same result above.
Posted
by keedylan.
Last updated
.
Post not yet marked as solved
0 Replies
396 Views
I am bundling a ML model directly into my app. The model is encrypted when compiled, and I can successfully decrypt and load the model. When I submit perform a VNCoreMLRequest for my model, the model fails to run with error: [espresso] [Espresso::handle_ex_plan] exception=Espresso exception: "Invalid argument": Error reading the input file as JSON. Error: The data couldn’t be read because it isn’t in the correct format. status=-6 [coreml] Error in adding network -6. Failed to run model inference: The VNCoreMLTransform request failed Important notes: If the model is not encrypted, it can run predictions just fine, and this error is not seen. If the model is encrypted AND l set the request's usesCPUOnly attribute to 'false', the model runs fine and this error is not seen While the simple solution could be: "just set usesCPUOnly to false then", I do not want to do that, as this messes with the precision and accuracy of my model. I do not understand why having usesCPUOnly set to true would cause a decrypted model to fail, but works for the exact same model if the model is not encrypted at all.
Posted
by keedylan.
Last updated
.