Skip to content

fix: recover from corrupt compiled Nemotron CoreML cache before ANE fallback#456

Open
mvanhorn wants to merge 1 commit into
altic-dev:mainfrom
mvanhorn:fix/383-fix-recover-from-corrupt-compiled-nemotr
Open

fix: recover from corrupt compiled Nemotron CoreML cache before ANE fallback#456
mvanhorn wants to merge 1 commit into
altic-dev:mainfrom
mvanhorn:fix/383-fix-recover-from-corrupt-compiled-nemotr

Conversation

@mvanhorn

Copy link
Copy Markdown

Description

Some users hit "Failed to build the model execution plan ... with error code: -14" when enabling Nemotron, and the existing ANE to GPU fallback could not recover because both attempts reused the same corrupt compiled CoreML cache.

In NemotronProvider.prepare(), when loadManager(.cpuAndNeuralEngine) throws and shouldRetryWithoutNeuralEngine matches the -14 / model-execution-plan failure, the provider now deletes the compiled cache at ~/Library/Caches/FluidAudio/CompiledNemotronModels before retrying with .cpuAndGPU, so CoreML recompiles fresh. This is the same directory the maintainer's manual workaround removes. The downloaded .mlpackage artifacts under the separate model cache directory are left untouched. If the retry still fails, the raw CoreML string is replaced with a clear message that names the cache path and the manual-delete fallback. The non-matching error path is unchanged and still rethrows without clearing anything.

Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🧹 Chore
  • 📝 Documentation update

Related Issues

Testing

  • Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources/Fluid/Services/NemotronProvider.swift (0 violations)

Added Tests/FluidDictationIntegrationTests/NemotronCacheRecoveryTests.swift (wired into the Xcode test target) covering: -14 detection through nested NSUnderlyingErrorKey and through the CoreML description string, a non-matching error returning false, the compiled-cache path resolving under .cachesDirectory to FluidAudio/CompiledNemotronModels, and the clear helper removing an existing directory while not throwing on a missing one. xcodebuild test -only-testing:FluidDictationIntegrationTests/NemotronCacheRecoveryTests passes (5 tests, 0 failures). Verified on Apple Silicon.

Notes

The fix is scoped to the cache-load error path; the existing ANE to GPU compute-unit fallback is preserved.

Screenshots / Video

Not applicable. This is an error-recovery path with no UI change; behavior is covered by the unit tests above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐞 BUG] Error occurred while enabling the model

1 participant