ChatTTS-ui icon indicating copy to clipboard operation
ChatTTS-ui copied to clipboard

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

Open SamXP2004 opened this issue 1 year ago • 9 comments

合成时候报错。

v0.93

Mac

SamXP2004 avatar Jun 20 '24 14:06 SamXP2004

#142 有没有更完整的报错记录

jianchang512 avatar Jun 20 '24 15:06 jianchang512

[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.

Maxinsomnia avatar Jun 20 '24 16:06 Maxinsomnia

重新 git pull下试试

jianchang512 avatar Jun 20 '24 16:06 jianchang512

拉取最新的,不报错了。但是推理时长异常的长,并且生成的音频是异常的,噪音啸叫那种。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 秒

hanshantao avatar Jun 21 '24 01:06 hanshantao

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

zuyu avatar Jun 30 '24 05:06 zuyu

+1 同样的问题,M3芯片的Mac

5high avatar Jul 02 '24 06:07 5high

安装最新ChatTTS官方代码试试

https://github.com/2noise/ChatTTS

jianchang512 avatar Jul 02 '24 06:07 jianchang512

+1 同样的问题,M3芯片的Mac

一样的问题

nathanliu100 avatar Jul 02 '24 17:07 nathanliu100

拉取最新的,正常了。我的是M1 Max的,平均速度是20.73it/s,比之前不能调用GPU的时候速度要快40%左右。

deadleaves1206 avatar Jul 11 '24 06:07 deadleaves1206