【Mac】安装CosyVoice

发布于:2024-11-02 ⋅ 阅读:(63) ⋅ 点赞:(0)

1、下载项目

git clone --recursive https://github.com/v3ucn/CosyVoice_for_MacOs.git

如果由于网络故障克隆子模块失败,请运行以下命令直到成功:

cd CosyVoice_for_MacOs
git submodule update --init --recursive

2、创建并激活 Python 虚拟环境

cd CosyVoice_for_MacOs
conda create -n cosyvoice python=3.11
conda activate cosyvoice

如未安装 conda ,请看 【Mac】Python 环境管理工具

3、安装 Python依赖

pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com

4、设置环境变量

export PYTHONPATH=third_party/AcademiCodec:third_party/Matcha-TTS

5、安装sox

# 退出虚拟环境
conda deactivate

# 安装sox
brew install sox

如未安装 Homwbrew ,请看 【Mac】Homwbrew

6、下载模型

mkdir -p pretrained_models  
git clone https://www.modelscope.cn/iic/CosyVoice-300M.git pretrained_models/CosyVoice-300M  
git clone https://www.modelscope.cn/iic/CosyVoice-300M-SFT.git pretrained_models/CosyVoice-300M-SFT  
git clone https://www.modelscope.cn/iic/CosyVoice-300M-Instruct.git pretrained_models/CosyVoice-300M-Instruct  
git clone https://www.modelscope.cn/speech_tts/speech_kantts_ttsfrd.git pretrained_models/speech_kantts_ttsfrd

7、启动

conda activate cosyvoice
python3 webui.py --port 50000 --model_dir speech_tts/CosyVoice-300M

访问 http://localhost:50000

10、参考资料