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.