Git Product home page Git Product logo

chattts_colab's Introduction

ChatTTS_colab

🚀 一键部署 简单易用 无需复杂安装(含win离线整合包)

基于 ChatTTS ,支持流式输出、音色抽卡、长音频生成和分角色朗读。

Open In Colab

🏆稳定说话人音色库/区分男女已开源 项目地址: ChatTTS_Speaker

Open In ModeScope Huggingface

支持按男女、年龄、特征查找稳定音色。

整合版下载地址

版本 地址
百度网盘 百度网盘 提取码: h3c5
夸克网盘 夸克网盘
123盘 123盘
Huggingface 🤗Huggingface

演示视频

演示视频

欢迎关注 氪学家频道 ,获取更多有趣的科技视频。

特点

  • Colab 一键运行:无需复杂的环境配置,只需点击上方的 Colab 按钮,即可在浏览器中直接运行项目。
  • 音色抽卡功能:批量生成多个音色,并可保存自己喜欢的音色。
  • 支持生成长音频:适合生成较长的语音内容。
  • 字符处理:对数字和朗读错误的标点做了初步处理。
  • 分角色朗读功能 :支持对不同角色的文本进行分角色朗读,并支持大模型一键生产脚本。
  • 支持流输出:边生成边播放,无需等待全部生成完毕。

功能展示

支持流输出

支持流输出

分角色朗读功能

分角色朗读功能

音色抽卡功能

音色抽卡功能

支持生成长音频

生成长音频

快速开始

在 Colab 运行

  1. 点击最上方的 "Open In Colab" 按钮,打开 Colab 笔记本。
  2. 点击菜单栏的–代码执行程序–全部运行即可
  3. 执行后在下方的日志中找到类似 Running on public URL: https://**********.gradio.live
  4. https://**********.gradio.live 就是可以访问的公网地址

在 macOS 上运行

  1. 安装 Conda(如果尚未安装)。
  2. 打开终端,创建一个新的 conda 环境:
    conda create -n "ChatTTS_colab" python=3.11
  3. 激活刚创建的环境:
    conda activate ChatTTS_colab
  4. 克隆本项目仓库到本地:
    git clone [email protected]:6drf21e/ChatTTS_colab.git
  5. 手动安装 ChatTTS 依赖到项目目录:
    cd ChatTTS_colab
    git clone -q https://github.com/2noise/ChatTTS
    cd ChatTTS
    git checkout -q e6412b1
    cd ..
    mv ChatTTS temp
    mv temp/ChatTTS ./ChatTTS
    rm -rf temp
  6. 在项目目录安装 ChatTTS_colab 所需的依赖:
    pip install -r requirements-macos.txt
  7. 运行项目,等待自动下载模型:
    python webui_mix.py
    # Loading ChatTTS model...
    一切正常的话会自动打开浏览器。

常见问题:

  1. 第一次运行项目,ChatTTS 会自动从 huggingface 下载模型,如果因为网络问题下载失败,那么 ChatTTS 是无法自行重新下载的,需要清除缓存后重新触发下载。 错误信息示例:

    FileNotFoundError: [Errno 2] No such file or directory: '~/.cache/huggingface/hub/models--2Noise--ChatTTS/snapshots/d7474137acb4f988874e5d57ad88d81bcb7e10b6/asset/Vocos.pt'
    

    清除缓存的方法:

    rm -rf ~/.cache/huggingface/hub/models--2Noise--ChatTTS

    清除缓存后,再次执行 python webui_mix.py,就会重新下载模型。

    如果多次下载都无法成功,可以手动将离线包里的 models 拷贝到项目目录,从本地加载模型

       python webui_mix.py --source local --local_path models
  2. 如果下载模型速度慢,建议使用赛博活菩萨 @padeoe 的镜像加速 https://hf-mirror.com/

     export HF_ENDPOINT=https://hf-mirror.com

贡献者列表

contributors

许可证

本项目使用 MIT 许可证。

chattts_colab's People

Contributors

6drf21e avatar daymade avatar frozentearz avatar fumiama avatar v3ucn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chattts_colab's Issues

关于种子管理的音色试听功能

