1、下载项目
bash
git clone --recursive https://github.com/v3ucn/CosyVoice_for_MacOs.git
如果由于网络故障克隆子模块失败,请运行以下命令直到成功:
bash
cd CosyVoice_for_MacOs
git submodule update --init --recursive
2、创建并激活 Python 虚拟环境
bash
cd CosyVoice_for_MacOs
conda create -n cosyvoice python=3.11
conda activate cosyvoice
如未安装 conda ,请看 【Mac】Python 环境管理工具
3、安装 Python依赖
bash
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
4、设置环境变量
bash
export PYTHONPATH=third_party/AcademiCodec:third_party/Matcha-TTS
5、安装sox
bash
# 退出虚拟环境
conda deactivate
# 安装sox
brew install sox
如未安装 Homwbrew ,请看 【Mac】Homwbrew
6、下载模型
bash
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、启动
bash
conda activate cosyvoice
python3 webui.py --port 50000 --model_dir speech_tts/CosyVoice-300M