Model fails to load: CoreML/BNNS compile error (macOS 26.6.2, error -14)
Reporting for tracking purposes (own repo).
Attempting to load NLLB_Encoder_1024.mlpackage via MLModel on macOS 26.6.2 (Apple Silicon) fails consistently, both on the GPU path and the CPU-only fallback:
Error(s) occurred compiling MIL to BNNS graph:
[CreateBnnsGraphProgramFromMIL]: BNNS failed to compile due to an exception: index out of bounds
@ CreateBnnsGraphProgramFromMIL
Failed to build the model execution plan using a model architecture file
'.../NLLB_Encoder_1024.mlmodelc/model.mil' with error code: -14.
This reproduces after clearing all CoreML/E5RT compilation caches, so it isn't a stale-cache issue. Packaging itself was also incomplete (missing Manifest.json for the Encoder package and the tokenizer/ directory) β those have since been added β but the model graph itself still fails to compile on this OS/toolchain.
Likely needs re-export from the source PyTorch checkpoint (facebook/nllb-200-distilled-600M based) with a current coremltools version. Leaving this open as a tracking note until re-converted.
Update: narrowed this down further.
- The base (non "-ios") mirror
aoiandroid/nllb200-coreml-1024-float32's Encoder weight.bin is a different size (1,658,261,824 bytes) than this repo's (1,517,850,624 bytes) β swapped it in to compare, but it got OOM-killed (SIGKILL) mid-compile before finishing, so that comparison was inconclusive on this machine. - To isolate whether NLLB CoreML export/compile works at all here, tested
aoiandroid/nllb200-coreml-512-pal8's Encoder directly viaMLModel.compileModel(at:)+MLModel(contentsOf:), outside the app. That one compiles and loads cleanly.
So the NLLB CoreML conversion pipeline itself is fine on this OS/toolchain (macOS 26.6.2, coremltools 9.0) β the issue is specific to the 1024-context / float32 export. Likely candidates: the float32 size is large enough to be memory/compile-time marginal, or this particular export has a structural issue. A palettized/quantized 1024 re-export, or using the 512 tier, would be worth trying as a workaround.