一点小建议:
种子管理窗口,能在后面加上种子音色试听功能吗?这样能在种子比较多的时候可以更方便的找到自己想要的种子音色,可以直接在保存种子的时候把对应的音频保存下来

关于增加speaker

hi,想咨询下增加speaker的方法。是不断调用函数sample_random_speaker 直到尝试出好的embedding特征,然后保存该特征随时调用,还是可以选择一个音频,使用VQ Encoder直接量化成 embedding然后保存呢?谢谢

MacOS 本地部署方法

Google colab的一键部署很方便点赞!

帮助说明中没有介绍mac的本地部署路径,这里给需要的童鞋分享下;

  1. 下载 ChatTTS_colab-main 项目文件;
  2. 终端进入 ChatTTS_colab-main 目录后需要先安装前置 pip install cn2an
  3. 复制原 ChatTTS的项目文件夹到 ChatTTS_colab-main 根目录下;
  4. 运行 python webui_mix.py 就自动启动本地界面了;

流式音频下载异常

推理完成可以试听,但有时下载无响应,有时下载完成后输出的txt和wav文件都是0字节,不知道为啥

【反馈】中英文混合朗读时,可能有以下2方面问题(附上文本)。

可能的问题1:中英文从text复制到文本框内时,点击文本初始化,英文句子之间的单词空格消失了。
可能的问题2:在朗读时,英文句子会读的很奇怪,(如果单独朗读英文句子或段落没有此问题,但是和中文在同一个句子中,朗读会变的很奇怪,吞词、句子读成中文谐音之类)。
可能的问题3(已修复):就是英文中出现“秒”,将文件正则删除即可。

文稿如下:
开心网,有一个对996态度倾向十分明确的修饰,叫做:Notorious so cooded nine nine six work style.
大家好,我是学长,今天我们要讲的是定语从句,Attributive Clause。
谈到定语从句啊,大家都不陌生,这是从初中一直到现在,也是几乎每场大大小小的考试都要出现的。
那定语从句呢,通常可以理解为是英语句子中的一种增强型插件,这个插件呢,可以给句子中的名词,或代词提供更多的信息,使句子变得更具体、更生动。
定语从句通常需要由关系代词引导,比如,who, whom, whose, which, that,.
也或者是关系副词,比如,where when why来引导。
这个引导代词,一定要紧跟在它们所修饰的名词,或代词的后面。
让我们来举个例子,第一个例子是,The book that I bought yesterday is interesting,我昨天买的书很有趣。
在这个句子中,that I bought yesterday,我昨天购买的,这里就是定语从句,它们修饰了句子中的名词 book。
那另一个例子呢,The woman who lives next door is a doctor. 住在隔壁的女人是一名医生。
在这个句子中,who lives next door,那个住在隔壁的,这个定语就是在修饰句子中的名词 woman。

烦请作者百忙之中抽时间测试测试,感谢啦!

API无法使用GPU

WEBUI正常使用GPU,API不行,GPU驱动和相关环境已安装。
Using GPU: NVIDIA A100 80GB PCIe
INFO:ChatTTS.core:Load from local: models
### WARNING:ChatTTS.utils.gpu_utils:GPU 0 has 81037.75 MB memory left. Switching to CPU.
INFO:ChatTTS.core:use cpu
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.
INFO: Started server process [1146414]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:9880 (Press CTRL+C to quit)
^CINFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [1146414]
被强制使用CPU。以下是环境日志
(venv) root@h3c-H3C-UniServer-R4900-G5:/usr/test/ChatTTS# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
(venv) root@h3c-H3C-UniServer-R4900-G5:/usr/test/ChatTTS# python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import torch
print(torch.cuda.is_available())
True
print(torch.cuda.current_device())
0
print(torch.cuda.get_device_name(torch.cuda.current_device()))
NVIDIA A100 80GB PCIe

0.0.6版出现无法继续工作的问题,汇报

用0.0.6版本的长文本模式测试了几个pt文件以后,突然出现如下错误提示,无法再正常运行,重启也不行。只有彻底删除整个chattts文件夹,重新解压后才能正常运行。这个状况已经出现两次。我的显卡是3060,12G显存,系统是windows 10。参数都没有改动,只有批大小设置为6了。

