CjangCjengh / MoeGoe

Executable file for VITS inference
MIT License
2.32k stars 251 forks source link

Exception: jieba: file does not exist: C:\jieba\dict.txt #14

Closed Kashouryo closed 1 year ago

Kashouryo commented 1 year ago
Microsoft Windows [Version 10.0.19044.1889]
(c) Microsoft Corporation. All rights reserved.

C:\Software\MoeGoe>moegoe
Traceback (most recent call last):
  File "MoeGoe.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "text\__init__.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "text\cleaners.py", line 24, in <module>
  File "jieba\__init__.py", line 513, in set_dictionary
Exception: jieba: file does not exist: C:\jieba\dict.txt
[2016] Failed to execute script 'MoeGoe' due to unhandled exception!
hash070 commented 1 year ago

I tried to use Python 3.10 venv on an Ubuntu 20.04 server and encountered the same problem.

(venv310) root@ubuntu:~/git/vits/MoeGoe# python MoeGoe.py
Path of a VITS model: /root/git/vits/cn/m.pth
Path of a config file: /root/git/vits/cn/conf.json
TTS or VC? (t/v):t
Text to read: HelloWorld!
Traceback (most recent call last):
  File "/root/git/vits/MoeGoe/MoeGoe.py", line 152, in <module>
    stn_tst = get_text(text, hps_ms, cleaned=cleaned)
  File "/root/git/vits/MoeGoe/MoeGoe.py", line 26, in get_text
    text_norm = text_to_sequence(text, hps.symbols, hps.data.text_cleaners)
  File "/root/git/vits/MoeGoe/text/__init__.py", line 17, in text_to_sequence
    clean_text = _clean_text(text, cleaner_names)
  File "/root/git/vits/MoeGoe/text/__init__.py", line 31, in _clean_text
    text = cleaner(text)
  File "/root/git/vits/MoeGoe/text/cleaners.py", line 36, in zh_ja_mixture_cleaners
    from text.mandarin import chinese_to_romaji
  File "/root/git/vits/MoeGoe/text/mandarin.py", line 10, in <module>
    jieba.set_dictionary(os.path.dirname(sys.argv[0])+'/jieba/dict.txt')
  File "/root/git/vits/MoeGoe/venv310/lib/python3.10/site-packages/jieba/__init__.py", line 513, in set_dictionary
    raise Exception("jieba: file does not exist: " + abs_path)
Exception: jieba: file does not exist: /jieba/dict.txt
(venv310) root@ubuntu:~/git/vits/MoeGoe#
handsome1238 commented 1 year ago

我也是出现这个问题 Traceback (most recent call last): File "MoeGoe.py", line 152, in stn_tst = get_text(text, hps_ms, cleaned=cleaned) File "MoeGoe.py", line 26, in get_text text_norm = text_to_sequence(text, hps.symbols, hps.data.text_cleaners) File "/content/drive/MyDrive/moegoe/text/init.py", line 17, in text_to_sequence clean_text = _clean_text(text, cleaner_names) File "/content/drive/MyDrive/moegoe/text/init.py", line 31, in _clean_text text = cleaner(text) File "/content/drive/MyDrive/moegoe/text/cleaners.py", line 36, in zh_ja_mixture_cleaners from text.mandarin import chinese_to_romaji File "/content/drive/MyDrive/moegoe/text/mandarin.py", line 10, in jieba.set_dictionary(os.path.dirname(sys.argv[0])+'/jieba/dict.txt') File "/usr/local/lib/python3.8/dist-packages/jieba/init.py", line 513, in set_dictionary raise Exception("jieba: file does not exist: " + abs_path) Exception: jieba: file does not exist: /jieba/dict.txt

asaintheretic commented 1 year ago

text文件夹里mandarin里读取dict的命令改为 def get_parent_directory_path(): abs_path = os.path.abspath(file) parent_dir_path = os.path.dirname(os.path.dirname(abs_path)) return parent_dir_path

logging.getLogger('jieba').setLevel(logging.WARNING) jieba.set_dictionary(get_parent_directory_path()+'\jieba\dict.txt') jieba.initialize()

yuewenma commented 1 year ago

我写一下我的解决方法吧, text文件夹里mandarin里读取dict的命令改为: logging.getLogger('jieba').setLevel(logging.WARNING) jieba.set_dictionary(os.getcwd()+'/jieba/dict.txt') jieba.initialize()