fix: recover from corrupt compiled Nemotron CoreML cache before ANE fallback#456
Open
mvanhorn wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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(), whenloadManager(.cpuAndNeuralEngine)throws andshouldRetryWithoutNeuralEnginematches the-14/ model-execution-plan failure, the provider now deletes the compiled cache at~/Library/Caches/FluidAudio/CompiledNemotronModelsbefore retrying with.cpuAndGPU, so CoreML recompiles fresh. This is the same directory the maintainer's manual workaround removes. The downloaded.mlpackageartifacts 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
Related Issues
Testing
swiftlint --strict --config .swiftlint.yml Sources/Fluid/Services/NemotronProvider.swift(0 violations)Added
Tests/FluidDictationIntegrationTests/NemotronCacheRecoveryTests.swift(wired into the Xcode test target) covering:-14detection through nestedNSUnderlyingErrorKeyand through the CoreML description string, a non-matching error returning false, the compiled-cache path resolving under.cachesDirectorytoFluidAudio/CompiledNemotronModels, and the clear helper removing an existing directory while not throwing on a missing one.xcodebuild test -only-testing:FluidDictationIntegrationTests/NemotronCacheRecoveryTestspasses (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.