如何用 MacOS 下使用 GPT-SoVITS

前言

第一次配置环境时,用了一个钟,踩了不少坑。现整理出来,方便大家快速在自己的 Mac 上启动 GPT-SoVITS。 # 环境和前置准备 ## 我的硬件环境: 用的是 MacBook Air M2 内存 16G,系统版本是 macOS 14.3。 有统一内存架构,所以不需要额外的显卡。用来上手 GPT-SoVITS 是绰绰有余的。

软件环境:

  • 已通过运行xcode-select –install安装 Xcode command-line tools
  • 安装好 Miniconda
  • 如果你会给 Conda 换源,那么也不需要魔法上网
  • 安装好了 git 、ffmpeg 、huggingface-cli

安装 ffmpeg

1# 安装 ffmpegbrew install ffmpeg 2# 查看版本ffmpeg -version

拉取代码、创建环境、安装依赖

1# 拉取项目代码git clone --depth=1 https://github.com/RVC-Boss/GPT-SoVITS 2cd GPT-SoVITS 3# 安装好 Miniconda 之后,先创建一个虚拟环境:conda create -n GPTSoVits python=3.9 4conda activate GPTSoVits 5# 安装依赖:pip3 install -r requirements.txt 6pip3 uninstall torch torchaudio 7pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu 8# (可选)如果网络环境不好,可以考虑换源(比如清华源):pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt 9pip3 uninstall torch torchaudio 10pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu

下载模型

1# 安装 huggingface-cli 用于和 huggingface hub 交互pip3 install huggingface_hub 2# 登录 huggingface-clihugging face-cli login 3# 下载模型, 由于模型文件较大,可能需要一段时间# --local-dir-use-symlinks False 用于解决 macOS alias 文件的问题# 会下载到 GPT_SoVITS/pretrained_models 文件夹下huggingface-cli download --resume-download lj1995/GPT-SoVITS --local-dir GPT_SoVITS/pretrained_models --local-dir-use-symlinks False

运行

1python webui.py
本文最早是发布在 GPT SoVITS 语雀文档中 上,现在已经过多轮升级,最新版请访问最新版本。