我本地是5080 16G
把安装过程和坑记录一下(坑基本上都在github上找到解决方案)
下载源码(必须用git的方式)
git clone --recursive github.com/FunAudioLLM…
创建并激活 Conda 环境
conda create -n cosyvoice -y python=3.10 conda activate cosyvoice
安装程序依赖
cd CosyVoice conda install -y -c conda-forge pynini==2.1.5 pip install -r requirements.txt -i mirrors.aliyun.com/pypi/simple… --trusted-host=mirrors.aliyun.com
下载模型
这里下载的是CosyVoice2.0的模型
300M那个是1.0的
mkdir -p pretrained_models git clone www.modelscope.cn/iic/CosyVoi… pretrained_models/CosyVoice2-0.5B
通过 Web 客户端使用程序
python webui.py --port 50000 --model_dir pretrained_models/CosyVoice2-0.5B
坑
No module named 'matcha'
pip install matcha # CosyVoice 的代码中依赖了第三方模块 Matcha-TTS,它存放在 third_party 目录下。如果该目录下没有 Matcha-TTS,请在项目根目录执行: git submodule update --init --recursive # 会下载并初始化所有子模块,包括 Matcha-TTS。运行完毕后,你的 third_party 目录下应该会有 Matcha-TTS 文件夹。 # 为了让 Python 能找到 Matcha-TTS 模块,可以将其路径添加到 PYTHONPATH set PYTHONPATH=.\third_party\Matcha-TTS
RuntimeError: CUDA error: no kernel image is available for execution on the device
import torch print(f"CUDA 版本: {torch.version.cuda}")
我是5080的显卡,需要更换pytorch版本
nvidia-smi CUDA Version: 12.8
pip install torch-2.7.0+cu128-cp310-cp310-win_amd64.whl pip install torchaudio-2.7.0+cu128-cp310-cp310-win_amd64.whl pip install torchvision-0.22.0+cu128-cp310-cp310-win_amd64.whl
选择预训练音色列表空
pretrained_models/CosyVoice2-0.5B
FileNotFoundError: [WinError 2] 系统找不到指定的文件
需要安装ffmpeg
环境变量配置