Skip to content

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

Description

@Dachannien

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions