Skip to content

求助 No module named 'tts' #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Baiken1412 opened this issue Apr 1, 2025 · 15 comments
Open

求助 No module named 'tts' #40

Baiken1412 opened this issue Apr 1, 2025 · 15 comments

Comments

@Baiken1412
Copy link

Traceback (most recent call last):
File "D:\study\语音\MegaTTS3\tts\infer_cli.py", line 28, in
from tts.modules.ar_dur.commons.nar_tts_modules import LengthRegulator
ModuleNotFoundError: No module named 'tts'

@jiang-ziyue
Copy link
Collaborator

@Baiken1412 请设置您的PYTHONPATH环境变量到当前目录set PYTHONPATH="C:\path\to\MegaTTS3;%PYTHONPATH%",如果这个命令不work可能需要手动设置一下

@Baiken1412
Copy link
Author

@Baiken1412 请设置您的PYTHONPATH环境变量到当前目录set PYTHONPATH="C:\path\to\MegaTTS3;%PYTHONPATH%",如果这个命令不work可能需要手动设置一下

(megatts3-env) D:\study\语音\MegaTTS3>python tts/infer_cli.py --input_wav "assets/Chinese_prompt.wav" --input_text "另一边的桌上,一位读书人嗤之以鼻道,'佛子三藏,神子燕小鱼是什么样的人物,李家的那个李子夜如何与他们相提并论?'" --output_dir ./gen
| loaded 'dur_model' from './checkpoints\duration_lm/model_only_last.ckpt'.
| Missing keys: 0, Unexpected keys: 0
Traceback (most recent call last):
File "D:\study\语音\MegaTTS3\tts\infer_cli.py", line 268, in
infer_ins = MegaTTS3DiTInfer()
File "D:\study\语音\MegaTTS3\tts\infer_cli.py", line 90, in init
self.build_model(self.device)
File "D:\study\语音\MegaTTS3\tts\infer_cli.py", line 126, in build_model
load_ckpt(self.dit, f'{self.dit_exp_name}', 'dit', strict=False)
File "D:\study\语音\MegaTTS3\tts\utils\commons\ckpt_utils.py", line 104, in load_ckpt
state_dict = state_dict_all[model_name]
KeyError: 'dit'

你好现在报这个错请问怎么解决?

@jiang-ziyue
Copy link
Collaborator

jiang-ziyue commented Apr 1, 2025

@Baiken1412 想问下你有下载预训练模型参数吗?你那边,./checkpoints目录中都有哪些文件和文件夹。

需要在docker build之前先下载好才行。

@Baiken1412
Copy link
Author

我是从readme里提供的链接下载了

Image

@jiang-ziyue
Copy link
Collaborator

@Baiken1412 是否有在docker build之前先下载好这些?

@Baiken1412
Copy link
Author

@Baiken1412 是否有在docker build之前先下载好这些?

嗯是的

@jiang-ziyue
Copy link
Collaborator

jiang-ziyue commented Apr 1, 2025

@Baiken1412 ok,windows docker目前还在测试中,所以暂时还不知道原因。我们会马上找更多的人来帮助解决一下,如果您后续找到解决方案也希望您可以发送给我们。

暂时认为问题是没有找到对应的checkpoint文件,但不清楚原因。

@Baiken1412
Copy link
Author

@Baiken1412 ok,windows docker目前还在测试中,所以暂时还不知道原因。我们会马上找更多的人来帮助解决一下,如果您后续找到解决方案也希望您可以发送给我们。

暂时认为问题是没有找到对应的checkpoint文件,但不清楚原因。

好的谢谢

@leeyeel
Copy link
Contributor

leeyeel commented Apr 1, 2025

@Baiken1412 ok,windows docker目前还在测试中,所以暂时还不知道原因。我们会马上找更多的人来帮助解决一下,如果您后续找到解决方案也希望您可以发送给我们。
暂时认为问题是没有找到对应的checkpoint文件,但不清楚原因。

好的谢谢

拷贝的时候没有成功把tts目录拷贝进去,你可以docker进到/app目录看下是否有tts目录。或者先用这个试试是否可以:https://github.com/leeyeel/MegaTTS3

@canwushuang
Copy link

export PYTHONPATH="path to MegaTTS3:$PYTHONPATH" 这步没操作吧。

@Idiotabtcodes
Copy link

直接用python -m tts.gradio_api能打开webui吗?

@Coder-Wjt
Copy link

magic_number = pickle_module.load(f, **pickle_load_args)

_pickle.UnpicklingError: invalid load key, 'v'.
不管在Ubuntu还是Macos,都会遇到这个报错,这到底什么问题?

@jiang-ziyue
Copy link
Collaborator

@Coder-Wjt 您使用的是docker还是物理机?

@Coder-Wjt
Copy link

@jiang-ziyue docker和物理机都会

@344303947
Copy link

2025-04-15 13:58:06,852 WETEXT INFO skip building fst for en_normalizer ...
| Start processing assets/Chinese_prompt.wav+另一边的桌上,一位读书人嗤之以鼻道,'佛子三藏,神子燕小鱼是什么样的人物,李家的那个李子夜如何与他们相提并论?'
/home/sean/miniconda3/envs/megatts3-env/lib/python3.10/site-packages/pydub/utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
Traceback (most recent call last):
File "/home/sean/MegaTTS3/tts/infer_cli.py", line 273, in
resource_context = infer_ins.preprocess(file_content, latent_file=wav_path.replace('.wav', '.npy'))
File "/home/sean/MegaTTS3/tts/infer_cli.py", line 164, in preprocess
wav_bytes = convert_to_wav_bytes(audio_bytes)
File "/home/sean/MegaTTS3/tts/utils/audio_utils/io.py", line 75, in convert_to_wav_bytes
audio = AudioSegment.from_file(io.BytesIO(audio_binary))
File "/home/sean/miniconda3/envs/megatts3-env/lib/python3.10/site-packages/pydub/audio_segment.py", line 728, in from_file
info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
File "/home/sean/miniconda3/envs/megatts3-env/lib/python3.10/site-packages/pydub/utils.py", line 274, in mediainfo_json
res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
File "/home/sean/miniconda3/envs/megatts3-env/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/sean/miniconda3/envs/megatts3-env/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants