2024-09-01
Linux运维
00

目录

报错信息
解决

在这里插入图片描述

报错信息

go
able of handling various complex tasks. Please report the progress of this project to the team members. > =========================== 0%| | 0/7 [00:00<?, ?it/s] Traceback (most recent call last): File "/ssd/xd/tts/MeloTTS/x01.py", line 37, in <module> model.tts_to_file(text, speaker_ids['EN-US'], output_path, speed=speed) File "/ssd/xd/tts/MeloTTS/melo/api.py", line 100, in tts_to_file bert, ja_bert, phones, tones, lang_ids = utils.get_text_for_tts_infer(t, language, self.hps, device, self.symbol_to_id) File "/ssd/xd/tts/MeloTTS/melo/utils.py", line 23, in get_text_for_tts_infer norm_text, phone, tone, word2ph = clean_text(text, language_str) File "/ssd/xd/tts/MeloTTS/melo/text/cleaner.py", line 12, in clean_text phones, tones, word2ph = language_module.g2p(norm_text) File "/ssd/xd/tts/MeloTTS/melo/text/english.py", line 242, in g2p phone_list = list(filter(lambda p: p != " ", _g2p(w))) File "/ssd/xd/miniconda3/envs/melotts/lib/python3.10/site-packages/g2p_en/g2p.py", line 162, in __call__ tokens = pos_tag(words) # tuples of (word, tag) File "/ssd/xd/miniconda3/envs/melotts/lib/python3.10/site-packages/nltk/tag/__init__.py", line 165, in pos_tag tagger = _get_tagger(lang) File "/ssd/xd/miniconda3/envs/melotts/lib/python3.10/site-packages/nltk/tag/__init__.py", line 107, in _get_tagger tagger = PerceptronTagger() File "/ssd/xd/miniconda3/envs/melotts/lib/python3.10/site-packages/nltk/tag/perceptron.py", line 183, in __init__ self.load_from_json(lang) File "/ssd/xd/miniconda3/envs/melotts/lib/python3.10/site-packages/nltk/tag/perceptron.py", line 273, in load_from_json loc = find(f"taggers/averaged_perceptron_tagger_{lang}/") File "/ssd/xd/miniconda3/envs/melotts/lib/python3.10/site-packages/nltk/data.py", line 582, in find raise LookupError(resource_not_found) LookupError: ********************************************************************** Resource averaged_perceptron_tagger_eng not found. Please use the NLTK Downloader to obtain the resource: >>> import nltk >>> nltk.download('averaged_perceptron_tagger_eng') For more information see: https://www.nltk.org/data.html Attempted to load taggers/averaged_perceptron_tagger_eng/ Searched in: - '/home/xd/nltk_data' - '/ssd/xd/miniconda3/envs/melotts/nltk_data' - '/ssd/xd/miniconda3/envs/melotts/share/nltk_data' - '/ssd/xd/miniconda3/envs/melotts/lib/nltk_data' - '/usr/share/nltk_data' - '/usr/local/share/nltk_data' - '/usr/lib/nltk_data' - '/usr/local/lib/nltk_data' - '/home/xd/nltk_data' ***************************************************************

解决

python代码前加这几句,开魔法执行,会下载好对应包,就不会报错了。

go
import nltk nltk.data.path.append('/home/xd/nltk_data') # 添加路径 nltk.download('averaged_perceptron_tagger_eng')

要有魔法才行,路径可以改为自己喜欢的,python能找到的。比如显示在这些地方找,那就选一个。

在这里插入图片描述

如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:Dong

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!