FluidVoice icon indicating copy to clipboard operation
FluidVoice copied to clipboard

[🐞 BUG] Error occurred while enabling the model

Open RussQuan opened this issue 5 months ago • 4 comments

Describe the bug

When I try to enable the model, I receive the following error:

Failed to build the model execution plan using a model architecture file '/Users/pi/Library/Caches/FluidAudio/CompiledNemotronModels/encoder-842ccec78631ca4e/encoder_ane_1781622167444.mlmodelc/model.mil' with error code: -14.

To Reproduce

Steps to reproduce the behavior:

  1. Open FluidAudio.
  2. Navigate to the Models settings page.
  3. Download and enable the Nemotron model.
  4. Wait for the model initialization process.
  5. An error message appears and the model cannot be enabled.

Expected behavior

The model should be enabled successfully and become available for use.

Screenshots

Image

Environment

  • macOS Version: 15.7.3 (24G419) Macbook air m4 32G
  • App Version: FluidVoice v1.5.15
  • Architecture: Apple Silicon

Additional context

I am using a MacBook Air M4. The issue occurs immediately when attempting to enable the Nemotron model after downloading it. Re-downloading the model and restarting the application did not resolve the issue.

Crash Logs

The application did not crash, but the following error was shown:

Failed to build the model execution plan using a model architecture file '/Users/pi/Library/Caches/FluidAudio/CompiledNemotronModels/encoder-842ccec78631ca4e/encoder_ane_1781622167444.mlmodelc/model.mil' with error code: -14.

RussQuan avatar Jun 16 '26 15:06 RussQuan

Open terminal and run

rm -rf /Users/pi/Library/Caches/FluidAudio/CompiledNemotronModels

Wanna delete this and see if it works?

altic-dev avatar Jun 22 '26 04:06 altic-dev

Implemented in https://github.com/altic-dev/FluidVoice/pull/456 - clears the corrupt FluidAudio CompiledNemotronModels cache before the GPU fallback retry so CoreML recompiles fresh, with an actionable error if it still fails.

mvanhorn avatar Jun 28 '26 11:06 mvanhorn

Reproduced + fix verified

Repro — forced the corrupt compiled-cache failure class deterministically:

  1. With the Nemotron model already downloaded, corrupted the ANE-compiled encoder at ~/Library/Caches/FluidAudio/CompiledNemotronModels/encoder-*/encoder_ane_*.mlmodelc/model.mil (overwrote with garbage bytes).
  2. Re-selected Nemotron to force a fresh model load.

The load fails on the bad model.mil and the app auto-recovers with no user-facing error:

[ERROR] ASRService: First prepare attempt for Nemotron … failed
[WARN]  CoreML … encoder_ane_….mlmodelc/model.mil … Error parsing MIL model …
        → Attempting a single recovery by clearing provider cache.
[INFO]  ASRService: Clearing provider cache before retry
[INFO]  Nemotron: loaded CoreML models with cpuAndNeuralEngine
[INFO]  ASRService: Provider prepared successfully after cache-clear retry

The line item that fixes this

Primary recovery — on the first prepare failure, wipe the compiled-model cache and do one strict retry (re-downloads/recompiles clean):

  • https://github.com/altic-dev/FluidVoice/blob/b0bb11f7ad64736a967d5342a7cde6d64e116678/Sources/Fluid/Services/ASRService.swift#L3196 — try await provider.clearCache() (retry at #L3207)

Dedicated -14 net — if only the ANE execution-plan build fails, fall off the Neural Engine onto GPU:

  • https://github.com/altic-dev/FluidVoice/blob/b0bb11f7ad64736a967d5342a7cde6d64e116678/Sources/Fluid/Services/NemotronProvider.swift#L179 — retry with .cpuAndGPU, guarded by shouldRetryWithoutNeuralEngine matching error.code == -14 / "model execution plan" (#L554).

Caveat

I induced the corrupt-cache failure as CoreML Code 71 (MIL parse error); the exact -14 (a valid-but-ANE-incompatible plan build, specific to the reported M4 / macOS 15.7.3) was verified by code inspection of the -14 branch rather than triggered live. The outer cache-clear recovery covers both classes.

No code change required — both safety nets are already on main.

shreeraman96 avatar Jul 21 '26 01:07 shreeraman96

Fixing commit

The -14 (ANE execution-plan failure) is directly addressed by:

fix(nemotron): fall back to cpuAndGPU when ANE load fails https://github.com/altic-dev/FluidVoice/commit/1235e4309e4814f494568b773a0dafebefbbab92

Core ML model load on the Neural Engine can fail with error code -14 on some Macs. Retry with .cpuAndGPU when that happens, detecting the retry via typed NSError code walking underlying/multiple errors first, with localized string matching as a secondary signal.

  • Merged via PR #389.
  • Landed 2026-06-17, ~16h after this issue was filed — a direct response to it.
  • On main: Sources/Fluid/Services/NemotronProvider.swift retries with .cpuAndGPU (guarded by shouldRetryWithoutNeuralEngine, which matches error.code == -14 / "model execution plan").

Note: this is the fix for the genuine ANE -14. The separate corrupt-cache clear-and-retry path (ASRService) only helps when the compiled cache is corrupt — it can't resolve a valid-but-ANE-incompatible plan, which is why the .cpuAndGPU fallback was the actual fix here.

shreeraman96 avatar Jul 21 '26 01:07 shreeraman96