IndexTTS2 macOS 部署指南
本教程将指导您如何在 macOS 系统上成功部署 IndexTTS2,一个强大的文本到语音转换工具。我们将逐步介绍所需的基础环境配置、代码获取、依赖同步、模型下载与验证,以及服务启动等关键步骤。
1. 基础环境 (Homebrew & Git)
首先,确保您的系统已经安装了 Homebrew 包管理器以及 Git 工具链。特别是 Git LFS,它对于拉取大型文件至关重要。
# 安装 Homebrew (如果尚未安装)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 安装基础工具
brew install git git-lfs
# 激活 Git LFS
git lfs install
2. 获取代码与工具链
接下来,您需要克隆 IndexTTS2 的仓库并安装 uv 包管理器。uv 是一个比传统 pip 更快、依赖解析更稳健的包管理工具。
# 克隆仓库
git clone https://github.com/index-tts/index-tts.git
cd index-tts
git lfs pull
# 安装 uv
brew install uv
3. 依赖同步 (Python环境)
使用 uv sync 命令自动创建虚拟环境并同步所有依赖。为了加速下载,建议使用阿里云镜像源。
# 推荐:使用阿里云镜像
uv sync --all-extras --default-index "https://mirrors.aliyun.com/pypi/simple"
# 备选:清华源
# uv sync --all-extras --default-index "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
4. 模型下载与验证
通过 ModelScope 下载模型权重,并验证 macOS 的 MPS (Metal Performance Shaders) 加速是否已开启。
# 下载模型
uv tool install "modelscope"
modelscope download --model IndexTeam/IndexTTS-2 --local_dir checkpoints
# 验证硬件加速 (应显示: PyTorch: Apple MPS is available!)
uv run tools/gpu_check.py
5. 启动服务
WebUI 启动后,请在浏览器中访问 http://127.0.0.1:7860 来查看效果。
uv run webui.py
恭喜您,IndexTTS2 已经成功在您的 macOS 系统上部署完毕!现在您可以开始体验文本到语音转换的强大功能了。
参考资料
希望本指南对您有所帮助,祝您使用愉快!