去年已经使用过chattts了,但是昨晚想用的时候却记怎么打开了,找了一下以前的笔记
MacOS 下源码部署chat-tts-ui
-
配置好 python3.9-3.11 环境,安装git ,执行命令
brew install libsndfile git
-
python@3.10
继续执行brew install ffmpeg export PATH="/usr/local/opt/python@3.10/bin:$PATH" source ~/.bash_profile source ~/.zshrc
-
创建空目录
/data/chattts
执行命令cd /data/chattts && git clone https://github.com/jianchang512/chatTTS-ui .
-
我的路径是/Users/lin/Documents/chattts/data/chatts/chatTTS-ui
-
创建虚拟环境
python3.10 -m venv venv
-
激活虚拟环境
source ./venv/bin/activate
-
安装依赖
pip3 install -r requirements.txt
-
安装torch
pip3 install torch==2.2.0 torchaudio==2.2.0
-
执行
python3 app.py
启动,将自动打开浏览器窗口,默认地址,如果跳转到了0.0.0.0:9966没联网的情况下可以输入http://127.0.0.1:9966
(注意:默认从 modelscope 魔塔下载模型,不可使用代理下载,请关闭代理)
Linux 下容器部署
安装
-
拉取项目仓库
在任意路径下克隆项目,例如:
git clone https://github.com/jianchang512/ChatTTS-ui.git chat-tts-ui
-
启动 Runner
进入到项目目录:
cd chat-tts-ui
启动容器并查看初始化日志:
gpu版本 docker compose -f docker-compose.gpu.yaml up -d cpu版本 docker compose -f docker-compose.cpu.yaml up -d docker compose logs -f --no-log-prefix
-
访问 ChatTTS WebUI
启动:['0.0.0.0', '9966']
,也即,访问部署设备的IP:9966
即可,例如:-
本机:
http://127.0.0.1:9966
-
服务器:
http://192.168.1.100:9966
-
更新
-
Get the latest code from the main branch:
git checkout main git pull origin main
-
Go to the next step and update to the latest image:
docker compose down gpu版本 docker compose -f docker-compose.gpu.yaml up -d --build cpu版本 docker compose -f docker-compose.cpu.yaml up -d --build docker compose logs -f --no-log-prefix
Linux 下源码部署
-
配置好 python3.9-3.11环境,安装 ffmpeg。
yum install ffmpeg
或apt-get install ffmpeg
等 -
创建空目录
/data/chattts
执行命令cd /data/chattts && git clone https://github.com/jianchang512/chatTTS-ui .
-
创建虚拟环境
python3 -m venv venv
-
激活虚拟环境
source ./venv/bin/activate
-
安装依赖
pip3 install -r requirements.txt
-
如果不需要CUDA加速,执行
pip3 install torch==2.2.0 torchaudio==2.2.0
如果需要CUDA加速,执行
pip install torch==2.2.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu118 pip install nvidia-cublas-cu11 nvidia-cudnn-cu11
另需安装 CUDA11.8+ ToolKit,请自行搜索安装方法 或参考 https://juejin.cn/post/7318704408727519270
除CUDA外,也可以使用AMD GPU进行加速,这需要安装ROCm和PyTorch_ROCm版本。AMG GPU借助ROCm,在PyTorch开箱即用,无需额外修改代码。
-
请参考Quick start installation guide — ROCm installation (Linux) 来安装AMD GPU Driver及ROCm.
-
再通过PyTorch 安装PyTorch_ROCm版本。
pip3 install torch==2.2.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/rocm6.0
安装完成后,可以通过rocm-smi命令来查看系统中的AMD GPU。也可以用以下Torch代码(query_gpu.py)来查询当前AMD GPU Device.
import torch print(torch.__version__) if torch.cuda.is_available(): device = torch.device("cuda") # a CUDA device object print('Using GPU:', torch.cuda.get_device_name(0)) else: device = torch.device("cpu") print('Using CPU') torch.cuda.get_device_properties(0)
使用以上代码,以AMD Radeon Pro W7900为例,查询设备如下。
$ python ~/query_gpu.py 2.4.0.dev20240401+rocm6.0 Using GPU: AMD Radeon PRO W7900
-