From 4762e5bc21b5d9c5c8701142573e31bc254d137e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?=
<41315874+fumiama@users.noreply.github.com>
Date: Sat, 20 Apr 2024 21:29:25 +0900
Subject: [PATCH] feat(all): optimize hierarchy of files
---
LICENSE | 6 +-
README.md | 3 +-
Retrieval_based_Voice_Conversion_WebUI.ipynb | 403 -----------------
...eval_based_Voice_Conversion_WebUI_v2.ipynb | 422 ------------------
docs/en/README.en.md | 3 +-
docs/fr/README.fr.md | 3 +-
docs/jp/README.ja.md | 3 +-
docs/kr/README.ko.han.md | 3 +-
docs/kr/README.ko.md | 3 +-
docs/pt/README.pt.md | 3 +-
docs/tr/README.tr.md | 3 +-
gui_v1.py | 9 +-
infer/lib/audio.py | 3 +-
.../rvc_for_realtime.py => infer/lib/rtrvc.py | 8 -
.../modules/gui}/__init__.py | 0
.../modules/gui}/torchgate.py | 0
.../torchgate => infer/modules/gui}/utils.py | 0
tools/{ => cmd}/calc_rvc_model_similarity.py | 0
tools/{infer => cmd}/infer-pm-index256.py | 0
tools/{ => cmd}/infer_batch_rvc.py | 0
tools/{ => cmd}/infer_cli.py | 0
tools/{infer => cmd}/train-index-v2.py | 0
tools/{infer => cmd}/train-index.py | 0
tools/{infer => cmd}/trans_weights.py | 0
tools/ipynb/v1.ipynb | 353 +++++++++++++++
tools/ipynb/v2.ipynb | 352 +++++++++++++++
tools/{ => onnx}/export_onnx.py | 0
tools/{ => onnx}/onnx_inference_demo.py | 2 +-
tools/{app.py => web/infer-only.py} | 0
venv.sh | 3 -
30 files changed, 729 insertions(+), 856 deletions(-)
delete mode 100644 Retrieval_based_Voice_Conversion_WebUI.ipynb
delete mode 100644 Retrieval_based_Voice_Conversion_WebUI_v2.ipynb
rename tools/rvc_for_realtime.py => infer/lib/rtrvc.py (96%)
rename {tools/torchgate => infer/modules/gui}/__init__.py (100%)
rename {tools/torchgate => infer/modules/gui}/torchgate.py (100%)
rename {tools/torchgate => infer/modules/gui}/utils.py (100%)
rename tools/{ => cmd}/calc_rvc_model_similarity.py (100%)
rename tools/{infer => cmd}/infer-pm-index256.py (100%)
rename tools/{ => cmd}/infer_batch_rvc.py (100%)
rename tools/{ => cmd}/infer_cli.py (100%)
rename tools/{infer => cmd}/train-index-v2.py (100%)
rename tools/{infer => cmd}/train-index.py (100%)
rename tools/{infer => cmd}/trans_weights.py (100%)
create mode 100644 tools/ipynb/v1.ipynb
create mode 100644 tools/ipynb/v2.ipynb
rename tools/{ => onnx}/export_onnx.py (100%)
rename tools/{ => onnx}/onnx_inference_demo.py (89%)
rename tools/{app.py => web/infer-only.py} (100%)
delete mode 100755 venv.sh
diff --git a/LICENSE b/LICENSE
index d798ccd..f703dbe 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,8 +1,8 @@
MIT License
-Copyright (c) 2023 liujing04
-Copyright (c) 2023 源文雨
-Copyright (c) 2023 Ftps
+Copyright (c) 2023-2024 liujing04
+Copyright (c) 2023-2024 fumiama
+Copyright (c) 2023-2024 Ftps
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index c463fca..f2cd5a9 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,8 @@