True 0 种子 <gradio.layouts.tabs.Tab object at 0x00000261C0785940>
paragraph 红色联合的战士们欢呼起来,几个人冲到楼下,掀开四二八的旗帜,抬起下面纤小的遗体,做为一个战利品炫耀地举了一段,然后将她高高地扔向大院的铁门,铁门上带尖的金属栅条大部分在武斗初期就被抽走当梭标了,剩下的两条正好挂住了她,那一瞬间,生命似乎又回到了那个柔软的躯体。红色联合的红卫兵们退后一段距离,将那个挂在高处的躯体当靶子练习射击,密集的子弹对她来说已柔和如雨,不再带来任何感觉,她那春藤般的手臂不时轻挥一下,仿佛拂去落在身上的雨滴,直到那颗年轻的头颅被打掉了一半,仅剩的一只美丽的眼睛仍然凝视着一九六七年的蓝天,目光中没有痛苦,只有凝固的激情和渴望。
sentences ['红色联合的战士们欢呼起来,几个人冲到楼下,掀开四二八的旗帜,抬起下面纤小的遗体,做为一个战利品炫耀地举了一段,然后将她高高地扔向大院的铁门,铁门上带尖的金属栅条大部分在武斗初期就被抽走当梭标了,剩下的两条正好挂住了她,那一瞬间,生命似乎又回到了那个柔软的躯体', '。', '红色联合的红卫兵们退后一段距离,将那个挂在高处的躯体当靶子练习射击,密集的子弹对她来说已柔和如雨,不再带来任何感觉,她那春藤般的手臂不时轻挥一下,仿佛拂去落在身上的雨滴,直到那颗年轻的头颅被打掉了一半,仅剩的一只美丽的眼睛仍然凝视着一九六七年的蓝天,目光中没有痛苦,只有凝固的激情和渴望', '。', '']
result ['红色联合的战士们欢呼起来,几个人冲到楼下,掀开四二八的旗帜,抬起下面纤小的遗体,做为一个战利品炫耀地举了一段, 然后将她高高地扔向大院的铁门,铁门上带尖的金属栅条大部分在武斗初期就被抽走当梭标了,剩下的两条正好挂住了她,那一瞬间,生命似乎又回到了那个柔软的躯体。', '红色联合的红卫兵们退后一段距离,将那个挂在高处的躯体当靶子练习射击,密集的子弹对她来说已柔和如雨,不再带来任何感觉,她那春藤般的手臂不时轻挥一下,仿佛拂去落在身上的雨滴,直到那颗年轻的头颅被打掉了一半,仅剩的一只美丽的眼睛仍然凝视着一九六七年的蓝天,目光中没有痛苦,只有凝固的激情和渴望。']
INFO:root:found existing fst: G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\tn\zh_tn_tagger.fst
INFO:root: G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\tn\zh_tn_verbalizer.fst
INFO:root:skip building fst for zh_normalizer ...
INFO:root:found existing fst: G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\tn\zh_tn_tagger.fst
INFO:root: G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\tn\zh_tn_verbalizer.fst
INFO:root:skip building fst for zh_normalizer ...
speaker_type: seed
Traceback (most recent call last):
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\queueing.py", line 521, in process_events
response = await route_utils.call_process_api(
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\blocks.py", line 1945, in process_api
result = await self.call_function(
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\blocks.py", line 1513, in call_function
prediction = await anyio.to_thread.run_sync(
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\utils.py", line 831, in wrapper
response = f(*args, **kwargs)
File "G:\AI-test\ChatTTS_colab_offline\webui_mix.py", line 299, in generate_tts_audio
raise e
File "G:\AI-test\ChatTTS_colab_offline\webui_mix.py", line 280, in generate_tts_audio
output_files = generate_audio_for_seed(
File "G:\AI-test\ChatTTS_colab_offline\tts_model.py", line 110, in generate_audio_for_seed
_params_infer_code = deepcopy(params_infer_code)
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\copy.py", line 146, in deepcopy
y = copier(x, memo)
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\copy.py", line 153, in deepcopy
y = copier(memo)
File "G:\AI-test\ChatTTS_colab_offline\runtime\lib\site-packages\torch_tensor.py", line 86, in deepcopy
raise RuntimeError(
RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment. If you were attempting to deepcopy a module, this may be because of a torch.nn.utils.weight_norm usage, see pytorch/pytorch#103001

mac本地conda部署出现错误Chat.infer() got an unexpected keyword argument 'stream'

speaker_type: role
Traceback (most recent call last):
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/queueing.py", line 532, in process_events
response = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/blocks.py", line 1928, in process_api
result = await self.call_function(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/blocks.py", line 1526, in call_function
prediction = await utils.async_iteration(iterator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/utils.py", line 656, in async_iteration
return await iterator.anext()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/utils.py", line 649, in anext
return await anyio.to_thread.run_sync(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 859, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/utils.py", line 632, in run_sync_iterator_async
return next(iterator)
^^^^^^^^^^^^^^
File "/Volumes/T9/Anaconda/anaconda3/envs/Chat-tts/lib/python3.11/site-packages/gradio/utils.py", line 815, in gen_wrapper
response = next(iterator)
^^^^^^^^^^^^^^
File "/Users/xuxiangxiang/ChatTTS_colab/webui_mix.py", line 382, in generate_tts_audio_stream
wavs = chat.infer(text, params_infer_code=_params_infer_code, params_refine_text=params_refine_text,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Chat.infer() got an unexpected keyword argument 'stream'

macos 报错

git clone [email protected]:6drf21e/ChatTTS_colab.git
Cloning into 'ChatTTS_colab'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for github.com has changed,
and the key for the corresponding IP address 140.82.114.4
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.

音色种子模型错位,与官方不对应,请求修复

本来找到了音色库 http://ttslist.aiqbh.com/ ,但使用指定种子生成的长音频音色与chattts官网的均有偏差,尤其本该是女声种子却会生成男声音色,如42、1400、1800、3333、10400等等。0.0.4新版依旧存在这个问题,估计产生了错位,也就不知道此处真正音色对应的种子数值。请求修复~~

error when running api.py on linux

this error when running api.py, running webui_mix.py is fine:

INFO:ChatTTS.core:Load from local: models
Traceback (most recent call last):
File "/ChatTTS_colab/api.py", line 342, in
chat.load_models(source="local", local_path="models")
File "/ChatTTS_colab/ChatTTS/core.py", line 62, in load_models
self.load(**{k: os.path.join(download_path, v) for k, v in OmegaConf.load(os.path.join(download_path, 'config', 'path.yaml')).items()}, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ChatTTS/.conda/lib/python3.11/site-packages/omegaconf/omegaconf.py", line 189, in load
with io.open(os.path.abspath(file
), "r", encoding="utf-8") as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/ChatTTS_colab/models/config/path.yaml'

英文语音有问题

测试文本:
Turning once again, and this time more generally, to the question of invasion, I would observe that there has never been a period in all these long centuries of which we boast when an absolute guarantee against invasion,
同样的文本在huggingface那个forge页面上测试结果没有问题。
但是是此项目本地部署英文部分会有“”喵喵喵“”的发音

当我对点击那个预处理停顿词时文本变成了如下样子;

turningonceagain [uv_break] , andthi 秒 ti 米 e 米 oregenerally , totheque 秒 tionofinva 秒 ion , iwouldob 秒 ervethatthereha [uv_break] 秒 neverbeenaperiodinallthe 秒 elongcenturie 秒 ofwhichweboa 秒 twhenanab 秒 oluteguaranteeagain 秒 tinva 秒 ion

Linux部署

请问linux服务本地部署有参照吗

「问题」流式传输出现了错误:

Traceback (most recent call last):
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/queueing.py", line 521, in process_events
response = await route_utils.call_process_api(
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/blocks.py", line 1945, in process_api
result = await self.call_function(
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/blocks.py", line 1525, in call_function
prediction = await utils.async_iteration(iterator)
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/utils.py", line 655, in async_iteration
return await iterator.anext()
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/utils.py", line 648, in anext
return await anyio.to_thread.run_sync(
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
return await future
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
result = context.run(func, *args)
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/utils.py", line 631, in run_sync_iterator_async
return next(iterator)
File "/home/zjy/miniconda3/envs/chattts/lib/python3.10/site-packages/gradio/utils.py", line 814, in gen_wrapper
response = next(iterator)
File "/home/zjy/ChatTTS_colab/webui_mix.py", line 375, in generate_tts_audio_stream
wavs_gen = chat.infer(text, params_infer_code=params_infer_code, params_refine_text=params_refine_text,
TypeError: Chat.infer() got an unexpected keyword argument 'stream'

0.6增量包升级0.5API启动出现 sha256_asset_Decoder_pt

INFO:ChatTTS.utils.download:checking assets...
Traceback (most recent call last):
File "C:\AI\ChatTTS_colab(3)\ChatTTS_colab_offline-0.0.6\ChatTTS_colab_offline\api.py", line 357, in
chat.load_models(source="local", local_path="models")
File "C:\AI\ChatTTS_colab(3)\ChatTTS_colab_offline-0.0.6\ChatTTS_colab_offline\ChatTTS\core.py", line 62, in load_models
if not check_all_assets(update=True):
File "C:\AI\ChatTTS_colab(3)\ChatTTS_colab_offline-0.0.6\ChatTTS_colab_offline\ChatTTS\utils\download.py", line 63, in check_all_assets
current_dir, model, os.environ[f"sha256_asset_{menv}"], update
File "C:\AI\ChatTTS_colab(3)\ChatTTS_colab_offline-0.0.6\ChatTTS_colab_offline\runtime\lib\os.py", line 679, in getitem
raise KeyError(key) from None
KeyError: 'sha256_asset_Decoder_pt'

win10整合包,双击运行.bat,抛异常FileNotFoundError

Windows 10 专业版
22H2
19045.4412
解压ChatTTS_colab_offline-003.7z到c:\ai目录下。

C:\ai\ChatTTS_colab_offline>runtime\python.exe webui_mix.py  --source local --local_path models
Traceback (most recent call last):
  File "C:\ai\ChatTTS_colab_offline\webui_mix.py", line 16, in <module>
    from tts_model import load_chat_tts_model, clear_cuda_cache, deterministic, generate_audio_for_seed
  File "C:\ai\ChatTTS_colab_offline\tts_model.py", line 1, in <module>
    import ChatTTS
  File "C:\ai\ChatTTS_colab_offline\ChatTTS\__init__.py", line 1, in <module>
    from .core import Chat
  File "C:\ai\ChatTTS_colab_offline\ChatTTS\core.py", line 7, in <module>
    from vocos import Vocos
  File "C:\ai\ChatTTS_colab_offline\runtime\lib\site-packages\vocos\__init__.py", line 1, in <module>
    from vocos.pretrained import Vocos
  File "C:\ai\ChatTTS_colab_offline\runtime\lib\site-packages\vocos\pretrained.py", line 9, in <module>
    from vocos.feature_extractors import FeatureExtractor, EncodecFeatures
  File "C:\ai\ChatTTS_colab_offline\runtime\lib\site-packages\vocos\feature_extractors.py", line 4, in <module>
    import torchaudio
  File "C:\ai\ChatTTS_colab_offline\runtime\lib\site-packages\torchaudio\__init__.py", line 2, in <module>
    from . import _extension  # noqa  # usort: skip
  File "C:\ai\ChatTTS_colab_offline\runtime\lib\site-packages\torchaudio\_extension\__init__.py", line 38, in <module>
    _load_lib("libtorchaudio")
  File "C:\ai\ChatTTS_colab_offline\runtime\lib\site-packages\torchaudio\_extension\utils.py", line 60, in _load_lib
    torch.ops.load_library(path)
  File "C:\ai\ChatTTS_colab_offline\runtime\lib\site-packages\torch\_ops.py", line 933, in load_library
    ctypes.CDLL(path)
  File "ctypes\__init__.py", line 374, in __init__
FileNotFoundError: Could not find module 'C:\ai\ChatTTS_colab_offline\runtime\Lib\site-packages\torchaudio\lib\libtorchaudio.pyd' (or one of its dependencies). Try using the full path with constructor syntax.

事实上,这个文件是存在的:

C:\Users\sun>dir C:\ai\ChatTTS_colab_offline\runtime\Lib\site-packages\torchaudio\lib\libtorchaudio.pyd
 驱动器 C 中的卷没有标签。
 卷的序列号是 5615-C7E5

 C:\ai\ChatTTS_colab_offline\runtime\Lib\site-packages\torchaudio\lib 的目录

2024/03/06  22:54         2,639,360 libtorchaudio.pyd
               1 个文件      2,639,360 字节
               0 个目录 134,852,808,704 可用字节

很奇怪,我换另外一台电脑,同一个解压包,是能正常使用的。

添加停顿或笑声位置问题

在长文本生成页面,点击【+停顿】或者【+笑声】按钮后,相应的标记总是会出现在文本最后面,不会插入到光标所在的位置。

中文文本情绪和停顿标签不生效问题,bug解决

问题在于前端处理文本的时候将[]括号替换掉了,导致ChatTTS不能正确合成。解决:对目前的三种标签做特定判断。

修改utils.py中的remove_chinese_punctuation模块为:

`
def remove_chinese_punctuation(text):

# 使用正则表达式找到所有的[...]括号内的内容
pattern = r'\[(.*?)\]'
matches = re.findall(pattern, text)

# 遍历每个括号内的内容
for match in matches:
    if match != "uv_break" and match != "laugh" and match != "lbreak":
        text = text.replace("[" + match + "]", match)

chinese_punctuation_pattern = r"[:;!(),【】『』「」《》-‘“’”:,;!\(\)><]"
text = re.sub(chinese_punctuation_pattern, ' ', text)
# 使用正则表达式将多个连续的句号替换为一个句号
text = re.sub(r'。{2,}', '。', text)
return text

`

作者如果觉得可行,望采纳

流式推理报错,这个怎么处理

To create a public link, set share=True in launch().
result ['四川美食确实以辣闻名,但也有不辣的选择。比如甜水面、赖汤圆、蛋烘糕、叶儿粑等,这些小吃口味温和,甜而不腻,也很 受欢迎。']
INFO:root:found existing fst: D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\tn\zh_tn_tagger.fst
INFO:root: D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\tn\zh_tn_verbalizer.fst
INFO:root:skip building fst for zh_normalizer ...
Building prefix dict from the default dictionary ...
DEBUG:jieba:Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\Administrator\AppData\Local\Temp\jieba.cache
DEBUG:jieba:Loading model from cache C:\Users\Administrator\AppData\Local\Temp\jieba.cache
Loading model cost 0.712 seconds.
DEBUG:jieba:Loading model cost 0.712 seconds.
Prefix dict has been built successfully.
DEBUG:jieba:Prefix dict has been built successfully.
speaker_type: seed
Traceback (most recent call last):
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\queueing.py", line 521, in process_events
response = await route_utils.call_process_api(
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\blocks.py", line 1945, in process_api
result = await self.call_function(
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\blocks.py", line 1513, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\gradio\utils.py", line 831, in wrapper
response = f(*args, **kwargs)
File "D:\AI\ChatTTS_colab_offline\webui_mix.py", line 299, in generate_tts_audio
raise e
File "D:\AI\ChatTTS_colab_offline\webui_mix.py", line 280, in generate_tts_audio
output_files = generate_audio_for_seed(
File "D:\AI\ChatTTS_colab_offline\tts_model.py", line 110, in generate_audio_for_seed
_params_infer_code = deepcopy(params_infer_code)
File "D:\AI\ChatTTS_colab_offline\runtime\lib\copy.py", line 146, in deepcopy
y = copier(x, memo)
File "D:\AI\ChatTTS_colab_offline\runtime\lib\copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "D:\AI\ChatTTS_colab_offline\runtime\lib\copy.py", line 153, in deepcopy
y = copier(memo)
File "D:\AI\ChatTTS_colab_offline\runtime\lib\site-packages\torch_tensor.py", line 86, in deepcopy
raise RuntimeError(
RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment. If you were attempting to deepcopy a module, this may be because of a torch.nn.utils.weight_norm usage, see pytorch/pytorch#103001

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.