lenML / Speech-AI-Forge

🍦 Speech-AI-Forge is a project developed around TTS generation model, implementing an API Server and a Gradio-based WebUI.
https://huggingface.co/spaces/lenML/ChatTTS-Forge
GNU Affero General Public License v3.0
859 stars 113 forks source link

[BUG:WebUI] #168

Open kuhubmk opened 1 month ago

kuhubmk commented 1 month ago

确认清单

Forge Commit 或者 Tag

AttributeError: 'Chat' object has no attribute 'gpt'

Python 版本

3.10.15

PyTorch 版本

2.4.1+cu121

操作系统信息

windos

浏览器信息

webui 报错

BUG 描述

在用chatTTS合成语音丢出下面报错 一,程序尝试从 ./models/ChatTTS 路径加载模型,但检查失败。(模型仔细检查了几遍,路径绝对没问题,都是手动下载,按MD的文件格式) 二,使用 Gradio 库时提供了一些未使用的参数。(这个没搞懂,因为我打开网页后没有去调整任何的参数,而是按示例直接点击合成语音) 三,访问 Chat 对象的 gpt 属性,但该对象没有这个属性。(这里也是很不解的,我去找chat类里,发现在load函数里面是有这么一个属性)

不知道是不是模型问题,chattts的模型没合成成功!

复现步骤

按MD的一步一步来的

期望结果

希望能正常使用即可,本来想着试试能不能用,然后再用来调用API,但最简单的都用不了。 整整弄了1天,从装依赖各种报错,反反复复终于装好了。

实际结果

没结果,用不了!

错误信息

下面是报错:
2024-10-11 00:41:47,162 - modules.core.models.tts.CosyVoiceModel - INFO - No CosyVoice model found
2024-10-11 00:41:48,368 - modules.devices.devices - INFO - Using half precision: torch.float16
2024-10-11 00:41:48,368 - modules.devices.devices - INFO - Using device: cuda
2024-10-11 00:41:48,624 - modules.webui.app - INFO - WebUI module initialized
2024-10-11 00:41:48,625 - modules.webui.localization - INFO - Loaded localization file c:\Users\Administrator\Desktop\Speech-AI-Forge-main\language\zh-CN.json
c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\webui\app.py:85: GradioUnusedKwargWarning: You have unused kwarg parameters in Blocks, please remove them: {'js': "\n    function refresh() {\n        const url = new URL(window.location);\n\n        if (url.searchParams.get('__theme') !== 'dark') {\n            url.searchParams.set('__theme', 'dark');\n            window.location.href = url.href;\n        }\n    }\n    ", 'head': '\n    <script>\n    </script>\n    '}
  with gr.Blocks(js=js_func, head=head_js, title="ChatTTS Forge WebUI") as demo:
Running on local URL:  http://0.0.0.0:7860
IMPORTANT: You are using gradio version 3.43.2, however version 4.29.0 is available, please upgrade.
--------

To create a public link, set `share=True` in `launch()`.
2024-10-11 00:42:11,057 - modules.core.models.zoo.ChatTTS - INFO - Loading ChatTTS models
2024-10-11 00:42:11,071 - modules.repos_static.ChatTTS.ChatTTS.core - INFO - try to load from local: C:/Users/Administrator/Desktop/Speech-AI-Forge-main/models/ChatTTS/asset
2024-10-11 00:42:11,071 - modules.repos_static.ChatTTS.ChatTTS.core - INFO - checking assets...
2024-10-11 00:42:11,072 - modules.repos_static.ChatTTS.ChatTTS.core - INFO - C:\Users\Administrator\Desktop\Speech-AI-Forge-main\models\ChatTTS\asset\asset\Decoder.pt not exist.
2024-10-11 00:42:11,072 - modules.repos_static.ChatTTS.ChatTTS.core - ERROR - check models in custom path C:/Users/Administrator/Desktop/Speech-AI-Forge-main/models/ChatTTS/asset failed.
Traceback (most recent call last):
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\gradio\queueing.py", line 388, in call_prediction
    output = await route_utils.call_process_api(
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\gradio\route_utils.py", line 219, in call_process_api
    output = await app.get_blocks().process_api(
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\gradio\blocks.py", line 1437, in process_api
    result = await self.call_function(
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\gradio\blocks.py", line 1109, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\anyio\_backends\_asyncio.py", line 2405, in run_sync_in_worker_thread
    return await future
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\anyio\_backends\_asyncio.py", line 914, in run
    result = context.run(func, *args)
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\gradio\utils.py", line 641, in wrapper
    response = f(*args, **kwargs)
  File "C:\Users\Administrator\miniconda3\envs\speech-ai-forge\lib\site-packages\gradio\utils.py", line 641, in wrapper
    response = f(*args, **kwargs)
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\webui\tts_tab.py", line 82, in tts_generate_with_history
    audio = tts_generate(model_id=self.model_id, *args, **kwargs)
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\webui\webui_utils.py", line 314, in tts_generate
    sample_rate, audio_data = handler.enqueue()
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\handler\TTSHandler.py", line 90, in enqueue
    return self.pipeline.generate()
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\pipeline\pipeline.py", line 103, in generate
    synth.start_generate()
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\pipeline\generate\BatchSynth.py", line 48, in start_generate
    self.start_generate_sync()
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\pipeline\generate\BatchSynth.py", line 61, in start_generate_sync
    self.generator.generate()
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\pipeline\generate\BatchGenerate.py", line 50, in generate
    self.generate_batch(batch)
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\pipeline\generate\BatchGenerate.py", line 67, in generate_batch
    results = model.generate_batch(segments=segments, context=self.context)
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\models\tts\ChatTtsModel.py", line 61, in generate_batch
    return self.generate_batch_base(segments, context, stream=False)
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\models\tts\ChatTtsModel.py", line 89, in generate_batch_base
    infer = self.get_infer(context)
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\models\tts\ChatTtsModel.py", line 69, in get_infer
    return ChatTTSInfer(self.load())
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\models\tts\ChatTtsModel.py", line 41, in load
    self.chat = load_chat_tts()
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\devices\devices.py", line 237, in wrapper
    ret = func(*args, **kwargs)
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\models\zoo\ChatTTS.py", line 60, in load_chat_tts
    do_load_chat_tts()
  File "c:\Users\Administrator\Desktop\Speech-AI-Forge-main\modules\core\models\zoo\ChatTTS.py", line 38, in do_load_chat_tts
    chat_tts.gpt,
AttributeError: 'Chat' object has no attribute 'gpt'
zhzLuke96 commented 1 month ago

2024-10-11 00:42:11,072 - modules.repos_static.ChatTTS.ChatTTS.core - INFO - C:\Users\Administrator\Desktop\Speech-AI-Forge-main\models\ChatTTS\asset\asset\Decoder.pt not exist.

看起来是缺少 Decoder.pt 这个文件额,你文件夹里有吗?

顺带一提,在项目目录执行这个脚本可以下载模型(并且会检查完整性):

python -m scripts.dl_chattts --source modelscope
kuhubmk commented 1 month ago

image 这个也是有的。

zhzLuke96 commented 1 month ago

额,我突然发现你这里报错信息有点奇怪

2024-10-11 00:42:11,072 - modules.repos_static.ChatTTS.ChatTTS.core - INFO - C:\Users\Administrator\Desktop\Speech-AI-Forge-main\models\ChatTTS\asset\asset\Decoder.pt not exist.

文件夹路径里怎么有两层 asset ? 我看代码里应该不会有这个逻辑,你有修改过代码吗?你用的是哪个 commit 的代码?