Spring
Spring

Reputation: 11855

CoreML initialization fails: MTLTextureDescriptor has width greater than the maximum allowed size

I have a Keras CNN model that I converted to CoreML using coremltools. It works perfectly on simulator but not on the iPhone X. It crashes just on initialization:

let cnn = MyCnn()

…with error:

MTLTextureDescriptor has width (44100) greater than the maximum allowed size of 16384.

After having read SO posts with similar errors, I thought that maybe this is a GPU issue, so I tried to set

usesCPUOnly = true 

However, I can only send options during prediction time and there seems to be no way to set this before initialization—where the crash occurs.

Any ideas what I can do?

Upvotes: 1

Views: 1371

Answers (1)

Matthijs Hollemans
Matthijs Hollemans

Reputation: 7892

You can set it during initialization by passing in an MLModelConfiguration object.

But it's probably a good idea to make your model smaller. It sounds like this is just way too big for a mobile phone.

Upvotes: 1

Related Questions