你知道什么是穷人吗?穷人就是没钱还想学习。
git GitHub - 2noise/ChatTTS: A generative speech model for daily dialogue.
因为所以。cosyvoice,gpt-s .
0.先找一个目录吧。
1.命令行模式
duyicheng@duyicheng-computer:~/gitee$ git clone https://github.com/2noise/ChatTTS
Cloning into 'ChatTTS'...
remote: Enumerating objects: 2628, done.
remote: Counting objects: 100% (754/754), done.
remote: Compressing objects: 100% (342/342), done.
remote: Total 2628 (delta 486), reused 465 (delta 402), pack-reused 1874 (from 1)
Receiving objects: 100% (2628/2628), 7.99 MiB | 6.33 MiB/s, done.
Resolving deltas: 100% (1586/1586), done.
duyicheng@duyicheng-computer:~/gitee$
2.创建虚拟环境
在Ubuntu中安装Anaconda和创建虚拟环境(保姆级教学,值得借鉴与信任)_ubuntu anaconda创建虚拟环境-CSDN博客
conda create -n chattts python=3.12
conda activate chattts
我喜欢把虚拟环境用小写的命名,不知这样合适不?
3.pycharm 创建工程
注意大小写一致,关键点已经全部标出来。
4.进入虚拟环境,并安装相关。先修改国内源(已经改过的忽之)
设为默认
升级 pip 到最新的版本后进行配置:
python -m pip install --upgrade pip pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:
python -m pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple --upgrade pip
pip install -r requirements.txt
Optional: Install vLLM (Linux only) 看你的平台决定是否。
pip install safetensors vllm==0.2.7 torchaudio
4.1相关错误解决
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-rl41m62f/pynini_3e3a079589ce484b9162320165b6356c/setup.py", line 22, in <module>
from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed× Encountered error while generating package metadata.
╰─> See above for output.note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
解决方法:
pip install Cython
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=10.11.0->typer<1.0,>=0.12->gradio->-r requirements.txt (line 10))
Using cached https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Building wheels for collected packages: pynini, encodec, cdifflib, wget
Building wheel for pynini (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [52 lines of output]
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-312/pywrapfst
copying pywrapfst/__init__.py -> build/lib.linux-x86_64-cpython-312/pywrapfst
creating build/lib.linux-x86_64-cpython-312/pynini
copying pynini/__init__.py -> build/lib.linux-x86_64-cpython-312/pynini
creating build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/numbers.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/chatspeak.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/g2p.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/plurals.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/case.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/chatspeak_model.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/dates.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/weather.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/__init__.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/examples/t9.py -> build/lib.linux-x86_64-cpython-312/pynini/examples
creating build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/byte.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/utf8.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/edit_transducer.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/paradigms.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/rewrite.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/__init__.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/tagger.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/pynutil.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/rule_cascade.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/lib/features.py -> build/lib.linux-x86_64-cpython-312/pynini/lib
creating build/lib.linux-x86_64-cpython-312/pynini/export
copying pynini/export/export.py -> build/lib.linux-x86_64-cpython-312/pynini/export
copying pynini/export/grm.py -> build/lib.linux-x86_64-cpython-312/pynini/export
copying pynini/export/grm_example.py -> build/lib.linux-x86_64-cpython-312/pynini/export
copying pynini/export/__init__.py -> build/lib.linux-x86_64-cpython-312/pynini/export
copying pynini/export/multi_grm_example.py -> build/lib.linux-x86_64-cpython-312/pynini/export
copying pynini/export/multi_grm.py -> build/lib.linux-x86_64-cpython-312/pynini/export
copying pywrapfst/__init__.pyi -> build/lib.linux-x86_64-cpython-312/pywrapfst
copying pywrapfst/py.typed -> build/lib.linux-x86_64-cpython-312/pywrapfst
copying pynini/__init__.pyi -> build/lib.linux-x86_64-cpython-312/pynini
copying pynini/py.typed -> build/lib.linux-x86_64-cpython-312/pynini
copying pynini/examples/py.typed -> build/lib.linux-x86_64-cpython-312/pynini/examples
copying pynini/lib/py.typed -> build/lib.linux-x86_64-cpython-312/pynini/lib
copying pynini/export/py.typed -> build/lib.linux-x86_64-cpython-312/pynini/export
running build_ext
building '_pywrapfst' extension
creating build/temp.linux-x86_64-cpython-312/extensions
g++ -pthread -B /home/duyicheng/anaconda3/envs/chattts/compiler_compat -fno-strict-overflow -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/duyicheng/anaconda3/envs/chattts/include -fPIC -O2 -isystem /home/duyicheng/anaconda3/envs/chattts/include -fPIC -I/home/duyicheng/anaconda3/envs/chattts/include/python3.12 -c extensions/_pywrapfst.cpp -o build/temp.linux-x86_64-cpython-312/extensions/_pywrapfst.o -std=c++17 -Wno-register -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-local-typedefs -funsigned-char
extensions/_pywrapfst.cpp:1289:10: fatal error: fst/util.h: No such file or directory
1289 | #include <fst/util.h>
| ^~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/g++' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pynini
Running setup.py clean for pynini
Building wheel for encodec (setup.py) ... done
Created wheel for encodec: filename=encodec-0.1.1-py3-none-any.whl size=45760 sha256=005bea59eb74b0d8e3b97fb1bc5e888fa70e54c7f4d89ceba26d222fc04b417e
Stored in directory: /home/duyicheng/.cache/pip/wheels/c3/ad/25/f3bc2f406330b1a23e1bed7af545b400df989c3a7e928e0253
Building wheel for cdifflib (pyproject.toml) ... done
Created wheel for cdifflib: filename=cdifflib-1.2.6-cp312-cp312-linux_x86_64.whl size=12666 sha256=c1d26ed10d6fa6d9cc91555fb849200212bb14950ccae17c3e14f4b70d64b788
Stored in directory: /home/duyicheng/.cache/pip/wheels/d5/48/ca/ae20a5bb753a401fdecb6fca5bae9ef1ec893ef17b6d14be14
Building wheel for wget (setup.py) ... done
Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9656 sha256=fc05a276303d011c3b6eb5c55955518886c526975a6c596f695c6a998f5770e9
Stored in directory: /home/duyicheng/.cache/pip/wheels/8c/ad/df/233ebb9957cf23ee9cd58bba09bea4caf4389b429ef6a32ef5
Successfully built encodec cdifflib wget
Failed to build pynini
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pynini)
解决
我的系统解决方案,你参考
sudo apt-get update
sudo apt-get install -y libfst-dev
pip install --only-binary :all: pynini
5. 梳理后的 requie...txt,各种冲突,之后的
numpy<2.0.0
numba
torch
torchaudio
tqdm
vector_quantize_pytorch
transformers>=4.41.1
vocos
IPython
gradio
pybase16384
pynini==2.1.5; sys_platform == 'linux'
WeTextProcessing; sys_platform == 'linux'
nemo_text_processing; sys_platform == 'linux'
av
pydub
成功之。
4.2安装模型 :
我要说的是,当进行第五步时,会自动安装。并且4.2整个的位置不对。可能是系统又更新了。请注意分析,完全可以忽略4.2。
魔搭社区
#安装ModelScope
pip install modelscope
新建 一个py,用来下载模型
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('pzc163/chatTTS')
使用modelscope,可以手动在页面下载,或者通过其提供的SDK下载,使用SDK下载会将模型保存在 C:\Users\<你的用户名>\.cache\modelscope路径下。因为是本地加载模型,我将下载模型文件复制到了当前模型工作路径下F:\Chat-TTS\ChatTTS\model\chatTTS,方便使用。
或
git下载,这用这个不太好用。
#Git模型下载
git clone https://www.modelscope.cn/pzc163/chatTTS.git
5.依据https://github.com/2noise/ChatTTS 进行测试
python examples/web/webui.py
执行上面的代码后,会自动安装所需要,另外,最最关键的是。生成的新的文件夹如图,与大多数教程上不一样。我上面的第4.2,是根据某些教程上完成的,可以不做。
[+0800 20241205 13:09:58] [INFO] ChatTTS | dl | checking assets...
[+0800 20241205 13:09:59] [INFO] ChatTTS | dl | /home/duyicheng/gitee/ChatTTS/asset/DVAE.safetensors not exist.
[+0800 20241205 13:09:59] [ERRO] ChatTTS | core | download to local path /home/duyicheng/gitee/ChatTTS failed.
[+0800 20241205 13:09:59] [ERRO] WebUI | webui | Models load failed.
提示的错误根据提示一个个的解决,把刚才从魔搭上下的复制到asset等下。如图:
。如图中颜色不正常的,都是复制来的。
(chattts) duyicheng@duyicheng-computer:~/gitee/ChatTTS$ python examples/web/webui.py
[+0800 20241205 13:41:05] [WARN] WebUI | funcs | no ffmpeg installed, use wav file output
[+0800 20241205 13:41:05] [INFO] WebUI | webui | loading ChatTTS model...
[+0800 20241205 13:41:05] [INFO] ChatTTS | dl | checking assets...
[+0800 20241205 13:41:10] [INFO] ChatTTS | dl | all assets are already latest.
[+0800 20241205 13:41:10] [INFO] ChatTTS | core | use device cuda:0
[+0800 20241205 13:41:11] [INFO] ChatTTS | core | vocos loaded.
[+0800 20241205 13:41:11] [INFO] ChatTTS | core | dvae loaded.
[+0800 20241205 13:41:12] [INFO] ChatTTS | core | embed loaded.
[+0800 20241205 13:41:13] [INFO] ChatTTS | core | gpt loaded.
[+0800 20241205 13:41:13] [INFO] ChatTTS | core | speaker loaded.
[+0800 20241205 13:41:13] [INFO] ChatTTS | core | decoder loaded.
[+0800 20241205 13:41:13] [INFO] ChatTTS | core | tokenizer loaded.
[+0800 20241205 13:41:13] [WARN] WebUI | funcs | Package nemo_text_processing not found!
[+0800 20241205 13:41:13] [WARN] WebUI | funcs | Run: conda install -c conda-forge pynini=2.1.5 && pip install nemo_text_processing
[+0800 20241205 13:41:13] [WARN] WebUI | funcs | Package WeTextProcessing not found!
[+0800 20241205 13:41:13] [WARN] WebUI | funcs | Run: conda install -c conda-forge pynini=2.1.5 && pip install WeTextProcessing
[+0800 20241205 13:41:13] [INFO] WebUI | webui | Models loaded successfully.
* Running on local URL: http://0.0.0.0:8080
速度如
最后的提示,根据提示,如:
conda install -c conda-forge pynini=2.1.5 && pip install nemo_text_processing
打开共享
demo.launch(server_name=args.server_name,server_port=args.server_port,root_path=args.root_path,inbrowser=True,show_api=False,share=True)
如果,分享不成功。
1. Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64
2. Rename the downloaded file to: frpc_linux_amd64_v0.3
3. Move the file to this location: /home/duyicheng/anaconda3/envs/chattts/lib/python3.12/site-packages/gradio
GitHub - bumblebeeMMa/DownLoad_frpc_linux_amd64: Download frpc_linux_amd64
留下一个问题,本地运行可以了,但是,想利用公网的这个地址还是不行。先这样吧。,下一步继续。
速度如下: