别再租配音了:用 GPT-SoVITS + Pi,把「我的声音」炼成可复用资产 | Stop Renting Voices: Train Your Own GPT-SoVITS Model and Let Pi Agent Dub Forever

大多数人以为「丢一段参考音就能永远像自己说话」。错。那叫零样本推理,关掉 WebUI 下次还得重新选参考。真正能省下未来几百小时配音时间的,是把你自己的声音训成可长期加载的 GPT + SoVITS 权重,再让 Pi Agent 每次自动读配置、调模型、出音频。

下面整条链路在 macOS M2 Pro + zsh + Conda base(Python 3.12.9) 上跑通。我按你的坚持用了 base——这比独立环境更危险,所以每一步都写了备份、验收和「什么时候必须停」。

Most people think a short reference clip equals permanent voice ownership. Wrong. That’s zero-shot. Close the WebUI and you’re back to picking references. What actually saves hundreds of future hours is training durable GPT + SoVITS weights from *your* recordings, then letting Pi Agent auto-load the workflow and generate audio.

This full path runs on macOS M2 Pro + zsh + Conda base (Python 3.12.9). You insisted on base—riskier than a clean env—so every step includes backup, verification, and hard stop rules.



在 `~/Documents/App_Dev/GPT-SoVITS` 用自己录的音训个人模型,写入 `VOICE_WORKFLOW.md`,让 Pi 以后只读配置就能给视频文稿出配音。

Train a personal model from your own recordings under `~/Documents/App_Dev/GPT-SoVITS`, persist paths in `VOICE_WORKFLOW.md`, and let Pi Agent dub video scripts forever without re-explaining the stack.


反常识前提 / Counter-intuitive premises

1. Shell 变量不是配置。 `PROJECT=...` 关终端就没了。路径必须进 `VOICE_WORKFLOW.md`,Pi 全局 `AGENTS.md` 强制先读它。

2. 你用 zsh,安装仍要用 bash。 官方 `install.sh` 是 Bash 语法;`bash install.sh ...` 不会改你的默认 Shell。

3. base + Python 3.12.9 不是官方主推组合。 官方 macOS 说明偏 Python 3.10,Apple Silicon 测试常见 3.9/3.11。坚持 base = 兼容性风险更高,安装失败就停,别狂升级包。

4. 零样本成功 ≠ 训练完成。 只有「训练权重可加载 + 用训练权重出新音频 + 重启后仍可用」才算 VERIFIED。


1. Shell variables are not config. They die with the terminal. Paths live in `VOICE_WORKFLOW.md`; Pi’s global `AGENTS.md` must force a read first.

2. zsh user, bash installer. Official `install.sh` is Bash; running `bash install.sh` does not change your default shell.

3. base + Python 3.12.9 is not the blessed path. Official macOS notes lean on 3.10; Apple Silicon tables often list 3.9/3.11. Base = higher risk—stop on conflict, don’t upgrade everything blindly.

4. Zero-shot ≠ trained. VERIFIED only when trained weights load, produce new audio, and still work after restart.


最终目录(先定死再动手)/ Final layout


~/Documents/App_Dev/GPT-SoVITS/

├── install.sh / webui.py / README.md

├── gpt-sovits-install-backup/

│   ├── base-environment.yml

│   ├── base-conda-explicit.txt

│   └── base-pip-freeze.txt

├── trained-my-voice/

│   ├── recordings/   # 原始长录音

│   ├── reference/    # 3–10 秒参考音

│   ├── dataset/      # 切分+标注后的训练数据

│   ├── models/       # 模型注册与备份说明

│   ├── scripts/      # 文稿

│   ├── generated/    # 输出音频

│   └── logs/         # 训练与验收日志

└── VOICE_WORKFLOW.md


注意:真实 GPT/SoVITS 权重可能落在仓库自带的 `GPT_weights/`、`SoVITS_weights/`。训练前不要假定一定在 `trained-my-voice/models/`;训完再把真实路径写进 `VOICE_WORKFLOW.md`。

Trained weights may land in project `GPT_weights/` / `SoVITS_weights/`. Don’t assume `trained-my-voice/models/` until training finishes—then record the real paths.


第一步:只检查,不安装 / Step 1 — Inspect only


conda activate base

echo "===== Shell ====="; echo "$SHELL"

echo "===== Python ====="; python --version; which python

echo "===== Architecture ====="; uname -m

echo "===== Conda ====="; conda --version; conda env list

echo "===== Git ====="; git --version

echo "===== FFmpeg ====="; ffmpeg -version | head -n 1

echo "===== FFprobe ====="; ffprobe -version | head -n 1

echo "===== Pi Agent ====="; pi --version; which pi

echo "===== Disk ====="; df -h "$HOME"


已知目标环境:macOS、M2 Pro 16GB、arm64、base Python 3.12.9、约 52GiB 空闲;Git / FFmpeg / Pi 已有则不必重装。磁盘和架构不对就先别往下走。

Target baseline: macOS, M2 Pro 16GB, arm64, base Python 3.12.9, ~52GiB free. Skip reinstalling Git/FFmpeg/Pi if already present. Stop if disk or arch is wrong.


第二步:克隆仓库(存在则跳过)/ Step 2 — Clone if missing


mkdir -p "$HOME/Documents/App_Dev"

ls -ld "$HOME/Documents/App_Dev/GPT-SoVITS" 2>/dev/null


不存在:

git clone https://github.com/RVC-Boss/GPT-SoVITS.git \

  "$HOME/Documents/App_Dev/GPT-SoVITS"


已存在:

cd "$HOME/Documents/App_Dev/GPT-SoVITS"

git remote -v

git status


只拿代码,不装依赖。 / Code only—no deps yet.


第三步:备份 base(强烈建议)/ Step 3 — Backup base


PROJECT="$HOME/Documents/App_Dev/GPT-SoVITS"

BACKUP="$PROJECT/gpt-sovits-install-backup"

mkdir -p "$BACKUP"

conda env export -n base > "$BACKUP/base-environment.yml"

conda list -n base --explicit > "$BACKUP/base-conda-explicit.txt"

conda run -n base python -m pip freeze > "$BACKUP/base-pip-freeze.txt"

ls -lh "$BACKUP"


这是清单备份,不是整盘镜像。冲突时不能保证一键还原。可跳过,但跳过 = 你接受 base 被搞坏的风险。

Manifest backup, not a disk image. Not a guaranteed restore. Optional—but skipping means you accept base breakage risk.


第四步:让 Pi 建工作区 + VOICE_WORKFLOW.md / Step 4 — Pi creates workspace


cd "$HOME/Documents/App_Dev/GPT-SoVITS"

pi


在 Pi 里下指令(要点必须全在):创建 `trained-my-voice/` 下 `recordings reference dataset models scripts generated logs`;写 `VOICE_WORKFLOW.md`,记录项目路径、base、Python 实测版本、各子目录;规则包括:配音前必读该文件、不猜 API/端口/权重路径、不把零样本当训练完成、不擅自装依赖/开训、验收要三个约 120 秒独立文件并用 ffprobe 验时长、初始状态全是 NOT VERIFIED / NOT RECORDED。


终端复核:


PROJECT="$HOME/Documents/App_Dev/GPT-SoVITS"

ls -la "$PROJECT"

find "$PROJECT/trained-my-voice" -maxdepth 2 -type d | sort

cat "$PROJECT/VOICE_WORKFLOW.md"


第五步:Pi 全局 AGENTS.md 挂钩 / Step 5 — Global Pi hook


PI_DIR="$HOME/.pi/agent"

GLOBAL_AGENTS="$PI_DIR/AGENTS.md"

mkdir -p "$PI_DIR"

touch "$GLOBAL_AGENTS"

if ! grep -q 'GPT_SOVITS_PERSONAL_VOICE_WORKFLOW' "$GLOBAL_AGENTS"; then

  cat >> "$GLOBAL_AGENTS" <<'EOF'

<!-- GPT_SOVITS_PERSONAL_VOICE_WORKFLOW -->

## GPT-SoVITS Personal Voice Workflow

Whenever the user requests GPT-SoVITS, personal voice cloning,

voice training, or batch voice generation:

1. Read ~/Documents/App_Dev/GPT-SoVITS/VOICE_WORKFLOW.md first.

2. Use the configured project and personal voice paths.

3. Use the Conda base environment only when requested, but never

   modify its Python or dependencies without explicit approval.

4. Inspect actual source files and documentation before using APIs.

5. Never guess model paths, ports, endpoints, or request formats.

6. Never overwrite existing recordings, models, or generated audio.

7. Never confuse zero-shot synthesis with personal model training.

8. Verify trained model weights and successful trained-model inference.

9. For the acceptance test, create three separate audio files,

   each approximately 120 seconds, and verify their actual durations.

10. If the workflow file is missing, report the problem rather than guessing.

<!-- GPT_SOVITS_PERSONAL_VOICE_WORKFLOW -->

EOF

fi

grep -n -A 20 -B 2 'GPT_SOVITS_PERSONAL_VOICE_WORKFLOW' "$GLOBAL_AGENTS"


