Failed to build the model execution plan using a model architecture file

Our app is downloading a zip of an .mlpackage file, which is then compiled into an .mlmodelc file using MLModel.compileModel(at:). This model is then run using a VNCoreMLRequest.

Two users – and this after a very small rollout - are reporting issues running the VNCoreMLRequest. The error message from their logs:

Error Domain=com.apple.CoreML Code=0 "Failed to build the model execution plan using a model architecture file '/private/var/mobile/Containers/Data/Application/F93077A5-5508-4970-92A6-03A835E3291D/Documents/SKDownload/Identify-image-iOS/mobile_img_eu_v210.mlmodelc/model.mil' with error code: -5."

The URL there is to a file inside the compiled model. The error is happening when the perform function of VNImageRequestHandler is run. (i.e. the model compiled without an error.)

Anyone else seen this issue? Its only picked up in a few web results and none of them are directly relevant or have a fix.

I know that a CoreML error Code=0 is a generic error, but does anyone know what error code -5 is? Not even sure which framework its coming from.

Answered by joseph_2166 in 829496022

It seems this is an issue affecting the GPU of A13 chips, as it only happens on iPhone 11 and 9th Gen iPads. The 'fix' is to force the model to not use the GPU by using the .cpuAndNeuralEngine on the MLModelConfiguration().computeUnits variable.

Accepted Answer

It seems this is an issue affecting the GPU of A13 chips, as it only happens on iPhone 11 and 9th Gen iPads. The 'fix' is to force the model to not use the GPU by using the .cpuAndNeuralEngine on the MLModelConfiguration().computeUnits variable.

Failed to build the model execution plan using a model architecture file
 
 
Q