Skip to content
New issue

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

preprocess.py misuses Espeak backend, resulting in slow performance and memory leak #81

Open
Dachannien opened this issue Oct 11, 2022 · 2 comments

Comments

@Dachannien
Copy link

In ForwardTacotron/utils/text/cleaners.py, the Espeak phonemizer backend is recreated every iteration of the preprocessing, on every text string. Initializing the backend is really slow and appears to pile a bunch of instances of the backend into a dict that something is holding onto somewhere, causing a memory leak. By creating an Espeak phonemizer backend in the Cleaner class and just reusing it for every text string, this saves a huge amount of time and allows the process to complete even on systems with not much memory. See the warning at the phonemizer documentation here: https://bootphon.github.io/phonemizer/common_issues.html

I did not push any fixes myself because (1) I'm a bit of a github noob and (2) I don't know whether the Espeak backend is reentrant, and if it isn't, it's somewhat of a design decision whether multithreading or this fix would be better.

@cschaefer26
Copy link

cschaefer26 commented Oct 26, 2022

Hi, thanks for pointing it out. I personally don't use espeak anymore, but I will look into it - there could be problems with the multiprocessing imo.

@cschaefer26
Copy link

Seems like the fix is easy, here you go: #84

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

No branches or pull requests

2 participants