jaketae / storyteller

Multimodal AI Story Teller, built with Stable Diffusion, GPT, and neural text-to-speech
MIT License
482 stars 64 forks source link

Crashes MeCab.Tagger() #12

Closed gvargas9 closed 1 year ago

gvargas9 commented 1 year ago

Traceback (most recent call last): File "/opt/homebrew/bin/storyteller", line 8, in sys.exit(main()) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/cli.py", line 39, in main story_teller = StoryTeller(config) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/utils.py", line 23, in wrapper_func func(*args, *kwargs) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/utils.py", line 37, in wrapper_func func(args, *kwargs) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/model.py", line 35, in init self.speaker = TTS(config.speaker) File "/opt/homebrew/lib/python3.10/site-packages/TTS/api.py", line 31, in init self.load_model_by_name(model_name, gpu) File "/opt/homebrew/lib/python3.10/site-packages/TTS/api.py", line 81, in load_model_by_name self.synthesizer = Synthesizer( File "/opt/homebrew/lib/python3.10/site-packages/TTS/utils/synthesizer.py", line 75, in init self._load_tts(tts_checkpoint, tts_config_path, use_cuda) File "/opt/homebrew/lib/python3.10/site-packages/TTS/utils/synthesizer.py", line 112, in _load_tts self.tts_model = setup_tts_model(config=self.tts_config) File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/models/init.py", line 12, in setup_model MyModel = find_module("TTS.tts.models", config.model.lower()) File "/opt/homebrew/lib/python3.10/site-packages/TTS/utils/generic_utils.py", line 93, in find_module module = importlib.import_module(module_path + "." + module_name) File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/models/glow_tts.py", line 17, in from TTS.tts.utils.text.tokenizer import TTSTokenizer File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/init.py", line 1, in from TTS.tts.utils.text.tokenizer import TTSTokenizer File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/tokenizer.py", line 5, in from TTS.tts.utils.text.phonemizers import DEF_LANG_TO_PHONEMIZER, get_phonemizer_by_name File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/phonemizers/init.py", line 4, in from TTS.tts.utils.text.phonemizers.ja_jp_phonemizer import JA_JP_Phonemizer File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/phonemizers/ja_jp_phonemizer.py", line 3, in from TTS.tts.utils.text.japanese.phonemizer import japanese_text_to_phonemes File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/japanese/phonemizer.py", line 352, in _TAGGER = MeCab.Tagger() File "/opt/homebrew/lib/python3.10/site-packages/MeCab.py", line 355, in init _MeCab.Tagger_swiginit(self, _MeCab.new_Tagger(args)) RuntimeError

jaketae commented 1 year ago

Hello, thanks for opening this issue. Could you provide more information on the following?

gvargas9 commented 1 year ago

Apple silicon Mac Defaul TTS mecab 0.996.3 pyttsx3 2.90

This is the full message. I find strang that its importing a_jp_phonemizer import JA_JP_Phonemizer

storyteller % storyteller
Fetching 16 files: 100%|███████████████████████████████████████████████████████████████████████████| 16/16 [00:00<00:00, 8324.10it/s]

tts_models/en/ljspeech/glow-tts is already downloaded. /Users/gio/Library/Application Support/tts/tts_models--en--ljspeech--glow-tts vocoder_models/en/ljspeech/multiband-melgan is already downloaded. /Users/gio/Library/Application Support/tts/vocoder_models--en--ljspeech--multiband-melgan Using model: glow_tts Traceback (most recent call last): File "/opt/homebrew/bin/storyteller", line 8, in sys.exit(main()) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/cli.py", line 39, in main story_teller = StoryTeller(config) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/utils.py", line 23, in wrapper_func func(*args, *kwargs) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/utils.py", line 37, in wrapper_func func(args, *kwargs) File "/opt/homebrew/lib/python3.10/site-packages/storyteller/model.py", line 35, in init self.speaker = TTS(config.speaker) File "/opt/homebrew/lib/python3.10/site-packages/TTS/api.py", line 31, in init self.load_model_by_name(model_name, gpu) File "/opt/homebrew/lib/python3.10/site-packages/TTS/api.py", line 81, in load_model_by_name self.synthesizer = Synthesizer( File "/opt/homebrew/lib/python3.10/site-packages/TTS/utils/synthesizer.py", line 75, in init self._load_tts(tts_checkpoint, tts_config_path, use_cuda) File "/opt/homebrew/lib/python3.10/site-packages/TTS/utils/synthesizer.py", line 112, in _load_tts self.tts_model = setup_tts_model(config=self.tts_config) File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/models/init.py", line 12, in setup_model MyModel = find_module("TTS.tts.models", config.model.lower()) File "/opt/homebrew/lib/python3.10/site-packages/TTS/utils/generic_utils.py", line 93, in find_module module = importlib.import_module(module_path + "." + module_name) File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/models/glow_tts.py", line 17, in from TTS.tts.utils.text.tokenizer import TTSTokenizer File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/init.py", line 1, in from TTS.tts.utils.text.tokenizer import TTSTokenizer File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/tokenizer.py", line 5, in from TTS.tts.utils.text.phonemizers import DEF_LANG_TO_PHONEMIZER, get_phonemizer_by_name File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/phonemizers/init.py", line 4, in from TTS.tts.utils.text.phonemizers.ja_jp_phonemizer import JA_JP_Phonemizer File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/phonemizers/ja_jp_phonemizer.py", line 3, in from TTS.tts.utils.text.japanese.phonemizer import japanese_text_to_phonemes File "/opt/homebrew/lib/python3.10/site-packages/TTS/tts/utils/text/japanese/phonemizer.py", line 352, in _TAGGER = MeCab.Tagger() File "/opt/homebrew/lib/python3.10/site-packages/MeCab.py", line 355, in init _MeCab.Tagger_swiginit(self, _MeCab.new_Tagger(args)) RuntimeError

gvargas9 commented 1 year ago

This could be related to MeCab, I had to built it for Arm64. Regular pip3 install was failing with the wrong architecture

ARCHFLAGS="-arch arm64" pip3 install -I MeCab --compile --no-cache-dir

gvargas9 commented 1 year ago

ok Solved. I will share some instructions here. This is for MacOS Arm.

You need version 1.05 and not 1.06

ARCHFLAGS="-arch arm64" pip install -I mecab-python3==1.0.5 --compile --no-cache-dirinstall mecab-python

jaketae commented 1 year ago

Hello @gvargas9, thanks for identifying the fix! I'll see if I can add more detailed instructions in the README.