改完重启 Pi 或 `/reload`。从任意目录启动也能找到工作流。 / Restart Pi or `/reload`. Works from any cwd.

第六–七步:两类录音 + 校验 / Steps 6–7 — Two audio types + checks


参考音(推理用):3 条,各约 5–8 秒(官方约 3–10 秒),`.wav` 优先,文本必须与口播一字不差。示例文本可自改,改口就改文本。  

训练音:约 5–10 分钟干净口播(官方少样本可约 1 分钟,首次建议更充足),同麦同环境,无 BGM/混响/他人声,放进 `recordings/`,再按当前版本流程切分标注进 `dataset/`——复制文件 ≠ 训练数据就绪。

Reference (inference): 3 clips ~5–8s each (official ~3–10s), prefer WAV, transcript must match speech exactly.  

Training: ~5–10 min clean speech (official few-shot can be ~1 min; first run: more is safer), same mic/room, no BGM/reverb/others → `recordings/`, then slice+label into `dataset/` per current repo—copying files is not a ready dataset.


VOICE="$HOME/Documents/App_Dev/GPT-SoVITS/trained-my-voice"

for FILE in "$VOICE"/reference/*; do

  if [ -f "$FILE" ]; then

    echo "===== $FILE ====="

    ffprobe -v error \

      -show_entries format=duration \

      -show_entries stream=codec_name,sample_rate,channels \

      -of default=noprint_wrappers=1 "$FILE"

  fi

done


参考音合格只证明「能做零样本」,不证明个人模型已训好。 / Pass only means zero-shot ready—not personal model trained.


第八步:在 base 上安装(最大风险点)/ Step 8 — Install on base


conda activate base

cd "$HOME/Documents/App_Dev/GPT-SoVITS"

bash install.sh --help

grep -n -E 'pip install|conda install|rm -rf|pretrained|torch|requirements.txt' \

  install.sh | head -n 100


确认参数后(官方 macOS 形态):


bash install.sh --device CPU --source HF


官方在 Mac 上倾向 CPU 训练(说明里 GPU 训练质量可能明显更差)。HF 不通先 `curl -I --max-time 15 https://huggingface.co`。冲突或 torch 报错:停,不要连跑安装、不要全盘升级。

Official macOS guidance leans CPU training (GPU quality on Mac can be worse). Probe HF if downloads fail. On conflict: stop—no parallel installs, no blanket upgrades.


第九步:WebUI 零样本冒烟 / Step 9 — WebUI zero-shot smoke


conda activate base

cd "$HOME/Documents/App_Dev/GPT-SoVITS"

python webui.py


选预训练模型 → 选 `reference/` 一条 → 填一致文本 → 新测试句 → 生成试听。  

成功 = 推理链路通;仍不是个人训练完成。


第十步:训练——让 Pi 读真实仓库再出清单 / Step 10 — Train via Pi + real repo


版本不同,训练入口/配置/权重名会变。不要抄网上过期命令。启动 Pi,要求它:读 `VOICE_WORKFLOW.md` 与 README;查训练 WebUI、数据处理、输出目录;给出切分标注与训练步骤(输入/输出/成功条件);区分预训练 / 零样本 / 个人权重推理;标出 base 兼容风险;不自动装包、不下载大模型、不开训、不覆盖,先交检查报告等你确认。

Training entrypoints change by version. Don’t paste stale commands. Tell Pi to read the workflow + README, map data tools and weight dirs, spell out slice/label/train steps with success criteria, separate pretrained / zero-shot / trained inference, flag base risks—and not install, download, train, or overwrite until you approve.


第十一步:什么叫真正训完 / Step 11 — Definition of done


| 检查项 | 通过条件 |

|--------|----------|

| 训练日志 | 正常结束 |

| GPT 权重 | 本次训练产物存在 |

| SoVITS 权重 | 本次训练产物存在 |

| 模型加载 | 当前版本能加载两者 |

| 推理 | 用训练权重生成新音频 |

| 试听 | 音色/清晰度/内容基本正常 |

| 重启 | 关 WebUI 再开,不重训仍可生成 |


全过才把 `VOICE_WORKFLOW.md` 标成 VERIFIED,并写入真实 GPT/SoVITS 路径与验证日期。



第十二步:新文稿复用测试 / Step 12 — Reuse test script


保存到 `trained-my-voice/scripts/reuse-test.txt`(内容见原文短文稿),用训练权重生成新文件(非旧缓存),可播、内容一致、像你、且无需重训。

第十三步:最终验收——3×约 120 秒 / Step 13 — Final acceptance


Pi 读 `VOICE_WORKFLOW.md` → 确认用的是训练权重 → 三份不同中文口语技术向文稿 → 三个独立 wav(可时间戳防覆盖)→ `ffprobe` 时长/采样率/声道 + `ffmpeg` 解码 → 报告写入 `logs/acceptance-test-report.md`。  

禁止:一个 6 分钟文件冒充三个;零样本冒充训练验收;虚报时长。


VOICE="$HOME/Documents/App_Dev/GPT-SoVITS/trained-my-voice/generated"

for FILE in "$VOICE"/test_*.wav; do

  [ -f "$FILE" ] || continue

  echo "===== $FILE ====="

  ffprobe -v error -show_entries format=duration \

    -show_entries stream=codec_name,sample_rate,channels \

    -of default=noprint_wrappers=1 "$FILE"

  ffmpeg -v error -i "$FILE" -f null - && echo "Decode OK" || echo "Decode FAILED"

done


技术过关后仍要人耳试听。


第十四步:日常一条指令配音 / Step 14 — Daily dubbing


文稿进 `scripts/` → `pi` → 读 workflow → 用已验证权重 → 输出到 `generated/` → 检查时长与解码。示例指令:「读 VOICE_WORKFLOW.md;用已验证个人模型为指定文稿配音;不重训、不覆盖、不改 base;报告实际时长。」


第十五步:必须 vs 可跳过 / Step 15 — Must vs optional


| 步骤 | 必须? | 目的 |

|------|--------|------|

| 查环境 | 必须 | 基线与磁盘 |

| 克隆 | 无则必须 | 拿代码 |

| 备份 base | 建议 | 留痕迹 |

| 目录+VOICE_WORKFLOW | 必须 | Pi 可读路径 |

| AGENTS 挂钩 | 建议 | 全局自动发现 |

| 参考录音+检查 | 零样本需要 | 冒烟 |

| 安装 | 必须 | 依赖 |

| WebUI | 必须 | 推理通 |

| 训练数据+训练+验证 | 个人模型必须 | 可复用权重 |

| 新文稿复用 | 必须 | 证明可重复 |

| 3×120s 验收 | 按目标必须 | 最终签字 |


真正要保住的:训练后的 GPT/SoVITS 权重、原始录音、dataset 标注、以及 VERIFIED 的 workflow——不是只有一个 md 文件。

What you must keep: trained GPT/SoVITS weights, raw recordings, labeled dataset, and a VERIFIED workflow—not just a markdown file. 相关链接/Related Links: https://nodejs.org/en https://pi.dev/ https://github.com/earendil-works/pi https://github.com/earendil-works/pi/tree/main/packages/coding-agent/docs https://github.com/earendil-works/pi/tree/main/packages/coding-agent/examples/extensions https://omp.sh/ https://api-docs.deepseek.com/zh-cn/quick_start/agent_integrations/pi_mono/ https://github.com/RVC-Boss/GPT-SoVITS https://lj1995-gpt-sovits-proplus.hf.space/ https://github.com/can1357/oh-my-pi https://github.com/microsoft/markitdown/tree/main/packages/markitdown-mcp https://claude.com/product/claude-code https://code.claude.com/docs/en/overview https://github.com/anthropics/claude-code https://openai.com/codex/ https://developers.openai.com/codex/cli/ https://github.com/openai/codex https://ollama.com/ https://ollama.com/download https://ollama.com/library/qwen2.5-coder https://docs.ollama.com/ https://www.typescriptlang.org/ https://www.typescriptlang.org/docs/ https://vitest.dev/ https://git-scm.com/ https://brew.sh/

评论

爽文共赏/Popular Posts

5分钟拿下原生IP + 免费节点 手残变大佬 | From Noob to Pro in 5 Minutes: 10 Real IPs + Daily Fresh Free Nodes

一口气搭好!Cloudflare融合Railway与Galaxy打造纯净原生免费VPS | Build a Pure Free VPS with Cloudflare + Railway + Galaxy in One Go

免费节点无限续?OneBox+subs-check,付费党沉默了 | Free Nodes Never Die? OneBox + subs-check, Paid Users Left Speechless

3 Steps to AI Video Fame✨WebSocket+Copilot Auto-Update, Newbies Win Too | 3 步 AI 视频封神✨WebSocket+Copilot 自动更,小白也能卷赢

Game-Changing! Get AI Parenting+Math Enlightenment for Free | 0成本get AI育儿+数学启蒙双buff,躺赢养娃

零成本薅云服务器 | 三分钟开人生外挂 ⚡ | Zero-Cost Cloud Hustle | Life Cheat Code for Broke Devs 🍜