Skip to content

用custom方式load在huggingface上下载的模型时报错哈希值不匹配 #985

@Latsukisan

Description

@Latsukisan

报错信息是:

D:\ChatTTS\asset\gpt\config.json sha256 hash mismatch.
check models in custom path D:\ChatTTS failed.
vocos not initialized.
gpt not initialized.
tokenizer not initialized.
embed not initialized.
decoder not initialized.
Traceback (most recent call last):
  File "D:\VoxMeeter\tts_service\tts_server.py", line 11, in <module>
    wavs = chat.infer(texts)
           ^^^^^^^^^^^^^^^^^
  File "D:\anaconda\Lib\site-packages\ChatTTS\core.py", line 263, in infer
    for wavs in res_gen:
  File "D:\anaconda\Lib\site-packages\ChatTTS\core.py", line 402, in _infer
    assert self.has_loaded(use_decoder=use_decoder)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

运行脚本是:

import ChatTTS
import torch
import torchaudio

model_path = r"D:\ChatTTS"
chat = ChatTTS.Chat()
chat.load(compile=False,source="custom",custom_path=model_path) # Set to True for better performance

texts = ["测试1", "测试2"]

wavs = chat.infer(texts)

for i in range(len(wavs)):
    """
    In some versions of torchaudio, the first line works but in other versions, so does the second line.
    """
    try:
        torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 24000)
    except:
        torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]), 24000)

文件是从huggingface上直接git下来的,没动任何东西,因为用local模式load的时候一直显示下载模型失败,就自己下载了,但也load不了,不知道啥问题,检查了一下config.json好像没啥异常情况,不知道是不是版本的问题,仓库是从github克隆的最新版本

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions