chatTTS使用问题新生避雷

1.链接:git clone https://github.com/2noise/ChatTTS.git

2.遇到'nomalizer'问题,直接pip install nemo_text_processing,pynini,WeTextProcessing,这在linux无问题,windows有问题

解决办法:

在chatTTS里面的core.py:

143行到149行注释掉:

# if do_text_normalization:

        # for i, t in enumerate(text):

        # _lang = detect_language(t) if lang is None else lang

        # self.init_normalizer(_lang)

        # text[i] = self.normalizer[_lang](t)

        # if _lang == 'zh':

        # text[i] = apply_half2full_map(text[i])

3.huggingface连接问题,在Google colab无问题可连接,但本地出现梯子代理问题,尚未解决

替代解决:

使用以下代码

from modelscope import snapshot_download

model_dir = snapshot_download('mirror013/ChatTTS')

 

# # 加载模型

chat = ChatTTS.Chat()

chat.load_models(

    source="local",

    local_path=model_dir,

)

替代以下代码:

chat = ChatTTS.Chat()

# chat.load_models(compile=False) # Set to True for better performance

chatTTS使用问题
1.链接:git clone https://github.com/2noise/ChatTTS.git
2.遇到'nomalizer'问题,直接pip install nemo_text_processing,pynini,WeTextProcessing,这在linux无问题,windows有问题
解决办法:
在chatTTS里面的core.py:
143行到149行注释掉:
SQL
# if do_text_normalization:
        #     for i, t in enumerate(text):
        #         _lang = detect_language(t) if lang is None else lang
        #         self.init_normalizer(_lang)
        #         text[i] = self.normalizer[_lang](t)
        #         if _lang == 'zh':
        #             text[i] = apply_half2full_map(text[i])

3.huggingface连接问题,在Google colab无问题可连接,但本地出现梯子代理问题,尚未解决
替代解决:
使用以下代码
SQL
from modelscope import snapshot_download
model_dir = snapshot_download('mirror013/ChatTTS')

# # 加载模型
chat = ChatTTS.Chat()
chat.load_models(
    source="local",
    local_path=model_dir,
)

替代以下代码:
SQL
chat = ChatTTS.Chat()
# chat.load_models(compile=False) # Set to True for better performance

4.torchaudio出现问题
问题如下:
SQL
Traceback (most recent call last):

    torchaudio.save("output1.wav", torch.from_numpy(wavs[0]), 24000)
  File "D:\Python\Anaconda3_2024_2_1\file\envs\talk\lib\site-packages\torchaudio\_backend\utils.py", line 312, in save
    backend = dispatcher(uri, format, backend)
  File "D:\Python\Anaconda3_2024_2_1\file\envs\talk\lib\site-packages\torchaudio\_backend\utils.py", line 222, in dispatcher
    raise RuntimeError(f"Couldn't find appropriate backend to handle uri {uri} and format {format}.")
RuntimeError: Couldn't find appropriate backend to handle uri output1.wav and format None.

解决办法:
SQL
pip install soundfile


5.webui的使用gradio进行公网链接生成时
设置share=True即可
SQL
import gradio as gr

def greet(name):
    return f"Hello {name}!"

iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch(share=True)

如果生成公网链接报错如下:
SQL
INFO:httpx:HTTP Request: GET https://api.gradio.app/v2/tunnel-request "HTTP/1.1 200 OK"

Could not create share link. Missing file: D:\Python\Anaconda3_2024_2_1\file\envs\talk\lib\site-packages\gradio\frpc_windows_amd64_v0.2.

Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps:

1. Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_windows_amd64.exe
2. Rename the downloaded file to: frpc_windows_amd64_v0.2
3. Move the file to this location: D:\Python\Anaconda3_2024_2_1\file\envs\talk\lib\site-packages\gradio

解决办法:
SQL
点开下载链接:https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_windows_amd64.exe
下载到自创anaconda的环境里的lib\site-packages\gradio下
改名成frpc_windows_amd64_v0.2(注意改名时连exe后缀名也去掉)

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
这段代码是定义了一个名为ACmix的类,继承自PyTorch中的nn.Module。它包含了一些卷积、全连接、非线性激活函数等层,用于实现图像处理任务中的注意力机制和特征融合。 具体来说,逐行解释代码如下: ``` class ACmix(nn.Module): def __init__(self, in_planes, out_planes, kernel_att=7, head=4, kernel_conv=3, stride=1, dilation=1): super(ACmix, self).__init__() ``` 定义ACmix类,其中包含了初始化函数__init__()。其中in_planes表示输入特征图的通道数,out_planes表示输出特征图的通道数,kernel_att表示注意力机制的卷积核大小,head表示注意力机制的头数,kernel_conv表示特征融合的卷积核大小,stride表示卷积的步长,dilation表示卷积的膨胀率。 ``` self.in_planes = in_planes self.out_planes = out_planes self.head = head self.kernel_att = kernel_att self.kernel_conv = kernel_conv self.stride = stride self.dilation = dilation self.rate1 = torch.nn.Parameter(torch.Tensor(1)) self.rate2 = torch.nn.Parameter(torch.Tensor(1)) self.head_dim = self.out_planes // self.head ``` 将输入的参数保存到类的成员变量中,其中rate1和rate2是需要学习的参数,用于调整注意力机制中的权重。 ``` self.conv1 = nn.Conv2d(in_planes, out_planes, kernel_size=1) self.conv2 = nn.Conv2d(in_planes, out_planes, kernel_size=1) self.conv3 = nn.Conv2d(in_planes, out_planes, kernel_size=1) ``` 定义三个卷积层,其中conv1和conv2用于计算注意力机制,conv3用于特征融合。 ``` self.conv_p = nn.Conv2d(2, self.head_dim, kernel_size=1) ``` 定义一个卷积层,用于将注意力机制中的特征图转换为头数的通道数。 ``` self.padding_att = (self.dilation * (self.kernel_att - 1) + 1) // 2 self.pad_att = torch.nn.ReflectionPad2d(self.padding_att) self.unfold = nn.Unfold(kernel_size=self.kernel_att, padding=0, stride=self.stride) self.softmax = torch.nn.Softmax(dim=1) ``` 定义一些辅助层,其中padding_att表示注意力机制的填充大小,pad_att表示进行反射填充的层,unfold表示对特征图进行展开的层,softmax表示对展开后的特征图进行softmax操作的层。 ``` self.fc = nn.Conv2d(3 * self.head, self.kernel_conv * self.kernel_conv, kernel_size=1, bias=False) self.dep_conv = nn.Conv2d(self.kernel_conv * self.kernel_conv * self.head_dim, out_planes, kernel_size=self.kernel_conv, bias=True, groups=self.head_dim, padding=1, stride=stride) ``` 定义特征融合的卷积层和深度可分离卷积层,其中fc层用于将展开后的特征图进行特征融合,dep_conv层用于将融合后的特征图进行输出。 ``` self.reset_parameters() ``` 初始化模型参数。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值