feat: add dictionaryOnly mode for background-safe G2P#14
Open
integrITsolutions wants to merge 1 commit into
Open
feat: add dictionaryOnly mode for background-safe G2P#14integrITsolutions wants to merge 1 commit into
integrITsolutions wants to merge 1 commit into
Conversation
When `dictionaryOnly = true`, the MLX BART OOV fallback is skipped.
Pure Swift dictionary lookups (179K entries) still run, covering
virtually all English words. Only rare OOV words miss — those pass
through with nil phonemes for the caller to handle.
Use case: iOS background mode where Metal GPU is unavailable.
MLX crashes with SIGABRT ("Insufficient Permission to submit GPU
work from background") when the BART fallback runs. Dictionary-only
mode prevents this while maintaining near-full pronunciation quality.
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.
Summary
Adds a
dictionaryOnlyproperty toEnglishG2Pthat skips the MLX BART OOV fallback while keeping pure-Swift dictionary lookups (179K entries) active.Use case
iOS apps using MisakiSwift with Kokoro TTS crash with
SIGABRTwhen the MLX BART fallback runs in background mode — Metal GPU work is prohibited by iOS in background processes. Settingg2p.dictionaryOnly = trueprevents this while maintaining near-full pronunciation quality (only rare OOV words miss, which callers can handle with a fallback G2P).Changes
public var dictionaryOnly: Bool = falseonEnglishG2Pfallback(w)for single words andfallback(token)for compound words) with!dictionaryOnlylexicon.transcribe) always run regardless of the flagdictionaryOnly = false(default)Testing
Tested in Voxnotes iOS app: foreground renders use full G2P, background renders use dictionary-only mode. Audio plays continuously through lock screen with consistent quality.