RVC:部署 AI 语音转换,拥有 35K+ 星标 — 2026 年 10 分钟训练设置
RVC (Retrieval-based Voice Conversion) is a VITS-based voice conversion framework compatible with GPT-SoVITS, Coqui TTS, and demucs. This tutorial covers Docker deployment, training pipelines, API integration, and production hardening.
- MIT
- 更新于 2026-05-19
{{< 资源信息 >}}
- GPU:NVIDIA GTX 1660 6GB / RTX 2060 8GB(训练); 4GB VRAM(仅供参考)
- CPU:4核Intel/AMD处理器
- RAM:最低 8GB,建议 16GB
- 存储:10GB 可用空间用于模型和依赖项 ### 方法 1:Docker 部署(推荐用于生产) 官方 Dockerfile 在 Ubuntu 20.04 和 Python 3.9 上使用 CUDA 11.6.2: ```` bas h
git 克隆 https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
cd 基于检索的语音转换WebUI # 构建 Docker 镜像
docker build -t rvc-webui:latest 。 # 在 GPU 支持和卷安装的情况下运行
docker run -d –name rvc \ –GPU全部\ -p 7865:7865 \ -v $(pwd)/weights:/app/weights \ -v $(pwd)/opt:/app/opt \ rvc-webui:最新
对于 docker-compose 用户:
yam
l
版本:‘3.8’ 服务: 房车: 建造: 。 容器名称:rvc-webui 运行时: 英伟达 环境: - NVIDIA_VISIBLE_DEVICES=全部 端口: - “7865:7865” 卷: - ./weights:/app/weights - ./opt:/app/opt - ./资产:/应用程序/资产 部署: 资源: 预订: 设备: - 驱动程序:nvidia 数量:1 能力:[GPU] 重新启动:除非停止
bas
h
Start with docker-compose #
docker-compose up -d # 检查日志
docker-compose 日志-f rvc
### Method 2: Local Python Setup
bas
h
克隆存储库 #
git 克隆 https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
cd 基于检索的语音转换WebUI # 创建虚拟环境
python3 -m venv venv
源 venv/bin/activate # 安装依赖项
pip install -r 要求.txt # 下载预训练模型
python 工具/download_models.py # 或者从 HuggingFace 手动下载
wget https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D40k.pth -P asset/pretrained_v2/
wget https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G40k.pth -P asset/pretrained_v2/
wget https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D40k.pth -P asset/pretrained_v2/
wget https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G40k.pth -P asset/pretrained_v2/
wget https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -P asset/hubert/
wget https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/rmvpe.pt -P asset/rmvpe/
### 方法 3:AMD GPU 设置 (ROCm)
bas
h
安装 ROCm 依赖项 (Ubuntu/Debian) #
sudo apt install rocm-hip-sdk rocm-opencl-sdk # 设置环境变量
导出 ROCM_PATH=/opt/rocm
导出 HSA_OVERRIDE_GFX_VERSION=10.3.0 # 将用户添加到渲染和视频组
sudo usermod -aG 渲染 $USER
sudo usermod -aG 视频 $USER # Install AMD-specific requirements
pip install -r requirements-amd.txt
### 启动WebUI
bas
h
启动 Gradio Web 界面 #
python infer-web.py # WebUI 将在 http://localhost:7865 上提供
- **格式:** WAV,16 位或 24 位,22050Hz 或 40000Hz 采样率
- **内容:** 单扬声器,最小背景噪音,无音乐或混响
- **静音:** 删除长静音片段(> 3 秒) 使用 UVR5(随附)进行源分离: ````
bas
h
# 将人声与背景音乐分开
python 工具/uvr5/uvr5_cli.py \ --input_path ./raw_audio/song_with_music.wav \ --output_path ./数据集/ \ --model_name "HP2-人声人声+非人声乐器"
```` ### 步骤 2:预处理和提取特征 在 WebUI **Train** 选项卡中: 1. 设置**实验名称**(例如“my_voice_v2”)
2. 将 **目标采样率** 设置为 40kHz(推荐)
3. 将 **RVC 版本** 设置为 v2
4. 将 **模型架构** 设置为 `rmvpe_gpu`
5. 将 **数据集路径** 设置为您的音频文件夹
6. 点击**一键培训** 或者通过命令行: ````
bas
h
# 第 1 步:预处理(重新采样、切片、去除静音)
python trainset_preprocess_pipeline_print.py \ ./数据集/my_voice \ 40000\ 8 #CPU线程数 # 步骤 2:使用 ContentVec 提取特征
python extract_feature_print.py \ --model_name my_voice_v2 \ --sample_rate 40000 \ --pitch_extractor rmvpe \ --GPU 0 # 第 3 步:训练模型
python train_nsf_sim_cache_sid_load_pretrain.py \ --model_name my_voice_v2 \ --sample_rate 40000 \ --batch_size 8 \ --total_epoch 200 \ --save_every_epoch 5 \ --pretrained_G 资产/pretrained_v2/f0G40k.pth \ --pretrained_D 资产/pretrained_v2/f0D40k.pth \ --GPU 0
```` ### 第 3 步:构建特征索引 ````
bas
h
# 生成Faiss索引用于检索
python 工具/infer/train_index.py \ --model_name my_voice_v2 \ --采样率 40000
```` 训练输出地点: ````
日志/
└── my_voice_v2/ ├── added_IVF512_Flat_nprobe_1.index # Faiss检索索引 ├── G_*.pth # 生成器检查点 ├── D_*.pth # 鉴别器检查点 └── config.json # 模型配置
````  ### 训练基准 | 硬件| 数据集大小 | 时代| 培训时间| 输出质量|
|
💬 留言讨论