jianchang512 / ChatTTS-ui

一个简单的本地网页界面,使用ChatTTS将文字合成为语音,同时支持对外提供API接口。A simple native web interface that uses ChatTTS to synthesize text into speech, along with support for external API interfaces.
https://pyvideotrans.com
Other
4.98k stars 541 forks source link

Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead. #143

Open SamXP2004 opened 1 week ago

SamXP2004 commented 1 week ago

合成时候报错。

v0.93

Mac

jianchang512 commented 1 week ago

142

有没有更完整的报错记录

Maxinsomnia commented 1 week ago
[2024-06-21 00:12:02,931] ERROR in app: Exception on /tts [POST]
Traceback (most recent call last):
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/app.py", line 216, in tts
    wavs = chat.infer(new_text, use_decoder=True, skip_refine_text=True if int(skip_refine)==1 else False,params_infer_code={
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/ChatTTS/core.py", line 169, in infer
    result = infer_code(self.pretrain_models, text, **params_infer_code, return_hidden=use_decoder)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/ChatTTS/infer/api.py", line 45, in infer_code
    F.normalize(spk_emb.to(device).to(emb.dtype)[None].expand(len(text), -1), p=2.0, dim=1, eps=1e-12)
              ^^^^^^^^^^^^^^^^^^
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
ERROR:app:Exception on /tts [POST]
Traceback (most recent call last):
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/venv/lib/python3.11/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/app.py", line 216, in tts
    wavs = chat.infer(new_text, use_decoder=True, skip_refine_text=True if int(skip_refine)==1 else False,params_infer_code={
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/ChatTTS/core.py", line 169, in infer
    result = infer_code(self.pretrain_models, text, **params_infer_code, return_hidden=use_decoder)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Guo/data/chattts/chat-tts-ui/ChatTTS/infer/api.py", line 45, in infer_code
    F.normalize(spk_emb.to(device).to(emb.dtype)[None].expand(len(text), -1), p=2.0, dim=1, eps=1e-12)
              ^^^^^^^^^^^^^^^^^^
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
jianchang512 commented 1 week ago

重新 git pull下试试

hanshantao commented 1 week ago

拉取最新的,不报错了。但是推理时长异常的长,并且生成的音频是异常的,噪音啸叫那种。cpu 为 mac M1,日志如下: python3 app.py Starting... 2024-06-21 09:52:37,380 - modelscope - INFO - PyTorch version 2.2.0 Found. 2024-06-21 09:52:37,381 - modelscope - INFO - Loading ast index from /Users/xxx/.cache/modelscope/ast_indexer 2024-06-21 09:52:37,495 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 e043b171d24ae8896ed2791da97752eb and a total number of 980 components indexed INFO:ChatTTS.core:Load from local: /Users/xxx/Documents/workspace/chattts/models/pzc163/chatTTS INFO:ChatTTS.utils.gpu_utils:Apple GPU found, using MPS. INFO:ChatTTS.core:use mps INFO:ChatTTS.core:vocos loaded. INFO:ChatTTS.core:dvae loaded. INFO:ChatTTS.core:gpt loaded. INFO:ChatTTS.core:decoder loaded. INFO:ChatTTS.core:tokenizer loaded. INFO:ChatTTS.core:All initialized. Start:127.0.0.1:9966 voice='4751.csv' 当前使用音色 seed_path='/Users/xxx/Documents/workspace/chattts/speaker/4751.csv' result=['你好'],len=1 WARNING:ChatTTS.core:Package WeTextProcessing not found! WARNING:ChatTTS.core:Run: conda install -c conda-forge pynini=2.1.5 && pip install WeTextProcessing 100%|████████████████████████████████████████████████████████████████████████████████████████████| 384/384 [00:02<00:00, 150.00it/s] 100%|███████████████████████████████████████████████████████████████████████████████████████████| 2048/2048 [01:02<00:00, 32.72it/s] 推理时长: 67.93 秒 音频时长: 4.09 秒

zuyu commented 1 day ago

159 我这m1上跑最新的commit也是杂音。一开始我以为是Python 3.12的问题,换成Python 3.10还是一样的杂音。