We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in phonemize.py
phonemizer = BACKENDS[backend] Spawns a new instance each time it's ran, while the old one persists in memory
One solution is to cache it, so it's only instantiated once:
_PHONEMIZER_CACHE = {}
cache_key = ( backend, language, str(punctuation_marks), preserve_punctuation, with_stress, tie, language_switch, words_mismatch ) # Check if we have a cached backend if cache_key not in _PHONEMIZER_CACHE: # initialize the phonemization backend if backend == 'espeak': _PHONEMIZER_CACHE[cache_key] = BACKENDS[backend]( language, punctuation_marks=punctuation_marks, preserve_punctuation=preserve_punctuation, with_stress=with_stress, tie=tie, language_switch=language_switch, words_mismatch=words_mismatch, logger=logger) elif backend == 'espeak-mbrola': _PHONEMIZER_CACHE[cache_key] = BACKENDS[backend]( language, logger=logger) else: # festival or segments _PHONEMIZER_CACHE[cache_key] = BACKENDS[backend]( language, punctuation_marks=punctuation_marks, preserve_punctuation=preserve_punctuation, logger=logger) phonemizer = _PHONEMIZER_CACHE[cache_key]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Memory leak in phonemize.py
phonemizer = BACKENDS[backend]
Spawns a new instance each time it's ran, while the old one persists in memory
One solution is to cache it, so it's only instantiated once:
Global cache for phonemizer backends
_PHONEMIZER_CACHE = {}
Create a cache key from the configuration
The text was updated successfully, but these errors were encountered: