# 第 051 期 · 本地 AI 配音跟做命令

从解压后的练习目录打开 PowerShell。用同一模型与 CosyVoice 官方示例分别运行原稿和修正版。

## 准备 Python 3.12、CUDA 和参考文件

从练习目录执行。已有可用环境可直接检查文件。CUDA 安装命令对应 CUDA 12.1，其他构建按 PyTorch 官方说明选择。

```powershell
py -3.12 -m venv .venv
$py = ".\.venv\Scripts\python.exe"
& $py -m pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
& $py -m pip install qwen-tts==0.1.1 transformers==4.57.3 soundfile==0.13.1
& $py -c "import torch; print(torch.__version__, torch.cuda.is_available())"
Test-Path .\Qwen3-TTS-12Hz-0.6B-Base\config.json
Test-Path .\zero_shot_prompt.wav
```

## 用同一模型合成原稿与修正版

两次只换输入文本和输出名。用 CPU 构建时给两条合成命令加 --device cpu。

```powershell
$py = ".\.venv\Scripts\python.exe"
$model = ".\Qwen3-TTS-12Hz-0.6B-Base"
$reference = ".\zero_shot_prompt.wav"
& $py .\synthesize.py --model $model --reference $reference --text .\01-original.txt --out .\outputs\original.wav
& $py .\synthesize.py --model $model --reference $reference --text .\02-spoken.txt --out .\outputs\corrected.wav
Invoke-Item .\outputs
```

## 复听 WAV，再核对字幕显示稿

两条 WAV 都完整听一遍。按操作词、五位编号、小数和单位记验收结果。显示稿保留 00081 和 0.8秒，时间轴以选中的 WAV 为准。

```powershell
Get-Content .\01-original.txt -Encoding UTF8
Get-Content .\02-spoken.txt -Encoding UTF8
Get-Content .\03-display.txt -Encoding UTF8
```
