coqui-ai / TTS

🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
http://coqui.ai
Mozilla Public License 2.0
35.85k stars 4.39k forks source link

[Bug] RuntimeError: Failed initializing MeCab. (xTTS-v2 on Google Colab for Japanese text-to-speech) #3164

Closed tsycstang closed 1 year ago

tsycstang commented 1 year ago

Describe the bug

I am having issue using xTTS-v2 model to do Japanese text-to-speech task on Google Colab with T4 GPU. And I got a RuntimeError: Failed initializing MeCab. Reinstalling mecab-python3 does not seem helpful.

ERROR DETAILS arguments: [b'fugashi', b'-C'] param.cpp(69) [ifs] no such file or directory: /usr/local/etc/mecabrc

To Reproduce

First it shows cutlet module not exist so I install it with TTS in the beginning:

!pip install TTS cutlet

Then:

from TTS.api import TTS
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)

Til here it all went well.

But when:

tts.tts_to_file(text="アメリカ:イスラエル軍によるガザ地区占領に反対を強調", # Sample text from news title
                file_path="output.wav",
                speaker_wav="/path/to/target/speaker.wav",
                language="ja")

Expected behavior

It gives:

/usr/local/lib/python3.10/dist-packages/cutlet/cutlet.py in init(self, system, use_foreign_spelling, ensure_ascii, mecab_args) 146 raise 147 --> 148 self.tagger = fugashi.Tagger(mecab_args) 149 self.exceptions = load_exceptions() 150

fugashi/fugashi.pyx in fugashi.fugashi.Tagger.init()

fugashi/fugashi.pyx in fugashi.fugashi.GenericTagger.init() RuntimeError: Failed initializing MeCab. Please see the README for possible solutions: https://github.com/polm/fugashi If you are still having trouble, please file an issue here, and include the ERROR DETAILS below: https://github.com/polm/fugashi/issues issueを英語で書く必要はありません。

------------------- ERROR DETAILS ------------------------ arguments: [b'fugashi', b'-C'] param.cpp(69) [ifs] no such file or directory: /usr/local/etc/mecabrc

Logs

No response

Environment

- Google Colab with T4 GPU
- Latest TTS version

Additional context

No response

tsycstang commented 1 year ago

Further progress: Fugashi dictionary is not handled by TTS so error occured.

To solve this:

!pip install fugashi[unidic]
!python -m unidic download