myshell-ai / MeloTTS

High-quality multi-lingual text-to-speech library by MyShell.ai. Support English, Spanish, French, Chinese, Japanese and Korean.
MIT License
3.97k stars 473 forks source link

Is it support korean? function error... #113

Closed gudwls3635 closed 2 months ago

gudwls3635 commented 2 months ago

When I run this code after installing the modules listed in requirements.txt:

from melo.api import TTS

# Speed is adjustable
speed = 1.0
device = 'cpu' # or cuda:0

text = "안녕하세요! 오늘은 날씨가 정말 좋네요."
model = TTS(language='KR', device=device)
speaker_ids = model.hps.data.spk2id

output_path = 'kr.wav'
model.tts_to_file(text, speaker_ids['KR'], output_path, speed=speed)

I get the following error message

> Text split to sentences.
안녕하세요! 오늘은 날씨가 정말 좋네요.
 > ===========================
  0%|                                                                                                                                                                                   
you have to install python-mecab-ko. install it...
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
        - Avoid using `tokenizers` before the fork if possible
        - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
Collecting python-mecab-ko
  Using cached python_mecab_ko-1.3.5-cp39-cp39-macosx_10_9_x86_64.whl.metadata (3.4 kB)
Collecting python-mecab-ko-dic (from python-mecab-ko)
  Using cached python_mecab_ko_dic-2.1.1.post2-py3-none-any.whl.metadata (1.4 kB)
Using cached python_mecab_ko-1.3.5-cp39-cp39-macosx_10_9_x86_64.whl (381 kB)
Using cached python_mecab_ko_dic-2.1.1.post2-py3-none-any.whl (34.5 MB)
Installing collected packages: python-mecab-ko-dic, python-mecab-ko
Successfully installed python-mecab-ko-1.3.5 python-mecab-ko-dic-2.1.1.post2
you have to install python-mecab-ko. "pip install python-mecab-ko"

Even though I installed the required modules from requirements.txt I still encounter this error. What should I do?

When I run the command pip install python-mecab-ko I get the following output indicating that it's already installed:

Requirement already satisfied: python-mecab-ko in /Users/user/anaconda3/envs/mellotts/lib/python3.9/site-packages (1.3.5)
Requirement already satisfied: python-mecab-ko-dic in /Users/user/anaconda3/envs/mellotts/lib/python3.9/site-packages (from python-mecab-ko) (2.1.1.post2)

I use python==3.9.19

joygom commented 2 months ago

Korean support seems to be incomplete. When I install meloTTS, it installs mecab-python3(1.0.5), but when I test Korean with melo-ui, it installs python-mecab-ko etc. with Huggingface/tokenizers message. It seems like python-mecab-ko is required for Korean to work, but on my computer, after python-mecab-ko is installed, the whole meloTTS stops working because python can't find(import) mecab. To fix it, I uninstalled mecab-python3 and reinstalled meloTTS, and it works. The funny thing is that even though the package still has python-mecab-ko installed earlier, when I test Korean with melo-ui, it tries to install python-mecab-ko again automatically and stops working melo-ui . Of course, if I test Korean with melo-ui in the docker version, it works fine with reinstall python-mecab-en the same way. It seems like I need some kind of special environment to using Korean of meloTTS. For reference, I failed to run melo-ui on meloTTS with the same python version as docker, but it worked fine for languages other than Korean with version 3.10.14.

Translated with DeepL.com (free version)