-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/Retrieval_based_Voice_Conversion_WebUI.ipynb b/Retrieval_based_Voice_Conversion_WebUI.ipynb
deleted file mode 100644
index fa1d84e..0000000
--- a/Retrieval_based_Voice_Conversion_WebUI.ipynb
+++ /dev/null
@@ -1,403 +0,0 @@
-{
- "cells": [
- {
- "attachments": {},
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# [Retrieval-based-Voice-Conversion-WebUI](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) Training notebook"
- ]
- },
- {
- "attachments": {},
- "cell_type": "markdown",
- "metadata": {
- "id": "ZFFCx5J80SGa"
- },
- "source": [
- "[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "GmFP6bN9dvOq"
- },
- "outputs": [],
- "source": [
- "# @title 查看显卡\n",
- "!nvidia-smi"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "jwu07JgqoFON"
- },
- "outputs": [],
- "source": [
- "# @title 挂载谷歌云盘\n",
- "\n",
- "from google.colab import drive\n",
- "\n",
- "drive.mount(\"/content/drive\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "wjddIFr1oS3W"
- },
- "outputs": [],
- "source": [
- "# @title 安装依赖\n",
- "!apt-get -y install build-essential python3-dev ffmpeg\n",
- "!pip3 install --upgrade setuptools wheel\n",
- "!pip3 install --upgrade pip\n",
- "!pip3 install faiss-cpu==1.7.2 fairseq gradio==4.23.0 ffmpeg ffmpeg-python praat-parselmouth pyworld numpy==1.23.5 numba==0.56.4 librosa==0.9.2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "ge_97mfpgqTm"
- },
- "outputs": [],
- "source": [
- "# @title 克隆仓库\n",
- "\n",
- "!git clone --depth=1 -b stable https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI\n",
- "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
- "!mkdir -p pretrained uvr5_weights"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "BLDEZADkvlw1"
- },
- "outputs": [],
- "source": [
- "# @title 更新仓库(一般无需执行)\n",
- "!git pull"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "pqE0PrnuRqI2"
- },
- "outputs": [],
- "source": [
- "# @title 安装aria2\n",
- "!apt -y install -qq aria2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "UG3XpUwEomUz"
- },
- "outputs": [],
- "source": [
- "# @title 下载底模\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D48k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G48k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D48k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G48k.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "HugjmZqZRuiF"
- },
- "outputs": [],
- "source": [
- "# @title 下载人声分离模型\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP2-人声vocals+非人声instrumentals.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/uvr5_weights -o HP2-人声vocals+非人声instrumentals.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP5-主旋律人声vocals+其他instrumentals.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/uvr5_weights -o HP5-主旋律人声vocals+其他instrumentals.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "2RCaT9FTR0ej"
- },
- "outputs": [],
- "source": [
- "# @title 下载hubert_base\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d /content/Retrieval-based-Voice-Conversion-WebUI -o hubert_base.pt"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "# @title #下载rmvpe模型\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/rmvpe.pt -d /content/Retrieval-based-Voice-Conversion-WebUI -o rmvpe.pt"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "Mwk7Q0Loqzjx"
- },
- "outputs": [],
- "source": [
- "# @title 从谷歌云盘加载打包好的数据集到/content/dataset\n",
- "\n",
- "# @markdown 数据集位置\n",
- "DATASET = (\n",
- " \"/content/drive/MyDrive/dataset/lulu20230327_32k.zip\" # @param {type:\"string\"}\n",
- ")\n",
- "\n",
- "!mkdir -p /content/dataset\n",
- "!unzip -d /content/dataset -B {DATASET}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "PDlFxWHWEynD"
- },
- "outputs": [],
- "source": [
- "# @title 重命名数据集中的重名文件\n",
- "!ls -a /content/dataset/\n",
- "!rename 's/(\\w+)\\.(\\w+)~(\\d*)/$1_$3.$2/' /content/dataset/*.*~*"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "7vh6vphDwO0b"
- },
- "outputs": [],
- "source": [
- "# @title 启动web\n",
- "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
- "# %load_ext tensorboard\n",
- "# %tensorboard --logdir /content/Retrieval-based-Voice-Conversion-WebUI/logs\n",
- "!python3 infer-web.py --colab --pycmd python3"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "FgJuNeAwx5Y_"
- },
- "outputs": [],
- "source": [
- "# @title 手动将训练后的模型文件备份到谷歌云盘\n",
- "# @markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
- "\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 模型epoch\n",
- "MODELEPOCH = 9600 # @param {type:\"integer\"}\n",
- "\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/added_*.index /content/drive/MyDrive/\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/total_*.npy /content/drive/MyDrive/\n",
- "\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "OVQoLQJXS7WX"
- },
- "outputs": [],
- "source": [
- "# @title 从谷歌云盘恢复pth\n",
- "# @markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
- "\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 模型epoch\n",
- "MODELEPOCH = 7500 # @param {type:\"integer\"}\n",
- "\n",
- "!mkdir -p /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
- "\n",
- "!cp /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
- "!cp /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
- "!cp /content/drive/MyDrive/*.index /content/\n",
- "!cp /content/drive/MyDrive/*.npy /content/\n",
- "!cp /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "ZKAyuKb9J6dz"
- },
- "outputs": [],
- "source": [
- "# @title 手动预处理(不推荐)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 采样率\n",
- "BITRATE = 48000 # @param {type:\"integer\"}\n",
- "# @markdown 使用的进程数\n",
- "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
- "\n",
- "!python3 trainset_preprocess_pipeline_print.py /content/dataset {BITRATE} {THREADCOUNT} logs/{MODELNAME} True"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "CrxJqzAUKmPJ"
- },
- "outputs": [],
- "source": [
- "# @title 手动提取特征(不推荐)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 使用的进程数\n",
- "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
- "# @markdown 音高提取算法\n",
- "ALGO = \"harvest\" # @param {type:\"string\"}\n",
- "\n",
- "!python3 extract_f0_print.py logs/{MODELNAME} {THREADCOUNT} {ALGO}\n",
- "\n",
- "!python3 extract_feature_print.py cpu 1 0 0 logs/{MODELNAME} True"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "IMLPLKOaKj58"
- },
- "outputs": [],
- "source": [
- "# @title 手动训练(不推荐)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 使用的GPU\n",
- "USEGPU = \"0\" # @param {type:\"string\"}\n",
- "# @markdown 批大小\n",
- "BATCHSIZE = 32 # @param {type:\"integer\"}\n",
- "# @markdown 停止的epoch\n",
- "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
- "# @markdown 保存epoch间隔\n",
- "EPOCHSAVE = 100 # @param {type:\"integer\"}\n",
- "# @markdown 采样率\n",
- "MODELSAMPLE = \"48k\" # @param {type:\"string\"}\n",
- "# @markdown 是否缓存训练集\n",
- "CACHEDATA = 1 # @param {type:\"integer\"}\n",
- "# @markdown 是否仅保存最新的ckpt文件\n",
- "ONLYLATEST = 0 # @param {type:\"integer\"}\n",
- "\n",
- "!python3 train_nsf_sim_cache_sid_load_pretrain.py -e lulu -sr {MODELSAMPLE} -f0 1 -bs {BATCHSIZE} -g {USEGPU} -te {MODELEPOCH} -se {EPOCHSAVE} -pg pretrained/f0G{MODELSAMPLE}.pth -pd pretrained/f0D{MODELSAMPLE}.pth -l {ONLYLATEST} -c {CACHEDATA}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "haYA81hySuDl"
- },
- "outputs": [],
- "source": [
- "# @title 删除其它pth,只留选中的(慎点,仔细看代码)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 选中模型epoch\n",
- "MODELEPOCH = 9600 # @param {type:\"integer\"}\n",
- "\n",
- "!echo \"备份选中的模型。。。\"\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"正在删除。。。\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
- "!rm /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*.pth\n",
- "\n",
- "!echo \"恢复选中的模型。。。\"\n",
- "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
- "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"删除完成\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "QhSiPTVPoIRh"
- },
- "outputs": [],
- "source": [
- "# @title 清除项目下所有文件,只留选中的模型(慎点,仔细看代码)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 选中模型epoch\n",
- "MODELEPOCH = 9600 # @param {type:\"integer\"}\n",
- "\n",
- "!echo \"备份选中的模型。。。\"\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"正在删除。。。\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
- "!rm -rf /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*\n",
- "\n",
- "!echo \"恢复选中的模型。。。\"\n",
- "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
- "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"删除完成\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
- ]
- }
- ],
- "metadata": {
- "accelerator": "GPU",
- "colab": {
- "private_outputs": true,
- "provenance": []
- },
- "gpuClass": "standard",
- "kernelspec": {
- "display_name": "Python 3",
- "name": "python3"
- },
- "language_info": {
- "name": "python"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Retrieval_based_Voice_Conversion_WebUI_v2.ipynb b/Retrieval_based_Voice_Conversion_WebUI_v2.ipynb
deleted file mode 100644
index 613e628..0000000
--- a/Retrieval_based_Voice_Conversion_WebUI_v2.ipynb
+++ /dev/null
@@ -1,422 +0,0 @@
-{
- "cells": [
- {
- "attachments": {},
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# [Retrieval-based-Voice-Conversion-WebUI](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) Training notebook"
- ]
- },
- {
- "attachments": {},
- "cell_type": "markdown",
- "metadata": {
- "id": "ZFFCx5J80SGa"
- },
- "source": [
- "[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI_v2.ipynb)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "GmFP6bN9dvOq"
- },
- "outputs": [],
- "source": [
- "# @title #查看显卡\n",
- "!nvidia-smi"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "jwu07JgqoFON"
- },
- "outputs": [],
- "source": [
- "# @title 挂载谷歌云盘\n",
- "\n",
- "from google.colab import drive\n",
- "\n",
- "drive.mount(\"/content/drive\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "wjddIFr1oS3W"
- },
- "outputs": [],
- "source": [
- "# @title #安装依赖\n",
- "!apt-get -y install build-essential python3-dev ffmpeg\n",
- "!pip3 install --upgrade setuptools wheel\n",
- "!pip3 install --upgrade pip\n",
- "!pip3 install faiss-cpu==1.7.2 fairseq gradio==4.23.0 ffmpeg ffmpeg-python praat-parselmouth pyworld numpy==1.23.5 numba==0.56.4 librosa==0.9.2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "ge_97mfpgqTm"
- },
- "outputs": [],
- "source": [
- "# @title #克隆仓库\n",
- "\n",
- "!mkdir Retrieval-based-Voice-Conversion-WebUI\n",
- "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
- "!git init\n",
- "!git remote add origin https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git\n",
- "!git fetch origin cfd984812804ddc9247d65b14c82cd32e56c1133 --depth=1\n",
- "!git reset --hard FETCH_HEAD"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "BLDEZADkvlw1"
- },
- "outputs": [],
- "source": [
- "# @title #更新仓库(一般无需执行)\n",
- "!git pull"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "pqE0PrnuRqI2"
- },
- "outputs": [],
- "source": [
- "# @title #安装aria2\n",
- "!apt -y install -qq aria2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "UG3XpUwEomUz"
- },
- "outputs": [],
- "source": [
- "# @title 下载底模\n",
- "\n",
- "# v1\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o D48k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o G48k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0D48k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G40k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained -o f0G48k.pth\n",
- "\n",
- "# v2\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o D32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o D40k.pth\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o D48k.pth\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o G32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o G40k.pth\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o G48k.pth\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0D32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0D40k.pth\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0D48k.pth\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G32k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0G32k.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G40k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0G40k.pth\n",
- "# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G48k.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/pretrained_v2 -o f0G48k.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "HugjmZqZRuiF"
- },
- "outputs": [],
- "source": [
- "# @title #下载人声分离模型\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP2-人声vocals+非人声instrumentals.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/uvr5_weights -o HP2-人声vocals+非人声instrumentals.pth\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP5-主旋律人声vocals+其他instrumentals.pth -d /content/Retrieval-based-Voice-Conversion-WebUI/uvr5_weights -o HP5-主旋律人声vocals+其他instrumentals.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "2RCaT9FTR0ej"
- },
- "outputs": [],
- "source": [
- "# @title #下载hubert_base\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d /content/Retrieval-based-Voice-Conversion-WebUI -o hubert_base.pt"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "# @title #下载rmvpe模型\n",
- "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/rmvpe.pt -d /content/Retrieval-based-Voice-Conversion-WebUI -o rmvpe.pt"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "Mwk7Q0Loqzjx"
- },
- "outputs": [],
- "source": [
- "# @title #从谷歌云盘加载打包好的数据集到/content/dataset\n",
- "\n",
- "# @markdown 数据集位置\n",
- "DATASET = (\n",
- " \"/content/drive/MyDrive/dataset/lulu20230327_32k.zip\" # @param {type:\"string\"}\n",
- ")\n",
- "\n",
- "!mkdir -p /content/dataset\n",
- "!unzip -d /content/dataset -B {DATASET}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "PDlFxWHWEynD"
- },
- "outputs": [],
- "source": [
- "# @title #重命名数据集中的重名文件\n",
- "!ls -a /content/dataset/\n",
- "!rename 's/(\\w+)\\.(\\w+)~(\\d*)/$1_$3.$2/' /content/dataset/*.*~*"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "7vh6vphDwO0b"
- },
- "outputs": [],
- "source": [
- "# @title #启动webui\n",
- "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
- "# %load_ext tensorboard\n",
- "# %tensorboard --logdir /content/Retrieval-based-Voice-Conversion-WebUI/logs\n",
- "!python3 infer-web.py --colab --pycmd python3"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "FgJuNeAwx5Y_"
- },
- "outputs": [],
- "source": [
- "# @title #手动将训练后的模型文件备份到谷歌云盘\n",
- "# @markdown #需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
- "\n",
- "# @markdown #模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown #模型epoch\n",
- "MODELEPOCH = 9600 # @param {type:\"integer\"}\n",
- "\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/added_*.index /content/drive/MyDrive/\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/total_*.npy /content/drive/MyDrive/\n",
- "\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "OVQoLQJXS7WX"
- },
- "outputs": [],
- "source": [
- "# @title 从谷歌云盘恢复pth\n",
- "# @markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
- "\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 模型epoch\n",
- "MODELEPOCH = 7500 # @param {type:\"integer\"}\n",
- "\n",
- "!mkdir -p /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
- "\n",
- "!cp /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
- "!cp /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
- "!cp /content/drive/MyDrive/*.index /content/\n",
- "!cp /content/drive/MyDrive/*.npy /content/\n",
- "!cp /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "ZKAyuKb9J6dz"
- },
- "outputs": [],
- "source": [
- "# @title 手动预处理(不推荐)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 采样率\n",
- "BITRATE = 48000 # @param {type:\"integer\"}\n",
- "# @markdown 使用的进程数\n",
- "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
- "\n",
- "!python3 trainset_preprocess_pipeline_print.py /content/dataset {BITRATE} {THREADCOUNT} logs/{MODELNAME} True"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "CrxJqzAUKmPJ"
- },
- "outputs": [],
- "source": [
- "# @title 手动提取特征(不推荐)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 使用的进程数\n",
- "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
- "# @markdown 音高提取算法\n",
- "ALGO = \"harvest\" # @param {type:\"string\"}\n",
- "\n",
- "!python3 extract_f0_print.py logs/{MODELNAME} {THREADCOUNT} {ALGO}\n",
- "\n",
- "!python3 extract_feature_print.py cpu 1 0 0 logs/{MODELNAME} True"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "IMLPLKOaKj58"
- },
- "outputs": [],
- "source": [
- "# @title 手动训练(不推荐)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 使用的GPU\n",
- "USEGPU = \"0\" # @param {type:\"string\"}\n",
- "# @markdown 批大小\n",
- "BATCHSIZE = 32 # @param {type:\"integer\"}\n",
- "# @markdown 停止的epoch\n",
- "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
- "# @markdown 保存epoch间隔\n",
- "EPOCHSAVE = 100 # @param {type:\"integer\"}\n",
- "# @markdown 采样率\n",
- "MODELSAMPLE = \"48k\" # @param {type:\"string\"}\n",
- "# @markdown 是否缓存训练集\n",
- "CACHEDATA = 1 # @param {type:\"integer\"}\n",
- "# @markdown 是否仅保存最新的ckpt文件\n",
- "ONLYLATEST = 0 # @param {type:\"integer\"}\n",
- "\n",
- "!python3 train_nsf_sim_cache_sid_load_pretrain.py -e lulu -sr {MODELSAMPLE} -f0 1 -bs {BATCHSIZE} -g {USEGPU} -te {MODELEPOCH} -se {EPOCHSAVE} -pg pretrained/f0G{MODELSAMPLE}.pth -pd pretrained/f0D{MODELSAMPLE}.pth -l {ONLYLATEST} -c {CACHEDATA}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "haYA81hySuDl"
- },
- "outputs": [],
- "source": [
- "# @title 删除其它pth,只留选中的(慎点,仔细看代码)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 选中模型epoch\n",
- "MODELEPOCH = 9600 # @param {type:\"integer\"}\n",
- "\n",
- "!echo \"备份选中的模型。。。\"\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"正在删除。。。\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
- "!rm /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*.pth\n",
- "\n",
- "!echo \"恢复选中的模型。。。\"\n",
- "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
- "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"删除完成\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "QhSiPTVPoIRh"
- },
- "outputs": [],
- "source": [
- "# @title 清除项目下所有文件,只留选中的模型(慎点,仔细看代码)\n",
- "# @markdown 模型名\n",
- "MODELNAME = \"lulu\" # @param {type:\"string\"}\n",
- "# @markdown 选中模型epoch\n",
- "MODELEPOCH = 9600 # @param {type:\"integer\"}\n",
- "\n",
- "!echo \"备份选中的模型。。。\"\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
- "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"正在删除。。。\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
- "!rm -rf /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*\n",
- "\n",
- "!echo \"恢复选中的模型。。。\"\n",
- "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
- "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
- "\n",
- "!echo \"删除完成\"\n",
- "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
- ]
- }
- ],
- "metadata": {
- "accelerator": "GPU",
- "colab": {
- "private_outputs": true,
- "provenance": []
- },
- "gpuClass": "standard",
- "kernelspec": {
- "display_name": "Python 3",
- "name": "python3"
- },
- "language_info": {
- "name": "python"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/docs/en/README.en.md b/docs/en/README.en.md
index 4bbb7db..9908241 100644
--- a/docs/en/README.en.md
+++ b/docs/en/README.en.md
@@ -8,7 +8,8 @@ An easy-to-use Voice Conversion framework based on VITS.

-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/docs/fr/README.fr.md b/docs/fr/README.fr.md
index 1cb6180..d466c93 100644
--- a/docs/fr/README.fr.md
+++ b/docs/fr/README.fr.md
@@ -8,7 +8,8 @@ Un framework simple et facile à utiliser pour la conversion vocale (modificateu

-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/docs/jp/README.ja.md b/docs/jp/README.ja.md
index ef322a5..4b4c622 100644
--- a/docs/jp/README.ja.md
+++ b/docs/jp/README.ja.md
@@ -7,7 +7,8 @@ VITSに基づく使いやすい音声変換(voice changer)framework

-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/docs/kr/README.ko.han.md b/docs/kr/README.ko.han.md
index ff227b4..0273b61 100644
--- a/docs/kr/README.ko.han.md
+++ b/docs/kr/README.ko.han.md
@@ -8,7 +8,8 @@ VITS基盤의 簡單하고使用하기 쉬운音聲變換틀

-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/docs/kr/README.ko.md b/docs/kr/README.ko.md
index d86becc..2ee14b2 100644
--- a/docs/kr/README.ko.md
+++ b/docs/kr/README.ko.md
@@ -7,7 +7,8 @@ VITS 기반의 간단하고 사용하기 쉬운 음성 변환 프레임워크.
-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/docs/pt/README.pt.md b/docs/pt/README.pt.md
index bc31e60..4b8ec50 100644
--- a/docs/pt/README.pt.md
+++ b/docs/pt/README.pt.md
@@ -8,7 +8,8 @@ Uma estrutura de conversão de voz fácil de usar baseada em VITS.

-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/docs/tr/README.tr.md b/docs/tr/README.tr.md
index d90c68e..8f93d15 100644
--- a/docs/tr/README.tr.md
+++ b/docs/tr/README.tr.md
@@ -9,7 +9,8 @@ VITS'e dayalı kullanımı kolay bir Ses Dönüşümü çerçevesi.

-[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v1.ipynb)
+[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/ipynb/v2.ipynb)
[](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
diff --git a/gui_v1.py b/gui_v1.py
index b5b35d4..112fc0a 100644
--- a/gui_v1.py
+++ b/gui_v1.py
@@ -75,14 +75,11 @@ if __name__ == "__main__":
import json
import multiprocessing
import re
- import threading
import time
- import traceback
from multiprocessing import Queue, cpu_count
- from queue import Empty
import librosa
- from tools.torchgate import TorchGate
+ from infer.modules.gui import TorchGate
import numpy as np
import FreeSimpleGUI as sg
import sounddevice as sd
@@ -90,7 +87,7 @@ if __name__ == "__main__":
import torch.nn.functional as F
import torchaudio.transforms as tat
- import tools.rvc_for_realtime as rvc_for_realtime
+ import infer.lib.rtrvc as rtrvc
from i18n.i18n import I18nAuto
from configs.config import Config
@@ -688,7 +685,7 @@ if __name__ == "__main__":
def start_vc(self):
torch.cuda.empty_cache()
- self.rvc = rvc_for_realtime.RVC(
+ self.rvc = rtrvc.RVC(
self.gui_config.pitch,
self.gui_config.pth_path,
self.gui_config.index_path,
diff --git a/infer/lib/audio.py b/infer/lib/audio.py
index a371b07..9b55787 100644
--- a/infer/lib/audio.py
+++ b/infer/lib/audio.py
@@ -1,8 +1,7 @@
-import platform, os
+import platform
import ffmpeg
import numpy as np
import av
-from io import BytesIO
def wav2(i, o, format):
diff --git a/tools/rvc_for_realtime.py b/infer/lib/rtrvc.py
similarity index 96%
rename from tools/rvc_for_realtime.py
rename to infer/lib/rtrvc.py
index 9a7399c..aa5b86c 100644
--- a/tools/rvc_for_realtime.py
+++ b/infer/lib/rtrvc.py
@@ -1,6 +1,5 @@
from io import BytesIO
import os
-import pickle
import sys
import traceback
from infer.lib import jit
@@ -17,13 +16,6 @@ import torch.nn as nn
import torch.nn.functional as F
import torchcrepe
-from infer.lib.infer_pack.models import (
- SynthesizerTrnMs256NSFsid,
- SynthesizerTrnMs256NSFsid_nono,
- SynthesizerTrnMs768NSFsid,
- SynthesizerTrnMs768NSFsid_nono,
-)
-
now_dir = os.getcwd()
sys.path.append(now_dir)
from multiprocessing import Manager as M
diff --git a/tools/torchgate/__init__.py b/infer/modules/gui/__init__.py
similarity index 100%
rename from tools/torchgate/__init__.py
rename to infer/modules/gui/__init__.py
diff --git a/tools/torchgate/torchgate.py b/infer/modules/gui/torchgate.py
similarity index 100%
rename from tools/torchgate/torchgate.py
rename to infer/modules/gui/torchgate.py
diff --git a/tools/torchgate/utils.py b/infer/modules/gui/utils.py
similarity index 100%
rename from tools/torchgate/utils.py
rename to infer/modules/gui/utils.py
diff --git a/tools/calc_rvc_model_similarity.py b/tools/cmd/calc_rvc_model_similarity.py
similarity index 100%
rename from tools/calc_rvc_model_similarity.py
rename to tools/cmd/calc_rvc_model_similarity.py
diff --git a/tools/infer/infer-pm-index256.py b/tools/cmd/infer-pm-index256.py
similarity index 100%
rename from tools/infer/infer-pm-index256.py
rename to tools/cmd/infer-pm-index256.py
diff --git a/tools/infer_batch_rvc.py b/tools/cmd/infer_batch_rvc.py
similarity index 100%
rename from tools/infer_batch_rvc.py
rename to tools/cmd/infer_batch_rvc.py
diff --git a/tools/infer_cli.py b/tools/cmd/infer_cli.py
similarity index 100%
rename from tools/infer_cli.py
rename to tools/cmd/infer_cli.py
diff --git a/tools/infer/train-index-v2.py b/tools/cmd/train-index-v2.py
similarity index 100%
rename from tools/infer/train-index-v2.py
rename to tools/cmd/train-index-v2.py
diff --git a/tools/infer/train-index.py b/tools/cmd/train-index.py
similarity index 100%
rename from tools/infer/train-index.py
rename to tools/cmd/train-index.py
diff --git a/tools/infer/trans_weights.py b/tools/cmd/trans_weights.py
similarity index 100%
rename from tools/infer/trans_weights.py
rename to tools/cmd/trans_weights.py
diff --git a/tools/ipynb/v1.ipynb b/tools/ipynb/v1.ipynb
new file mode 100644
index 0000000..d4ef933
--- /dev/null
+++ b/tools/ipynb/v1.ipynb
@@ -0,0 +1,353 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "WHBMn6dOWm-S"
+ },
+ "source": [
+ "# [Retrieval-based-Voice-Conversion-WebUI](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) Training notebook"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "ZFFCx5J80SGa"
+ },
+ "source": [
+ "[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/colab/v1.ipynb)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "GmFP6bN9dvOq"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 查看显卡\n",
+ "!nvidia-smi"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "jwu07JgqoFON"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 挂载谷歌云盘\n",
+ "\n",
+ "from google.colab import drive\n",
+ "\n",
+ "drive.mount(\"/content/drive\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "wjddIFr1oS3W"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 安装依赖\n",
+ "!apt -y install build-essential python3-dev ffmpeg\n",
+ "!pip3 install --upgrade setuptools wheel\n",
+ "!pip3 install --upgrade pip"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "ge_97mfpgqTm"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 克隆仓库\n",
+ "\n",
+ "!git clone --depth=1 -b v1 https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI\n",
+ "%cd /content/Retrieval-based-Voice-Conversion-WebUI"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "BLDEZADkvlw1"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 安装依赖\n",
+ "!pip install -r requirements.txt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "pqE0PrnuRqI2"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 下载安装 RVC-Models-Downloader\n",
+ "!wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.1/rvcmd_linux_amd64.deb\n",
+ "!apt install ./rvcmd_linux_amd64.deb"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "UG3XpUwEomUz"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 下载所需资源\n",
+ "!rvcmd -notrs -w 1 -notui assets/v1\n",
+ "!rvcmd -notrs -w 1 -notui assets/rmvpe"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "Mwk7Q0Loqzjx"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 从谷歌云盘加载打包好的数据集到/content/dataset\n",
+ "\n",
+ "# @markdown 数据集位置\n",
+ "DATASET = \"/content/drive/MyDrive/mydataset.zip\" # @param {type:\"string\"}\n",
+ "\n",
+ "!mkdir -p /content/dataset\n",
+ "!unzip -d /content/dataset -B {DATASET}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "PDlFxWHWEynD"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 重命名数据集中的重名文件\n",
+ "!ls -a /content/dataset/\n",
+ "!rename 's/(\\w+)\\.(\\w+)~(\\d*)/$1_$3.$2/' /content/dataset/*.*~*"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "7vh6vphDwO0b"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 启动web\n",
+ "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
+ "# %load_ext tensorboard\n",
+ "# %tensorboard --logdir /content/Retrieval-based-Voice-Conversion-WebUI/logs\n",
+ "!python3 infer-web.py --colab --pycmd python3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "FgJuNeAwx5Y_"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 手动将训练后的模型文件备份到谷歌云盘\n",
+ "# @markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
+ "\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/added_*.index /content/drive/MyDrive/\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/total_*.npy /content/drive/MyDrive/\n",
+ "\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "OVQoLQJXS7WX"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 从谷歌云盘恢复pth\n",
+ "# @markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
+ "\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!mkdir -p /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
+ "\n",
+ "!cp /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
+ "!cp /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
+ "!cp /content/drive/MyDrive/*.index /content/\n",
+ "!cp /content/drive/MyDrive/*.npy /content/\n",
+ "!cp /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "ZKAyuKb9J6dz"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 手动预处理(不推荐)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 采样率\n",
+ "BITRATE = 48000 # @param {type:\"integer\"}\n",
+ "# @markdown 使用的进程数\n",
+ "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
+ "\n",
+ "!python3 trainset_preprocess_pipeline_print.py /content/dataset {BITRATE} {THREADCOUNT} logs/{MODELNAME} True"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "CrxJqzAUKmPJ"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 手动提取特征(不推荐)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 使用的进程数\n",
+ "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
+ "# @markdown 音高提取算法\n",
+ "ALGO = \"harvest\" # @param {type:\"string\"}\n",
+ "\n",
+ "!python3 extract_f0_print.py logs/{MODELNAME} {THREADCOUNT} {ALGO}\n",
+ "\n",
+ "!python3 extract_feature_print.py cpu 1 0 0 logs/{MODELNAME} True"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "IMLPLKOaKj58"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 手动训练(不推荐)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 使用的GPU\n",
+ "USEGPU = \"0\" # @param {type:\"string\"}\n",
+ "# @markdown 批大小\n",
+ "BATCHSIZE = 32 # @param {type:\"integer\"}\n",
+ "# @markdown 停止的epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "# @markdown 保存epoch间隔\n",
+ "EPOCHSAVE = 100 # @param {type:\"integer\"}\n",
+ "# @markdown 采样率\n",
+ "MODELSAMPLE = \"48k\" # @param {type:\"string\"}\n",
+ "# @markdown 是否缓存训练集\n",
+ "CACHEDATA = 1 # @param {type:\"integer\"}\n",
+ "# @markdown 是否仅保存最新的ckpt文件\n",
+ "ONLYLATEST = 0 # @param {type:\"integer\"}\n",
+ "\n",
+ "!python3 train_nsf_sim_cache_sid_load_pretrain.py -e lulu -sr {MODELSAMPLE} -f0 1 -bs {BATCHSIZE} -g {USEGPU} -te {MODELEPOCH} -se {EPOCHSAVE} -pg pretrained/f0G{MODELSAMPLE}.pth -pd pretrained/f0D{MODELSAMPLE}.pth -l {ONLYLATEST} -c {CACHEDATA}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "haYA81hySuDl"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 删除其它pth,只留选中的(慎点,仔细看代码)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 选中模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!echo \"备份选中的模型。。。\"\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"正在删除。。。\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
+ "!rm /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*.pth\n",
+ "\n",
+ "!echo \"恢复选中的模型。。。\"\n",
+ "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
+ "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"删除完成\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "QhSiPTVPoIRh"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 清除项目下所有文件,只留选中的模型(慎点,仔细看代码)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 选中模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!echo \"备份选中的模型。。。\"\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"正在删除。。。\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
+ "!rm -rf /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*\n",
+ "\n",
+ "!echo \"恢复选中的模型。。。\"\n",
+ "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
+ "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"删除完成\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
+ ]
+ }
+ ],
+ "metadata": {
+ "colab": {
+ "private_outputs": true,
+ "provenance": []
+ },
+ "kernelspec": {
+ "display_name": "Python 3",
+ "name": "python3"
+ },
+ "language_info": {
+ "name": "python"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/tools/ipynb/v2.ipynb b/tools/ipynb/v2.ipynb
new file mode 100644
index 0000000..1275311
--- /dev/null
+++ b/tools/ipynb/v2.ipynb
@@ -0,0 +1,352 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "QTSdqTqGcbyr"
+ },
+ "source": [
+ "# [Retrieval-based-Voice-Conversion-WebUI](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) Training notebook"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "ZFFCx5J80SGa"
+ },
+ "source": [
+ "[](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/tools/colab/v2.ipynb)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "GmFP6bN9dvOq"
+ },
+ "outputs": [],
+ "source": [
+ "# @title #查看显卡\n",
+ "!nvidia-smi"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "jwu07JgqoFON"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 挂载谷歌云盘\n",
+ "\n",
+ "from google.colab import drive\n",
+ "\n",
+ "drive.mount(\"/content/drive\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "wjddIFr1oS3W"
+ },
+ "outputs": [],
+ "source": [
+ "# @title #安装依赖\n",
+ "!apt -y install build-essential python3-dev ffmpeg\n",
+ "!pip3 install --upgrade setuptools wheel\n",
+ "!pip3 install --upgrade pip"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "ge_97mfpgqTm"
+ },
+ "outputs": [],
+ "source": [
+ "# @title #克隆仓库\n",
+ "\n",
+ "!git clone --depth=1 -b v2.2 https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI\n",
+ "%cd /content/Retrieval-based-Voice-Conversion-WebUI"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "BLDEZADkvlw1"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 安装依赖\n",
+ "!pip install -r requirements.txt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "pqE0PrnuRqI2"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 下载安装 RVC-Models-Downloader\n",
+ "!wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.1/rvcmd_linux_amd64.deb\n",
+ "!apt install ./rvcmd_linux_amd64.deb"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "UG3XpUwEomUz"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 下载所需资源\n",
+ "!rvcmd -notrs -w 1 -notui assets/all"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "Mwk7Q0Loqzjx"
+ },
+ "outputs": [],
+ "source": [
+ "# @title #从谷歌云盘加载打包好的数据集到/content/dataset\n",
+ "\n",
+ "# @markdown 数据集位置\n",
+ "DATASET = \"/content/drive/MyDrive/mydataset.zip\" # @param {type:\"string\"}\n",
+ "\n",
+ "!mkdir -p /content/dataset\n",
+ "!unzip -d /content/dataset -B {DATASET}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "PDlFxWHWEynD"
+ },
+ "outputs": [],
+ "source": [
+ "# @title #重命名数据集中的重名文件\n",
+ "!ls -a /content/dataset/\n",
+ "!rename 's/(\\w+)\\.(\\w+)~(\\d*)/$1_$3.$2/' /content/dataset/*.*~*"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "7vh6vphDwO0b"
+ },
+ "outputs": [],
+ "source": [
+ "# @title #启动webui\n",
+ "%cd /content/Retrieval-based-Voice-Conversion-WebUI\n",
+ "# %load_ext tensorboard\n",
+ "# %tensorboard --logdir /content/Retrieval-based-Voice-Conversion-WebUI/logs\n",
+ "!python3 infer-web.py --colab --pycmd python3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "FgJuNeAwx5Y_"
+ },
+ "outputs": [],
+ "source": [
+ "# @title #手动将训练后的模型文件备份到谷歌云盘\n",
+ "# @markdown #需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
+ "\n",
+ "# @markdown #模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown #模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/added_*.index /content/drive/MyDrive/\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/total_*.npy /content/drive/MyDrive/\n",
+ "\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "OVQoLQJXS7WX"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 从谷歌云盘恢复pth\n",
+ "# @markdown 需要自己查看logs文件夹下模型的文件名,手动修改下方命令末尾的文件名\n",
+ "\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!mkdir -p /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
+ "\n",
+ "!cp /content/drive/MyDrive/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
+ "!cp /content/drive/MyDrive/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
+ "!cp /content/drive/MyDrive/*.index /content/\n",
+ "!cp /content/drive/MyDrive/*.npy /content/\n",
+ "!cp /content/drive/MyDrive/{MODELNAME}{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/weights/{MODELNAME}.pth"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "ZKAyuKb9J6dz"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 手动预处理(不推荐)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 采样率\n",
+ "BITRATE = 48000 # @param {type:\"integer\"}\n",
+ "# @markdown 使用的进程数\n",
+ "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
+ "\n",
+ "!python3 trainset_preprocess_pipeline_print.py /content/dataset {BITRATE} {THREADCOUNT} logs/{MODELNAME} True"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "CrxJqzAUKmPJ"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 手动提取特征(不推荐)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 使用的进程数\n",
+ "THREADCOUNT = 8 # @param {type:\"integer\"}\n",
+ "# @markdown 音高提取算法\n",
+ "ALGO = \"harvest\" # @param {type:\"string\"}\n",
+ "\n",
+ "!python3 extract_f0_print.py logs/{MODELNAME} {THREADCOUNT} {ALGO}\n",
+ "\n",
+ "!python3 extract_feature_print.py cpu 1 0 0 logs/{MODELNAME} True"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "IMLPLKOaKj58"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 手动训练(不推荐)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 使用的GPU\n",
+ "USEGPU = \"0\" # @param {type:\"string\"}\n",
+ "# @markdown 批大小\n",
+ "BATCHSIZE = 32 # @param {type:\"integer\"}\n",
+ "# @markdown 停止的epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "# @markdown 保存epoch间隔\n",
+ "EPOCHSAVE = 100 # @param {type:\"integer\"}\n",
+ "# @markdown 采样率\n",
+ "MODELSAMPLE = \"48k\" # @param {type:\"string\"}\n",
+ "# @markdown 是否缓存训练集\n",
+ "CACHEDATA = 1 # @param {type:\"integer\"}\n",
+ "# @markdown 是否仅保存最新的ckpt文件\n",
+ "ONLYLATEST = 0 # @param {type:\"integer\"}\n",
+ "\n",
+ "!python3 train_nsf_sim_cache_sid_load_pretrain.py -e lulu -sr {MODELSAMPLE} -f0 1 -bs {BATCHSIZE} -g {USEGPU} -te {MODELEPOCH} -se {EPOCHSAVE} -pg pretrained/f0G{MODELSAMPLE}.pth -pd pretrained/f0D{MODELSAMPLE}.pth -l {ONLYLATEST} -c {CACHEDATA}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "haYA81hySuDl"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 删除其它pth,只留选中的(慎点,仔细看代码)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 选中模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!echo \"备份选中的模型。。。\"\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"正在删除。。。\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
+ "!rm /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*.pth\n",
+ "\n",
+ "!echo \"恢复选中的模型。。。\"\n",
+ "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
+ "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"删除完成\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "QhSiPTVPoIRh"
+ },
+ "outputs": [],
+ "source": [
+ "# @title 清除项目下所有文件,只留选中的模型(慎点,仔细看代码)\n",
+ "# @markdown 模型名\n",
+ "MODELNAME = \"mymodel\" # @param {type:\"string\"}\n",
+ "# @markdown 选中模型epoch\n",
+ "MODELEPOCH = 3200 # @param {type:\"integer\"}\n",
+ "\n",
+ "!echo \"备份选中的模型。。。\"\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth /content/{MODELNAME}_D_{MODELEPOCH}.pth\n",
+ "!cp /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth /content/{MODELNAME}_G_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"正在删除。。。\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}\n",
+ "!rm -rf /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/*\n",
+ "\n",
+ "!echo \"恢复选中的模型。。。\"\n",
+ "!mv /content/{MODELNAME}_D_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/G_{MODELEPOCH}.pth\n",
+ "!mv /content/{MODELNAME}_G_{MODELEPOCH}.pth /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}/D_{MODELEPOCH}.pth\n",
+ "\n",
+ "!echo \"删除完成\"\n",
+ "!ls /content/Retrieval-based-Voice-Conversion-WebUI/logs/{MODELNAME}"
+ ]
+ }
+ ],
+ "metadata": {
+ "colab": {
+ "private_outputs": true,
+ "provenance": []
+ },
+ "kernelspec": {
+ "display_name": "Python 3",
+ "name": "python3"
+ },
+ "language_info": {
+ "name": "python"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/tools/export_onnx.py b/tools/onnx/export_onnx.py
similarity index 100%
rename from tools/export_onnx.py
rename to tools/onnx/export_onnx.py
diff --git a/tools/onnx_inference_demo.py b/tools/onnx/onnx_inference_demo.py
similarity index 89%
rename from tools/onnx_inference_demo.py
rename to tools/onnx/onnx_inference_demo.py
index 5ba12ae..67f4371 100644
--- a/tools/onnx_inference_demo.py
+++ b/tools/onnx/onnx_inference_demo.py
@@ -1,6 +1,6 @@
import soundfile
-from ..infer.lib.infer_pack.onnx_inference import OnnxRVC
+from infer.lib.infer_pack.onnx_inference import OnnxRVC
hop_size = 512
sampling_rate = 40000 # 采样率
diff --git a/tools/app.py b/tools/web/infer-only.py
similarity index 100%
rename from tools/app.py
rename to tools/web/infer-only.py
diff --git a/venv.sh b/venv.sh
deleted file mode 100755
index 577283b..0000000
--- a/venv.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-python3.8 -m venv .venv