CoreML crash on macOS 15.0 (24A335)

When I try to run basically any CoreML model using MLPredictionOptions.outputBackings , inference throws the following error:

2024-09-11 15:36:00.184740-0600 run_demo[4260:64822] [coreml] Unrecognized ANE execution priority (null)
2024-09-11 15:36:00.185380-0600 run_demo[4260:64822] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unrecognized ANE execution priority (null)'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000019812cec0 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000197c12cd8 objc_exception_throw + 88
	2   CoreFoundation                      0x000000019812cdb0 +[NSException exceptionWithName:reason:userInfo:] + 0
	3   CoreML                              0x00000001a1bf6504 _ZN12_GLOBAL__N_141espressoPlanPriorityFromPredictionOptionsEP19MLPredictionOptions + 264
	4   CoreML                              0x00000001a1bf68c0 -[MLNeuralNetworkEngine _matchEngineToOptions:error:] + 236
	5   CoreML                              0x00000001a1be254c __62-[MLNeuralNetworkEngine predictionFromFeatures:options:error:]_block_invoke + 68
	6   libdispatch.dylib                   0x0000000197e20658 _dispatch_client_callout + 20
	7   libdispatch.dylib                   0x0000000197e2fcd8 _dispatch_l
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unrecognized ANE execution priority (null)'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000019812cec0 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000197c12cd8 objc_exception_throw + 88
	2   CoreFoundation                      0x000000019812cdb0 +[NSException exceptionWithName:reason:userInfo:] + 0
	3   CoreML                              0x00000001a1bf6504 _ZN12_GLOBAL__N_141espressoPlanPriorityFromPredictionOptionsEP19MLPredictionOptions + 264
	4   CoreML                              0x00000001a1bf68c0 -[MLNeuralNetworkEngine _matchEngineToOptions:error:] + 236
	5   CoreML                              0x00000001a1be254c __62-[MLNeuralNetworkEngine predictionFromFeatures:options:error:]_block_invoke + 68
	6   libdispatch.dylib                   0x0000000197e20658 _dispatch_client_callout + 20
	7   libdispatch.dylib                   0x0000000197e2fcd8 _dispatch_lane_barrier_sync_invoke_and_complete + 56
	8   CoreML                              0x00000001a1be2450 -[MLNeuralNetworkEngine predictionFromFeatures:options:error:] + 304
	9   CoreML                              0x00000001a1c9e118 -[MLDelegateModel _predictionFromFeatures:usingState:options:error:] + 776
	10  CoreML                              0x00000001a1c9e4a4 -[MLDelegateModel predictionFromFeatures:options:error:] + 136
	11  libMLBackend_coreml.dylib           0x00000001002f19f0 _ZN6CoreML8runModelENS_5ModelERNSt3__16vectorIPvNS1_9allocatorIS3_EEEES7_ + 904
	12  libMLBackend_coreml.dylib           0x00000001002c56e8 _ZZN8ModelImp9runCoremlEPN2ML7Backend17ModelIoBindingImpEENKUlvE_clEv + 120
	13  libMLBackend_coreml.dylib           0x00000001002c1e40 _ZNSt3__110__function6__funcIZN2ML4Util10WorkThread11runInThreadENS_8functionIFvvEEEEUlvE_NS_9allocatorIS8_EES6_EclEv + 40
	14  libMLBackend_coreml.dylib           0x00000001002bc3a4 _ZZN2ML4Util10WorkThreadC1EvENKUlvE_clEv + 160
	15  libMLBackend_coreml.dylib           0x00000001002bc244 _ZNSt3__114__thread_proxyB7v160006INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN2ML4Util10WorkThreadC1EvEUlvE_EEEEEPvSC_ + 52
	16  libsystem_pthread.dylib             0x0000000197fd32e4 _pthread_start + 136
	17  libsystem_pthread.dylib             0x0000000197fce0fc thread_start + 8
)
libc++abi: terminating due to uncaught exception of type NSException

Interestingly, if I don't use MLPredictionOptions to set pre-allocated output backings, then inference appears to run as expected.

A similar issue seems to have been discussed and fixed here: https://developer.apple.com/forums/thread/761649 , however I'm seeing this issue on a beta build that I downloaded today (Sept 11 2024).

Will this be fixed? Any advice would be greatly appreciated.

Thanks

Answered by csw0pe in 803945022

It turned out to be caused by not properly initializing the MLPredictionOptions object:

It should be: [[MLPredictionOptions alloc] init]

But I was donig: [MLPredictionOptions alloc]

Hello @csw0pe, please use Feedback Assistant to submit a bug report, and please post here your bug report's ID.

Accepted Answer

It turned out to be caused by not properly initializing the MLPredictionOptions object:

It should be: [[MLPredictionOptions alloc] init]

But I was donig: [MLPredictionOptions alloc]

CoreML crash on macOS 15.0 (24A335)
 
 
Q