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

Can't use multiple EspeakBackend objects with njobs=1 #116

Open
eeishaan opened this issue Mar 29, 2022 · 0 comments
Open

Can't use multiple EspeakBackend objects with njobs=1 #116

eeishaan opened this issue Mar 29, 2022 · 0 comments

Comments

@eeishaan
Copy link

eeishaan commented Mar 29, 2022

Describe the bug
It seems that instantiation of multiple EspeakBackend objects is not correctly handled.
All the objects start operating with the language used to instantiate the last object.
Please refer to the example below.

Phonemizer version
3.0.1

System
macOS 11.6.4
python 3.8.9
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin

To reproduce

from phonemizer.backend import EspeakBackend

en_backend = EspeakBackend(
    "en-us",
    preserve_punctuation=True,
    with_stress=True,
    language_switch="remove-flags",
    words_mismatch="ignore",
)
en_sentence = ["I love to eat pizza everyday"]
print(en_backend.phonemize(en_sentence, njobs=1, strip=True)) # ['aɪ lˈʌv tʊ ˈiːt pˈiːtsə ˈɛvɹɪdˌeɪ']

de_backend = EspeakBackend(
    "de",
    preserve_punctuation=True,
    with_stress=True,
    language_switch="remove-flags",
    words_mismatch="ignore",
)
de_sentence = ["ich esse jeden tag gerne pizza."]
print(de_backend.phonemize(de_sentence, njobs=1, strip=True)) # ['ɪç ˈɛsə jˈeːdən tˈɑːk ɡˈɛɾnə pˈɪtsɑː.']

incorrect_en = en_backend.phonemize(en_sentence, njobs=1, strip=True)
en_with_de = de_backend.phonemize(en_sentence, njobs=1, strip=True)

assert en_with_de == incorrect_en
print(incorrect_en, en_with_de) 
# ['ˈiː lˈoːvə tˈoː eːˈɑːt pˈɪtsɑː ˈeːveːrˌyːdɛɪ'] 
# ['ˈiː lˈoːvə tˈoː eːˈɑːt pˈɪtsɑː ˈeːveːrˌyːdɛɪ']

Expected behavior
Notice that incorrect_en is equal to en_with_de and not equal to en_sentence.

Additional context
This problem happens only with njobs=1 and doesn't appear with njobs>1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants