Commit ·
7b48653
1
Parent(s): fe851cc
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .github/workflows/genlocale.ymlAdded+32
- .github/workflows/pull_format.ymlAdded+35
- .github/workflows/push_format.ymlAdded+46
- .github/workflows/unitest.ymlAdded+36
- .gitignoreAdded+6
- Changelog_CN.mdAdded+35
- LICENSEAdded+21
- README.md+110-8
- Retrieval_based_Voice_Conversion_WebUI.ipynbAdded+381
- __pycache__/config.cpython-310.pycAdded
- __pycache__/i18n.cpython-310.pycAdded
- __pycache__/infer_uvr5.cpython-310.pycAdded
- __pycache__/my_utils.cpython-310.pycAdded
- __pycache__/vc_infer_pipeline.cpython-310.pycAdded
- config.pyAdded+117
- configs/32k.jsonAdded+46
- configs/40k.jsonAdded+46
- configs/48k.jsonAdded+46
- docs/README.en.mdAdded+102
- docs/README.ja.mdAdded+106
- docs/README.ko.han.mdAdded+102
- docs/README.ko.mdAdded+102
- docs/faiss_tips_en.mdAdded+102
- docs/faiss_tips_ja.mdAdded+101
- docs/faiss_tips_ko.mdAdded+132
- docs/training_tips_en.mdAdded+65
- docs/training_tips_ja.mdAdded+64
- docs/training_tips_ko.mdAdded+53
- docs/小白简易教程.docAdded
- envfilescheck.batAdded+230
- export_onnx.pyAdded+85
- export_onnx_old.pyAdded+47
- extract_f0_print.pyAdded+160
- extract_feature_print.pyAdded+104
- extract_locale.pyAdded+31
- go-realtime-gui.batAdded+2
- go-web.batAdded+2
- gui.pyAdded+570
- hubert_base.ptAdded+3
- i18n.pyAdded+25
- i18n/en_US.jsonAdded+115
- i18n/es_ES.jsonAdded+115
- i18n/ja_JP.jsonAdded+115
- i18n/locale_diff.pyAdded+45
- i18n/zh_CN.jsonAdded+115
- i18n/zh_HK.jsonAdded+115
- i18n/zh_SG.jsonAdded+115
- i18n/zh_TW.jsonAdded+115
- infer-web.pyAdded+1547
- infer/infer-pm-index256.pyAdded+199
1234567891011121314151617181920212223242526272829303132name: genlocaleon: push: branches: - mainjobs: golangci: name: genlocale runs-on: ubuntu-latest steps: - name: Check out uses: actions/checkout@master
- name: Run locale generation run: | python3 extract_locale.py cd i18n && python3 locale_diff.py
- name: Commit back if: ${{ !github.head_ref }} continue-on-error: true run: | git config --local user.name 'github-actions[bot]' git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com' git add --all git commit -m "🎨 同步 locale"
- name: Create Pull Request if: ${{ !github.head_ref }} continue-on-error: true uses: peter-evans/create-pull-request@v4 1234567891011121314151617181920212223242526272829303132333435name: pull format
on: [pull_request]
permissions: contents: writejobs: pull_format: runs-on: ubuntu-latest continue-on-error: true steps: - name: checkout continue-on-error: true uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }}
- name: Install Black run: pip install black
- name: Run Black # run: black $(git ls-files '*.py') run: black .
- name: Commit Back uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Apply Code Formatter Change12345678910111213141516171819202122232425262728293031323334353637383940414243444546name: push format
on: push: branches: - main
permissions: contents: write pull-requests: writejobs: push_format: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: ref: ${{github.ref_name}}
- name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }}
- name: Install Black run: pip install black
- name: Run Black # run: black $(git ls-files '*.py') run: black .
- name: Commit Back continue-on-error: true id: commitback run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add --all git commit -m "Format code" - name: Create Pull Request if: steps.commitback.outcome == 'success' continue-on-error: true uses: peter-evans/create-pull-request@v4 with: body: Apply Code Formatter Change commit-message: Automatic code format123456789101112131415161718192021222324252627282930313233343536name: uniteston: [ push, pull_request ]jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: python-version: ["3.8", "3.9", "3.10"] os: [ubuntu-latest] fail-fast: false
steps: - uses: actions/checkout@master - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | sudo apt update sudo apt -y install ffmpeg sudo apt -y install -qq aria2 aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d ./ -o hubert_base.pt python -m pip install --upgrade pip python -m pip install --upgrade setuptools python -m pip install --upgrade wheel pip install torch torchvision torchaudio pip install -r requirements.txt - name: Test step 1 & 2 run: | mkdir -p logs/mi-test touch logs/mi-test/preprocess.log python trainset_preprocess_pipeline_print.py logs/mute/0_gt_wavs 48000 8 logs/mi-test True touch logs/mi-test/extract_f0_feature.log python extract_f0_print.py logs/mi-test $(nproc) pm python extract_feature_print.py cpu 1 0 0 logs/mi-test123456.DS_Store__pycache__/TEMP*.pydhubert_base.pt/logs1234567891011121314151617181920212223242526272829303132333435### 20230409- 修正训练参数,提升显卡平均利用率,A100最高从25%提升至90%左右,V100:50%->90%左右,2060S:60%->85%左右,P40:25%->95%左右,训练速度显著提升- 修正参数:总batch_size改为每张卡的batch_size- 修正total_epoch:最大限制100解锁至1000;默认10提升至默认20- 修复ckpt提取识别是否带音高错误导致推理异常的问题- 修复分布式训练每个rank都保存一次ckpt的问题- 特征提取进行nan特征过滤- 修复静音输入输出随机辅音or噪声的问题(老版模型需要重做训练集重训)
### 20230416更新- 新增本地实时变声迷你GUI,双击go-realtime-gui.bat启动- 训练推理均对<50Hz的频段进行滤波过滤- 训练推理音高提取pyworld最低音高从默认80下降至50,50-80hz间的男声低音不会哑- WebUI支持根据系统区域变更语言(现支持en_US,ja_JP,zh_CN,zh_HK,zh_SG,zh_TW,不支持的默认en_US)- 修正部分显卡识别(例如V100-16G识别失败,P4识别失败)
### 20230428更新- 升级faiss索引设置,速度更快,质量更高- 取消total_npy依赖,后续分享模型不再需要填写total_npy- 解锁16系限制。4G显存GPU给到4G的推理设置。- 修复部分音频格式下UVR5人声伴奏分离的bug- 实时变声迷你gui增加对非40k与不懈怠音高模型的支持
### 后续计划:功能:- 增加选项:每次epoch保存的小模型均进行提取- 增加选项:推理额外导出mp3至填写的路径- 支持多人训练选项卡(至多4人)- 底模:- 收集呼吸wav加入训练集修正呼吸变声电音的问题- 我们正在训练增加了歌声训练集的底模,未来会公开- 升级鉴别器- 升级自监督特征结构123456789101112131415161718192021MIT License
Copyright (c) 2023 liujing04
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.123452347895678129101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114---title: Retrieval Based Voice Conversion WebUIemoji: 🐢colorFrom: redcolorTo: bluetitle: Retrieval-based-Voice-Conversion-WebUIapp_file: infer-web.pysdk: gradiosdk_version: 3.35.2app_file: app.pypinned: falsesdk_version: 3.34.0---<div align="center">
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference<h1>Retrieval-based-Voice-Conversion-WebUI</h1>一个基于VITS的简单易用的语音转换(变声器)框架<br><br>
[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI)
<img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br>
[](https://colab.research.google.com/github/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/%E4%BD%BF%E7%94%A8%E9%9C%80%E9%81%B5%E5%AE%88%E7%9A%84%E5%8D%8F%E8%AE%AE-LICENSE.txt)[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
[](https://discord.gg/HcsmBBGyVk)
</div>
------
[**更新日志**](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Changelog_CN.md)
[**English**](./docs/README.en.md) | [**中文简体**](./README.md) | [**日本語**](./docs/README.ja.md) | [**한국어**](./docs/README.ko.md) ([**韓國語**](./docs/README.ko.han.md))
> 点此查看我们的[演示视频](https://www.bilibili.com/video/BV1pm4y1z7Gm/) !
> 使用了RVC的实时语音转换: [w-okada/voice-changer](https://github.com/w-okada/voice-changer)
> 底模使用接近50小时的开源高质量VCTK训练集训练,无版权方面的顾虑,请大家放心使用
> 后续会陆续加入高质量有授权歌声训练集训练底模
## 简介本仓库具有以下特点+ 使用top1检索替换输入源特征为训练集特征来杜绝音色泄漏+ 即便在相对较差的显卡上也能快速训练+ 使用少量数据进行训练也能得到较好结果(推荐至少收集10分钟低底噪语音数据)+ 可以通过模型融合来改变音色(借助ckpt处理选项卡中的ckpt-merge)+ 简单易用的网页界面+ 可调用UVR5模型来快速分离人声和伴奏
## 环境配置推荐使用poetry配置环境。
以下指令需在Python版本大于3.8的环境中执行:```bash# 安装Pytorch及其核心依赖,若已安装则跳过# 参考自: https://pytorch.org/get-started/locally/pip install torch torchvision torchaudio
#如果是win系统+Nvidia Ampere架构(RTX30xx),根据 #21 的经验,需要指定pytorch对应的cuda版本#pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
# 安装 Poetry 依赖管理工具, 若已安装则跳过# 参考自: https://python-poetry.org/docs/#installationcurl -sSL https://install.python-poetry.org | python3 -
# 通过poetry安装依赖poetry install```
你也可以通过pip来安装依赖:
**注意**: `MacOS`下`faiss 1.7.2`版本会导致抛出段错误,在手动安装时请使用命令`pip install faiss-cpu==1.7.0`指定使用`1.7.0`版本
```bashpip install -r requirements.txt```
## 其他预模型准备RVC需要其他一些预模型来推理和训练。
你可以从我们的[Hugging Face space](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)下载到这些模型。
以下是一份清单,包括了所有RVC所需的预模型和其他文件的名称:```bashhubert_base.pt
./pretrained
./uvr5_weights
#如果你正在使用Windows,则你可能需要这个文件,若ffmpeg和ffprobe已安装则跳过; ubuntu/debian 用户可以通过apt install ffmpeg来安装这2个库./ffmpeg
./ffprobe```之后使用以下指令来启动WebUI:```bashpython infer-web.py```如果你正在使用Windows,你可以直接下载并解压`RVC-beta.7z`,运行`go-web.bat`以启动WebUI。
仓库内还有一份`小白简易教程.doc`以供参考。
## 参考项目+ [ContentVec](https://github.com/auspicious3000/contentvec/)+ [VITS](https://github.com/jaywalnut310/vits)+ [HIFIGAN](https://github.com/jik876/hifi-gan)+ [Gradio](https://github.com/gradio-app/gradio)+ [FFmpeg](https://github.com/FFmpeg/FFmpeg)+ [Ultimate Vocal Remover](https://github.com/Anjok07/ultimatevocalremovergui)+ [audio-slicer](https://github.com/openvpi/audio-slicer)
## 感谢所有贡献者作出的努力<a href="https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank"> <img src="https://contrib.rocks/image?repo=liujing04/Retrieval-based-Voice-Conversion-WebUI" /></a>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "private_outputs": true, "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU", "gpuClass": "standard" }, "cells": [ { "cell_type": "markdown", "source": [ "[](https://colab.research.google.com/github/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)" ], "metadata": { "id": "ZFFCx5J80SGa" } }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "GmFP6bN9dvOq" }, "outputs": [], "source": [ "#@title 查看显卡\n", "!nvidia-smi" ] }, { "cell_type": "code", "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-gpu fairseq gradio ffmpeg ffmpeg-python praat-parselmouth pyworld numpy==1.23.5 numba==0.56.4 librosa==0.9.2" ], "metadata": { "id": "wjddIFr1oS3W" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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" ], "metadata": { "id": "ge_97mfpgqTm" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#@title 更新仓库(一般无需执行)\n", "!git pull" ], "metadata": { "id": "BLDEZADkvlw1" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#@title 安装aria2\n", "!apt -y install -qq aria2" ], "metadata": { "id": "pqE0PrnuRqI2" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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" ], "metadata": { "id": "UG3XpUwEomUz" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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" ], "metadata": { "id": "HugjmZqZRuiF" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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" ], "metadata": { "id": "2RCaT9FTR0ej" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#@title 挂载谷歌云盘\n", "\n", "from google.colab import drive\n", "drive.mount('/content/drive')" ], "metadata": { "id": "jwu07JgqoFON" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#@title 从谷歌云盘加载打包好的数据集到/content/dataset\n", "\n", "#@markdown 数据集位置\n", "DATASET = \"/content/drive/MyDrive/dataset/lulu20230327_32k.zip\" #@param {type:\"string\"}\n", "\n", "!mkdir -p /content/dataset\n", "!unzip -d /content/dataset -B {DATASET}" ], "metadata": { "id": "Mwk7Q0Loqzjx" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#@title 重命名数据集中的重名文件\n", "!ls -a /content/dataset/\n", "!rename 's/(\\w+)\\.(\\w+)~(\\d*)/$1_$3.$2/' /content/dataset/*.*~*" ], "metadata": { "id": "PDlFxWHWEynD" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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" ], "metadata": { "id": "7vh6vphDwO0b" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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" ], "metadata": { "id": "FgJuNeAwx5Y_" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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" ], "metadata": { "id": "OVQoLQJXS7WX" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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\n" ], "metadata": { "id": "ZKAyuKb9J6dz" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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}\n" ], "metadata": { "id": "CrxJqzAUKmPJ" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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}\n" ], "metadata": { "id": "IMLPLKOaKj58" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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}" ], "metadata": { "id": "haYA81hySuDl" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "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": { "id": "QhSiPTVPoIRh" }, "execution_count": null, "outputs": [] } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117import argparseimport globimport sysimport torchfrom multiprocessing import cpu_count
class Config: def __init__(self): self.device = "cuda:0" self.is_half = True self.n_cpu = 0 self.gpu_name = None self.gpu_mem = None ( self.python_cmd, self.listen_port, self.iscolab, self.noparallel, self.noautoopen, ) = self.arg_parse() self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
def arg_parse(self) -> tuple: parser = argparse.ArgumentParser() parser.add_argument("--port", type=int, default=7865, help="Listen port") parser.add_argument( "--pycmd", type=str, default="python", help="Python command" ) parser.add_argument("--colab", action="store_true", help="Launch in colab") parser.add_argument( "--noparallel", action="store_true", help="Disable parallel processing" ) parser.add_argument( "--noautoopen", action="store_true", help="Do not open in browser automatically", ) cmd_opts = parser.parse_args()
cmd_opts.port = cmd_opts.port if 0 <= cmd_opts.port <= 65535 else 7865
return ( cmd_opts.pycmd, cmd_opts.port, cmd_opts.colab, cmd_opts.noparallel, cmd_opts.noautoopen, )
def device_config(self) -> tuple: if torch.cuda.is_available(): i_device = int(self.device.split(":")[-1]) self.gpu_name = torch.cuda.get_device_name(i_device) if ( ("16" in self.gpu_name and "V100" not in self.gpu_name.upper()) or "P40" in self.gpu_name.upper() or "1060" in self.gpu_name or "1070" in self.gpu_name or "1080" in self.gpu_name ): print("16系/10系显卡和P40强制单精度") self.is_half = False for config_file in ["32k.json", "40k.json", "48k.json"]: with open(f"configs/{config_file}", "r") as f: strr = f.read().replace("true", "false") with open(f"configs/{config_file}", "w") as f: f.write(strr) with open("trainset_preprocess_pipeline_print.py", "r") as f: strr = f.read().replace("3.7", "3.0") with open("trainset_preprocess_pipeline_print.py", "w") as f: f.write(strr) else: self.gpu_name = None self.gpu_mem = int( torch.cuda.get_device_properties(i_device).total_memory / 1024 / 1024 / 1024 + 0.4 ) if self.gpu_mem <= 4: with open("trainset_preprocess_pipeline_print.py", "r") as f: strr = f.read().replace("3.7", "3.0") with open("trainset_preprocess_pipeline_print.py", "w") as f: f.write(strr) elif torch.backends.mps.is_available(): print("没有发现支持的N卡, 使用MPS进行推理") self.device = "mps" else: print("没有发现支持的N卡, 使用CPU进行推理") self.device = "cpu" self.is_half = True
if self.n_cpu == 0: self.n_cpu = cpu_count()
if self.is_half: # 6G显存配置 x_pad = 3 x_query = 10 x_center = 60 x_max = 65 else: # 5G显存配置 x_pad = 1 x_query = 6 x_center = 38 x_max = 41
if self.gpu_mem != None and self.gpu_mem <= 4: x_pad = 1 x_query = 5 x_center = 30 x_max = 32
return x_pad, x_query, x_center, x_max12345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "train": { "log_interval": 200, "seed": 1234, "epochs": 20000, "learning_rate": 1e-4, "betas": [0.8, 0.99], "eps": 1e-9, "batch_size": 4, "fp16_run": true, "lr_decay": 0.999875, "segment_size": 12800, "init_lr_ratio": 1, "warmup_epochs": 0, "c_mel": 45, "c_kl": 1.0 }, "data": { "max_wav_value": 32768.0, "sampling_rate": 32000, "filter_length": 1024, "hop_length": 320, "win_length": 1024, "n_mel_channels": 80, "mel_fmin": 0.0, "mel_fmax": null }, "model": { "inter_channels": 192, "hidden_channels": 192, "filter_channels": 768, "n_heads": 2, "n_layers": 6, "kernel_size": 3, "p_dropout": 0, "resblock": "1", "resblock_kernel_sizes": [3,7,11], "resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]], "upsample_rates": [10,4,2,2,2], "upsample_initial_channel": 512, "upsample_kernel_sizes": [16,16,4,4,4], "use_spectral_norm": false, "gin_channels": 256, "spk_embed_dim": 109 }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "train": { "log_interval": 200, "seed": 1234, "epochs": 20000, "learning_rate": 1e-4, "betas": [0.8, 0.99], "eps": 1e-9, "batch_size": 4, "fp16_run": true, "lr_decay": 0.999875, "segment_size": 12800, "init_lr_ratio": 1, "warmup_epochs": 0, "c_mel": 45, "c_kl": 1.0 }, "data": { "max_wav_value": 32768.0, "sampling_rate": 40000, "filter_length": 2048, "hop_length": 400, "win_length": 2048, "n_mel_channels": 125, "mel_fmin": 0.0, "mel_fmax": null }, "model": { "inter_channels": 192, "hidden_channels": 192, "filter_channels": 768, "n_heads": 2, "n_layers": 6, "kernel_size": 3, "p_dropout": 0, "resblock": "1", "resblock_kernel_sizes": [3,7,11], "resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]], "upsample_rates": [10,10,2,2], "upsample_initial_channel": 512, "upsample_kernel_sizes": [16,16,4,4], "use_spectral_norm": false, "gin_channels": 256, "spk_embed_dim": 109 }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "train": { "log_interval": 200, "seed": 1234, "epochs": 20000, "learning_rate": 1e-4, "betas": [0.8, 0.99], "eps": 1e-9, "batch_size": 4, "fp16_run": true, "lr_decay": 0.999875, "segment_size": 11520, "init_lr_ratio": 1, "warmup_epochs": 0, "c_mel": 45, "c_kl": 1.0 }, "data": { "max_wav_value": 32768.0, "sampling_rate": 48000, "filter_length": 2048, "hop_length": 480, "win_length": 2048, "n_mel_channels": 128, "mel_fmin": 0.0, "mel_fmax": null }, "model": { "inter_channels": 192, "hidden_channels": 192, "filter_channels": 768, "n_heads": 2, "n_layers": 6, "kernel_size": 3, "p_dropout": 0, "resblock": "1", "resblock_kernel_sizes": [3,7,11], "resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]], "upsample_rates": [10,6,2,2,2], "upsample_initial_channel": 512, "upsample_kernel_sizes": [16,16,4,4,4], "use_spectral_norm": false, "gin_channels": 256, "spk_embed_dim": 109 }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102<div align="center">
<h1>Retrieval-based-Voice-Conversion-WebUI</h1>An easy-to-use SVC framework based on VITS.<br><br>
[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI) <img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br> [](https://colab.research.google.com/github/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/%E4%BD%BF%E7%94%A8%E9%9C%80%E9%81%B5%E5%AE%88%E7%9A%84%E5%8D%8F%E8%AE%AE-LICENSE.txt)[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
[](https://discord.gg/HcsmBBGyVk)
</div>
------[**Changelog**](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Changelog_CN.md)
[**English**](./README.en.md) | [**中文简体**](../README.md) | [**日本語**](./README.ja.md) | [**한국어**](./README.ko.md) ([**韓國語**](./README.ko.han.md))
> Check our [Demo Video](https://www.bilibili.com/video/BV1pm4y1z7Gm/) here!
> Realtime Voice Conversion Software using RVC : [w-okada/voice-changer](https://github.com/w-okada/voice-changer)
> The dataset for the pre-training model uses nearly 50 hours of high quality VCTK open source dataset.
> High quality licensed song datasets will be added to training-set one after another for your use, without worrying about copyright infringement.## SummaryThis repository has the following features:+ Reduce tone leakage by replacing source feature to training-set feature using top1 retrieval;+ Easy and fast training, even on relatively poor graphics cards;+ Training with a small amount of data also obtains relatively good results (>=10min low noise speech recommended);+ Supporting model fusion to change timbres (using ckpt processing tab->ckpt merge);+ Easy-to-use Webui interface;+ Use the UVR5 model to quickly separate vocals and instruments.## Preparing the environmentWe recommend you install the dependencies through poetry.
The following commands need to be executed in the environment of Python version 3.8 or higher:```bash# Install PyTorch-related core dependencies, skip if installed# Reference: https://pytorch.org/get-started/locally/pip install torch torchvision torchaudio
#For Windows + Nvidia Ampere Architecture(RTX30xx), you need to specify the cuda version corresponding to pytorch according to the experience of https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/issues/21#pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
# Install the Poetry dependency management tool, skip if installed# Reference: https://python-poetry.org/docs/#installationcurl -sSL https://install.python-poetry.org | python3 -
# Install the project dependenciespoetry install```You can also use pip to install the dependencies
**Notice**: `faiss 1.7.2` will raise Segmentation Fault: 11 under `MacOS`, please use `pip install faiss-cpu==1.7.0` if you use pip to install it manually.
```bashpip install -r requirements.txt```
## Preparation of other Pre-modelsRVC requires other pre-models to infer and train.
You need to download them from our [Huggingface space](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/).
Here's a list of Pre-models and other files that RVC needs:```bashhubert_base.pt
./pretrained
./uvr5_weights
#If you are using Windows, you may also need this dictionary, skip if FFmpeg is installedffmpeg.exe```Then use this command to start Webui:```bashpython infer-web.py```If you are using Windows, you can download and extract `RVC-beta.7z` to use RVC directly and use `go-web.bat` to start Webui.
There's also a tutorial on RVC in Chinese and you can check it out if needed.
## Credits+ [ContentVec](https://github.com/auspicious3000/contentvec/)+ [VITS](https://github.com/jaywalnut310/vits)+ [HIFIGAN](https://github.com/jik876/hifi-gan)+ [Gradio](https://github.com/gradio-app/gradio)+ [FFmpeg](https://github.com/FFmpeg/FFmpeg)+ [Ultimate Vocal Remover](https://github.com/Anjok07/ultimatevocalremovergui)+ [audio-slicer](https://github.com/openvpi/audio-slicer)## Thanks to all contributors for their efforts
<a href="https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank"> <img src="https://contrib.rocks/image?repo=liujing04/Retrieval-based-Voice-Conversion-WebUI" /></a>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106<div align="center">
<h1>Retrieval-based-Voice-Conversion-WebUI</h1>VITSに基づく使いやすい音声変換(voice changer)framework<br><br>
[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI)
<img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br>
[](https://colab.research.google.com/github/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/%E4%BD%BF%E7%94%A8%E9%9C%80%E9%81%B5%E5%AE%88%E7%9A%84%E5%8D%8F%E8%AE%AE-LICENSE.txt)[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
[](https://discord.gg/HcsmBBGyVk)
</div>
------
[**更新日誌**](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Changelog_CN.md)
[**English**](./README.en.md) | [**中文简体**](../README.md) | [**日本語**](./README.ja.md) | [**한국어**](./README.ko.md) ([**韓國語**](./README.ko.han.md))
> デモ動画は[こちら](https://www.bilibili.com/video/BV1pm4y1z7Gm/)でご覧ください。
> RVCによるリアルタイム音声変換: [w-okada/voice-changer](https://github.com/w-okada/voice-changer)
> 著作権侵害を心配することなく使用できるように、基底モデルは約50時間の高品質なオープンソースデータセットで訓練されています。
> 今後も、次々と使用許可のある高品質な歌声の資料集を追加し、基底モデルを訓練する予定です。
## はじめに本リポジトリには下記の特徴があります。
+ Top1検索を用いることで、生の特徴量を訓練用データセット特徴量に変換し、トーンリーケージを削減します。+ 比較的貧弱なGPUでも、高速かつ簡単に訓練できます。+ 少量のデータセットからでも、比較的良い結果を得ることができます。(10分以上のノイズの少ない音声を推奨します。)+ モデルを融合することで、音声を混ぜることができます。(ckpt processingタブの、ckpt mergeを使用します。)+ 使いやすいWebUI。+ UVR5 Modelも含んでいるため、人の声とBGMを素早く分離できます。
## 環境構築Poetryで依存関係をインストールすることをお勧めします。
下記のコマンドは、Python3.8以上の環境で実行する必要があります:```bash# PyTorch関連の依存関係をインストール。インストール済の場合は省略。# 参照先: https://pytorch.org/get-started/locally/pip install torch torchvision torchaudio
#Windows+ Nvidia Ampere Architecture(RTX30xx)の場合、 #21 に従い、pytorchに対応するcuda versionを指定する必要があります。#pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
# PyTorch関連の依存関係をインストール。インストール済の場合は省略。# 参照先: https://python-poetry.org/docs/#installationcurl -sSL https://install.python-poetry.org | python3 -
# Poetry経由で依存関係をインストールpoetry install```
pipでも依存関係のインストールが可能です:
**注意**:`faiss 1.7.2`は`macOS`で`Segmentation Fault: 11`を起こすので、マニュアルインストールする場合は、 `pip install faiss-cpu==1.7.0`を実行してください。
```bashpip install -r requirements.txt```
## 基底modelsを準備RVCは推論/訓練のために、様々な事前訓練を行った基底モデルを必要とします。
modelsは[Hugging Face space](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)からダウンロードできます。
以下は、RVCに必要な基底モデルやその他のファイルの一覧です。```bashhubert_base.pt
./pretrained
./uvr5_weights
# ffmpegがすでにinstallされている場合は省略./ffmpeg```その後、下記のコマンドでWebUIを起動します。```bashpython infer-web.py```Windowsをお使いの方は、直接`RVC-beta.7z`をダウンロード後に展開し、`go-web.bat`をクリックすることで、WebUIを起動することができます。(7zipが必要です。)
また、リポジトリに[小白简易教程.doc](./小白简易教程.doc)がありますので、参考にしてください(中国語版のみ)。
## 参考プロジェクト+ [ContentVec](https://github.com/auspicious3000/contentvec/)+ [VITS](https://github.com/jaywalnut310/vits)+ [HIFIGAN](https://github.com/jik876/hifi-gan)+ [Gradio](https://github.com/gradio-app/gradio)+ [FFmpeg](https://github.com/FFmpeg/FFmpeg)+ [Ultimate Vocal Remover](https://github.com/Anjok07/ultimatevocalremovergui)+ [audio-slicer](https://github.com/openvpi/audio-slicer)
## 貢献者(contributor)の皆様の尽力に感謝します<a href="https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank"> <img src="https://contrib.rocks/image?repo=liujing04/Retrieval-based-Voice-Conversion-WebUI" /></a>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102<div align="center">
<h1>Retrieval-based-Voice-Conversion-WebUI</h1>VITS基盤의 簡單하고使用하기 쉬운音聲變換틀<br><br>
[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI) <img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br> [](https://colab.research.google.com/github/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/%E4%BD%BF%E7%94%A8%E9%9C%80%E9%81%B5%E5%AE%88%E7%9A%84%E5%8D%8F%E8%AE%AE-LICENSE.txt)[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
[](https://discord.gg/HcsmBBGyVk)
</div>
------[**更新日誌**](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Changelog_CN.md)
[**English**](./README.en.md) | [**中文简体**](../README.md) | [**日本語**](./README.ja.md) | [**한국어**](./README.ko.md) ([**韓國語**](./README.ko.han.md))
> [示範映像](https://www.bilibili.com/video/BV1pm4y1z7Gm/)을 確認해 보세요!
> RVC를活用한實時間音聲變換: [w-okada/voice-changer](https://github.com/w-okada/voice-changer)
> 基本모델은 50時間假量의 高品質 오픈 소스 VCTK 데이터셋을 使用하였으므로, 著作權上의 念慮가 없으니 安心하고 使用하시기 바랍니다.
> 著作權問題가 없는 高品質의 노래를 以後에도 繼續해서 訓練할 豫定입니다.
## 紹介本Repo는 다음과 같은 特徵을 가지고 있습니다:+ top1檢索을利用하여 入力音色特徵을 訓練세트音色特徵으로 代替하여 音色의漏出을 防止;+ 相對的으로 낮은性能의 GPU에서도 빠른訓練可能;+ 적은量의 데이터로 訓練해도 좋은 結果를 얻을 수 있음 (最小10分以上의 低雜음音聲데이터를 使用하는 것을 勸獎);+ 모델融合을通한 音色의 變調可能 (ckpt處理탭->ckpt混合選擇);+ 使用하기 쉬운 WebUI (웹 使用者인터페이스);+ UVR5 모델을 利用하여 목소리와 背景音樂의 빠른 分離;
## 環境의準備poetry를通해 依存를設置하는 것을 勸獎합니다.
다음命令은 Python 버전3.8以上의環境에서 實行되어야 합니다:```bash# PyTorch 關聯主要依存設置, 이미設置되어 있는 境遇 건너뛰기 可能# 參照: https://pytorch.org/get-started/locally/pip install torch torchvision torchaudio
# Windows + Nvidia Ampere Architecture(RTX30xx)를 使用하고 있다面, #21 에서 명시된 것과 같이 PyTorch에 맞는 CUDA 버전을 指定해야 합니다.#pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
# Poetry 設置, 이미設置되어 있는 境遇 건너뛰기 可能# Reference: https://python-poetry.org/docs/#installationcurl -sSL https://install.python-poetry.org | python3 -
# 依存設置poetry install```pip를 活用하여依存를 設置하여도 無妨합니다.
**公知**: `MacOS`에서 `faiss 1.7.2`를 使用하면 Segmentation Fault: 11 誤謬가 發生할 수 있습니다. 手動으로 pip를 使用하여 設置하는境遇 `pip install faiss-cpu==1.7.0`을 使用해야 합니다.
```bashpip install -r requirements.txt```
## 其他預備모델準備RVC 모델은 推論과訓練을 依하여 다른 預備모델이 必要합니다.
[Huggingface space](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)를 通해서 다운로드 할 수 있습니다.
다음은 RVC에 必要한 預備모델 및 其他 파일 目錄입니다:```bashhubert_base.pt
./pretrained
./uvr5_weights
# Windows를 使用하는境遇 이 사전도 必要할 수 있습니다. FFmpeg가 設置되어 있으면 건너뛰어도 됩니다.ffmpeg.exe```그後 以下의 命令을 使用하여 WebUI를 始作할 수 있습니다:```bashpython infer-web.py```Windows를 使用하는境遇 `RVC-beta.7z`를 다운로드 및 壓縮解除하여 RVC를 直接使用하거나 `go-web.bat`을 使用하여 WebUi를 直接할 수 있습니다.
## 參考+ [ContentVec](https://github.com/auspicious3000/contentvec/)+ [VITS](https://github.com/jaywalnut310/vits)+ [HIFIGAN](https://github.com/jik876/hifi-gan)+ [Gradio](https://github.com/gradio-app/gradio)+ [FFmpeg](https://github.com/FFmpeg/FFmpeg)+ [Ultimate Vocal Remover](https://github.com/Anjok07/ultimatevocalremovergui)+ [audio-slicer](https://github.com/openvpi/audio-slicer)## 모든寄與者분들의勞力에感謝드립니다
<a href="https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank"> <img src="https://contrib.rocks/image?repo=liujing04/Retrieval-based-Voice-Conversion-WebUI" /></a>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102<div align="center">
<h1>Retrieval-based-Voice-Conversion-WebUI</h1>VITS 기반의 간단하고 사용하기 쉬운 음성 변환 프레임워크.<br><br>
[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI) <img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br> [](https://colab.research.google.com/github/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)[](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/%E4%BD%BF%E7%94%A8%E9%9C%80%E9%81%B5%E5%AE%88%E7%9A%84%E5%8D%8F%E8%AE%AE-LICENSE.txt)[](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)
[](https://discord.gg/HcsmBBGyVk)
</div>
------[**업데이트 로그**](https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/blob/main/Changelog_CN.md)
[**English**](./README.en.md) | [**中文简体**](../README.md) | [**日本語**](./README.ja.md) | [**한국어**](./README.ko.md) ([**韓國語**](./README.ko.han.md))
> [데모 영상](https://www.bilibili.com/video/BV1pm4y1z7Gm/)을 확인해 보세요!
> RVC를 활용한 실시간 음성변환: [w-okada/voice-changer](https://github.com/w-okada/voice-changer)
> 기본 모델은 50시간 가량의 고퀄리티 오픈 소스 VCTK 데이터셋을 사용하였으므로, 저작권상의 염려가 없으니 안심하고 사용하시기 바랍니다.
> 저작권 문제가 없는 고퀄리티의 노래를 이후에도 계속해서 훈련할 예정입니다.
## 소개본 Repo는 다음과 같은 특징을 가지고 있습니다:+ top1 검색을 이용하여 입력 음색 특징을 훈련 세트 음색 특징으로 대체하여 음색의 누출을 방지;+ 상대적으로 낮은 성능의 GPU에서도 빠른 훈련 가능;+ 적은 양의 데이터로 훈련해도 좋은 결과를 얻을 수 있음 (최소 10분 이상의 저잡음 음성 데이터를 사용하는 것을 권장);+ 모델 융합을 통한 음색의 변조 가능 (ckpt 처리 탭->ckpt 병합 선택);+ 사용하기 쉬운 WebUI (웹 인터페이스);+ UVR5 모델을 이용하여 목소리와 배경음악의 빠른 분리;
## 환경의 준비poetry를 통해 dependecies를 설치하는 것을 권장합니다.
다음 명령은 Python 버전 3.8 이상의 환경에서 실행되어야 합니다:```bash# PyTorch 관련 주요 dependencies 설치, 이미 설치되어 있는 경우 건너뛰기 가능# 참조: https://pytorch.org/get-started/locally/pip install torch torchvision torchaudio
# Windows + Nvidia Ampere Architecture(RTX30xx)를 사용하고 있다면, https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/issues/21 에서 명시된 것과 같이 PyTorch에 맞는 CUDA 버전을 지정해야 합니다.#pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
# Poetry 설치, 이미 설치되어 있는 경우 건너뛰기 가능# Reference: https://python-poetry.org/docs/#installationcurl -sSL https://install.python-poetry.org | python3 -
# Dependecies 설치poetry install```pip를 활용하여 dependencies를 설치하여도 무방합니다.
**공지**: `MacOS`에서 `faiss 1.7.2`를 사용하면 Segmentation Fault: 11 오류가 발생할 수 있습니다. 수동으로 pip를 사용하여 설치하는 경우 `pip install faiss-cpu==1.7.0`을 사용해야 합니다.
```bashpip install -r requirements.txt```
## 기타 사전 모델 준비RVC 모델은 추론과 훈련을 위하여 다른 사전 모델이 필요합니다.
[Huggingface space](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)를 통해서 다운로드 할 수 있습니다.
다음은 RVC에 필요한 사전 모델 및 기타 파일 목록입니다:```bashhubert_base.pt
./pretrained
./uvr5_weights
# Windows를 사용하는 경우 이 사전도 필요할 수 있습니다. FFmpeg가 설치되어 있으면 건너뛰어도 됩니다.ffmpeg.exe```그 후 이하의 명령을 사용하여 WebUI를 시작할 수 있습니다:```bashpython infer-web.py```Windows를 사용하는 경우 `RVC-beta.7z`를 다운로드 및 압축 해제하여 RVC를 직접 사용하거나 `go-web.bat`을 사용하여 WebUi를 시작할 수 있습니다.
## 참고+ [ContentVec](https://github.com/auspicious3000/contentvec/)+ [VITS](https://github.com/jaywalnut310/vits)+ [HIFIGAN](https://github.com/jik876/hifi-gan)+ [Gradio](https://github.com/gradio-app/gradio)+ [FFmpeg](https://github.com/FFmpeg/FFmpeg)+ [Ultimate Vocal Remover](https://github.com/Anjok07/ultimatevocalremovergui)+ [audio-slicer](https://github.com/openvpi/audio-slicer)## 모든 기여자 분들의 노력에 감사드립니다.
<a href="https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank"> <img src="https://contrib.rocks/image?repo=liujing04/Retrieval-based-Voice-Conversion-WebUI" /></a>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102faiss tuning TIPS==================# about faissfaiss is a library of neighborhood searches for dense vectors, developed by facebook research, which efficiently implements many approximate neighborhood search methods.Approximate Neighbor Search finds similar vectors quickly while sacrificing some accuracy.
## faiss in RVCIn RVC, for the embedding of features converted by HuBERT, we search for embeddings similar to the embedding generated from the training data and mix them to achieve a conversion that is closer to the original speech. However, since this search takes time if performed naively, high-speed conversion is realized by using approximate neighborhood search.
# implementation overviewIn '/logs/your-experiment/3_feature256' where the model is located, features extracted by HuBERT from each voice data are located.From here we read the npy files in order sorted by filename and concatenate the vectors to create big_npy. (This vector has shape [N, 256].)After saving big_npy as /logs/your-experiment/total_fea.npy, train it with faiss.
In this article, I will explain the meaning of these parameters.
# Explanation of the method## index factoryAn index factory is a unique faiss notation that expresses a pipeline that connects multiple approximate neighborhood search methods as a string.This allows you to try various approximate neighborhood search methods simply by changing the index factory string.In RVC it is used like this:
```pythonindex = faiss.index_factory(256, "IVF%s,Flat" % n_ivf)```Among the arguments of index_factory, the first is the number of dimensions of the vector, the second is the index factory string, and the third is the distance to use.
For more detailed notationhttps://github.com/facebookresearch/faiss/wiki/The-index-factory
## index for distanceThere are two typical indexes used as similarity of embedding as follows.
- Euclidean distance (METRIC_L2)- inner product (METRIC_INNER_PRODUCT)
Euclidean distance takes the squared difference in each dimension, sums the differences in all dimensions, and then takes the square root. This is the same as the distance in 2D and 3D that we use on a daily basis.The inner product is not used as an index of similarity as it is, and the cosine similarity that takes the inner product after being normalized by the L2 norm is generally used.
Which is better depends on the case, but cosine similarity is often used in embedding obtained by word2vec and similar image retrieval models learned by ArcFace. If you want to do l2 normalization on vector X with numpy, you can do it with the following code with eps small enough to avoid 0 division.
```pythonX_normed = X / np.maximum(eps, np.linalg.norm(X, ord=2, axis=-1, keepdims=True))```
Also, for the index factory, you can change the distance index used for calculation by choosing the value to pass as the third argument.
```pythonindex = faiss.index_factory(dimention, text, faiss.METRIC_INNER_PRODUCT)```
## IVFIVF (Inverted file indexes) is an algorithm similar to the inverted index in full-text search.During learning, the search target is clustered with kmeans, and Voronoi partitioning is performed using the cluster center. Each data point is assigned a cluster, so we create a dictionary that looks up the data points from the clusters.
For example, if clusters are assigned as follows|index|Cluster||-----|-------||1|A||2|B||3|A||4|C||5|B|
The resulting inverted index looks like this:
|cluster|index||-------|-----||A|1, 3||B|2, 5||C|4|
When searching, we first search n_probe clusters from the clusters, and then calculate the distances for the data points belonging to each cluster.
# recommend parameterThere are official guidelines on how to choose an index, so I will explain accordingly.https://github.com/facebookresearch/faiss/wiki/Guidelines-to-choose-an-index
For datasets below 1M, 4bit-PQ is the most efficient method available in faiss as of April 2023.Combining this with IVF, narrowing down the candidates with 4bit-PQ, and finally recalculating the distance with an accurate index can be described by using the following index factory.
```pythonindex = faiss.index_factory(256, "IVF1024,PQ128x4fs,RFlat")```
## Recommended parameters for IVFConsider the case of too many IVFs. For example, if coarse quantization by IVF is performed for the number of data, this is the same as a naive exhaustive search and is inefficient.For 1M or less, IVF values are recommended between 4*sqrt(N) ~ 16*sqrt(N) for N number of data points.
Since the calculation time increases in proportion to the number of n_probes, please consult with the accuracy and choose appropriately. Personally, I don't think RVC needs that much accuracy, so n_probe = 1 is fine.
## FastScanFastScan is a method that enables high-speed approximation of distances by Cartesian product quantization by performing them in registers.Cartesian product quantization performs clustering independently for each d dimension (usually d = 2) during learning, calculates the distance between clusters in advance, and creates a lookup table. At the time of prediction, the distance of each dimension can be calculated in O(1) by looking at the lookup table.So the number you specify after PQ usually specifies half the dimension of the vector.
For a more detailed description of FastScan, please refer to the official documentation.https://github.com/facebookresearch/faiss/wiki/Fast-accumulation-of-PQ-and-AQ-codes-(FastScan)
## RFlatRFlat is an instruction to recalculate the rough distance calculated by FastScan with the exact distance specified by the third argument of index factory.When getting k neighbors, k*k_factor points are recalculated.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101faiss tuning TIPS==================# about faissfaissはfacebook researchの開発する、密なベクトルに対する近傍探索をまとめたライブラリで、多くの近似近傍探索の手法を効率的に実装しています。近似近傍探索はある程度精度を犠牲にしながら高速に類似するベクトルを探します。
## faiss in RVCRVCではHuBERTで変換した特徴量のEmbeddingに対し、学習データから生成されたEmbeddingと類似するものを検索し、混ぜることでより元の音声に近い変換を実現しています。ただ、この検索は愚直に行うと時間がかかるため、近似近傍探索を用いることで高速な変換を実現しています。
# 実装のoverviewモデルが配置されている '/logs/your-experiment/3_feature256'には各音声データからHuBERTで抽出された特徴量が配置されています。ここからnpyファイルをファイル名でソートした順番で読み込み、ベクトルを連結してbig_npyを作成しfaissを学習させます。(このベクトルのshapeは[N, 256]です。)
本Tipsではまずこれらのパラメータの意味を解説します。
# 手法の解説## index factoryindex factoryは複数の近似近傍探索の手法を繋げるパイプラインをstringで表記するfaiss独自の記法です。これにより、index factoryの文字列を変更するだけで様々な近似近傍探索の手法を試せます。RVCでは以下のように使われています。
```pythonindex = faiss.index_factory(256, "IVF%s,Flat" % n_ivf)```index_factoryの引数のうち、1つ目はベクトルの次元数、2つ目はindex factoryの文字列で、3つ目には用いる距離を指定することができます。
より詳細な記法についてはhttps://github.com/facebookresearch/faiss/wiki/The-index-factory
## 距離指標embeddingの類似度として用いられる代表的な指標として以下の二つがあります。
- ユークリッド距離(METRIC_L2)- 内積(METRIC_INNER_PRODUCT)
ユークリッド距離では各次元において二乗の差をとり、全次元の差を足してから平方根をとります。これは日常的に用いる2次元、3次元での距離と同じです。内積はこのままでは類似度の指標として用いず、一般的にはL2ノルムで正規化してから内積をとるコサイン類似度を用います。
どちらがよいかは場合によりますが、word2vec等で得られるembeddingやArcFace等で学習した類似画像検索のモデルではコサイン類似度が用いられることが多いです。ベクトルXに対してl2正規化をnumpyで行う場合は、0 divisionを避けるために十分に小さな値をepsとして以下のコードで可能です。
```pythonX_normed = X / np.maximum(eps, np.linalg.norm(X, ord=2, axis=-1, keepdims=True))```
また、index factoryには第3引数に渡す値を選ぶことで計算に用いる距離指標を変更できます。
```pythonindex = faiss.index_factory(dimention, text, faiss.METRIC_INNER_PRODUCT)```
## IVFIVF(Inverted file indexes)は全文検索における転置インデックスと似たようなアルゴリズムです。学習時には検索対象に対してkmeansでクラスタリングを行い、クラスタ中心を用いてボロノイ分割を行います。各データ点には一つずつクラスタが割り当てられるので、クラスタからデータ点を逆引きする辞書を作成します。
例えば以下のようにクラスタが割り当てられた場合|index|クラスタ||-----|-------||1|A||2|B||3|A||4|C||5|B|
作成される転置インデックスは以下のようになります。
|クラスタ|index||-------|-----||A|1, 3||B|2, 5||C|4|
検索時にはまずクラスタからn_probe個のクラスタを検索し、次にそれぞれのクラスタに属するデータ点について距離を計算します。
# 推奨されるパラメータindexの選び方については公式にガイドラインがあるので、それに準じて説明します。https://github.com/facebookresearch/faiss/wiki/Guidelines-to-choose-an-index
1M以下のデータセットにおいては4bit-PQが2023年4月時点ではfaissで利用できる最も効率的な手法です。これをIVFと組み合わせ、4bit-PQで候補を絞り、最後に正確な指標で距離を再計算するには以下のindex factoryを用いることで記載できます。
```pythonindex = faiss.index_factory(256, "IVF1024,PQ128x4fs,RFlat")```
## IVFの推奨パラメータIVFの数が多すぎる場合、たとえばデータ数の数だけIVFによる粗量子化を行うと、これは愚直な全探索と同じになり効率が悪いです。1M以下の場合ではIVFの値はデータ点の数Nに対して4*sqrt(N) ~ 16*sqrt(N)に推奨しています。
n_probeはn_probeの数に比例して計算時間が増えるので、精度と相談して適切に選んでください。個人的にはRVCにおいてそこまで精度は必要ないと思うのでn_probe = 1で良いと思います。
## FastScanFastScanは直積量子化で大まかに距離を近似するのを、レジスタ内で行うことにより高速に行うようにした手法です。直積量子化は学習時にd次元ごと(通常はd=2)に独立してクラスタリングを行い、クラスタ同士の距離を事前計算してlookup tableを作成します。予測時はlookup tableを見ることで各次元の距離をO(1)で計算できます。そのため、PQの次に指定する数字は通常ベクトルの半分の次元を指定します。
FastScanに関するより詳細な説明は公式のドキュメントを参照してください。https://github.com/facebookresearch/faiss/wiki/Fast-accumulation-of-PQ-and-AQ-codes-(FastScan)
## RFlatRFlatはFastScanで計算した大まかな距離を、index factoryの第三引数で指定した正確な距離で再計算する指示です。k個の近傍を取得する際は、k*k_factor個の点について再計算が行われます。123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132Facebook AI Similarity Search (Faiss) 팁==================# Faiss에 대하여Faiss 는 Facebook Research가 개발하는, 고밀도 벡터 이웃 검색 라이브러리입니다. 근사 근접 탐색법 (Approximate Neigbor Search)은 약간의 정확성을 희생하여 유사 벡터를 고속으로 찾습니다.
## RVC에 있어서 FaissRVC에서는 HuBERT로 변환한 feature의 embedding을 위해 훈련 데이터에서 생성된 embedding과 유사한 embadding을 검색하고 혼합하여 원래의 음성에 더욱 가까운 변환을 달성합니다. 그러나, 이 탐색법은 단순히 수행하면 시간이 다소 소모되므로, 근사 근접 탐색법을 통해 고속 변환을 가능케 하고 있습니다.
# 구현 개요모델이 위치한 `/logs/your-experiment/3_feature256`에는 각 음성 데이터에서 HuBERT가 추출한 feature들이 있습니다. 여기에서 파일 이름별로 정렬된 npy 파일을 읽고, 벡터를 연결하여 big_npy ([N, 256] 모양의 벡터) 를 만듭니다. big_npy를 `/logs/your-experiment/total_fea.npy`로 저장한 후, Faiss로 학습시킵니다.
2023/04/18 기준으로, Faiss의 Index Factory 기능을 이용해, L2 거리에 근거하는 IVF를 이용하고 있습니다. IVF의 분할수(n_ivf)는 N//39로, n_probe는 int(np.power(n_ivf, 0.3))가 사용되고 있습니다. (infer-web.py의 train_index 주위를 찾으십시오.)
이 팁에서는 먼저 이러한 매개 변수의 의미를 설명하고, 개발자가 추후 더 나은 index를 작성할 수 있도록 하는 조언을 작성합니다.
# 방법의 설명## Index factoryindex factory는 여러 근사 근접 탐색법을 문자열로 연결하는 pipeline을 문자열로 표기하는 Faiss만의 독자적인 기법입니다. 이를 통해 index factory의 문자열을 변경하는 것만으로 다양한 근사 근접 탐색을 시도해 볼 수 있습니다. RVC에서는 다음과 같이 사용됩니다:
```pythonindex = Faiss.index_factory(256, "IVF%s,Flat" % n_ivf)````index_factory`의 인수들 중 첫 번째는 벡터의 차원 수이고, 두번째는 index factory 문자열이며, 세번째에는 사용할 거리를 지정할 수 있습니다.
기법의 보다 자세한 설명은 https://github.com/facebookresearch/Faiss/wiki/The-index-factory 를 확인해 주십시오.
## 거리에 대한 indexembedding의 유사도로서 사용되는 대표적인 지표로서 이하의 2개가 있습니다.
- 유클리드 거리 (METRIC_L2)- 내적(内積) (METRIC_INNER_PRODUCT)
유클리드 거리에서는 각 차원에서 제곱의 차를 구하고, 각 차원에서 구한 차를 모두 더한 후 제곱근을 취합니다. 이것은 일상적으로 사용되는 2차원, 3차원에서의 거리의 연산법과 같습니다. 내적은 그 값을 그대로 유사도 지표로 사용하지 않고, L2 정규화를 한 이후 내적을 취하는 코사인 유사도를 사용합니다.
어느 쪽이 더 좋은지는 경우에 따라 다르지만, word2vec에서 얻은 embedding 및 ArcFace를 활용한 이미지 검색 모델은 코사인 유사성이 이용되는 경우가 많습니다. numpy를 사용하여 벡터 X에 대해 L2 정규화를 하고자 하는 경우, 0 division을 피하기 위해 충분히 작은 값을 eps로 한 뒤 이하에 코드를 활용하면 됩니다.
```pythonX_normed = X / np.maximum(eps, np.linalg.norm(X, ord=2, axis=-1, keepdims=True))```
또한, `index factory`의 3번째 인수에 건네주는 값을 선택하는 것을 통해 계산에 사용하는 거리 index를 변경할 수 있습니다.
```pythonindex = Faiss.index_factory(dimention, text, Faiss.METRIC_INNER_PRODUCT)```
## IVFIVF (Inverted file indexes)는 역색인 탐색법과 유사한 알고리즘입니다. 학습시에는 검색 대상에 대해 k-평균 군집법을 실시하고 클러스터 중심을 이용해 보로노이 분할을 실시합니다. 각 데이터 포인트에는 클러스터가 할당되므로, 클러스터에서 데이터 포인트를 조회하는 dictionary를 만듭니다.
예를 들어, 클러스터가 다음과 같이 할당된 경우|index|Cluster||-----|-------||1|A||2|B||3|A||4|C||5|B|
IVF 이후의 결과는 다음과 같습니다:
|cluster|index||-------|-----||A|1, 3||B|2, 5||C|4|
탐색 시, 우선 클러스터에서 `n_probe`개의 클러스터를 탐색한 다음, 각 클러스터에 속한 데이터 포인트의 거리를 계산합니다.
# 권장 매개변수index의 선택 방법에 대해서는 공식적으로 가이드 라인이 있으므로, 거기에 준해 설명합니다.https://github.com/facebookresearch/Faiss/wiki/Guidelines-to-choose-an-index
1M 이하의 데이터 세트에 있어서는 4bit-PQ가 2023년 4월 시점에서는 Faiss로 이용할 수 있는 가장 효율적인 수법입니다. 이것을 IVF와 조합해, 4bit-PQ로 후보를 추려내고, 마지막으로 이하의 index factory를 이용하여 정확한 지표로 거리��� 재계산하면 됩니다.
```pythonindex = Faiss.index_factory(256, "IVF1024,PQ128x4fs,RFlat")```
## IVF 권장 매개변수IVF의 수가 너무 많으면, 가령 데이터 수의 수만큼 IVF로 양자화(Quantization)를 수행하면, 이것은 완전탐색과 같아져 효율이 나빠지게 됩니다. 1M 이하의 경우 IVF 값은 데이터 포인트 수 N에 대해 4sqrt(N) ~ 16sqrt(N)를 사용하는 것을 권장합니다.
n_probe는 n_probe의 수에 비례하여 계산 시간이 늘어나므로 정확도와 시간을 적절히 균형을 맞추어 주십시오. 개인적으로 RVC에 있어서 그렇게까지 정확도는 필요 없다고 생각하기 때문에 n_probe = 1이면 된다고 생각합니다.
## FastScanFastScan은 직적 양자화를 레지스터에서 수행함으로써 거리의 고속 근사를 가능하게 하는 방법입니다.직적 양자화는 학습시에 d차원마다(보통 d=2)에 독립적으로 클러스터링을 실시해, 클러스터끼리의 거리를 사전 계산해 lookup table를 작성합니다. 예측시는 lookup table을 보면 각 차원의 거리를 O(1)로 계산할 수 있습니다. 따라서 PQ 다음에 지정하는 숫자는 일반적으로 벡터의 절반 차원을 지정합니다.
FastScan에 대한 자세한 설명은 공식 문서를 참조하십시오.https://github.com/facebookresearch/Faiss/wiki/Fast-accumulation-of-PQ-and-AQ-codes-(FastScan)
## RFlatRFlat은 FastScan이 계산한 대략적인 거리를 index factory의 3번째 인수로 지정한 정확한 거리로 다시 계산하라는 인스트럭션입니다. k개의 근접 변수를 가져올 때 k*k_factor개의 점에 대해 재계산이 이루어집니다.
# Embedding 테크닉## Alpha 쿼리 확장퀴리 확장이란 탐색에서 사용되는 기술로, 예를 들어 전문 탐색 시, 입력된 검색문에 단어를 몇 개를 추가함으로써 검색 정확도를 올리는 방법입니다. 백터 탐색을 위해서도 몇가지 방법이 제안되었는데, 그 중 α-쿼리 확장은 추가 학습이 필요 없는 매우 효과적인 방법으로 알려져 있습니다. [Attention-Based Query Expansion Learning](https://arxiv.org/abs/2007.08019)와 [2nd place solution of kaggle shopee competition](https://www.kaggle.com/code/lyakaap/2nd-place-solution/notebook) 논문에서 소개된 바 있습니다..
α-쿼리 확장은 한 벡터에 인접한 벡터를 유사도의 α곱한 가중치로 더해주면 됩니다. 코드로 예시를 들어 보겠습니다. big_npy를 α query expansion로 대체합니다.
```pythonalpha = 3.index = Faiss.index_factory(256, "IVF512,PQ128x4fs,RFlat")original_norm = np.maximum(np.linalg.norm(big_npy, ord=2, axis=1, keepdims=True), 1e-9)big_npy /= original_normindex.train(big_npy)index.add(big_npy)dist, neighbor = index.search(big_npy, num_expand)
expand_arrays = []ixs = np.arange(big_npy.shape[0])for i in range(-(-big_npy.shape[0]//batch_size)): ix = ixs[i*batch_size:(i+1)*batch_size] weight = np.power(np.einsum("nd,nmd->nm", big_npy[ix], big_npy[neighbor[ix]]), alpha) expand_arrays.append(np.sum(big_npy[neighbor[ix]] * np.expand_dims(weight, axis=2),axis=1))big_npy = np.concatenate(expand_arrays, axis=0)
# index version 정규화big_npy = big_npy / np.maximum(np.linalg.norm(big_npy, ord=2, axis=1, keepdims=True), 1e-9)```
위 테크닉은 탐색을 수행하는 쿼리에도, 탐색 대상 DB에도 적응 가능한 테크닉입니다.
## MiniBatch KMeans에 의한 embedding 압축
total_fea.npy가 너무 클 경우 K-means를 이용하여 벡터를 작게 만드는 것이 가능합니다. 이하 코드로 embedding의 압축이 가능합니다. n_clusters에 압축하고자 하는 크기를 지정하고 batch_size에 256 * CPU의 코어 수를 지정함으로써 CPU 병렬화의 혜택을 충분히 얻을 수 있습니다.
```pythonimport multiprocessingfrom sklearn.cluster import MiniBatchKMeanskmeans = MiniBatchKMeans(n_clusters=10000, batch_size=256 * multiprocessing.cpu_count(), init="random")kmeans.fit(big_npy)sample_npy = kmeans.cluster_centers_```1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465Instructions and tips for RVC training======================================This TIPS explains how data training is done.
# Training flowI will explain along the steps in the training tab of the GUI.
## step1Set the experiment name here.
You can also set here whether the model should take pitch into account.If the model doesn't consider pitch, the model will be lighter, but not suitable for singing.
Data for each experiment is placed in `/logs/your-experiment-name/`.
## step2aLoads and preprocesses audio.
### load audioIf you specify a folder with audio, the audio files in that folder will be read automatically.For example, if you specify `C:Users\hoge\voices`, `C:Users\hoge\voices\voice.mp3` will be loaded, but `C:Users\hoge\voices\dir\voice.mp3` will Not loaded.
Since ffmpeg is used internally for reading audio, if the extension is supported by ffmpeg, it will be read automatically.After converting to int16 with ffmpeg, convert to float32 and normalize between -1 to 1.
### denoisingThe audio is smoothed by scipy's filtfilt.
### Audio SplitFirst, the input audio is divided by detecting parts of silence that last longer than a certain period (max_sil_kept=5 seconds?). After splitting the audio on silence, split the audio every 4 seconds with an overlap of 0.3 seconds. For audio separated within 4 seconds, after normalizing the volume, convert the wav file to `/logs/your-experiment-name/0_gt_wavs` and then convert it to 16k sampling rate to `/logs/your-experiment-name/1_16k_wavs ` as a wav file.
## step2b### Extract pitchExtract pitch information from wav files. Extract the pitch information (=f0) using the method built into parselmouth or pyworld and save it in `/logs/your-experiment-name/2a_f0`. Then logarithmically convert the pitch information to an integer between 1 and 255 and save it in `/logs/your-experiment-name/2b-f0nsf`.
### Extract feature_printConvert the wav file to embedding in advance using HuBERT. Read the wav file saved in `/logs/your-experiment-name/1_16k_wavs`, convert the wav file to 256-dimensional features with HuBERT, and save in npy format in `/logs/your-experiment-name/3_feature256`.
## step3train the model.### Glossary for BeginnersIn deep learning, the data set is divided and the learning proceeds little by little. In one model update (step), batch_size data are retrieved and predictions and error corrections are performed. Doing this once for a dataset counts as one epoch.
Therefore, the learning time is the learning time per step x (the number of data in the dataset / batch size) x the number of epochs. In general, the larger the batch size, the more stable the learning becomes (learning time per step ÷ batch size) becomes smaller, but it uses more GPU memory. GPU RAM can be checked with the nvidia-smi command. Learning can be done in a short time by increasing the batch size as much as possible according to the machine of the execution environment.
### Specify pretrained modelRVC starts training the model from pretrained weights instead of from 0, so it can be trained with a small dataset.
By default
- If you consider pitch, it loads `rvc-location/pretrained/f0G40k.pth` and `rvc-location/pretrained/f0D40k.pth`. - If you don't consider pitch, it loads `rvc-location/pretrained/f0G40k.pth` and `rvc-location/pretrained/f0D40k.pth`.
When learning, model parameters are saved in `logs/your-experiment-name/G_{}.pth` and `logs/your-experiment-name/D_{}.pth` for each save_every_epoch, but by specifying this path, you can start learning. You can restart or start training from model weights learned in a different experiment.
### learning indexRVC saves the HuBERT feature values used during training, and during inference, searches for feature values that are similar to the feature values used during learning to perform inference. In order to perform this search at high speed, the index is learned in advance.For index learning, we use the approximate neighborhood search library faiss. Read the feature value of `logs/your-experiment-name/3_feature256` and use it to learn the index, and save it as `logs/your-experiment-name/add_XXX.index`.
(From the 20230428update version, it is read from the index, and saving / specifying is no longer necessary.)
### Button description- Train model: After executing step2b, press this button to train the model.- Train feature index: After training the model, perform index learning.- One-click training: step2b, model training and feature index training all at once.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364RVCの訓練における説明、およびTIPS===============================本TIPSではどのようにデータの訓練が行われているかを説明します。
# 訓練の流れGUIの訓練タブのstepに沿って説明します。
## step1 実験名の設定を行います。
また、モデルに音高ガイド(ピッチ)を考慮させるかもここで設定できます。考慮させない場合はモデルは軽量になりますが、歌唱には向かなくなります。
各実験のデータは`/logs/実験名/`に配置されます。
## step2a音声の読み込みと前処理を行います。
### load audio音声のあるフォルダを指定すると、そのフォルダ内にある音声ファイルを自動で読み込みます。例えば`C:Users\hoge\voices`を指定した場合、`C:Users\hoge\voices\voice.mp3`は読み込まれますが、`C:Users\hoge\voices\dir\voice.mp3`は読み込まれません。
音声の読み込みには内部でffmpegを利用しているので、ffmpegで対応している拡張子であれば自動的に読み込まれます。ffmpegでint16に変換した後、float32に変換し、-1 ~ 1の間に正規化されます。
### denoising音声についてscipyのfiltfiltによる平滑化を行います。
### 音声の分割入力した音声はまず、一定期間(max_sil_kept=5秒?)より長く無音が続く部分を検知して音声を分割します。無音で音声を分割した後は、0.3秒のoverlapを含む4秒ごとに音声を分割します。4秒以内に区切られた音声は、音量の正規化を行った後wavファイルを`/logs/実験名/0_gt_wavs`に、そこから16kのサンプリングレートに変換して`/logs/実験名/1_16k_wavs`にwavファイルで保存します。
## step2b### ピッチの抽出wavファイルからピッチ(音の高低)の情報を抽出します。parselmouthやpyworldに内蔵されている手法でピッチ情報(=f0)を抽出し、`/logs/実験名/2a_f0`に保存します。その後、ピッチ情報を対数で変換して1~255の整数に変換し、`/logs/実験名/2b-f0nsf`に保存します。
### feature_printの抽出HuBERTを用いてwavファイルを事前にembeddingに変換します。`/logs/実験名/1_16k_wavs`に保存したwavファイルを読み込み、HuBERTでwavファイルを256次元の特徴量に変換し、npy形式で`/logs/実験名/3_feature256`に保存します。
## step3モデルのトレーニングを行います。### 初心者向け用語解説深層学習ではデータセットを分割し、少しずつ学習を進めていきます。一回のモデルの更新(step)では、batch_size個のデータを取り出し予測と誤差の修正を行います。これをデータセットに対して一通り行うと一epochと数えます。
そのため、学習時間は 1step当たりの学習時間 x (データセット内のデータ数 ÷ バッチサイズ) x epoch数 かかります。一般にバッチサイズを大きくするほど学習は安定し、(1step当たりの学習時間÷バッチサイズ)は小さくなりますが、その分GPUのメモリを多く使用します。GPUのRAMはnvidia-smiコマンド等で確認できます。実行環境のマシンに合わせてバッチサイズをできるだけ大きくするとより短時間で学習が可能です。
### pretrained modelの指定RVCではモデルの訓練を0からではなく、事前学習済みの重みから開始するため、少ないデータセットで学習を行えます。
デフォルトでは
- 音高ガイドを考慮する場合、`RVCのある場所/pretrained/f0G40k.pth`と`RVCのある場所/pretrained/f0D40k.pth`を読み込みます。- 音高ガイドを考慮しない場合、`RVCのある場所/pretrained/G40k.pth`と`RVCのある場所/pretrained/D40k.pth`を読み込みます。
学習時はsave_every_epochごとにモデルのパラメータが`logs/実験名/G_{}.pth`と`logs/実験名/D_{}.pth`に保存されますが、このパスを指定することで学習を再開したり、もしくは違う実験で学習したモデルの重みから学習を開始できます。
### indexの学習RVCでは学習時に使われたHuBERTの特徴量を保存し、推論時は学習時の特徴量から近い特徴量を探してきて推論を行います。この検索を高速に行うために事前にindexの学習を行います。indexの学習には近似近傍探索ライブラリのfaissを用います。`/logs/実験名/3_feature256`の特徴量を読み込み、それを用いて学習したindexを`/logs/実験名/add_XXX.index`として保存します。(20230428updateよりtotal_fea.npyはindexから読み込むので不要になりました。)
### ボタンの説明- モデルのトレーニング: step2bまでを実行した後、このボタンを押すとモデルの学習を行います。- 特徴インデックスのトレーニング: モデルのトレーニング後、indexの学習を行います。- ワンクリックトレーニング: step2bまでとモデルのトレーニング、特徴インデックスのトレーニングを一括で行います。
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253RVC 훈련에 대한 설명과 팁들======================================본 팁에서는 어떻게 데이터 훈련이 이루어지고 있는지 설명합니다.
# 훈련의 흐름GUI의 훈련 탭의 단계를 따라 설명합니다.
## step1실험 이름을 지정합니다. 또한, 모델이 피치(소리의 높낮이)를 고려해야 하는지 여부를 여기에서 설정할 수도 있습니다..각 실험을 위한 데이터는 `/logs/experiment name/`에 배치됩니다..
## step2a음성 파일을 불러오고 전처리합니다.
### 음성 파일 불러오기음성 파일이 있는 폴더를 지정하면 해당 폴더에 있는 음성 파일이 자동으로 가져와집니다.예를 들어 `C:Users\hoge\voices`를 지정하면 `C:Users\hoge\voices\voice.mp3`가 읽히지만 `C:Users\hoge\voices\dir\voice.mp3`는 읽히지 않습니다.
음성 로드에는 내부적으로 ffmpeg를 이용하고 있으므로, ffmpeg로 대응하고 있는 확장자라면 자동적으로 읽힙니다.ffmpeg에서 int16으로 변환한 후 float32로 변환하고 -1과 1 사이에 정규화됩니다.
### 잡음 제거음성 파일에 대해 scipy의 filtfilt를 이용하여 잡음을 처리합니다.
### 음성 분할입력한 음성 파일은 먼저 일정 기간(max_sil_kept=5초?)보다 길게 무음이 지속되는 부분을 감지하여 음성을 분할합니다.무음으로 음성을 분할한 후에는 0.3초의 overlap을 포함하여 4초마다 음성을 분할합니다.4초 이내에 구분된 음성은 음량의 정규화를 실시한 후 wav 파일을 `/logs/실험명/0_gt_wavs`로, 거기에서 16k의 샘플링 레이트로 변환해 `/logs/실험명/1_16k_wavs`에 wav 파일로 저장합니다.
## step2b### 피치 추출wav 파일에서 피치(소리의 높낮이) 정보를 추출합니다. parselmouth나 pyworld에 내장되어 있는 메서드으로 피치 정보(=f0)를 추출해, `/logs/실험명/2a_f0`에 저장합니다. 그 후 피치 정보를 로그로 변환하여 1~255 정수로 변환하고 `/logs/실험명/2b-f0nsf`에 저장합니다.
### feature_print 추출HuBERT를 이용하여 wav 파일을 미리 embedding으로 변환합니다. `/logs/실험명/1_16k_wavs`에 저장한 wav 파일을 읽고 HuBERT에서 wav 파일을 256차원 feature들로 변환한 후 npy 형식으로 `/logs/실험명/3_feature256`에 저장합니다.
## step3모델의 훈련을 진행합니다.
### 초보자용 용어 해설심층학습(딥러닝)에서는 데이터셋을 분할하여 조금씩 학습을 진행합니다.한 번의 모델 업데이트(step) 단계 당 batch_size개의 데이터를 탐색하여 예측과 오차를 수정합니다. 데이터셋 전부에 대해 이 작업을 한 번 수행하는 이를 하나의 epoch라고 계산합니다.
따라서 학습 시간은 단계당 학습 시간 x (데이터셋 내 데이터의 수 / batch size) x epoch 수가 소요됩니다. 일반적으로 batch size가 클수록 학습이 안정적이게 됩니다. (step당 학습 시간 ÷ batch size)는 작아지지만 GPU 메모리를 더 많이 사용합니다. GPU RAM은 nvidia-smi 명령어를 통해 확인할 수 있습니다. 실행 환경에 따라 배치 크기를 최대한 늘리면 짧은 시간 내에 학습이 가능합니다.
### 사전 학습된 모델 지정RVC는 적은 데이터셋으로도 훈련이 가능하도록 사전 훈련된 가중치에서 모델 훈련을 시작합니다. 기본적으로 `rvc-location/pretrained/f0G40k.pth` 및 `rvc-location/pretrained/f0D40k.pth`를 불러옵니다. 학습을 할 시에, 모델 파라미터는 각 save_every_epoch별로 `logs/experiment name/G_{}.pth` 와 `logs/experiment name/D_{}.pth`로 저장이 되는데, 이 경로를 지정함으로써 학습을 재개하거나, 다른 실험에서 학습한 모델의 가중치에서 학습을 시작할 수 있습니다.
### index의 학습RVC에서는 학습시에 사용된 HuBERT의 feature값을 저장하고, 추론 시에는 학습 시 사용한 feature값과 유사한 feature 값을 탐색해 추론을 진행합니다. 이 탐색을 고속으로 수행하기 위해 사전에 index을 학습하게 됩니다.Index 학습에는 근사 근접 탐색법 라이브러리인 Faiss를 사용하게 됩니다. `/logs/실험명/3_feature256`의 feature값을 불러와, 이를 모두 결합시킨 feature값을 `/logs/실험명/total_fea.npy`로서 저장, 그것을 사용해 학습한 index를`/logs/실험명/add_XXX.index`로 저장합니다.
### 버튼 설명- モデルのトレーニング (모델 학습): step2b까지 실행한 후, 이 버튼을 눌러 모델을 학습합니다.- 特徴インデックスのトレーニング (특징 지수 훈련): 모델의 훈련 후, index를 학습합니다.- ワンクリックトレーニング (원클릭 트레이닝): step2b까지의 모델 훈련, feature index 훈련을 일괄로 실시합니다.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230@echo off && chcp 65001
echo working dir is %cd%echo downloading requirement aria2 check.echo=dir /a:d/b | findstr "aria2" > flag.txtfindstr "aria2" flag.txt >nulif %errorlevel% ==0 ( echo aria2 checked. echo=) else ( echo failed. please downloading aria2 from webpage! echo unzip it and put in this directory! timeout /T 5 start https://github.com/aria2/aria2/releases/tag/release-1.36.0 echo= goto end)
echo envfiles checking start.echo=
for /f %%x in ('findstr /i /c:"aria2" "flag.txt"') do (set aria2=%%x)&goto endSch:endSch
set d32=f0D32k.pthset d40=f0D40k.pthset d48=f0D48k.pthset g32=f0G32k.pthset g40=f0G40k.pthset g48=f0G48k.pth
set dld32=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D32k.pthset dld40=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D40k.pthset dld48=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D48k.pthset dlg32=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G32k.pthset dlg40=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G40k.pthset dlg48=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G48k.pth
set hp2=HP2-人声vocals+非人声instrumentals.pthset hp5=HP5-主旋律人声vocals+其他instrumentals.pth
set dlhp2=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP2-人声vocals+非人声instrumentals.pthset dlhp5=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP5-主旋律人声vocals+其他instrumentals.pth
set hb=hubert_base.pt
set dlhb=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt
echo dir check start.echo=
if exist "%~dp0pretrained" ( echo dir .\pretrained checked. ) else ( echo failed. generating dir .\pretrained. mkdir pretrained )if exist "%~dp0uvr5_weights" ( echo dir .\uvr5_weights checked. ) else ( echo failed. generating dir .\uvr5_weights. mkdir uvr5_weights )
echo=echo dir check finished.
echo=echo required files check start.
echo checking D32k.pthif exist "%~dp0pretrained\D32k.pth" ( echo D32k.pth in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D32k.pth -d %~dp0pretrained -o D32k.pth if exist "%~dp0pretrained\D32k.pth" (echo download successful.) else (echo please try again! echo=) )echo checking D40k.pthif exist "%~dp0pretrained\D40k.pth" ( echo D40k.pth in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D40k.pth -d %~dp0pretrained -o D40k.pth if exist "%~dp0pretrained\D40k.pth" (echo download successful.) else (echo please try again! echo=) ) echo checking D48k.pthif exist "%~dp0pretrained\D48k.pth" ( echo D48k.pth in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D48k.pth -d %~dp0pretrained -o D48k.pth if exist "%~dp0pretrained\D48k.pth" (echo download successful.) else (echo please try again! echo=) ) echo checking G32k.pthif exist "%~dp0pretrained\G32k.pth" ( echo G32k.pth in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G32k.pth -d %~dp0pretrained -o G32k.pth if exist "%~dp0pretrained\G32k.pth" (echo download successful.) else (echo please try again! echo=) ) echo checking G40k.pthif exist "%~dp0pretrained\G40k.pth" ( echo G40k.pth in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G40k.pth -d %~dp0pretrained -o G40k.pth if exist "%~dp0pretrained\G40k.pth" (echo download successful.) else (echo please try again! echo=) ) echo checking G48k.pthif exist "%~dp0pretrained\G48k.pth" ( echo G48k.pth in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G48k.pth -d %~dp0pretrained -o G48k.pth if exist "%~dp0pretrained\G48k.pth" (echo download successful.) else (echo please try again! echo=) )
echo checking %d32%if exist "%~dp0pretrained\%d32%" ( echo %d32% in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dld32% -d %~dp0pretrained -o %d32% if exist "%~dp0pretrained\%d32%" (echo download successful.) else (echo please try again! echo=) )echo checking %d40%if exist "%~dp0pretrained\%d40%" ( echo %d40% in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dld40% -d %~dp0pretrained -o %d40% if exist "%~dp0pretrained\%d40%" (echo download successful.) else (echo please try again! echo=) )echo checking %d48%if exist "%~dp0pretrained\%d48%" ( echo %d48% in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dld48% -d %~dp0pretrained -o %d48% if exist "%~dp0pretrained\%d48%" (echo download successful.) else (echo please try again! echo=) )echo checking %g32%if exist "%~dp0pretrained\%g32%" ( echo %g32% in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dlg32% -d %~dp0pretrained -o %g32% if exist "%~dp0pretrained\%g32%" (echo download successful.) else (echo please try again! echo=) )echo checking %g40%if exist "%~dp0pretrained\%g40%" ( echo %g40% in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dlg40% -d %~dp0pretrained -o %g40% if exist "%~dp0pretrained\%g40%" (echo download successful.) else (echo please try again! echo=) )echo checking %g48%if exist "%~dp0pretrained\%g48%" ( echo %g48% in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dlg48% -d %~dp0\pretrained -o %g48% if exist "%~dp0pretrained\%g48%" (echo download successful.) else (echo please try again! echo=) )
echo checking %hp2%if exist "%~dp0uvr5_weights\%hp2%" ( echo %hp2% in .\uvr5_weights checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dlhp2% -d %~dp0\uvr5_weights -o %hp2% if exist "%~dp0uvr5_weights\%hp2%" (echo download successful.) else (echo please try again! echo=) )echo checking %hp5%if exist "%~dp0uvr5_weights\%hp5%" ( echo %hp5% in .\uvr5_weights checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dlhp5% -d %~dp0\uvr5_weights -o %HP5% if exist "%~dp0uvr5_weights\%hp5%" (echo download successful.) else (echo please try again! echo=) )
echo checking %hb%if exist "%~dp0%hb%" ( echo %hb% in .\pretrained checked. echo= ) else ( echo failed. starting download from huggingface. %~dp0%aria2%\aria2c --console-log-level=error -c -x 16 -s 16 -k 1M %dlhb% -d %~dp0 -o %hb% if exist "%~dp0%hb%" (echo download successful.) else (echo please try again! echo=) )
echo required files check finished.echo envfiles check complete.pause:enddel flag.txt12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485from infer_pack.models_onnx_moess import SynthesizerTrnMs256NSFsidMfrom infer_pack.models_onnx import SynthesizerTrnMs256NSFsidOimport torch
if __name__ == "__main__": MoeVS = True # 模型是否为MoeVoiceStudio(原MoeSS)使用
ModelPath = "Shiroha/shiroha.pth" # 模型路径 ExportedPath = "model.onnx" # 输出路径 hidden_channels = 256 # hidden_channels,为768Vec做准备 cpt = torch.load(ModelPath, map_location="cpu") cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk print(*cpt["config"])
test_phone = torch.rand(1, 200, hidden_channels) # hidden unit test_phone_lengths = torch.tensor([200]).long() # hidden unit 长度(貌似没啥用) test_pitch = torch.randint(size=(1, 200), low=5, high=255) # 基频(单位赫兹) test_pitchf = torch.rand(1, 200) # nsf基频 test_ds = torch.LongTensor([0]) # 说话人ID test_rnd = torch.rand(1, 192, 200) # 噪声(加入随机因子)
device = "cpu" # 导出时设备(不影响使用模型)
if MoeVS: net_g = SynthesizerTrnMs256NSFsidM( *cpt["config"], is_half=False ) # fp32导出(C++要支持fp16必须手动将内存重新排列所以暂时不用fp16) net_g.load_state_dict(cpt["weight"], strict=False) input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"] output_names = [ "audio", ] torch.onnx.export( net_g, ( test_phone.to(device), test_phone_lengths.to(device), test_pitch.to(device), test_pitchf.to(device), test_ds.to(device), test_rnd.to(device), ), ExportedPath, dynamic_axes={ "phone": [1], "pitch": [1], "pitchf": [1], "rnd": [2], }, do_constant_folding=False, opset_version=16, verbose=False, input_names=input_names, output_names=output_names, ) else: net_g = SynthesizerTrnMs256NSFsidO( *cpt["config"], is_half=False ) # fp32导出(C++要支持fp16必须手动将内存重新排列所以暂时不用fp16) net_g.load_state_dict(cpt["weight"], strict=False) input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds"] output_names = [ "audio", ] torch.onnx.export( net_g, ( test_phone.to(device), test_phone_lengths.to(device), test_pitch.to(device), test_pitchf.to(device), test_ds.to(device), ), ExportedPath, dynamic_axes={ "phone": [1], "pitch": [1], "pitchf": [1], }, do_constant_folding=False, opset_version=16, verbose=False, input_names=input_names, output_names=output_names, )1234567891011121314151617181920212223242526272829303132333435363738394041424344454647from infer_pack.models_onnx_moess import SynthesizerTrnMs256NSFsidMimport torch
person = "Shiroha/shiroha.pth"exported_path = "model.onnx"
cpt = torch.load(person, map_location="cpu")cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spkprint(*cpt["config"])net_g = SynthesizerTrnMs256NSFsidM(*cpt["config"], is_half=False)net_g.load_state_dict(cpt["weight"], strict=False)
test_phone = torch.rand(1, 200, 256)test_phone_lengths = torch.tensor([200]).long()test_pitch = torch.randint(size=(1, 200), low=5, high=255)test_pitchf = torch.rand(1, 200)test_ds = torch.LongTensor([0])test_rnd = torch.rand(1, 192, 200)input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"]output_names = [ "audio",]device = "cpu"torch.onnx.export( net_g, ( test_phone.to(device), test_phone_lengths.to(device), test_pitch.to(device), test_pitchf.to(device), test_ds.to(device), test_rnd.to(device), ), exported_path, dynamic_axes={ "phone": [1], "pitch": [1], "pitchf": [1], "rnd": [2], }, do_constant_folding=False, opset_version=16, verbose=False, input_names=input_names, output_names=output_names,)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160import os, traceback, sys, parselmouthimport librosaimport pyworldfrom scipy.io import wavfileimport numpy as np, logging
logging.getLogger("numba").setLevel(logging.WARNING)from multiprocessing import Process
exp_dir = sys.argv[1]f = open("%s/extract_f0_feature.log" % exp_dir, "a+")
def printt(strr): print(strr) f.write("%s\n" % strr) f.flush()
n_p = int(sys.argv[2])f0method = sys.argv[3]
class FeatureInput(object): def __init__(self, samplerate=16000, hop_size=160): self.fs = samplerate self.hop = hop_size
self.f0_bin = 256 self.f0_max = 1100.0 self.f0_min = 50.0 self.f0_mel_min = 1127 * np.log(1 + self.f0_min / 700) self.f0_mel_max = 1127 * np.log(1 + self.f0_max / 700)
def compute_f0(self, path, f0_method): # default resample type of librosa.resample is "soxr_hq". # Quality: soxr_vhq > soxr_hq x, sr = librosa.load(path, self.fs) # , res_type='soxr_vhq' p_len = x.shape[0] // self.hop assert sr == self.fs if f0_method == "pm": time_step = 160 / 16000 * 1000 f0_min = 50 f0_max = 1100 f0 = ( parselmouth.Sound(x, sr) .to_pitch_ac( time_step=time_step / 1000, voicing_threshold=0.6, pitch_floor=f0_min, pitch_ceiling=f0_max, ) .selected_array["frequency"] ) pad_size = (p_len - len(f0) + 1) // 2 if pad_size > 0 or p_len - len(f0) - pad_size > 0: f0 = np.pad( f0, [[pad_size, p_len - len(f0) - pad_size]], mode="constant" ) elif f0_method == "harvest": f0, t = pyworld.harvest( x.astype(np.double), fs=sr, f0_ceil=self.f0_max, f0_floor=self.f0_min, frame_period=1000 * self.hop / sr, ) f0 = pyworld.stonemask(x.astype(np.double), f0, t, self.fs) elif f0_method == "dio": f0, t = pyworld.dio( x.astype(np.double), fs=sr, f0_ceil=self.f0_max, f0_floor=self.f0_min, frame_period=1000 * self.hop / sr, ) f0 = pyworld.stonemask(x.astype(np.double), f0, t, self.fs) return f0
def coarse_f0(self, f0): f0_mel = 1127 * np.log(1 + f0 / 700) f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - self.f0_mel_min) * ( self.f0_bin - 2 ) / (self.f0_mel_max - self.f0_mel_min) + 1
# use 0 or 1 f0_mel[f0_mel <= 1] = 1 f0_mel[f0_mel > self.f0_bin - 1] = self.f0_bin - 1 f0_coarse = np.rint(f0_mel).astype(np.int) assert f0_coarse.max() <= 255 and f0_coarse.min() >= 1, ( f0_coarse.max(), f0_coarse.min(), ) return f0_coarse
def go(self, paths, f0_method): if len(paths) == 0: printt("no-f0-todo") else: printt("todo-f0-%s" % len(paths)) n = max(len(paths) // 5, 1) # 每个进程最多打印5条 for idx, (inp_path, opt_path1, opt_path2) in enumerate(paths): try: if idx % n == 0: printt("f0ing,now-%s,all-%s,-%s" % (idx, len(paths), inp_path)) if ( os.path.exists(opt_path1 + ".npy") == True and os.path.exists(opt_path2 + ".npy") == True ): continue featur_pit = self.compute_f0(inp_path, f0_method) np.save( opt_path2, featur_pit, allow_pickle=False, ) # nsf coarse_pit = self.coarse_f0(featur_pit) np.save( opt_path1, coarse_pit, allow_pickle=False, ) # ori except: printt("f0fail-%s-%s-%s" % (idx, inp_path, traceback.format_exc()))
if __name__ == "__main__": # exp_dir=r"E:\codes\py39\dataset\mi-test" # n_p=16 # f = open("%s/log_extract_f0.log"%exp_dir, "w") printt(sys.argv) featureInput = FeatureInput() paths = [] inp_root = "%s/1_16k_wavs" % (exp_dir) opt_root1 = "%s/2a_f0" % (exp_dir) opt_root2 = "%s/2b-f0nsf" % (exp_dir)
os.makedirs(opt_root1, exist_ok=True) os.makedirs(opt_root2, exist_ok=True) for name in sorted(list(os.listdir(inp_root))): inp_path = "%s/%s" % (inp_root, name) if "spec" in inp_path: continue opt_path1 = "%s/%s" % (opt_root1, name) opt_path2 = "%s/%s" % (opt_root2, name) paths.append([inp_path, opt_path1, opt_path2])
ps = [] for i in range(n_p): p = Process( target=featureInput.go, args=( paths[i::n_p], f0method, ), ) p.start() ps.append(p) for p in ps: p.join()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104import os, sys, traceback
# device=sys.argv[1]n_part = int(sys.argv[2])i_part = int(sys.argv[3])if len(sys.argv) == 5: exp_dir = sys.argv[4]else: i_gpu = sys.argv[4] exp_dir = sys.argv[5] os.environ["CUDA_VISIBLE_DEVICES"] = str(i_gpu)
import torchimport torch.nn.functional as Fimport soundfile as sfimport numpy as npfrom fairseq import checkpoint_utils
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
f = open("%s/extract_f0_feature.log" % exp_dir, "a+")
def printt(strr): print(strr) f.write("%s\n" % strr) f.flush()
printt(sys.argv)model_path = "hubert_base.pt"
printt(exp_dir)wavPath = "%s/1_16k_wavs" % exp_diroutPath = "%s/3_feature256" % exp_diros.makedirs(outPath, exist_ok=True)
# wave must be 16k, hop_size=320def readwave(wav_path, normalize=False): wav, sr = sf.read(wav_path) assert sr == 16000 feats = torch.from_numpy(wav).float() if feats.dim() == 2: # double channels feats = feats.mean(-1) assert feats.dim() == 1, feats.dim() if normalize: with torch.no_grad(): feats = F.layer_norm(feats, feats.shape) feats = feats.view(1, -1) return feats
# HuBERT modelprintt("load model(s) from {}".format(model_path))models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task( [model_path], suffix="",)model = models[0]model = model.to(device)printt("move model to %s" % device)if device != "cpu": model = model.half()model.eval()
todo = sorted(list(os.listdir(wavPath)))[i_part::n_part]n = max(1, len(todo) // 10) # 最多打印十条if len(todo) == 0: printt("no-feature-todo")else: printt("all-feature-%s" % len(todo)) for idx, file in enumerate(todo): try: if file.endswith(".wav"): wav_path = "%s/%s" % (wavPath, file) out_path = "%s/%s" % (outPath, file.replace("wav", "npy"))
if os.path.exists(out_path): continue
feats = readwave(wav_path, normalize=saved_cfg.task.normalize) padding_mask = torch.BoolTensor(feats.shape).fill_(False) inputs = { "source": feats.half().to(device) if device != "cpu" else feats.to(device), "padding_mask": padding_mask.to(device), "output_layer": 9, # layer 9 } with torch.no_grad(): logits = model.extract_features(**inputs) feats = model.final_proj(logits[0])
feats = feats.squeeze(0).float().cpu().numpy() if np.isnan(feats).sum() == 0: np.save(out_path, feats, allow_pickle=False) else: printt("%s-contains nan" % file) if idx % n == 0: printt("now-%s,all-%s,%s,%s" % (len(todo), idx, file, feats.shape)) except: printt(traceback.format_exc()) printt("all-feature-done")12345678910111213141516171819202122232425262728293031import jsonimport re
# Define regular expression patternspattern = r"""i18n\([\s\n\t]*(["'][^"']+["'])[\s\n\t]*\)"""
# Initialize the dictionary to store key-value pairsdata = {}
def process(fn: str): global data with open(fn, "r", encoding="utf-8") as f: contents = f.read() matches = re.findall(pattern, contents) for key in matches: key = eval(key) print("extract:", key) data[key] = key
print("processing infer-web.py")process("infer-web.py")
print("processing gui.py")process("gui.py")
# Save as a JSON filewith open("./i18n/zh_CN.json", "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=4) f.write("\n")12runtime\python.exe gui.pypause12runtime\python.exe infer-web.py --pycmd runtime\python.exe --port 7897pause123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570import os, sys
now_dir = os.getcwd()sys.path.append(now_dir)import PySimpleGUI as sgimport sounddevice as sdimport noisereduce as nrimport numpy as npfrom fairseq import checkpoint_utilsimport librosa, torch, pyworld, faiss, time, threadingimport torch.nn.functional as Fimport torchaudio.transforms as tatimport scipy.signal as signal
# import matplotlib.pyplot as pltfrom infer_pack.models import SynthesizerTrnMs256NSFsid, SynthesizerTrnMs256NSFsid_nonofrom i18n import I18nAuto
i18n = I18nAuto()device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class RVC: def __init__( self, key, hubert_path, pth_path, index_path, npy_path, index_rate ) -> None: """ 初始化 """ try: self.f0_up_key = key self.time_step = 160 / 16000 * 1000 self.f0_min = 50 self.f0_max = 1100 self.f0_mel_min = 1127 * np.log(1 + self.f0_min / 700) self.f0_mel_max = 1127 * np.log(1 + self.f0_max / 700) self.sr = 16000 self.window = 160 if index_rate != 0: self.index = faiss.read_index(index_path) # self.big_npy = np.load(npy_path) self.big_npy = index.reconstruct_n(0, self.index.ntotal) print("index search enabled") self.index_rate = index_rate model_path = hubert_path print("load model(s) from {}".format(model_path)) models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task( [model_path], suffix="", ) self.model = models[0] self.model = self.model.to(device) self.model = self.model.half() self.model.eval() cpt = torch.load(pth_path, map_location="cpu") self.tgt_sr = cpt["config"][-1] cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk self.if_f0 = cpt.get("f0", 1) if self.if_f0 == 1: self.net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=True) else: self.net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"]) del self.net_g.enc_q print(self.net_g.load_state_dict(cpt["weight"], strict=False)) self.net_g.eval().to(device) self.net_g.half() except Exception as e: print(e)
def get_f0(self, x, f0_up_key, inp_f0=None): x_pad = 1 f0_min = 50 f0_max = 1100 f0_mel_min = 1127 * np.log(1 + f0_min / 700) f0_mel_max = 1127 * np.log(1 + f0_max / 700) f0, t = pyworld.harvest( x.astype(np.double), fs=self.sr, f0_ceil=f0_max, f0_floor=f0_min, frame_period=10, ) f0 = pyworld.stonemask(x.astype(np.double), f0, t, self.sr) f0 = signal.medfilt(f0, 3) f0 *= pow(2, f0_up_key / 12) # with open("test.txt","w")as f:f.write("\n".join([str(i)for i in f0.tolist()])) tf0 = self.sr // self.window # 每秒f0点数 if inp_f0 is not None: delta_t = np.round( (inp_f0[:, 0].max() - inp_f0[:, 0].min()) * tf0 + 1 ).astype("int16") replace_f0 = np.interp( list(range(delta_t)), inp_f0[:, 0] * 100, inp_f0[:, 1] ) shape = f0[x_pad * tf0 : x_pad * tf0 + len(replace_f0)].shape[0] f0[x_pad * tf0 : x_pad * tf0 + len(replace_f0)] = replace_f0[:shape] # with open("test_opt.txt","w")as f:f.write("\n".join([str(i)for i in f0.tolist()])) f0bak = f0.copy() f0_mel = 1127 * np.log(1 + f0 / 700) f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - f0_mel_min) * 254 / ( f0_mel_max - f0_mel_min ) + 1 f0_mel[f0_mel <= 1] = 1 f0_mel[f0_mel > 255] = 255 f0_coarse = np.rint(f0_mel).astype(np.int) return f0_coarse, f0bak # 1-0
def infer(self, feats: torch.Tensor) -> np.ndarray: """ 推理函数 """ audio = feats.clone().cpu().numpy() assert feats.dim() == 1, feats.dim() feats = feats.view(1, -1) padding_mask = torch.BoolTensor(feats.shape).fill_(False) inputs = { "source": feats.half().to(device), "padding_mask": padding_mask.to(device), "output_layer": 9, # layer 9 } torch.cuda.synchronize() with torch.no_grad(): logits = self.model.extract_features(**inputs) feats = self.model.final_proj(logits[0])
####索引优化 if hasattr(self, "index") and hasattr(self, "big_npy") and self.index_rate != 0: npy = feats[0].cpu().numpy().astype("float32")
# _, I = self.index.search(npy, 1) # npy = self.big_npy[I.squeeze()].astype("float16")
score, ix = index.search(npy, k=8) weight = np.square(1 / score) weight /= weight.sum(axis=1, keepdims=True) npy = np.sum(big_npy[ix] * np.expand_dims(weight, axis=2), axis=1).astype( "float16" )
feats = ( torch.from_numpy(npy).unsqueeze(0).to(device) * self.index_rate + (1 - self.index_rate) * feats ) else: print("index search FAIL or disabled")
feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1) torch.cuda.synchronize() print(feats.shape) if self.if_f0 == 1: pitch, pitchf = self.get_f0(audio, self.f0_up_key) p_len = min(feats.shape[1], 13000, pitch.shape[0]) # 太大了爆显存 else: pitch, pitchf = None, None p_len = min(feats.shape[1], 13000) # 太大了爆显存 torch.cuda.synchronize() # print(feats.shape,pitch.shape) feats = feats[:, :p_len, :] if self.if_f0 == 1: pitch = pitch[:p_len] pitchf = pitchf[:p_len] pitch = torch.LongTensor(pitch).unsqueeze(0).to(device) pitchf = torch.FloatTensor(pitchf).unsqueeze(0).to(device) p_len = torch.LongTensor([p_len]).to(device) ii = 0 # sid sid = torch.LongTensor([ii]).to(device) with torch.no_grad(): if self.if_f0 == 1: infered_audio = ( self.net_g.infer(feats, p_len, pitch, pitchf, sid)[0][0, 0] .data.cpu() .float() ) else: infered_audio = ( self.net_g.infer(feats, p_len, sid)[0][0, 0].data.cpu().float() ) torch.cuda.synchronize() return infered_audio
class Config: def __init__(self) -> None: self.hubert_path: str = "" self.pth_path: str = "" self.index_path: str = "" self.npy_path: str = "" self.pitch: int = 12 self.samplerate: int = 44100 self.block_time: float = 1.0 # s self.buffer_num: int = 1 self.threhold: int = -30 self.crossfade_time: float = 0.08 self.extra_time: float = 0.04 self.I_noise_reduce = False self.O_noise_reduce = False self.index_rate = 0.3
class GUI: def __init__(self) -> None: self.config = Config() self.flag_vc = False
self.launcher()
def launcher(self): sg.theme("LightBlue3") input_devices, output_devices, _, _ = self.get_devices() layout = [ [ sg.Frame( title=i18n("加载模型"), layout=[ [ sg.Input(default_text="hubert_base.pt", key="hubert_path"), sg.FileBrowse(i18n("Hubert模型")), ], [ sg.Input(default_text="TEMP\\atri.pth", key="pth_path"), sg.FileBrowse(i18n("选择.pth文件")), ], [ sg.Input( default_text="TEMP\\added_IVF512_Flat_atri_baseline_src_feat.index", key="index_path", ), sg.FileBrowse(i18n("选择.index文件")), ], [ sg.Input( default_text="你不需要填写这个You don't need write this.", key="npy_path", ), sg.FileBrowse(i18n("选择.npy文件")), ], ], ) ], [ sg.Frame( layout=[ [ sg.Text(i18n("输入设备")), sg.Combo( input_devices, key="sg_input_device", default_value=input_devices[sd.default.device[0]], ), ], [ sg.Text(i18n("输出设备")), sg.Combo( output_devices, key="sg_output_device", default_value=output_devices[sd.default.device[1]], ), ], ], title=i18n("音频设备(请使用同种类驱动)"), ) ], [ sg.Frame( layout=[ [ sg.Text(i18n("响应阈值")), sg.Slider( range=(-60, 0), key="threhold", resolution=1, orientation="h", default_value=-30, ), ], [ sg.Text(i18n("音调设置")), sg.Slider( range=(-24, 24), key="pitch", resolution=1, orientation="h", default_value=12, ), ], [ sg.Text(i18n("Index Rate")), sg.Slider( range=(0.0, 1.0), key="index_rate", resolution=0.01, orientation="h", default_value=0.5, ), ], ], title=i18n("常规设置"), ), sg.Frame( layout=[ [ sg.Text(i18n("采样长度")), sg.Slider( range=(0.1, 3.0), key="block_time", resolution=0.1, orientation="h", default_value=1.0, ), ], [ sg.Text(i18n("淡入淡出长度")), sg.Slider( range=(0.01, 0.15), key="crossfade_length", resolution=0.01, orientation="h", default_value=0.08, ), ], [ sg.Text(i18n("额外推理时长")), sg.Slider( range=(0.05, 3.00), key="extra_time", resolution=0.01, orientation="h", default_value=0.05, ), ], [ sg.Checkbox(i18n("输入降噪"), key="I_noise_reduce"), sg.Checkbox(i18n("输出降噪"), key="O_noise_reduce"), ], ], title=i18n("性能设置"), ), ], [ sg.Button(i18n("开始音频转换"), key="start_vc"), sg.Button(i18n("停止音频转换"), key="stop_vc"), sg.Text(i18n("推理时间(ms):")), sg.Text("0", key="infer_time"), ], ]
self.window = sg.Window("RVC - GUI", layout=layout) self.event_handler()
def event_handler(self): while True: event, values = self.window.read() if event == sg.WINDOW_CLOSED: self.flag_vc = False exit() if event == "start_vc" and self.flag_vc == False: self.set_values(values) print(str(self.config.__dict__)) print("using_cuda:" + str(torch.cuda.is_available())) self.start_vc() if event == "stop_vc" and self.flag_vc == True: self.flag_vc = False
def set_values(self, values): self.set_devices(values["sg_input_device"], values["sg_output_device"]) self.config.hubert_path = values["hubert_path"] self.config.pth_path = values["pth_path"] self.config.index_path = values["index_path"] self.config.npy_path = values["npy_path"] self.config.threhold = values["threhold"] self.config.pitch = values["pitch"] self.config.block_time = values["block_time"] self.config.crossfade_time = values["crossfade_length"] self.config.extra_time = values["extra_time"] self.config.I_noise_reduce = values["I_noise_reduce"] self.config.O_noise_reduce = values["O_noise_reduce"] self.config.index_rate = values["index_rate"]
def start_vc(self): torch.cuda.empty_cache() self.flag_vc = True self.block_frame = int(self.config.block_time * self.config.samplerate) self.crossfade_frame = int(self.config.crossfade_time * self.config.samplerate) self.sola_search_frame = int(0.012 * self.config.samplerate) self.delay_frame = int(0.01 * self.config.samplerate) # 往前预留0.02s self.extra_frame = int(self.config.extra_time * self.config.samplerate) self.rvc = None self.rvc = RVC( self.config.pitch, self.config.hubert_path, self.config.pth_path, self.config.index_path, self.config.npy_path, self.config.index_rate, ) self.input_wav: np.ndarray = np.zeros( self.extra_frame + self.crossfade_frame + self.sola_search_frame + self.block_frame, dtype="float32", ) self.output_wav: torch.Tensor = torch.zeros( self.block_frame, device=device, dtype=torch.float32 ) self.sola_buffer: torch.Tensor = torch.zeros( self.crossfade_frame, device=device, dtype=torch.float32 ) self.fade_in_window: torch.Tensor = torch.linspace( 0.0, 1.0, steps=self.crossfade_frame, device=device, dtype=torch.float32 ) self.fade_out_window: torch.Tensor = 1 - self.fade_in_window self.resampler1 = tat.Resample( orig_freq=self.config.samplerate, new_freq=16000, dtype=torch.float32 ) self.resampler2 = tat.Resample( orig_freq=self.rvc.tgt_sr, new_freq=self.config.samplerate, dtype=torch.float32, ) thread_vc = threading.Thread(target=self.soundinput) thread_vc.start()
def soundinput(self): """ 接受音频输入 """ with sd.Stream( callback=self.audio_callback, blocksize=self.block_frame, samplerate=self.config.samplerate, dtype="float32", ): while self.flag_vc: time.sleep(self.config.block_time) print("Audio block passed.") print("ENDing VC")
def audio_callback( self, indata: np.ndarray, outdata: np.ndarray, frames, times, status ): """ 音频处理 """ start_time = time.perf_counter() indata = librosa.to_mono(indata.T) if self.config.I_noise_reduce: indata[:] = nr.reduce_noise(y=indata, sr=self.config.samplerate)
"""noise gate""" frame_length = 2048 hop_length = 1024 rms = librosa.feature.rms( y=indata, frame_length=frame_length, hop_length=hop_length ) db_threhold = librosa.amplitude_to_db(rms, ref=1.0)[0] < self.config.threhold # print(rms.shape,db.shape,db) for i in range(db_threhold.shape[0]): if db_threhold[i]: indata[i * hop_length : (i + 1) * hop_length] = 0 self.input_wav[:] = np.append(self.input_wav[self.block_frame :], indata)
# infer print("input_wav:" + str(self.input_wav.shape)) # print('infered_wav:'+str(infer_wav.shape)) infer_wav: torch.Tensor = self.resampler2( self.rvc.infer(self.resampler1(torch.from_numpy(self.input_wav))) )[-self.crossfade_frame - self.sola_search_frame - self.block_frame :].to( device ) print("infer_wav:" + str(infer_wav.shape))
# SOLA algorithm from https://github.com/yxlllc/DDSP-SVC cor_nom = F.conv1d( infer_wav[None, None, : self.crossfade_frame + self.sola_search_frame], self.sola_buffer[None, None, :], ) cor_den = torch.sqrt( F.conv1d( infer_wav[None, None, : self.crossfade_frame + self.sola_search_frame] ** 2, torch.ones(1, 1, self.crossfade_frame, device=device), ) + 1e-8 ) sola_offset = torch.argmax(cor_nom[0, 0] / cor_den[0, 0]) print("sola offset: " + str(int(sola_offset)))
# crossfade self.output_wav[:] = infer_wav[sola_offset : sola_offset + self.block_frame] self.output_wav[: self.crossfade_frame] *= self.fade_in_window self.output_wav[: self.crossfade_frame] += self.sola_buffer[:] if sola_offset < self.sola_search_frame: self.sola_buffer[:] = ( infer_wav[ -self.sola_search_frame - self.crossfade_frame + sola_offset : -self.sola_search_frame + sola_offset ] * self.fade_out_window ) else: self.sola_buffer[:] = ( infer_wav[-self.crossfade_frame :] * self.fade_out_window )
if self.config.O_noise_reduce: outdata[:] = np.tile( nr.reduce_noise( y=self.output_wav[:].cpu().numpy(), sr=self.config.samplerate ), (2, 1), ).T else: outdata[:] = self.output_wav[:].repeat(2, 1).t().cpu().numpy() total_time = time.perf_counter() - start_time self.window["infer_time"].update(int(total_time * 1000)) print("infer time:" + str(total_time))
def get_devices(self, update: bool = True): """获取设备列表""" if update: sd._terminate() sd._initialize() devices = sd.query_devices() hostapis = sd.query_hostapis() for hostapi in hostapis: for device_idx in hostapi["devices"]: devices[device_idx]["hostapi_name"] = hostapi["name"] input_devices = [ f"{d['name']} ({d['hostapi_name']})" for d in devices if d["max_input_channels"] > 0 ] output_devices = [ f"{d['name']} ({d['hostapi_name']})" for d in devices if d["max_output_channels"] > 0 ] input_devices_indices = [ d["index"] for d in devices if d["max_input_channels"] > 0 ] output_devices_indices = [ d["index"] for d in devices if d["max_output_channels"] > 0 ] return ( input_devices, output_devices, input_devices_indices, output_devices_indices, )
def set_devices(self, input_device, output_device): """设置输出设备""" ( input_devices, output_devices, input_device_indices, output_device_indices, ) = self.get_devices() sd.default.device[0] = input_device_indices[input_devices.index(input_device)] sd.default.device[1] = output_device_indices[ output_devices.index(output_device) ] print("input device:" + str(sd.default.device[0]) + ":" + str(input_device)) print("output device:" + str(sd.default.device[1]) + ":" + str(output_device))
gui = GUI()123version https://git-lfs.github.com/spec/v1oid sha256:f54b40fd2802423a5643779c4861af1e9ee9c1564dc9d32f54f20b5ffba7db96size 18950790912345678910111213141516171819202122232425import localeimport jsonimport os
def load_language_list(language): with open(f"./i18n/{language}.json", "r", encoding="utf-8") as f: language_list = json.load(f) return language_list
class I18nAuto: def __init__(self, language=None): if language in ["Auto", None]: language = locale.getdefaultlocale()[ 0 ] # getlocale can't identify the system's language ((None, None)) if not os.path.exists(f"./i18n/{language}.json"): language = "en_US" self.language = language print("Use Language:", language) self.language_map = load_language_list(language)
def __call__(self, key): return self.language_map.get(key, key)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "很遗憾您这没有能用的显卡来支持您训练": "Unfortunately, you don't have a GPU to help you train", "是": "yes", "step1:正在处理数据": "step 1: processing data", "step2a:无需提取音高": "step 2a: skipped extracting pitch", "step2b:正在提取特征": "step 2b: extracting features", "step3a:正在训练模型": "step 3a: training the model", "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "Training completed, you can view the training logs in the console or the train.log within the experiement folder", "全流程结束!": "all processes have been completed!", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "This software is open source under the MIT license, the author does not have any control over the software, and those who use the software and spread the sounds exported by the software are solely responsible. <br>If you do not agree with this clause, you cannot use or quote any codes and files in the software package. See root directory <b>Agreement-LICENSE.txt</b> for details.", "模型推理": "Model inference", "推理音色": "Inferencing timbre", "刷新音色列表": "Refresh timbre list", "卸载音色省显存": "Unload timbre to save GPU memory", "请选择说话人id": "Please select a speaker id", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "It is recommended +12key for male to female conversion, and -12key for female to male conversion. If the sound range explodes and the timbre is distorted, you can also adjust it to the appropriate range by yourself. ", "变调(整数, 半音数量, 升八度12降八度-12)": "transpose(integer, number of semitones, octave sharp 12 octave flat -12)", "输入待处理音频文件路径(默认是正确格式示例)": "Enter the path of the audio file to be processed (the default is the correct format example)", "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "Select the algorithm for pitch extraction. Use 'pm' to speed up for singing voices, or use 'harvest' for better low-pitched voices, but it is extremely slow.", "特征检索库文件路径": "Feature search database file path", "特征文件路径": "Feature file path", "检索特征占比": "Search feature ratio", "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0 curve file, optional, one pitch per line, instead of the default F0 and ups and downs", "转换": "Convert", "输出信息": "Export message", "输出音频(右下角三个点,点了可以下载)": "Export audio (three dots in the lower right corner, click to download)", "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "For batch conversion, input the audio folder to be converted, or upload multiple audio files, and output the converted audio in the specified folder (opt by default). ", "指定输出文件夹": "Specify output folder", "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "Enter the path of the audio folder to be processed (just go to the address bar of the file manager and copy it)", "也可批量输入音频文件, 二选一, 优先读文件夹": "You can also input audio files in batches, choose one of the two, and read the folder first", "伴奏人声分离": "Accompaniment and vocal separation", "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)": "Batch processing of vocal accompaniment separation, using UVR5 model. <br>Without harmony, use HP2, with harmony and extracted vocals do not need harmony, use HP5<br>Example of qualified folder path format: E:\\ codes\\py39\\vits_vc_gpu\\Egret Shuanghua test sample (just go to the address bar of the file manager and copy it)", "输入待处理音频文件夹路径": "Input audio folder path", "模型": "Model", "人声提取激进程度": "vocal extraction aggressiveness", "指定输出人声文件夹": "Specify vocals output folder", "指定输出乐器文件夹": "Specify instrumentals output folder", "训练": "Train", "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "step1: Fill in the experimental configuration. The experimental data is placed under logs, and each experiment has a folder. You need to manually enter the experimental name path, which contains the experimental configuration, logs, and model files obtained from training. ", "输入实验名": "Input experiment name", "目标采样率": "Target sample rate", "模型是否带音高指导(唱歌一定要, 语音可以不要)": "Does the model have pitch guidance (singing must, voice can not.)", "否": "no", "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a: Automatically traverse all files that can be decoded into audio in the training folder and perform slice normalization, and generate 2 wav folders in the experiment directory; only single-person training is supported for the time being. ", "输入训练文件夹路径": "Input training folder path", "请指定说话人id": "Please specify speaker ID", "处理数据": "Process data", "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "step2b: Use CPU to extract pitch (if the model has pitch), use GPU to extract features (select card number)", "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "Enter the card numbers used separated by -, for example 0-1-2 use card 0 and card 1 and card 2", "显卡信息": "GPU information", "提取音高使用的CPU进程数": "Number of CPU threads to use for pitch extraction", "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "Select pitch extraction algorithm: Use 'pm' for faster processing of singing voice, 'dio' for high-quality speech but slower processing, and 'harvest' for the best quality but slowest processing.", "特征提取": "Feature extraction", "step3: 填写训练设置, 开始训练模型和索引": "step3: Fill in the training settings, start training the model and index", "保存频率save_every_epoch": "Save frequency (save_every_epoch)", "总训练轮数total_epoch": "Total training epochs (total_epoch)", "每张显卡的batch_size": "batch_size for every GPU", "是否仅保存最新的ckpt文件以节省硬盘空间": "Whether to save only the latest ckpt file to save disk space", "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "Whether to cache all training sets to video memory. Small data under 10 minutes can be cached to speed up training, and large data cache will blow up video memory and not increase the speed much", "加载预训练底模G路径": "Load pre-trained base model G path.", "加载预训练底模D路径": "Load pre-trained base model D path.", "训练模型": "Train model.", "训练特征索引": "Train feature index.", "一键训练": "One-click training.", "ckpt处理": "ckpt processing.", "模型融合, 可用于测试音色融合": "Model Fusion, which can be used to test sound fusion", "A模型路径": "A model path.", "B模型路径": "B model path.", "A模型权重": "A model weight for model A.", "模型是否带音高指导": "Whether the model has pitch guidance.", "要置入的模型信息": "Model information to be placed.", "保存的模型名不带后缀": "Saved model name without extension.", "融合": "Fusion.", "修改模型信息(仅支持weights文件夹下提取的小模型文件)": "Modify model information (only small model files extracted from the weights folder are supported)", "模型路径": "Model path", "要改的模型信息": "Model information to be modified", "保存的文件名, 默认空为和源文件同名": "The saved file name, the default is empty and the same name as the source file", "修改": "Modify", "查看模型信息(仅支持weights文件夹下提取的小模型文件)": "View model information (only small model files extracted from the weights folder are supported)", "查看": "View", "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "Model extraction (enter the path of the large file model under the logs folder), which is suitable for half of the training and does not want to train the model without automatically extracting and saving the small file model, or if you want to test the intermediate model", "保存名": "Save Name", "模型是否带音高指导,1是0否": "Whether the model has pitch guidance, 1 for yes, 0 for no", "提取": "Extract", "Onnx导出": "Export Onnx", "RVC模型路径": "RVC Model Path", "Onnx输出路径": "Onnx Export Path", "MoeVS模型": "MoeVS Model", "导出Onnx模型": "Export Onnx Model", "招募音高曲线前端编辑器": "Recruit front-end editors for pitch curves", "加开发群联系我xxxxx": "Add development group to contact me xxxxx", "点击查看交流、问题反馈群号": "Click to view the communication and problem feedback group number", "xxxxx": "xxxxx", "加载模型": "load model", "Hubert模型": "Hubert File", "选择.pth文件": "Select the .pth file", "选择.index文件": "Select the .index file", "选择.npy文件": "Select the .npy file", "输入设备": "input device", "输出设备": "output device", "音频设备(请使用同种类驱动)": "Audio device (please use the same type of driver)", "响应阈值": "response threshold", "音调设置": "tone setting", "Index Rate": "Index Rate", "常规设置": "general settings", "采样长度": "Sample length", "淡入淡出长度": "fade length", "额外推理时长": "extra inference time", "输入降噪": "Input Noise Reduction", "输出降噪": "Output Noise Reduction", "性能设置": "performance settings", "开始音频转换": "start audio conversion", "停止音频转换": "stop audio conversion", "推理时间(ms):": "Infer Time(ms):"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "很遗憾您这没有能用的显卡来支持您训练": "很遗憾您这没有能用的显卡来支持您训练", "是": "是", "step1:正在处理数据": "step1:正在处理数据", "step2a:无需提取音高": "step2a:无需提取音高", "step2b:正在提取特征": "step2b:正在提取特征", "step3a:正在训练模型": "step3a:正在训练模型", "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log", "全流程结束!": "全流程结束!", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "Este software es de código abierto bajo la licencia MIT, el autor no tiene ningún control sobre el software, y aquellos que usan el software y difunden los sonidos exportados por el software son los únicos responsables.<br>Si no está de acuerdo con esta cláusula , no puede utilizar ni citar ningún código ni archivo del paquete de software Consulte el directorio raíz <b>Agreement-LICENSE.txt</b> para obtener más información.", "模型推理": "inferencia del modelo", "推理音色": "inferencia de voz", "刷新音色列表": "Actualizar lista de voces", "卸载音色省显存": "Descargue la voz para ahorrar memoria GPU", "请选择说话人id": "seleccione una identificación de altavoz", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "Tecla +12 recomendada para conversión de voz de hombre a mujer, tecla -12 para conversión de voz de mujer a hombre. Si el rango de tono es demasiado amplio y causa distorsión, ajústelo usted mismo a un rango adecuado.", "变调(整数, 半音数量, 升八度12降八度-12)": "Cambio de tono (entero, número de semitonos, subir una octava +12 o bajar una octava -12)", "输入待处理音频文件路径(默认是正确格式示例)": "Ingrese la ruta del archivo del audio que se procesará (el formato predeterminado es el ejemplo correcto)", "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "Seleccione el algoritmo para la extracción de tono. Use 'pm' para acelerar las voces cantadas, o use 'harvest' para mejorar las voces bajas, pero es extremadamente lento.", "特征检索库文件路径": "Ruta del archivo de la base de datos de búsqueda de características", "特征文件路径": "Ruta del archivo de características", "检索特征占比": "Proporción de función de búsqueda", "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "Archivo de curva F0, opcional, un tono por línea, en lugar de F0 predeterminado y cambio de tono", "转换": "Conversión", "输出信息": "Información de salida", "输出音频(右下角三个点,点了可以下载)": "Salida de audio (haga clic en los tres puntos en la esquina inferior derecha para descargar)", "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "Conversión por lotes, ingrese la carpeta que contiene los archivos de audio para convertir o cargue varios archivos de audio. El audio convertido se emitirá en la carpeta especificada (opción predeterminada).", "指定输出文件夹": "Especificar carpeta de salida", "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "Ingrese la ruta a la carpeta de audio que se procesará (simplemente cópiela desde la barra de direcciones del administrador de archivos)", "也可批量输入音频文件, 二选一, 优先读文件夹": "También se pueden ingresar múltiples archivos de audio, cualquiera de las dos opciones, con prioridad dada a la carpeta", "伴奏人声分离": "Instrumental and vocal separation", "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)": "Procesamiento por lotes de separación instrumental y vocal utilizando el modelo UVR5. <br>Utilice HP2 para la separación vocal sin armónicos, y utilice HP5 para la separación vocal con armónicos y las voces extraídas no necesitan tener armónicos. <br>Ejemplo de una ruta de carpeta calificada: E:\\codes\\py39\\vits_vc_gpu\\test_sample (simplemente cópielo desde la barra de direcciones del administrador de archivos)", "输入待处理音频文件夹路径": "Ingrese la ruta a la carpeta de audio que se procesará", "模型": "Modelo", "人声提取激进程度": "人声提取激进程度", "指定输出人声文件夹": "Especificar la carpeta de salida de voces", "指定输出乐器文件夹": "Especificar la carpeta de salida de instrumentales", "训练": "Entrenamiento", "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "paso 1: Complete la configuración del experimento. Los datos del experimento se almacenan en el directorio 'logs', con cada experimento en una carpeta separada. La ruta del nombre del experimento debe ingresarse manualmente y debe contener la configuración del experimento, los registros y los archivos del modelo entrenado.", "输入实验名": "Ingrese el nombre del modelo", "目标采样率": "Tasa de muestreo objetivo", "模型是否带音高指导(唱歌一定要, 语音可以不要)": "Si el modelo tiene guía de tono (necesaria para cantar, pero no para hablar)", "否": "否", "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "paso 2a: recorra automáticamente la carpeta de capacitación y corte y normalice todos los archivos de audio que se pueden decodificar en audio. Se generarán dos carpetas 'wav' en el directorio del experimento. Actualmente, solo se admite la capacitación de una sola persona.", "输入训练文件夹路径": "Introduzca la ruta de la carpeta de entrenamiento", "请指定说话人id": "Especifique el ID del hablante", "处理数据": "Procesar datos", "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "paso 2b: use la CPU para extraer el tono (si el modelo tiene guía de tono) y la GPU para extraer características (seleccione el número de tarjeta).", "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "Separe los números de identificación de la GPU con '-' al ingresarlos. Por ejemplo, '0-1-2' significa usar GPU 0, GPU 1 y GPU 2.", "显卡信息": "información de la GPU", "提取音高使用的CPU进程数": "Número de subprocesos de CPU que se utilizarán para la extracción de tono", "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "Seleccione el algoritmo de extracción de tono: utilice 'pm' para un procesamiento más rápido de la voz cantada, 'dio' para un discurso de alta calidad pero un procesamiento más lento y 'cosecha' para obtener la mejor calidad pero un procesamiento más lento.", "特征提取": "Extracción de características", "step3: 填写训练设置, 开始训练模型和索引": "Paso 3: complete la configuración de entrenamiento y comience a entrenar el modelo y el índice.", "保存频率save_every_epoch": "Frecuencia de guardado (save_every_epoch)", "总训练轮数total_epoch": "Total de épocas de entrenamiento (total_epoch)", "每张显卡的batch_size": "每张显卡的batch_size", "是否仅保存最新的ckpt文件以节省硬盘空间": "Si guardar solo el archivo ckpt más reciente para ahorrar espacio en disco", "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "Si almacenar en caché todos los conjuntos de entrenamiento en la memoria de la GPU. Los conjuntos de datos pequeños (menos de 10 minutos) se pueden almacenar en caché para acelerar el entrenamiento, pero el almacenamiento en caché de conjuntos de datos grandes puede causar errores de memoria en la GPU y no aumenta la velocidad de manera significativa.", "加载预训练底模G路径": "Cargue la ruta G del modelo base preentrenada.", "加载预训练底模D路径": "Cargue la ruta del modelo D base preentrenada.", "训练模型": "Entrenar Modelo", "训练特征索引": "Índice de características del Entrenamiento", "一键训练": "Entrenamiento con un clic.", "ckpt处理": "Procesamiento de recibos", "模型融合, 可用于测试音色融合": "Fusión de modelos, se puede utilizar para fusionar diferentes voces", "A模型路径": "Modelo A ruta.", "B模型路径": "Modelo B ruta.", "A模型权重": "Un peso modelo para el modelo A.", "模型是否带音高指导": "Si el modelo tiene guía de tono.", "要置入的模型信息": "Información del modelo a colocar.", "保存的模型名不带后缀": "Nombre del modelo guardado sin extensión.", "融合": "Fusión.", "修改模型信息(仅支持weights文件夹下提取的小模型文件)": "Modificar la información del modelo (solo admite archivos de modelos pequeños extraídos en la carpeta de pesos).", "模型路径": "Ruta del modelo", "要改的模型信息": "Información del modelo a modificar", "保存的文件名, 默认空为和源文件同名": "Nombre del archivo que se guardará, el valor predeterminado es el mismo que el nombre del archivo de origen", "修改": "Modificar", "查看模型信息(仅支持weights文件夹下提取的小模型文件)": "Ver información del modelo (solo aplicable a archivos de modelos pequeños extraídos de la carpeta 'pesos')", "查看": "Ver", "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "Extracción de modelo (ingrese la ruta de un archivo de modelo grande en la carpeta 'logs'), aplicable cuando desea extraer un archivo de modelo pequeño después de entrenar a mitad de camino y no se guardó automáticamente, o cuando desea probar un modelo intermedio", "保存名": "Guardar nombre", "模型是否带音高指导,1是0否": "Si el modelo tiene guía de tono, 1 para sí, 0 para no", "提取": "Extracter", "Onnx导出": "Onnx导出", "RVC模型路径": "RVC模型路径", "Onnx输出路径": "Onnx输出路径", "MoeVS模型": "MoeVS模型", "导出Onnx模型": "导出Onnx模型", "招募音高曲线前端编辑器": "Reclutar editores front-end para curvas de tono", "加开发群联系我xxxxx": "Únase al grupo de desarrollo para contactarme en xxxxx", "点击查看交流、问题反馈群号": "Haga clic para ver el número de grupo de comunicación y comentarios sobre problemas", "xxxxx": "xxxxx", "加载模型": "Cargar modelo", "Hubert模型": "Modelo de Hubert ", "选择.pth文件": "Seleccionar archivo .pth", "选择.index文件": "Select .index file", "选择.npy文件": "Seleccionar archivo .npy", "输入设备": "Dispositivo de entrada", "输出设备": "Dispositivo de salida", "音频设备(请使用同种类驱动)": "Dispositivo de audio (utilice el mismo tipo de controlador)", "响应阈值": "Umbral de respuesta", "音调设置": "Ajuste de tono", "Index Rate": "Tasa de índice", "常规设置": "Configuración general", "采样长度": "Longitud de muestreo", "淡入淡出长度": "Duración del fundido de entrada/salida", "额外推理时长": "Tiempo de inferencia adicional", "输入降噪": "Reducción de ruido de entrada", "输出降噪": "Reducción de ruido de salida", "性能设置": "Configuración de rendimiento", "开始音频转换": "Iniciar conversión de audio", "停止音频转换": "Detener la conversión de audio", "推理时间(ms):": "Inferir tiempo (ms):"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "很遗憾您这没有能用的显卡来支持您训练": "很遗憾您这没有能用的显卡来支持您训练", "是": "是", "step1:正在处理数据": "step1:正在处理数据", "step2a:无需提取音高": "step2a:无需提取音高", "step2b:正在提取特征": "step2b:正在提取特征", "step3a:正在训练模型": "step3a:正在训练模型", "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log", "全流程结束!": "全流程结束!", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.", "模型推理": "モデル推論", "推理音色": "音源推論", "刷新音色列表": "音源リストを更新", "卸载音色省显存": "音源を削除してメモリを節約", "请选择说话人id": "話者IDを選択してください", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性から女性へは+12キーをお勧めします。女性から男性へは-12キーをお勧めします。音域が広すぎて音質が劣化した場合は、適切な音域に自分で調整することもできます。", "变调(整数, 半音数量, 升八度12降八度-12)": "ピッチ変更(整数、半音数、上下オクターブ12-12)", "输入待处理音频文件路径(默认是正确格式示例)": "処理対象音声ファイルのパスを入力してください(デフォルトは正しいフォーマットの例です)", "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "ピッチ抽出アルゴリズムを選択してください。歌声の場合は、pmを使用して速度を上げることができます。低音が重要な場合は、harvestを使用できますが、非常に遅くなります。", "特征检索库文件路径": "特徴量検索データベースのファイルパス", "特征文件路径": "特徴量ファイルのパス", "检索特征占比": "検索特徴率", "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0(最低共振周波数)カーブファイル(オプション、1行に1ピッチ、デフォルトのF0(最低共振周波数)とエレベーションを置き換えます。)", "转换": "変換", "输出信息": "出力情報", "输出音频(右下角三个点,点了可以下载)": "出力音声(右下の三点をクリックしてダウンロードできます)", "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "一括変換、変換する音声フォルダを入力、または複数の音声ファイルをアップロードし、指定したフォルダ(デフォルトのopt)に変換した音声を出力します。", "指定输出文件夹": "出力フォルダを指定してください", "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "処理対象音声フォルダーのパスを入力してください(ファイルマネージャのアドレスバーからコピーしてください)", "也可批量输入音频文件, 二选一, 优先读文件夹": "複数の音声ファイルを一括で入力することもできますが、フォルダーを優先して読み込みます", "伴奏人声分离": "伴奏とボーカルの分離", "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)": "UVR5モデルを使用した、声帯分離バッチ処理です。<br>HP2はハーモニー、ハーモニーのあるボーカルとハーモニーのないボーカルを抽出したものはHP5を使ってください <br>フォルダーパスの形式例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(エクスプローラーのアドレスバーからコピーするだけです)", "输入待处理音频文件夹路径": "処理するオーディオファイルのフォルダパスを入力してください", "模型": "モデル", "人声提取激进程度": "人声提取激进程度", "指定输出人声文件夹": "人の声を出力するフォルダを指定してください", "指定输出乐器文件夹": "楽器の出力フォルダを指定してください", "训练": "トレーニング", "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "ステップ1:実験設定を入力します。実験データはlogsに保存され、各実験にはフォルダーがあります。実験名のパスを手動で入力する必要があり、実験設定、ログ、トレーニングされたモデルファイルが含まれます。", "输入实验名": "実験名を入力してください", "目标采样率": "目標サンプリングレート", "模型是否带音高指导(唱歌一定要, 语音可以不要)": "モデルに音高ガイドがあるかどうか(歌唱には必要ですが、音声には必要ありません)", "否": "否", "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "ステップ2a: 訓練フォルダー内のすべての音声ファイルを自動的に探索し、スライスと正規化を行い、2つのwavフォルダーを実験ディレクトリに生成します。現在は一人でのトレーニングのみをサポートしています。", "输入训练文件夹路径": "トレーニング用フォルダのパスを入力してください", "请指定说话人id": "話者IDを指定してください", "处理数据": "データ処理", "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "ステップ2b: CPUを使用して音高を抽出する(モデルに音高がある場合)、GPUを使用して特徴を抽出する(カード番号を選択する)", "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "ハイフンで区切って使用するカード番号を入力します。例えば0-1-2はカード0、カード1、カード2を使用します", "显卡信息": "カード情報", "提取音高使用的CPU进程数": "抽出に使用するCPUプロセス数", "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "音高抽出アルゴリズムの選択:歌声を入力する場合は、pmを使用して速度を上げることができます。CPUが低い場合はdioを使用して速度を上げることができます。harvestは品質が高く、精度が高いですが、遅いです。", "特征提取": "特徴抽出", "step3: 填写训练设置, 开始训练模型和索引": "ステップ3: トレーニング設定を入力して、モデルとインデックスのトレーニングを開始します", "保存频率save_every_epoch": "エポックごとの保存頻度", "总训练轮数total_epoch": "総トレーニング回数", "每张显卡的batch_size": "每张显卡的batch_size", "是否仅保存最新的ckpt文件以节省硬盘空间": "ハードディスク容量を節約するため、最新のckptファイルのみを保存するかどうか", "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "すべてのトレーニングデータをメモリにキャッシュするかどうか。10分以下の小さなデータはキャッシュしてトレーニングを高速化できますが、大きなデータをキャッシュするとメモリが破裂し、あまり速度が上がりません。", "加载预训练底模G路径": "事前学習済みのGモデルのパスをロードしてください", "加载预训练底模D路径": "事前学習済みのDモデルのパスをロードしてください", "训练模型": "モデルのトレーニング", "训练特征索引": "特徴インデックスのトレーニング", "一键训练": "ワンクリックトレーニング", "ckpt处理": "ckptファイルの処理", "模型融合, 可用于测试音色融合": "モデルのマージ、音源のマージテストに使用できます", "A模型路径": "Aモデルのパス", "B模型路径": "Bモデルのパス", "A模型权重": "Aモデルの重み", "模型是否带音高指导": "モデルに音高ガイドを付けるかどうか", "要置入的模型信息": "挿入するモデル情報", "保存的模型名不带后缀": "拡張子のない保存するモデル名", "融合": "フュージョン", "修改模型信息(仅支持weights文件夹下提取的小模型文件)": "モデル情報の修正(weightsフォルダから抽出された小さなモデルファイルのみ対応)", "模型路径": "モデルパス", "要改的模型信息": "変更するモデル情報", "保存的文件名, 默认空为和源文件同名": "保存するファイル名、デフォルトでは空欄で元のファ���ル名と同じ名前になります", "修改": "変更", "查看模型信息(仅支持weights文件夹下提取的小模型文件)": "モデル情報を表示する(小さいモデルファイルはweightsフォルダーからのみサポートされています)", "查看": "表示", "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "モデル抽出(ログフォルダー内の大きなファイルのモデルパスを入力)、モデルを半分までトレーニングし、自動的に小さいファイルモデルを保存しなかったり、中間モデルをテストしたい場合に適用されます。", "保存名": "保存ファイル名", "模型是否带音高指导,1是0否": "モデルに音高ガイドを付けるかどうか、1は付ける、0は付けない", "提取": "抽出", "Onnx导出": "Onnx", "RVC模型路径": "RVCルパス", "Onnx输出路径": "Onnx出力パス", "MoeVS模型": "MoeSS?", "导出Onnx模型": "Onnxに変換", "招募音高曲线前端编辑器": "音高曲線フロントエンドエディターを募集", "加开发群联系我xxxxx": "開発グループに参加して私に連絡してくださいxxxxx", "点击查看交流、问题反馈群号": "クリックして交流、問題フィードバックグループ番号を表示", "xxxxx": "xxxxx", "加载模型": "モデルをロード", "Hubert模型": "Hubert模型", "选择.pth文件": ".pthファイルを選択", "选择.index文件": ".indexファイルを選択", "选择.npy文件": ".npyファイルを選択", "输入设备": "入力デバイス", "输出设备": "出力デバイス", "音频设备(请使用同种类驱动)": "オーディオデバイス(同じ種類のドライバーを使用してください)", "响应阈值": "反応閾値", "音调设置": "音程設定", "Index Rate": "Index Rate", "常规设置": "一般設定", "采样长度": "サンプル長", "淡入淡出长度": "フェードイン/フェードアウト長", "额外推理时长": "追加推論時間", "输入降噪": "入力ノイズの低減", "输出降噪": "出力ノイズの低減", "性能设置": "パフォーマンス設定", "开始音频转换": "音声変換を開始", "停止音频转换": "音声変換を停止", "推理时间(ms):": "推論時間(ms):"}123456789101112131415161718192021222324252627282930313233343536373839404142434445import jsonimport osfrom collections import OrderedDict
# Define the standard file namestandard_file = "zh_CN.json"
# Find all JSON files in the directorydir_path = "./"languages = [ f for f in os.listdir(dir_path) if f.endswith(".json") and f != standard_file]
# Load the standard filewith open(standard_file, "r", encoding="utf-8") as f: standard_data = json.load(f, object_pairs_hook=OrderedDict)
# Loop through each language filefor lang_file in languages: # Load the language file with open(lang_file, "r", encoding="utf-8") as f: lang_data = json.load(f, object_pairs_hook=OrderedDict)
# Find the difference between the language file and the standard file diff = set(standard_data.keys()) - set(lang_data.keys())
miss = set(lang_data.keys()) - set(standard_data.keys())
# Add any missing keys to the language file for key in diff: lang_data[key] = key
# Del any extra keys to the language file for key in miss: del lang_data[key]
# Sort the keys of the language file to match the order of the standard file lang_data = OrderedDict( sorted(lang_data.items(), key=lambda x: list(standard_data.keys()).index(x[0])) )
# Save the updated language file with open(lang_file, "w", encoding="utf-8") as f: json.dump(lang_data, f, ensure_ascii=False, indent=4) f.write("\n")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "很遗憾您这没有能用的显卡来支持您训练": "很遗憾您这没有能用的显卡来支持您训练", "是": "是", "step1:正在处理数据": "step1:正在处理数据", "step2a:无需提取音高": "step2a:无需提取音高", "step2b:正在提取特征": "step2b:正在提取特征", "step3a:正在训练模型": "step3a:正在训练模型", "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log", "全流程结束!": "全流程结束!", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.", "模型推理": "模型推理", "推理音色": "推理音色", "刷新音色列表": "刷新音色列表", "卸载音色省显存": "卸载音色省显存", "请选择说话人id": "请选择说话人id", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ", "变调(整数, 半音数量, 升八度12降八度-12)": "变调(整数, 半音数量, 升八度12降八度-12)", "输入待处理音频文件路径(默认是正确格式示例)": "输入待处理音频文件路径(默认是正确格式示例)", "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比", "特征检索库文件路径": "特征检索库文件路径", "特征文件路径": "特征文件路径", "检索特征占比": "检索特征占比", "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调", "转换": "转换", "输出信息": "输出信息", "输出音频(右下角三个点,点了可以下载)": "输出音频(右下角三个点,点了可以下载)", "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ", "指定输出文件夹": "指定输出文件夹", "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)", "也可批量输入音频文件, 二选一, 优先读文件夹": "也可批量输入音频文件, 二选一, 优先读文件夹", "伴奏人声分离": "伴奏人声分离", "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)": "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)", "输入待处理音频文件夹路径": "输入待处理音频文件夹路径", "模型": "模型", "人声提取激进程度": "人声提取激进程度", "指定输出人声文件夹": "指定输出人声文件夹", "指定输出乐器文件夹": "指定输出乐器文件夹", "训练": "训练", "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ", "输入实验名": "输入实验名", "目标采样率": "目标采样率", "模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否带音高指导(唱歌一定要, 语音可以不要)", "否": "否", "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ", "输入��练文件夹路径": "输入训练文件夹路径", "请指定说话人id": "请指定说话人id", "处理数据": "处理数据", "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)", "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2", "显卡信息": "显卡信息", "提取音高使用的CPU进程数": "提取音高使用的CPU进程数", "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢", "特征提取": "特征提取", "step3: 填写训练设置, 开始训练模型和索引": "step3: 填写训练设置, 开始训练模型和索引", "保存频率save_every_epoch": "保存频率save_every_epoch", "总训练轮数total_epoch": "总训练轮数total_epoch", "每张显卡的batch_size": "每张显卡的batch_size", "是否仅保存最新的ckpt文件以节省硬盘空间": "是否仅保存最新的ckpt文件以节省硬盘空间", "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速", "加载预训练底模G路径": "加载预训练底模G路径", "加载预训练底模D路径": "加载预训练底模D路径", "训练模型": "训练模型", "训练特征索引": "训练特征索引", "一键训练": "一键训练", "ckpt处理": "ckpt处理", "模型融合, 可用于测试音色融合": "模型融合, 可用于测试音色融合", "A模型路径": "A模型路径", "B模型路径": "B模型路径", "A模型权重": "A模型权重", "模型是否带音高指导": "模型是否带音高指导", "要置入的模型信息": "要置入的模型信息", "保存的模型名不带后缀": "保存的模型名不带后缀", "融合": "融合", "修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型信息(仅支持weights文件夹下提取的小模型文件)", "模型路径": "模型路径", "要改的模型信息": "要改的模型信息", "保存的文件名, 默认空为和源文件同名": "保存的文件名, 默认空为和源文件同名", "修改": "修改", "查看模型信息(仅支持weights文件夹下提取的小模型文件)": "查看模型信息(仅支持weights文件夹下提取的小模型文件)", "查看": "查看", "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况", "保存名": "保存名", "模型是否带音高指导,1是0否": "模型是否带音高指导,1是0否", "提取": "提取", "Onnx导出": "Onnx导出", "RVC模型路径": "RVC模型路径", "Onnx输出路径": "Onnx输出路径", "MoeVS模型": "MoeVS模型", "导出Onnx模型": "导出Onnx模型", "招募音高曲线前端编辑器": "招募音高曲线前端编辑器", "加开发群联系我xxxxx": "加开发群联系我xxxxx", "点击查看交流、问题反馈群号": "点击查看交流、问题反馈群号", "xxxxx": "xxxxx", "加载模型": "加载模型", "Hubert模型": "Hubert模型", "选择.pth文件": "选择.pth文件", "选择.index文件": "选择.index文件", "选择.npy文件": "选择.npy文件", "输入设备": "输入设备", "输出设备": "输出设备", "音频设备(请使用同种类驱动)": "音频设备(请使用同种类驱动)", "响应阈值": "响应阈值", "音调设置": "音调设置", "Index Rate": "Index Rate", "常规设置": "常规设置", "采样长度": "采样长度", "淡入淡出长度": "淡入淡出长度", "额外推理时长": "额外推理时长", "输入降噪": "输入降噪", "输出降噪": "输出降噪", "性能设置": "性能设置", "开始音频转换": "开始音频转换", "停止音频转换": "停止音频转换", "推理时间(ms):": "推理时间(ms):"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "很遗憾您这没有能用的显卡来支持您训练": "很遗憾您这没有能用的显卡来支持您训练", "是": "是", "step1:正在处理数据": "step1:正在处理数据", "step2a:无需提取音高": "step2a:无需提取音高", "step2b:正在提取特征": "step2b:正在提取特征", "step3a:正在训练模型": "step3a:正在训练模型", "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log", "全流程结束!": "全流程结束!", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本軟體以MIT協議開源,作者不對軟體具備任何控制力,使用軟體者、傳播軟體導出的聲音者自負全責。<br>如不認可該條款,則不能使用或引用軟體包內任何程式碼和檔案。詳見根目錄<b>使用需遵守的協議-LICENSE.txt</b>。", "模型推理": "模型推理", "推理音色": "推理音色", "刷新音色列表": "重新整理音色列表", "卸载音色省显存": "卸載音色節省 VRAM", "请选择说话人id": "請選擇說話人ID", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性轉女性推薦+12key,女性轉男性推薦-12key,如果音域爆炸導致音色失真也可以自己調整到合適音域。", "变调(整数, 半音数量, 升八度12降八度-12)": "變調(整數、半音數量、升八度12降八度-12)", "输入待处理音频文件路径(默认是正确格式示例)": "輸入待處理音頻檔案路徑(預設是正確格式示例)", "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "選擇音高提取演算法,輸入歌聲可用 pm 提速,harvest 低音好但巨慢無比", "特征检索库文件路径": "特徵檢索庫檔案路徑", "特征文件路径": "特徵檔案路徑", "检索特征占比": "檢索特徵佔比", "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲線檔案,可選,一行一個音高,代替預設的F0及升降調", "转换": "轉換", "输出信息": "輸出訊息", "输出音频(右下角三个点,点了可以下载)": "輸出音頻(右下角三個點,點了可以下載)", "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "批量轉換,輸入待轉換音頻資料夾,或上傳多個音頻檔案,在指定資料夾(默認opt)下輸出轉換的音頻。", "指定输出文件夹": "指定輸出資料夾", "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "輸入待處理音頻資料夾路徑(去檔案管理器地址欄拷貝即可)", "也可批量输入音频文件, 二选一, 优先读文件夹": "也可批量輸入音頻檔案,二選一,優先讀資料夾", "伴奏人声分离": "伴奏人聲分離", "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)": "人聲伴奏分離批量處理,使用UVR5模型。<br>不帶和聲用HP2,帶和聲且提取的人聲不需要和聲用HP5<br>合格的資料夾路徑格式舉例:E:\\codes\\py39\\vits_vc_gpu\\白鷺霜華測試樣例(去檔案管理員地址欄複製就行了)", "输入待处理音频文件夹路径": "輸入待處理音頻資料夾路徑", "模型": "模型", "人声提取激进程度": "人声提取激进程度", "指定输出人声文件夹": "指定輸出人聲資料夾", "指定输出乐器文件夹": "指定輸出樂器資料夾", "训练": "訓練", "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "step1:填寫實驗配置。實驗數據放在logs下,每個實驗一個資料夾,需手動輸入實驗名路徑,內含實驗配置、日誌、訓練得到的模型檔案。", "输入实验名": "輸入實驗名稱", "目标采样率": "目標取樣率", "模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否帶音高指導(唱歌一定要,語音可以不要)", "否": "否", "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a:自動遍歷訓練資料夾下所有可解碼成音頻的檔案並進行切片歸一��,在實驗目錄下生成2個wav資料夾;暫時只支援單人訓練。", "输入训练文件夹路径": "輸入訓練檔案夾路徑", "请指定说话人id": "請指定說話人id", "处理数据": "處理資料", "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "步驟2b: 使用CPU提取音高(如果模型帶音高), 使用GPU提取特徵(選擇卡號)", "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔輸入使用的卡號, 例如 0-1-2 使用卡0和卡1和卡2", "显卡信息": "顯示卡資訊", "提取音高使用的CPU进程数": "提取音高使用的CPU進程數", "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "選擇音高提取算法:輸入歌聲可用pm提速,高品質語音但CPU差可用dio提速,harvest品質更好但較慢", "特征提取": "特徵提取", "step3: 填写训练设置, 开始训练模型和索引": "步驟3: 填寫訓練設定, 開始訓練模型和索引", "保存频率save_every_epoch": "保存頻率save_every_epoch", "总训练轮数total_epoch": "總訓練輪數total_epoch", "每张显卡的batch_size": "每张显卡的batch_size", "是否仅保存最新的ckpt文件以节省硬盘空间": "是否僅保存最新的ckpt檔案以節省硬碟空間", "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否緩存所有訓練集至 VRAM。小於10分鐘的小數據可緩存以加速訓練,大數據緩存會爆 VRAM 也加不了多少速度", "加载预训练底模G路径": "加載預訓練底模G路徑", "加载预训练底模D路径": "加載預訓練底模D路徑", "训练模型": "訓練模型", "训练特征索引": "訓練特徵索引", "一键训练": "一鍵訓練", "ckpt处理": "ckpt處理", "模型融合, 可用于测试音色融合": "模型融合,可用於測試音色融合", "A模型路径": "A模型路徑", "B模型路径": "B模型路徑", "A模型权重": "A模型權重", "模型是否带音高指导": "模型是否帶音高指導", "要置入的模型信息": "要置入的模型資訊", "保存的模型名不带后缀": "儲存的模型名不帶副檔名", "融合": "融合", "修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型資訊(僅支援weights資料夾下提取的小模型檔案)", "模型路径": "模型路徑", "要改的模型信息": "要改的模型資訊", "保存的文件名, 默认空为和源文件同名": "儲存的檔案名,預設空為與來源檔案同名", "修改": "修改", "查看模型信息(仅支持weights文件夹下提取的小模型文件)": "查看模型資訊(僅支援weights資料夾下提取的小模型檔案)", "查看": "查看", "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "模型提取(輸入logs資料夾下大檔案模型路徑),適用於訓一半不想訓了模型沒有自動提取儲存小檔案模型,或者想測試中間模型的情況", "保存名": "儲存名", "模型是否带音高指导,1是0否": "模型是否帶音高指導,1是0否", "提取": "提取", "Onnx导出": "Onnx导出", "RVC模型路径": "RVC模型路径", "Onnx输出路径": "Onnx输出路径", "MoeVS模型": "MoeSS模型", "导出Onnx模型": "导出Onnx模型", "招募音高曲线前端编辑器": "招募音高曲線前端編輯器", "加开发群联系我xxxxx": "加開發群聯繫我xxxxx", "点击查看交流、问题反馈群号": "點擊查看交流、問題反饋群號", "xxxxx": "xxxxx", "加载模型": "載入模型", "Hubert模型": "Hubert 模型", "选择.pth文件": "選擇 .pth 檔案", "选择.index文件": "選擇 .index 檔案", "选择.npy文件": "選擇 .npy 檔案", "输入设备": "輸入設備", "输出设备": "輸出設備", "音频设备(请使用同种类驱动)": "音訊設備 (請使用同種類驅動)", "响应阈值": "響應閾值", "音调设置": "音調設定", "Index Rate": "Index Rate", "常规设置": "一般設定", "采样长度": "取樣長度", "淡入淡出长度": "淡入淡出長度", "额外推理时长": "額外推理時長", "输入降噪": "輸入降噪", "输出降噪": "輸出降噪", "性能设置": "效能設定", "开始音频转换": "開始音訊轉換", "停止音频转换": "停止音訊轉換", "推理时间(ms):": "推理時間(ms):"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "很遗憾您这没有能用的显卡来支持您训练": "很遗憾您这没有能用的显卡来支持您训练", "是": "是", "step1:正在处理数据": "step1:正在处理数据", "step2a:无需提取音高": "step2a:无需提取音高", "step2b:正在提取特征": "step2b:正在提取特征", "step3a:正在训练模型": "step3a:正在训练模型", "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log", "全流程结束!": "全流程结束!", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本軟體以MIT協議開源,作者不對軟體具備任何控制力,使用軟體者、傳播軟體導出的聲音者自負全責。<br>如不認可該條款,則不能使用或引用軟體包內任何程式碼和檔案。詳見根目錄<b>使用需遵守的協議-LICENSE.txt</b>。", "模型推理": "模型推理", "推理音色": "推理音色", "刷新音色列表": "重新整理音色列表", "卸载音色省显存": "卸載音色節省 VRAM", "请选择说话人id": "請選擇說話人ID", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性轉女性推薦+12key,女性轉男性推薦-12key,如果音域爆炸導致音色失真也可以自己調整到合適音域。", "变调(整数, 半音数量, 升八度12降八度-12)": "變調(整數、半音數量、升八度12降八度-12)", "输入待处理音频文件路径(默认是正确格式示例)": "輸入待處理音頻檔案路徑(預設是正確格式示例)", "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "選擇音高提取演算法,輸入歌聲可用 pm 提速,harvest 低音好但巨慢無比", "特征检索库文件路径": "特徵檢索庫檔案路徑", "特征文件路径": "特徵檔案路徑", "检索特征占比": "檢索特徵佔比", "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲線檔案,可選,一行一個音高,代替預設的F0及升降調", "转换": "轉換", "输出信息": "輸出訊息", "输出音频(右下角三个点,点了可以下载)": "輸出音頻(右下角三個點,點了可以下載)", "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "批量轉換,輸入待轉換音頻資料夾,或上傳多個音頻檔案,在指定資料夾(默認opt)下輸出轉換的音頻。", "指定输出文件夹": "指定輸出資料夾", "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "輸入待處理音頻資料夾路徑(去檔案管理器地址欄拷貝即可)", "也可批量输入音频文件, 二选一, 优先读文件夹": "也可批量輸入音頻檔案,二選一,優先讀資料夾", "伴奏人声分离": "伴奏人聲分離", "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)": "人聲伴奏分離批量處理,使用UVR5模型。<br>不帶和聲用HP2,帶和聲且提取的人聲不需要和聲用HP5<br>合格的資料夾路徑格式舉例:E:\\codes\\py39\\vits_vc_gpu\\白鷺霜華測試樣例(去檔案管理員地址欄複製就行了)", "输入待处理音频文件夹路径": "輸入待處理音頻資料夾路徑", "模型": "模型", "人声提取激进程度": "人声提取激进程度", "指定输出人声文件夹": "指定輸出人聲資料夾", "指定输出乐器文件夹": "指定輸出樂器資料夾", "训练": "訓練", "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "step1:填寫實驗配置。實驗數據放在logs下,每個實驗一個資料夾,需手動輸入實驗名路徑,內含實驗配置、日誌、訓練得到的模型檔案。", "输入实验名": "輸入實驗名稱", "目标采样率": "目標取樣率", "模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否帶音高指導(唱歌一定要,語音可以不要)", "否": "否", "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a:自動遍歷訓練資料夾下所有可解碼成音頻的檔案並進行切片歸一��,在實驗目錄下生成2個wav資料夾;暫時只支援單人訓練。", "输入训练文件夹路径": "輸入訓練檔案夾路徑", "请指定说话人id": "請指定說話人id", "处理数据": "處理資料", "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "步驟2b: 使用CPU提取音高(如果模型帶音高), 使用GPU提取特徵(選擇卡號)", "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔輸入使用的卡號, 例如 0-1-2 使用卡0和卡1和卡2", "显卡信息": "顯示卡資訊", "提取音高使用的CPU进程数": "提取音高使用的CPU進程數", "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "選擇音高提取算法:輸入歌聲可用pm提速,高品質語音但CPU差可用dio提速,harvest品質更好但較慢", "特征提取": "特徵提取", "step3: 填写训练设置, 开始训练模型和索引": "步驟3: 填寫訓練設定, 開始訓練模型和索引", "保存频率save_every_epoch": "保存頻率save_every_epoch", "总训练轮数total_epoch": "總訓練輪數total_epoch", "每张显卡的batch_size": "每张显卡的batch_size", "是否仅保存最新的ckpt文件以节省硬盘空间": "是否僅保存最新的ckpt檔案以節省硬碟空間", "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否緩存所有訓練集至 VRAM。小於10分鐘的小數據可緩存以加速訓練,大數據緩存會爆 VRAM 也加不了多少速度", "加载预训练底模G路径": "加載預訓練底模G路徑", "加载预训练底模D路径": "加載預訓練底模D路徑", "训练模型": "訓練模型", "训练特征索引": "訓練特徵索引", "一键训练": "一鍵訓練", "ckpt处理": "ckpt處理", "模型融合, 可用于测试音色融合": "模型融合,可用於測試音色融合", "A模型路径": "A模型路徑", "B模型路径": "B模型路徑", "A模型权重": "A模型權重", "模型是否带音高指导": "模型是否帶音高指導", "要置入的模型信息": "要置入的模型資訊", "保存的模型名不带后缀": "儲存的模型名不帶副檔名", "融合": "融合", "修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型資訊(僅支援weights資料夾下提取的小模型檔案)", "模型路径": "模型路徑", "要改的模型信息": "要改的模型資訊", "保存的文件名, 默认空为和源文件同名": "儲存的檔案名,預設空為與來源檔案同名", "修改": "修改", "查看模型信息(仅支持weights文件夹下提取的小模型文件)": "查看模型資訊(僅支援weights資料夾下提取的小模型檔案)", "查看": "查看", "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "模型提取(輸入logs資料夾下大檔案模型路徑),適用於訓一半不想訓了模型沒有自動提取儲存小檔案模型,或者想測試中間模型的情況", "保存名": "儲存名", "模型是否带音高指导,1是0否": "模型是否帶音高指導,1是0否", "提取": "提取", "Onnx导出": "Onnx导出", "RVC模型路径": "RVC模型路径", "Onnx输出路径": "Onnx输出路径", "MoeVS模型": "MoeSS模型", "导出Onnx模型": "导出Onnx模型", "招募音高曲线前端编辑器": "招募音高曲線前端編輯器", "加开发群联系我xxxxx": "加開發群聯繫我xxxxx", "点击查看交流、问题反馈群号": "點擊查看交流、問題反饋群號", "xxxxx": "xxxxx", "加载模型": "載入模型", "Hubert模型": "Hubert 模型", "选择.pth文件": "選擇 .pth 檔案", "选择.index文件": "選擇 .index 檔案", "选择.npy文件": "選擇 .npy 檔案", "输入设备": "輸入設備", "输出设备": "輸出設備", "音频设备(请使用同种类驱动)": "音訊設備 (請使用同種類驅動)", "响应阈值": "響應閾值", "音调设置": "音調設定", "Index Rate": "Index Rate", "常规设置": "一般設定", "采样长度": "取樣長度", "淡入淡出长度": "淡入淡出長度", "额外推理时长": "額外推理時長", "输入降噪": "輸入降噪", "输出降噪": "輸出降噪", "性能设置": "效能設定", "开始音频转换": "開始音訊轉換", "停止音频转换": "停止音訊轉換", "推理时间(ms):": "推理時間(ms):"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "很遗憾您这没有能用的显卡来支持您训练": "很遗憾您这没有能用的显卡来支持您训练", "是": "是", "step1:正在处理数据": "step1:正在处理数据", "step2a:无需提取音高": "step2a:无需提取音高", "step2b:正在提取特征": "step2b:正在提取特征", "step3a:正在训练模型": "step3a:正在训练模型", "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log", "全流程结束!": "全流程结束!", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>.": "本軟體以MIT協議開源,作者不對軟體具備任何控制力,使用軟體者、傳播軟體導出的聲音者自負全責。<br>如不認可該條款,則不能使用或引用軟體包內任何程式碼和檔案。詳見根目錄<b>使用需遵守的協議-LICENSE.txt</b>。", "模型推理": "模型推理", "推理音色": "推理音色", "刷新音色列表": "重新整理音色列表", "卸载音色省显存": "卸載音色節省 VRAM", "请选择说话人id": "請選擇說話人ID", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "男性轉女性推薦+12key,女性轉男性推薦-12key,如果音域爆炸導致音色失真也可以自己調整到合適音域。", "变调(整数, 半音数量, 升八度12降八度-12)": "變調(整數、半音數量、升八度12降八度-12)", "输入待处理音频文件路径(默认是正确格式示例)": "輸入待處理音頻檔案路徑(預設是正確格式示例)", "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比": "選擇音高提取演算法,輸入歌聲可用 pm 提速,harvest 低音好但巨慢無比", "特征检索库文件路径": "特徵檢索庫檔案路徑", "特征文件路径": "特徵檔案路徑", "检索特征占比": "檢索特徵佔比", "F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0曲線檔案,可選,一行一個音高,代替預設的F0及升降調", "转换": "轉換", "输出信息": "輸出訊息", "输出音频(右下角三个点,点了可以下载)": "輸出音頻(右下角三個點,點了可以下載)", "批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "批量轉換,輸入待轉換音頻資料夾,或上傳多個音頻檔案,在指定資料夾(默認opt)下輸出轉換的音頻。", "指定输出文件夹": "指定輸出資料夾", "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "輸入待處理音頻資料夾路徑(去檔案管理器地址欄拷貝即可)", "也可批量输入音频文件, 二选一, 优先读文件夹": "也可批量輸入音頻檔案,二選一,優先讀資料夾", "伴奏人声分离": "伴奏人聲分離", "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)": "人聲伴奏分離批量處理,使用UVR5模型。<br>不帶和聲用HP2,帶和聲且提取的人聲不需要和聲用HP5<br>合格的資料夾路徑格式舉例:E:\\codes\\py39\\vits_vc_gpu\\白鷺霜華測試樣例(去檔案管理員地址欄複製就行了)", "输入待处理音频文件夹路径": "輸入待處理音頻資料夾路徑", "模型": "模型", "人声提取激进程度": "人声提取激进程度", "指定输出人声文件夹": "指定輸出人聲資料夾", "指定输出乐器文件夹": "指定輸出樂器資料夾", "训练": "訓練", "step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "step1:填寫實驗配置。實驗數據放在logs下,每個實驗一個資料夾,需手動輸入實驗名路徑,內含實驗配置、日誌、訓練得到的模型檔案。", "输入实验名": "輸入實驗名稱", "目标采样率": "目標取樣率", "模型是否带音高指导(唱歌一定要, 语音可以不要)": "模型是否帶音高指導(唱歌一定要,語音可以不要)", "否": "否", "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a:自動遍歷訓練資料夾下所有可解碼成音頻的檔案並進行切片歸一��,在實驗目錄下生成2個wav資料夾;暫時只支援單人訓練。", "输入训练文件夹路径": "輸入訓練檔案夾路徑", "请指定说话人id": "請指定說話人id", "处理数据": "處理資料", "step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "步驟2b: 使用CPU提取音高(如果模型帶音高), 使用GPU提取特徵(選擇卡號)", "以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "以-分隔輸入使用的卡號, 例如 0-1-2 使用卡0和卡1和卡2", "显卡信息": "顯示卡資訊", "提取音高使用的CPU进程数": "提取音高使用的CPU進程數", "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢": "選擇音高提取算法:輸入歌聲可用pm提速,高品質語音但CPU差可用dio提速,harvest品質更好但較慢", "特征提取": "特徵提取", "step3: 填写训练设置, 开始训练模型和索引": "步驟3: 填寫訓練設定, 開始訓練模型和索引", "保存频率save_every_epoch": "保存頻率save_every_epoch", "总训练轮数total_epoch": "總訓練輪數total_epoch", "每张显卡的batch_size": "每张显卡的batch_size", "是否仅保存最新的ckpt文件以节省硬盘空间": "是否僅保存最新的ckpt檔案以節省硬碟空間", "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "是否緩存所有訓練集至 VRAM。小於10分鐘的小數據可緩存以加速訓練,大數據緩存會爆 VRAM 也加不了多少速度", "加载预训练底模G路径": "加載預訓練底模G路徑", "加载预训练底模D路径": "加載預訓練底模D路徑", "训练模型": "訓練模型", "训练特征索引": "訓練特徵索引", "一键训练": "一鍵訓練", "ckpt处理": "ckpt處理", "模型融合, 可用于测试音色融合": "模型融合,可用於測試音色融合", "A模型路径": "A模型路徑", "B模型路径": "B模型路徑", "A模型权重": "A模型權重", "模型是否带音高指导": "模型是否帶音高指導", "要置入的模型信息": "要置入的模型資訊", "保存的模型名不带后缀": "儲存的模型名不帶副檔名", "融合": "融合", "修改模型信息(仅支持weights文件夹下提取的小模型文件)": "修改模型資訊(僅支援weights資料夾下提取的小模型檔案)", "模型路径": "模型路徑", "要改的模型信息": "要改的模型資訊", "保存的文件名, 默认空为和源文件同名": "儲存的檔案名,預設空為與來源檔案同名", "修改": "修改", "查看模型信息(仅支持weights文件夹下提取的小模型文件)": "查看模型資訊(僅支援weights資料夾下提取的小模型檔案)", "查看": "查看", "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "模型提取(輸入logs資料夾下大檔案模型路徑),適用於訓一半不想訓了模型沒有自動提取儲存小檔案模型,或者想測試中間模型的情況", "保存名": "儲存名", "模型是否带音高指导,1是0否": "模型是否帶音高指導,1是0否", "提取": "提取", "Onnx导出": "Onnx导出", "RVC模型路径": "RVC模型路径", "Onnx输出路径": "Onnx输出路径", "MoeVS模型": "MoeSS模型", "导出Onnx模型": "导出Onnx模型", "招募音高曲线前端编辑器": "招募音高曲線前端編輯器", "加开发群联系我xxxxx": "加開發群聯繫我xxxxx", "点击查看交流、问题反馈群号": "點擊查看交流、問題反饋群號", "xxxxx": "xxxxx", "加载模型": "載入模型", "Hubert模型": "Hubert 模型", "选择.pth文件": "選擇 .pth 檔案", "选择.index文件": "選擇 .index 檔案", "选择.npy文件": "選擇 .npy 檔案", "输入设备": "輸入設備", "输出设备": "輸出設備", "音频设备(请使用同种类驱动)": "音訊設備 (請使用同種類驅動)", "响应阈值": "響應閾值", "音调设置": "音調設定", "Index Rate": "Index Rate", "常规设置": "一般設定", "采样长度": "取樣長度", "淡入淡出长度": "淡入淡出長度", "额外推理时长": "額外推理時長", "输入降噪": "輸入降噪", "输出降噪": "輸出降噪", "性能设置": "效能設定", "开始音频转换": "開始音訊轉換", "停止音频转换": "停止音訊轉換", "推理时间(ms):": "推理時間(ms):"}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547from multiprocessing import cpu_countimport threading, pdb, librosafrom time import sleepfrom subprocess import Popenfrom time import sleepimport torch, os, traceback, sys, warnings, shutil, numpy as npimport faissfrom random import shuffle
now_dir = os.getcwd()sys.path.append(now_dir)tmp = os.path.join(now_dir, "TEMP")shutil.rmtree(tmp, ignore_errors=True)os.makedirs(tmp, exist_ok=True)os.makedirs(os.path.join(now_dir, "logs"), exist_ok=True)os.makedirs(os.path.join(now_dir, "weights"), exist_ok=True)os.environ["TEMP"] = tmpwarnings.filterwarnings("ignore")torch.manual_seed(114514)from i18n import I18nAutoimport ffmpeg
i18n = I18nAuto()# 判断是否有能用来训练和加速推理的N卡ncpu = cpu_count()ngpu = torch.cuda.device_count()gpu_infos = []mem = []if (not torch.cuda.is_available()) or ngpu == 0: if_gpu_ok = Falseelse: if_gpu_ok = False for i in range(ngpu): gpu_name = torch.cuda.get_device_name(i) if ( "10" in gpu_name or "16" in gpu_name or "20" in gpu_name or "30" in gpu_name or "40" in gpu_name or "A2" in gpu_name.upper() or "A3" in gpu_name.upper() or "A4" in gpu_name.upper() or "P4" in gpu_name.upper() or "A50" in gpu_name.upper() or "70" in gpu_name or "80" in gpu_name or "90" in gpu_name or "M4" in gpu_name.upper() or "T4" in gpu_name.upper() or "TITAN" in gpu_name.upper() ): # A10#A100#V100#A40#P40#M40#K80#A4500 if_gpu_ok = True # 至少有一张能用的N卡 gpu_infos.append("%s\t%s" % (i, gpu_name)) mem.append( int( torch.cuda.get_device_properties(i).total_memory / 1024 / 1024 / 1024 + 0.4 ) )if if_gpu_ok == True and len(gpu_infos) > 0: gpu_info = "\n".join(gpu_infos) default_batch_size = min(mem) // 2else: gpu_info = i18n("很遗憾您这没有能用的显卡来支持您训练") default_batch_size = 1gpus = "-".join([i[0] for i in gpu_infos])from infer_pack.models import SynthesizerTrnMs256NSFsid, SynthesizerTrnMs256NSFsid_nonofrom scipy.io import wavfilefrom fairseq import checkpoint_utilsimport gradio as grimport loggingfrom vc_infer_pipeline import VCfrom config import Configfrom infer_uvr5 import _audio_pre_from my_utils import load_audiofrom train.process_ckpt import show_info, change_info, merge, extract_small_model
config = Config()# from trainset_preprocess_pipeline import PreProcesslogging.getLogger("numba").setLevel(logging.WARNING)
class ToolButton(gr.Button, gr.components.FormComponent): """Small button with single emoji as text, fits inside gradio forms"""
def __init__(self, **kwargs): super().__init__(variant="tool", **kwargs)
def get_block_name(self): return "button"
hubert_model = None
def load_hubert(): global hubert_model models, _, _ = checkpoint_utils.load_model_ensemble_and_task( ["hubert_base.pt"], suffix="", ) hubert_model = models[0] hubert_model = hubert_model.to(config.device) if config.is_half: hubert_model = hubert_model.half() else: hubert_model = hubert_model.float() hubert_model.eval()
weight_root = "weights"weight_uvr5_root = "uvr5_weights"names = []for name in os.listdir(weight_root): if name.endswith(".pth"): names.append(name)uvr5_names = []for name in os.listdir(weight_uvr5_root): if name.endswith(".pth"): uvr5_names.append(name.replace(".pth", ""))
def vc_single( sid, input_audio, f0_up_key, f0_file, f0_method, file_index, # file_big_npy, index_rate,): # spk_item, input_audio0, vc_transform0,f0_file,f0method0 global tgt_sr, net_g, vc, hubert_model if input_audio is None: return "You need to upload an audio", None f0_up_key = int(f0_up_key) try: audio = load_audio(input_audio, 16000) times = [0, 0, 0] if hubert_model == None: load_hubert() if_f0 = cpt.get("f0", 1) file_index = ( file_index.strip(" ") .strip('"') .strip("\n") .strip('"') .strip(" ") .replace("trained", "added") ) # 防止小白写错,自动帮他替换掉 # file_big_npy = ( # file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ") # ) audio_opt = vc.pipeline( hubert_model, net_g, sid, audio, times, f0_up_key, f0_method, file_index, # file_big_npy, index_rate, if_f0, f0_file=f0_file, ) print( "npy: ", times[0], "s, f0: ", times[1], "s, infer: ", times[2], "s", sep="" ) return "Success", (tgt_sr, audio_opt) except: info = traceback.format_exc() print(info) return info, (None, None)
def vc_multi( sid, dir_path, opt_root, paths, f0_up_key, f0_method, file_index, # file_big_npy, index_rate,): try: dir_path = ( dir_path.strip(" ").strip('"').strip("\n").strip('"').strip(" ") ) # 防止小白拷路径头尾带了空格和"和回车 opt_root = opt_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ") os.makedirs(opt_root, exist_ok=True) try: if dir_path != "": paths = [os.path.join(dir_path, name) for name in os.listdir(dir_path)] else: paths = [path.name for path in paths] except: traceback.print_exc() paths = [path.name for path in paths] infos = [] file_index = ( file_index.strip(" ") .strip('"') .strip("\n") .strip('"') .strip(" ") .replace("trained", "added") ) # 防止小白写错,自动帮他替换掉 for path in paths: info, opt = vc_single( sid, path, f0_up_key, None, f0_method, file_index, # file_big_npy, index_rate, ) if info == "Success": try: tgt_sr, audio_opt = opt wavfile.write( "%s/%s" % (opt_root, os.path.basename(path)), tgt_sr, audio_opt ) except: info = traceback.format_exc() infos.append("%s->%s" % (os.path.basename(path), info)) yield "\n".join(infos) yield "\n".join(infos) except: yield traceback.format_exc()
def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg): infos = [] try: inp_root = inp_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ") save_root_vocal = ( save_root_vocal.strip(" ").strip('"').strip("\n").strip('"').strip(" ") ) save_root_ins = ( save_root_ins.strip(" ").strip('"').strip("\n").strip('"').strip(" ") ) pre_fun = _audio_pre_( agg=int(agg), model_path=os.path.join(weight_uvr5_root, model_name + ".pth"), device=config.device, is_half=config.is_half, ) if inp_root != "": paths = [os.path.join(inp_root, name) for name in os.listdir(inp_root)] else: paths = [path.name for path in paths] for path in paths: inp_path = os.path.join(inp_root, path) need_reformat = 1 done = 0 try: info = ffmpeg.probe(inp_path, cmd="ffprobe") if ( info["streams"][0]["channels"] == 2 and info["streams"][0]["sample_rate"] == "44100" ): need_reformat = 0 pre_fun._path_audio_(inp_path, save_root_ins, save_root_vocal) done = 1 except: need_reformat = 1 traceback.print_exc() if need_reformat == 1: tmp_path = "%s/%s.reformatted.wav" % (tmp, os.path.basename(inp_path)) os.system( "ffmpeg -i %s -vn -acodec pcm_s16le -ac 2 -ar 44100 %s -y" % (inp_path, tmp_path) ) inp_path = tmp_path try: if done == 0: pre_fun._path_audio_(inp_path, save_root_ins, save_root_vocal) infos.append("%s->Success" % (os.path.basename(inp_path))) yield "\n".join(infos) except: infos.append( "%s->%s" % (os.path.basename(inp_path), traceback.format_exc()) ) yield "\n".join(infos) except: infos.append(traceback.format_exc()) yield "\n".join(infos) finally: try: del pre_fun.model del pre_fun except: traceback.print_exc() print("clean_empty_cache") if torch.cuda.is_available(): torch.cuda.empty_cache() yield "\n".join(infos)
# 一个选项卡全局只能有一个音色def get_vc(sid): global n_spk, tgt_sr, net_g, vc, cpt if sid == []: global hubert_model if hubert_model != None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的 print("clean_empty_cache") del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None if torch.cuda.is_available(): torch.cuda.empty_cache() ###楼下不这么折腾清理不干净 if_f0 = cpt.get("f0", 1) if if_f0 == 1: net_g = SynthesizerTrnMs256NSFsid( *cpt["config"], is_half=config.is_half ) else: net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"]) del net_g, cpt if torch.cuda.is_available(): torch.cuda.empty_cache() cpt = None return {"visible": False, "__type__": "update"} person = "%s/%s" % (weight_root, sid) print("loading %s" % person) cpt = torch.load(person, map_location="cpu") tgt_sr = cpt["config"][-1] cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk if_f0 = cpt.get("f0", 1) if if_f0 == 1: net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=config.is_half) else: net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"]) del net_g.enc_q print(net_g.load_state_dict(cpt["weight"], strict=False)) # 不加这一行清不干净, 真奇葩 net_g.eval().to(config.device) if config.is_half: net_g = net_g.half() else: net_g = net_g.float() vc = VC(tgt_sr, config) n_spk = cpt["config"][-3] return {"visible": True, "maximum": n_spk, "__type__": "update"}
def change_choices(): names = [] for name in os.listdir(weight_root): if name.endswith(".pth"): names.append(name) return {"choices": sorted(names), "__type__": "update"}
def clean(): return {"value": "", "__type__": "update"}
def change_f0(if_f0_3, sr2): # np7, f0method8,pretrained_G14,pretrained_D15 if if_f0_3 == i18n("是"): return ( {"visible": True, "__type__": "update"}, {"visible": True, "__type__": "update"}, "pretrained/f0G%s.pth" % sr2, "pretrained/f0D%s.pth" % sr2, ) return ( {"visible": False, "__type__": "update"}, {"visible": False, "__type__": "update"}, "pretrained/G%s.pth" % sr2, "pretrained/D%s.pth" % sr2, )
sr_dict = { "32k": 32000, "40k": 40000, "48k": 48000,}
def if_done(done, p): while 1: if p.poll() == None: sleep(0.5) else: break done[0] = True
def if_done_multi(done, ps): while 1: # poll==None代表进程未结束 # 只要有一个进程未结束都不停 flag = 1 for p in ps: if p.poll() == None: flag = 0 sleep(0.5) break if flag == 1: break done[0] = True
def preprocess_dataset(trainset_dir, exp_dir, sr, n_p=ncpu): sr = sr_dict[sr] os.makedirs("%s/logs/%s" % (now_dir, exp_dir), exist_ok=True) f = open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir), "w") f.close() cmd = ( config.python_cmd + " trainset_preprocess_pipeline_print.py %s %s %s %s/logs/%s " % (trainset_dir, sr, n_p, now_dir, exp_dir) + str(config.noparallel) ) print(cmd) p = Popen(cmd, shell=True) # , stdin=PIPE, stdout=PIPE,stderr=PIPE,cwd=now_dir ###煞笔gr, popen read都非得全跑完了再一次性读取, 不用gr就正常读一句输出一句;只能额外弄出一个文本流定时读 done = [False] threading.Thread( target=if_done, args=( done, p, ), ).start() while 1: with open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir), "r") as f: yield (f.read()) sleep(1) if done[0] == True: break with open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir), "r") as f: log = f.read() print(log) yield log
# but2.click(extract_f0,[gpus6,np7,f0method8,if_f0_3,trainset_dir4],[info2])def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir): gpus = gpus.split("-") os.makedirs("%s/logs/%s" % (now_dir, exp_dir), exist_ok=True) f = open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "w") f.close() if if_f0 == i18n("是"): cmd = config.python_cmd + " extract_f0_print.py %s/logs/%s %s %s" % ( now_dir, exp_dir, n_p, f0method, ) print(cmd) p = Popen(cmd, shell=True, cwd=now_dir) # , stdin=PIPE, stdout=PIPE,stderr=PIPE ###煞笔gr, popen read都非得全跑完了再一次性读取, 不用gr就正常读一句输出一句;只能额外弄出一个文本流定时读 done = [False] threading.Thread( target=if_done, args=( done, p, ), ).start() while 1: with open( "%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r" ) as f: yield (f.read()) sleep(1) if done[0] == True: break with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r") as f: log = f.read() print(log) yield log ####对不同part分别开多进程 """ n_part=int(sys.argv[1]) i_part=int(sys.argv[2]) i_gpu=sys.argv[3] exp_dir=sys.argv[4] os.environ["CUDA_VISIBLE_DEVICES"]=str(i_gpu) """ leng = len(gpus) ps = [] for idx, n_g in enumerate(gpus): cmd = config.python_cmd + " extract_feature_print.py %s %s %s %s %s/logs/%s" % ( config.device, leng, idx, n_g, now_dir, exp_dir, ) print(cmd) p = Popen( cmd, shell=True, cwd=now_dir ) # , shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=now_dir ps.append(p) ###煞笔gr, popen read都非得全跑完了再一次性读取, 不用gr就正常读一句输出一句;只能额外弄出一个文本流定时读 done = [False] threading.Thread( target=if_done_multi, args=( done, ps, ), ).start() while 1: with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r") as f: yield (f.read()) sleep(1) if done[0] == True: break with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r") as f: log = f.read() print(log) yield log
def change_sr2(sr2, if_f0_3): if if_f0_3 == i18n("是"): return "pretrained/f0G%s.pth" % sr2, "pretrained/f0D%s.pth" % sr2 else: return "pretrained/G%s.pth" % sr2, "pretrained/D%s.pth" % sr2
# but3.click(click_train,[exp_dir1,sr2,if_f0_3,save_epoch10,total_epoch11,batch_size12,if_save_latest13,pretrained_G14,pretrained_D15,gpus16])def click_train( exp_dir1, sr2, if_f0_3, spk_id5, save_epoch10, total_epoch11, batch_size12, if_save_latest13, pretrained_G14, pretrained_D15, gpus16, if_cache_gpu17,): # 生成filelist exp_dir = "%s/logs/%s" % (now_dir, exp_dir1) os.makedirs(exp_dir, exist_ok=True) gt_wavs_dir = "%s/0_gt_wavs" % (exp_dir) co256_dir = "%s/3_feature256" % (exp_dir) if if_f0_3 == i18n("是"): f0_dir = "%s/2a_f0" % (exp_dir) f0nsf_dir = "%s/2b-f0nsf" % (exp_dir) names = ( set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set([name.split(".")[0] for name in os.listdir(co256_dir)]) & set([name.split(".")[0] for name in os.listdir(f0_dir)]) & set([name.split(".")[0] for name in os.listdir(f0nsf_dir)]) ) else: names = set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set( [name.split(".")[0] for name in os.listdir(co256_dir)] ) opt = [] for name in names: if if_f0_3 == i18n("是"): opt.append( "%s/%s.wav|%s/%s.npy|%s/%s.wav.npy|%s/%s.wav.npy|%s" % ( gt_wavs_dir.replace("\\", "\\\\"), name, co256_dir.replace("\\", "\\\\"), name, f0_dir.replace("\\", "\\\\"), name, f0nsf_dir.replace("\\", "\\\\"), name, spk_id5, ) ) else: opt.append( "%s/%s.wav|%s/%s.npy|%s" % ( gt_wavs_dir.replace("\\", "\\\\"), name, co256_dir.replace("\\", "\\\\"), name, spk_id5, ) ) if if_f0_3 == i18n("是"): for _ in range(2): opt.append( "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s" % (now_dir, sr2, now_dir, now_dir, now_dir, spk_id5) ) else: for _ in range(2): opt.append( "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s" % (now_dir, sr2, now_dir, spk_id5) ) shuffle(opt) with open("%s/filelist.txt" % exp_dir, "w") as f: f.write("\n".join(opt)) print("write filelist done") # 生成config#无需生成config # cmd = python_cmd + " train_nsf_sim_cache_sid_load_pretrain.py -e mi-test -sr 40k -f0 1 -bs 4 -g 0 -te 10 -se 5 -pg pretrained/f0G40k.pth -pd pretrained/f0D40k.pth -l 1 -c 0" print("use gpus:", gpus16) if gpus16: cmd = ( config.python_cmd + " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s -pg %s -pd %s -l %s -c %s" % ( exp_dir1, sr2, 1 if if_f0_3 == i18n("是") else 0, batch_size12, gpus16, total_epoch11, save_epoch10, pretrained_G14, pretrained_D15, 1 if if_save_latest13 == i18n("是") else 0, 1 if if_cache_gpu17 == i18n("是") else 0, ) ) else: cmd = ( config.python_cmd + " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s -pg %s -pd %s -l %s -c %s" % ( exp_dir1, sr2, 1 if if_f0_3 == i18n("是") else 0, batch_size12, total_epoch11, save_epoch10, pretrained_G14, pretrained_D15, 1 if if_save_latest13 == i18n("是") else 0, 1 if if_cache_gpu17 == i18n("是") else 0, ) ) print(cmd) p = Popen(cmd, shell=True, cwd=now_dir) p.wait() return "训练结束, 您可查看控制台训练日志或实验文件夹下的train.log"
# but4.click(train_index, [exp_dir1], info3)def train_index(exp_dir1): exp_dir = "%s/logs/%s" % (now_dir, exp_dir1) os.makedirs(exp_dir, exist_ok=True) feature_dir = "%s/3_feature256" % (exp_dir) if os.path.exists(feature_dir) == False: return "请先进行特征提取!" listdir_res = list(os.listdir(feature_dir)) if len(listdir_res) == 0: return "请先进行特征提取!" npys = [] for name in sorted(listdir_res): phone = np.load("%s/%s" % (feature_dir, name)) npys.append(phone) big_npy = np.concatenate(npys, 0) big_npy_idx = np.arange(big_npy.shape[0]) np.random.shuffle(big_npy_idx) big_npy = big_npy[big_npy_idx] np.save("%s/total_fea.npy" % exp_dir, big_npy) # n_ivf = big_npy.shape[0] // 39 n_ivf = min(int(16 * np.sqrt(big_npy.shape[0])), big_npy.shape[0] // 39) infos = [] infos.append("%s,%s" % (big_npy.shape, n_ivf)) yield "\n".join(infos) index = faiss.index_factory(256, "IVF%s,Flat" % n_ivf) # index = faiss.index_factory(256, "IVF%s,PQ128x4fs,RFlat"%n_ivf) infos.append("training") yield "\n".join(infos) index_ivf = faiss.extract_index_ivf(index) # # index_ivf.nprobe = int(np.power(n_ivf,0.3)) index_ivf.nprobe = 1 index.train(big_npy) faiss.write_index( index, "%s/trained_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe), ) # faiss.write_index(index, '%s/trained_IVF%s_Flat_FastScan.index'%(exp_dir,n_ivf)) infos.append("adding") yield "\n".join(infos) batch_size_add = 8192 for i in range(0, big_npy.shape[0], batch_size_add): index.add(big_npy[i : i + batch_size_add]) faiss.write_index( index, "%s/added_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe), ) infos.append("成功构建索引,added_IVF%s_Flat_nprobe_%s.index" % (n_ivf, index_ivf.nprobe)) # faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan.index'%(exp_dir,n_ivf)) # infos.append("成功构建索引,added_IVF%s_Flat_FastScan.index"%(n_ivf)) yield "\n".join(infos)
# but5.click(train1key, [exp_dir1, sr2, if_f0_3, trainset_dir4, spk_id5, gpus6, np7, f0method8, save_epoch10, total_epoch11, batch_size12, if_save_latest13, pretrained_G14, pretrained_D15, gpus16, if_cache_gpu17], info3)def train1key( exp_dir1, sr2, if_f0_3, trainset_dir4, spk_id5, gpus6, np7, f0method8, save_epoch10, total_epoch11, batch_size12, if_save_latest13, pretrained_G14, pretrained_D15, gpus16, if_cache_gpu17,): infos = []
def get_info_str(strr): infos.append(strr) return "\n".join(infos)
os.makedirs("%s/logs/%s" % (now_dir, exp_dir1), exist_ok=True) #########step1:处理数据 open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir1), "w").close() cmd = ( config.python_cmd + " trainset_preprocess_pipeline_print.py %s %s %s %s/logs/%s " % (trainset_dir4, sr_dict[sr2], ncpu, now_dir, exp_dir1) + str(config.noparallel) ) yield get_info_str(i18n("step1:正在处理数据")) yield get_info_str(cmd) p = Popen(cmd, shell=True) p.wait() with open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir1), "r") as f: print(f.read()) #########step2a:提取音高 open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir1), "w") if if_f0_3 == i18n("是"): yield get_info_str("step2a:正在提取音高") cmd = config.python_cmd + " extract_f0_print.py %s/logs/%s %s %s" % ( now_dir, exp_dir1, np7, f0method8, ) yield get_info_str(cmd) p = Popen(cmd, shell=True, cwd=now_dir) p.wait() with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir1), "r") as f: print(f.read()) else: yield get_info_str(i18n("step2a:无需提取音高")) #######step2b:提取特征 yield get_info_str(i18n("step2b:正在提取特征")) gpus = gpus16.split("-") leng = len(gpus) ps = [] for idx, n_g in enumerate(gpus): cmd = config.python_cmd + " extract_feature_print.py %s %s %s %s %s/logs/%s" % ( config.device, leng, idx, n_g, now_dir, exp_dir1, ) yield get_info_str(cmd) p = Popen( cmd, shell=True, cwd=now_dir ) # , shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=now_dir ps.append(p) for p in ps: p.wait() with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir1), "r") as f: print(f.read()) #######step3a:训练模型 yield get_info_str(i18n("step3a:正在训练模型")) # 生成filelist exp_dir = "%s/logs/%s" % (now_dir, exp_dir1) gt_wavs_dir = "%s/0_gt_wavs" % (exp_dir) co256_dir = "%s/3_feature256" % (exp_dir) if if_f0_3 == i18n("是"): f0_dir = "%s/2a_f0" % (exp_dir) f0nsf_dir = "%s/2b-f0nsf" % (exp_dir) names = ( set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set([name.split(".")[0] for name in os.listdir(co256_dir)]) & set([name.split(".")[0] for name in os.listdir(f0_dir)]) & set([name.split(".")[0] for name in os.listdir(f0nsf_dir)]) ) else: names = set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set( [name.split(".")[0] for name in os.listdir(co256_dir)] ) opt = [] for name in names: if if_f0_3 == i18n("是"): opt.append( "%s/%s.wav|%s/%s.npy|%s/%s.wav.npy|%s/%s.wav.npy|%s" % ( gt_wavs_dir.replace("\\", "\\\\"), name, co256_dir.replace("\\", "\\\\"), name, f0_dir.replace("\\", "\\\\"), name, f0nsf_dir.replace("\\", "\\\\"), name, spk_id5, ) ) else: opt.append( "%s/%s.wav|%s/%s.npy|%s" % ( gt_wavs_dir.replace("\\", "\\\\"), name, co256_dir.replace("\\", "\\\\"), name, spk_id5, ) ) if if_f0_3 == i18n("是"): for _ in range(2): opt.append( "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s" % (now_dir, sr2, now_dir, now_dir, now_dir, spk_id5) ) else: for _ in range(2): opt.append( "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature256/mute.npy|%s" % (now_dir, sr2, now_dir, spk_id5) ) shuffle(opt) with open("%s/filelist.txt" % exp_dir, "w") as f: f.write("\n".join(opt)) yield get_info_str("write filelist done") if gpus16: cmd = ( config.python_cmd + " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s -pg %s -pd %s -l %s -c %s" % ( exp_dir1, sr2, 1 if if_f0_3 == i18n("是") else 0, batch_size12, gpus16, total_epoch11, save_epoch10, pretrained_G14, pretrained_D15, 1 if if_save_latest13 == i18n("是") else 0, 1 if if_cache_gpu17 == i18n("是") else 0, ) ) else: cmd = ( config.python_cmd + " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s -pg %s -pd %s -l %s -c %s" % ( exp_dir1, sr2, 1 if if_f0_3 == i18n("是") else 0, batch_size12, total_epoch11, save_epoch10, pretrained_G14, pretrained_D15, 1 if if_save_latest13 == i18n("是") else 0, 1 if if_cache_gpu17 == i18n("是") else 0, ) ) yield get_info_str(cmd) p = Popen(cmd, shell=True, cwd=now_dir) p.wait() yield get_info_str(i18n("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log")) #######step3b:训练索引 feature_dir = "%s/3_feature256" % (exp_dir) npys = [] listdir_res = list(os.listdir(feature_dir)) for name in sorted(listdir_res): phone = np.load("%s/%s" % (feature_dir, name)) npys.append(phone) big_npy = np.concatenate(npys, 0) big_npy_idx = np.arange(big_npy.shape[0]) np.random.shuffle(big_npy_idx) big_npy = big_npy[big_npy_idx] np.save("%s/total_fea.npy" % exp_dir, big_npy) # n_ivf = big_npy.shape[0] // 39 n_ivf = min(int(16 * np.sqrt(big_npy.shape[0])), big_npy.shape[0] // 39) yield get_info_str("%s,%s" % (big_npy.shape, n_ivf)) index = faiss.index_factory(256, "IVF%s,Flat" % n_ivf) yield get_info_str("training index") index_ivf = faiss.extract_index_ivf(index) # # index_ivf.nprobe = int(np.power(n_ivf,0.3)) index_ivf.nprobe = 1 index.train(big_npy) faiss.write_index( index, "%s/trained_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe), ) yield get_info_str("adding index") batch_size_add = 8192 for i in range(0, big_npy.shape[0], batch_size_add): index.add(big_npy[i : i + batch_size_add]) faiss.write_index( index, "%s/added_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe), ) yield get_info_str( "成功构建索引, added_IVF%s_Flat_nprobe_%s.index" % (n_ivf, index_ivf.nprobe) ) yield get_info_str(i18n("全流程结束!"))
# ckpt_path2.change(change_info_,[ckpt_path2],[sr__,if_f0__])def change_info_(ckpt_path): if ( os.path.exists(ckpt_path.replace(os.path.basename(ckpt_path), "train.log")) == False ): return {"__type__": "update"}, {"__type__": "update"} try: with open( ckpt_path.replace(os.path.basename(ckpt_path), "train.log"), "r" ) as f: info = eval(f.read().strip("\n").split("\n")[0].split("\t")[-1]) sr, f0 = info["sample_rate"], info["if_f0"] return sr, str(f0) except: traceback.print_exc() return {"__type__": "update"}, {"__type__": "update"}
from infer_pack.models_onnx_moess import SynthesizerTrnMs256NSFsidMfrom infer_pack.models_onnx import SynthesizerTrnMs256NSFsidO
def export_onnx(ModelPath, ExportedPath, MoeVS=True): hidden_channels = 256 # hidden_channels,为768Vec做准备 cpt = torch.load(ModelPath, map_location="cpu") cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk print(*cpt["config"])
test_phone = torch.rand(1, 200, hidden_channels) # hidden unit test_phone_lengths = torch.tensor([200]).long() # hidden unit 长度(貌似没啥用) test_pitch = torch.randint(size=(1, 200), low=5, high=255) # 基频(单位赫兹) test_pitchf = torch.rand(1, 200) # nsf基频 test_ds = torch.LongTensor([0]) # 说话人ID test_rnd = torch.rand(1, 192, 200) # 噪声(加入随机因子)
device = "cpu" # 导出时设备(不影响使用模型)
if MoeVS: net_g = SynthesizerTrnMs256NSFsidM( *cpt["config"], is_half=False ) # fp32导出(C++要支持fp16必须手动将内存重新排列所以暂时不用fp16) net_g.load_state_dict(cpt["weight"], strict=False) input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"] output_names = [ "audio", ] torch.onnx.export( net_g, ( test_phone.to(device), test_phone_lengths.to(device), test_pitch.to(device), test_pitchf.to(device), test_ds.to(device), test_rnd.to(device), ), ExportedPath, dynamic_axes={ "phone": [1], "pitch": [1], "pitchf": [1], "rnd": [2], }, do_constant_folding=False, opset_version=16, verbose=False, input_names=input_names, output_names=output_names, ) else: net_g = SynthesizerTrnMs256NSFsidO( *cpt["config"], is_half=False ) # fp32导出(C++要支持fp16必须手动将内存重新排列所以暂时不用fp16) net_g.load_state_dict(cpt["weight"], strict=False) input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds"] output_names = [ "audio", ] torch.onnx.export( net_g, ( test_phone.to(device), test_phone_lengths.to(device), test_pitch.to(device), test_pitchf.to(device), test_ds.to(device), ), ExportedPath, dynamic_axes={ "phone": [1], "pitch": [1], "pitchf": [1], }, do_constant_folding=False, opset_version=16, verbose=False, input_names=input_names, output_names=output_names, ) return "Finished"
with gr.Blocks() as app: gr.Markdown( value=i18n( "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>使用需遵守的协议-LICENSE.txt</b>." ) ) with gr.Tabs(): with gr.TabItem(i18n("模型推理")): with gr.Row(): sid0 = gr.Dropdown(label=i18n("推理音色"), choices=sorted(names)) refresh_button = gr.Button(i18n("刷新音色列表"), variant="primary") refresh_button.click(fn=change_choices, inputs=[], outputs=[sid0]) clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary") spk_item = gr.Slider( minimum=0, maximum=2333, step=1, label=i18n("请选择说话人id"), value=0, visible=False, interactive=True, ) clean_button.click(fn=clean, inputs=[], outputs=[sid0]) sid0.change( fn=get_vc, inputs=[sid0], outputs=[spk_item], ) with gr.Group(): gr.Markdown( value=i18n("男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ") ) with gr.Row(): with gr.Column(): vc_transform0 = gr.Number( label=i18n("变调(整数, 半音数量, 升八度12降八度-12)"), value=0 ) input_audio0 = gr.Textbox( label=i18n("输入待处理音频文件路径(默认是正确格式示例)"), value="E:\\codes\\py39\\vits_vc_gpu_train\\todo-songs\\冬之花clip1.wav", ) f0method0 = gr.Radio( label=i18n("选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比"), choices=["pm", "harvest"], value="pm", interactive=True, ) with gr.Column(): file_index1 = gr.Textbox( label=i18n("特征检索库文件路径"), value="E:\\codes\\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\added_IVF677_Flat_nprobe_7.index", interactive=True, ) # file_big_npy1 = gr.Textbox( # label=i18n("特征文件路径"), # value="E:\\codes\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy", # interactive=True, # ) index_rate1 = gr.Slider( minimum=0, maximum=1, label=i18n("检索特征占比"), value=0.76, interactive=True, ) f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调")) but0 = gr.Button(i18n("转换"), variant="primary") with gr.Column(): vc_output1 = gr.Textbox(label=i18n("输出信息")) vc_output2 = gr.Audio(label=i18n("输出音频(右下角三个点,点了可以下载)")) but0.click( vc_single, [ spk_item, input_audio0, vc_transform0, f0_file, f0method0, file_index1, # file_big_npy1, index_rate1, ], [vc_output1, vc_output2], ) with gr.Group(): gr.Markdown( value=i18n("批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ") ) with gr.Row(): with gr.Column(): vc_transform1 = gr.Number( label=i18n("变调(整数, 半音数量, 升八度12降八度-12)"), value=0 ) opt_input = gr.Textbox(label=i18n("指定输出文件夹"), value="opt") f0method1 = gr.Radio( label=i18n("选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比"), choices=["pm", "harvest"], value="pm", interactive=True, ) with gr.Column(): file_index2 = gr.Textbox( label=i18n("特征检索库文件路径"), value="E:\\codes\\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\added_IVF677_Flat_nprobe_7.index", interactive=True, ) # file_big_npy2 = gr.Textbox( # label=i18n("特征文件路径"), # value="E:\\codes\\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy", # interactive=True, # ) index_rate2 = gr.Slider( minimum=0, maximum=1, label=i18n("检索特征占比"), value=1, interactive=True, ) with gr.Column(): dir_input = gr.Textbox( label=i18n("输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)"), value="E:\codes\py39\\vits_vc_gpu_train\\todo-songs", ) inputs = gr.File( file_count="multiple", label=i18n("也可批量输入音频文件, 二选一, 优先读文件夹") ) but1 = gr.Button(i18n("转换"), variant="primary") vc_output3 = gr.Textbox(label=i18n("输出信息")) but1.click( vc_multi, [ spk_item, dir_input, opt_input, inputs, vc_transform1, f0method1, file_index2, # file_big_npy2, index_rate2, ], [vc_output3], ) with gr.TabItem(i18n("伴奏人声分离")): with gr.Group(): gr.Markdown( value=i18n( "人声伴奏分离批量处理, 使用UVR5模型. <br>不带和声用HP2, 带和声且提取的人声不需要和声用HP5<br>合格的文件夹路径格式举例: E:\\codes\\py39\\vits_vc_gpu\\白鹭霜华测试样例(去文件管理器地址栏拷就行了)" ) ) with gr.Row(): with gr.Column(): dir_wav_input = gr.Textbox( label=i18n("输入待处理音频文件夹路径"), value="E:\\codes\\py39\\vits_vc_gpu_train\\todo-songs", ) wav_inputs = gr.File( file_count="multiple", label=i18n("也可批量输入音频文件, 二选一, 优先读文件夹") ) with gr.Column(): model_choose = gr.Dropdown(label=i18n("模型"), choices=uvr5_names) agg = gr.Slider( minimum=0, maximum=20, step=1, label="人声提取激进程度", value=10, interactive=True, visible=False, # 先不开放调整 ) opt_vocal_root = gr.Textbox( label=i18n("指定输出人声文件夹"), value="opt" ) opt_ins_root = gr.Textbox(label=i18n("指定输出乐器文件夹"), value="opt") but2 = gr.Button(i18n("转换"), variant="primary") vc_output4 = gr.Textbox(label=i18n("输出信息")) but2.click( uvr, [ model_choose, dir_wav_input, opt_vocal_root, wav_inputs, opt_ins_root, agg, ], [vc_output4], ) with gr.TabItem(i18n("训练")): gr.Markdown( value=i18n( "step1: 填写实验配置. 实��数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. " ) ) with gr.Row(): exp_dir1 = gr.Textbox(label=i18n("输入实验名"), value="mi-test") sr2 = gr.Radio( label=i18n("目标采样率"), choices=["32k", "40k", "48k"], value="40k", interactive=True, ) if_f0_3 = gr.Radio( label=i18n("模型是否带音高指导(唱歌一定要, 语音可以不要)"), choices=[i18n("是"), i18n("否")], value=i18n("是"), interactive=True, ) with gr.Group(): # 暂时单人的, 后面支持最多4人的#数据处理 gr.Markdown( value=i18n( "step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. " ) ) with gr.Row(): trainset_dir4 = gr.Textbox( label=i18n("输入训练文件夹路径"), value="E:\\语音音频+标注\\米津玄师\\src" ) spk_id5 = gr.Slider( minimum=0, maximum=4, step=1, label=i18n("请指定说话人id"), value=0, interactive=True, ) but1 = gr.Button(i18n("处理数据"), variant="primary") info1 = gr.Textbox(label=i18n("输出信息"), value="") but1.click( preprocess_dataset, [trainset_dir4, exp_dir1, sr2], [info1] ) with gr.Group(): gr.Markdown(value=i18n("step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)")) with gr.Row(): with gr.Column(): gpus6 = gr.Textbox( label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"), value=gpus, interactive=True, ) gpu_info9 = gr.Textbox(label=i18n("显卡信息"), value=gpu_info) with gr.Column(): np7 = gr.Slider( minimum=0, maximum=ncpu, step=1, label=i18n("提取音高使用的CPU进程数"), value=ncpu, interactive=True, ) f0method8 = gr.Radio( label=i18n( "选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢" ), choices=["pm", "harvest", "dio"], value="harvest", interactive=True, ) but2 = gr.Button(i18n("特征提取"), variant="primary") info2 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8) but2.click( extract_f0_feature, [gpus6, np7, f0method8, if_f0_3, exp_dir1], [info2], ) with gr.Group(): gr.Markdown(value=i18n("step3: 填写训练设置, 开始训练模型和索引")) with gr.Row(): save_epoch10 = gr.Slider( minimum=0, maximum=50, step=1, label=i18n("保存频率save_every_epoch"), value=5, interactive=True, ) total_epoch11 = gr.Slider( minimum=0, maximum=1000, step=1, label=i18n("总训练轮数total_epoch"), value=20, interactive=True, ) batch_size12 = gr.Slider( minimum=1, maximum=40, step=1, label=i18n("每张显卡的batch_size"), value=default_batch_size, interactive=True, ) if_save_latest13 = gr.Radio( label=i18n("是否仅保存最新的ckpt文件以节省硬盘空间"), choices=[i18n("是"), i18n("否")], value=i18n("否"), interactive=True, ) if_cache_gpu17 = gr.Radio( label=i18n( "是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速" ), choices=[i18n("是"), i18n("否")], value=i18n("否"), interactive=True, ) with gr.Row(): pretrained_G14 = gr.Textbox( label=i18n("加载预训练底模G路径"), value="pretrained/f0G40k.pth", interactive=True, ) pretrained_D15 = gr.Textbox( label=i18n("加载预训练底模D路径"), value="pretrained/f0D40k.pth", interactive=True, ) sr2.change( change_sr2, [sr2, if_f0_3], [pretrained_G14, pretrained_D15] ) if_f0_3.change( change_f0, [if_f0_3, sr2], [np7, f0method8, pretrained_G14, pretrained_D15], ) gpus16 = gr.Textbox( label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"), value=gpus, interactive=True, ) but3 = gr.Button(i18n("训练模型"), variant="primary") but4 = gr.Button(i18n("训练特征索引"), variant="primary") but5 = gr.Button(i18n("一键训练"), variant="primary") info3 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=10) but3.click( click_train, [ exp_dir1, sr2, if_f0_3, spk_id5, save_epoch10, total_epoch11, batch_size12, if_save_latest13, pretrained_G14, pretrained_D15, gpus16, if_cache_gpu17, ], info3, ) but4.click(train_index, [exp_dir1], info3) but5.click( train1key, [ exp_dir1, sr2, if_f0_3, trainset_dir4, spk_id5, gpus6, np7, f0method8, save_epoch10, total_epoch11, batch_size12, if_save_latest13, pretrained_G14, pretrained_D15, gpus16, if_cache_gpu17, ], info3, )
with gr.TabItem(i18n("ckpt处理")): with gr.Group(): gr.Markdown(value=i18n("模型融合, 可用于测试音色融合")) with gr.Row(): ckpt_a = gr.Textbox(label=i18n("A模型路径"), value="", interactive=True) ckpt_b = gr.Textbox(label=i18n("B模型路径"), value="", interactive=True) alpha_a = gr.Slider( minimum=0, maximum=1, label=i18n("A模型权重"), value=0.5, interactive=True, ) with gr.Row(): sr_ = gr.Radio( label=i18n("目标采样率"), choices=["32k", "40k", "48k"], value="40k", interactive=True, ) if_f0_ = gr.Radio( label=i18n("模型是否带音高指导"), choices=[i18n("是"), i18n("否")], value=i18n("是"), interactive=True, ) info__ = gr.Textbox( label=i18n("要置入的模型信息"), value="", max_lines=8, interactive=True ) name_to_save0 = gr.Textbox( label=i18n("保存的模型名不带后缀"), value="", max_lines=1, interactive=True, ) with gr.Row(): but6 = gr.Button(i18n("融合"), variant="primary") info4 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8) but6.click( merge, [ckpt_a, ckpt_b, alpha_a, sr_, if_f0_, info__, name_to_save0], info4, ) # def merge(path1,path2,alpha1,sr,f0,info): with gr.Group(): gr.Markdown(value=i18n("修改模型信息(仅支持weights文件夹下提取的小模型文件)")) with gr.Row(): ckpt_path0 = gr.Textbox( label=i18n("模型路径"), value="", interactive=True ) info_ = gr.Textbox( label=i18n("要改的模型信息"), value="", max_lines=8, interactive=True ) name_to_save1 = gr.Textbox( label=i18n("保存的文件名, 默认空为和源文件同名"), value="", max_lines=8, interactive=True, ) with gr.Row(): but7 = gr.Button(i18n("修改"), variant="primary") info5 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8) but7.click(change_info, [ckpt_path0, info_, name_to_save1], info5) with gr.Group(): gr.Markdown(value=i18n("查看模型信息(仅支持weights文件夹下提取的小模型文件)")) with gr.Row(): ckpt_path1 = gr.Textbox( label=i18n("模型路径"), value="", interactive=True ) but8 = gr.Button(i18n("查看"), variant="primary") info6 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8) but8.click(show_info, [ckpt_path1], info6) with gr.Group(): gr.Markdown( value=i18n( "模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况" ) ) with gr.Row(): ckpt_path2 = gr.Textbox( label=i18n("模型路径"), value="E:\\codes\\py39\\logs\\mi-test_f0_48k\\G_23333.pth", interactive=True, ) save_name = gr.Textbox( label=i18n("保存名"), value="", interactive=True ) sr__ = gr.Radio( label=i18n("目标采样率"), choices=["32k", "40k", "48k"], value="40k", interactive=True, ) if_f0__ = gr.Radio( label=i18n("模型是否带音高指导,1是0否"), choices=["1", "0"], value="1", interactive=True, ) info___ = gr.Textbox( label=i18n("要置入的模型信息"), value="", max_lines=8, interactive=True ) but9 = gr.Button(i18n("提取"), variant="primary") info7 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8) ckpt_path2.change(change_info_, [ckpt_path2], [sr__, if_f0__]) but9.click( extract_small_model, [ckpt_path2, save_name, sr__, if_f0__, info___], info7, )
with gr.TabItem(i18n("Onnx导出")): with gr.Row(): ckpt_dir = gr.Textbox(label=i18n("RVC模型路径"), value="", interactive=True) with gr.Row(): onnx_dir = gr.Textbox( label=i18n("Onnx输出路径"), value="", interactive=True ) with gr.Row(): moevs = gr.Checkbox(label=i18n("MoeVS模型"), value=True) infoOnnx = gr.Label(label="Null") with gr.Row(): butOnnx = gr.Button(i18n("导出Onnx模型"), variant="primary") butOnnx.click(export_onnx, [ckpt_dir, onnx_dir, moevs], infoOnnx)
# with gr.TabItem(i18n("招募音高曲线前端编辑器")): # gr.Markdown(value=i18n("加开发群联系我xxxxx")) # with gr.TabItem(i18n("点击查看交流、问题反馈群号")): # gr.Markdown(value=i18n("xxxxx"))
if config.iscolab: app.queue(concurrency_count=511, max_size=1022).launch(share=True) else: app.queue(concurrency_count=511, max_size=1022).launch( server_name="0.0.0.0", inbrowser=not config.noautoopen, server_port=config.listen_port, quiet=True, )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199"""
对源特征进行检索"""import torch, pdb, os, parselmouth
os.environ["CUDA_VISIBLE_DEVICES"] = "0"import numpy as npimport soundfile as sf
# from models import SynthesizerTrn256#hifigan_nonsf# from infer_pack.models import SynthesizerTrn256NSF as SynthesizerTrn256#hifigan_nsffrom infer_pack.models import ( SynthesizerTrnMs256NSFsid as SynthesizerTrn256,) # hifigan_nsf
# from infer_pack.models import SynthesizerTrnMs256NSFsid_sim as SynthesizerTrn256#hifigan_nsf# from models import SynthesizerTrn256NSFsim as SynthesizerTrn256#hifigan_nsf# from models import SynthesizerTrn256NSFsimFlow as SynthesizerTrn256#hifigan_nsf
from scipy.io import wavfilefrom fairseq import checkpoint_utils
# import pyworldimport librosaimport torch.nn.functional as Fimport scipy.signal as signal
# import torchcrepefrom time import time as ttime
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")model_path = r"E:\codes\py39\vits_vc_gpu_train\hubert_base.pt" #print("load model(s) from {}".format(model_path))models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task( [model_path], suffix="",)model = models[0]model = model.to(device)model = model.half()model.eval()
# net_g = SynthesizerTrn256(1025,32,192,192,768,2,6,3,0.1,"1", [3,7,11],[[1,3,5], [1,3,5], [1,3,5]],[10,10,2,2],512,[16,16,4,4],183,256,is_half=True)#hifigan#512#256# net_g = SynthesizerTrn256(1025,32,192,192,768,2,6,3,0.1,"1", [3,7,11],[[1,3,5], [1,3,5], [1,3,5]],[10,10,2,2],512,[16,16,4,4],109,256,is_half=True)#hifigan#512#256net_g = SynthesizerTrn256( 1025, 32, 192, 192, 768, 2, 6, 3, 0, "1", [3, 7, 11], [[1, 3, 5], [1, 3, 5], [1, 3, 5]], [10, 10, 2, 2], 512, [16, 16, 4, 4], 183, 256, is_half=True,) # hifigan#512#256#no_dropout# net_g = SynthesizerTrn256(1025,32,192,192,768,2,3,3,0.1,"1", [3,7,11],[[1,3,5], [1,3,5], [1,3,5]],[10,10,2,2],512,[16,16,4,4],0)#ts3# net_g = SynthesizerTrn256(1025,32,192,192,768,2,6,3,0.1,"1", [3,7,11],[[1,3,5], [1,3,5], [1,3,5]],[10,10,2],512,[16,16,4],0)#hifigan-ps-sr## net_g = SynthesizerTrn(1025, 32, 192, 192, 768, 2, 6, 3, 0.1, "1", [3, 7, 11], [[1, 3, 5], [1, 3, 5], [1, 3, 5]], [5,5], 512, [15,15], 0)#ms# net_g = SynthesizerTrn(1025, 32, 192, 192, 768, 2, 6, 3, 0.1, "1", [3, 7, 11], [[1, 3, 5], [1, 3, 5], [1, 3, 5]], [10,10], 512, [16,16], 0)#idwt2
# weights=torch.load("infer/ft-mi_1k-noD.pt")# weights=torch.load("infer/ft-mi-freeze-vocoder-flow-enc_q_1k.pt")# weights=torch.load("infer/ft-mi-freeze-vocoder_true_1k.pt")# weights=torch.load("infer/ft-mi-sim1k.pt")weights = torch.load("infer/ft-mi-no_opt-no_dropout.pt")print(net_g.load_state_dict(weights, strict=True))
net_g.eval().to(device)net_g.half()
def get_f0(x, p_len, f0_up_key=0): time_step = 160 / 16000 * 1000 f0_min = 50 f0_max = 1100 f0_mel_min = 1127 * np.log(1 + f0_min / 700) f0_mel_max = 1127 * np.log(1 + f0_max / 700)
f0 = ( parselmouth.Sound(x, 16000) .to_pitch_ac( time_step=time_step / 1000, voicing_threshold=0.6, pitch_floor=f0_min, pitch_ceiling=f0_max, ) .selected_array["frequency"] )
pad_size = (p_len - len(f0) + 1) // 2 if pad_size > 0 or p_len - len(f0) - pad_size > 0: f0 = np.pad(f0, [[pad_size, p_len - len(f0) - pad_size]], mode="constant") f0 *= pow(2, f0_up_key / 12) f0bak = f0.copy()
f0_mel = 1127 * np.log(1 + f0 / 700) f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - f0_mel_min) * 254 / ( f0_mel_max - f0_mel_min ) + 1 f0_mel[f0_mel <= 1] = 1 f0_mel[f0_mel > 255] = 255 # f0_mel[f0_mel > 188] = 188 f0_coarse = np.rint(f0_mel).astype(np.int) return f0_coarse, f0bak
import faiss
index = faiss.read_index("infer/added_IVF512_Flat_mi_baseline_src_feat.index")big_npy = np.load("infer/big_src_feature_mi.npy")ta0 = ta1 = ta2 = 0for idx, name in enumerate( [ "冬之花clip1.wav", ]): ## wav_path = "todo-songs/%s" % name # f0_up_key = -2 # audio, sampling_rate = sf.read(wav_path) if len(audio.shape) > 1: audio = librosa.to_mono(audio.transpose(1, 0)) if sampling_rate != 16000: audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
feats = torch.from_numpy(audio).float() if feats.dim() == 2: # double channels feats = feats.mean(-1) assert feats.dim() == 1, feats.dim() feats = feats.view(1, -1) padding_mask = torch.BoolTensor(feats.shape).fill_(False) inputs = { "source": feats.half().to(device), "padding_mask": padding_mask.to(device), "output_layer": 9, # layer 9 } if torch.cuda.is_available(): torch.cuda.synchronize() t0 = ttime() with torch.no_grad(): logits = model.extract_features(**inputs) feats = model.final_proj(logits[0])
####索引优化 npy = feats[0].cpu().numpy().astype("float32") D, I = index.search(npy, 1) feats = ( torch.from_numpy(big_npy[I.squeeze()].astype("float16")).unsqueeze(0).to(device) )
feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1) if torch.cuda.is_available(): torch.cuda.synchronize() t1 = ttime() # p_len = min(feats.shape[1],10000,pitch.shape[0])#太大了爆显存 p_len = min(feats.shape[1], 10000) # pitch, pitchf = get_f0(audio, p_len, f0_up_key) p_len = min(feats.shape[1], 10000, pitch.shape[0]) # 太大了爆显存 if torch.cuda.is_available(): torch.cuda.synchronize() t2 = ttime() feats = feats[:, :p_len, :] pitch = pitch[:p_len] pitchf = pitchf[:p_len] p_len = torch.LongTensor([p_len]).to(device) pitch = torch.LongTensor(pitch).unsqueeze(0).to(device) sid = torch.LongTensor([0]).to(device) pitchf = torch.FloatTensor(pitchf).unsqueeze(0).to(device) with torch.no_grad(): audio = ( net_g.infer(feats, p_len, pitch, pitchf, sid)[0][0, 0] .data.cpu() .float() .numpy() ) # nsf if torch.cuda.is_available(): torch.cuda.synchronize() t3 = ttime() ta0 += t1 - t0 ta1 += t2 - t1 ta2 += t3 - t2 # wavfile.write("ft-mi_1k-index256-noD-%s.wav"%name, 40000, audio)## # wavfile.write("ft-mi-freeze-vocoder-flow-enc_q_1k-%s.wav"%name, 40000, audio)## # wavfile.write("ft-mi-sim1k-%s.wav"%name, 40000, audio)## wavfile.write("ft-mi-no_opt-no_dropout-%s.wav" % name, 40000, audio) ##
print(ta0, ta1, ta2) #.github/workflows/genlocale.ymlAdded+32
.github/workflows/pull_format.ymlAdded+35
.github/workflows/push_format.ymlAdded+46
.github/workflows/unitest.ymlAdded+36
.gitignoreAdded+6
Changelog_CN.mdAdded+35
LICENSEAdded+21
README.md+110-8
Retrieval_based_Voice_Conversion_WebUI.ipynbAdded+381
__pycache__/config.cpython-310.pycAdded
__pycache__/i18n.cpython-310.pycAdded
__pycache__/infer_uvr5.cpython-310.pycAdded
__pycache__/my_utils.cpython-310.pycAdded
__pycache__/vc_infer_pipeline.cpython-310.pycAdded
config.pyAdded+117
configs/32k.jsonAdded+46
configs/40k.jsonAdded+46
configs/48k.jsonAdded+46
docs/README.en.mdAdded+102
docs/README.ja.mdAdded+106
docs/README.ko.han.mdAdded+102
docs/README.ko.mdAdded+102
docs/faiss_tips_en.mdAdded+102
docs/faiss_tips_ja.mdAdded+101
docs/faiss_tips_ko.mdAdded+132
docs/training_tips_en.mdAdded+65
docs/training_tips_ja.mdAdded+64
docs/training_tips_ko.mdAdded+53
docs/小白简易教程.docAdded
envfilescheck.batAdded+230
export_onnx.pyAdded+85
export_onnx_old.pyAdded+47
extract_f0_print.pyAdded+160
extract_feature_print.pyAdded+104
extract_locale.pyAdded+31
go-realtime-gui.batAdded+2
go-web.batAdded+2
gui.pyAdded+570
hubert_base.ptAdded+3
i18n.pyAdded+25
i18n/en_US.jsonAdded+115
i18n/es_ES.jsonAdded+115
i18n/ja_JP.jsonAdded+115
i18n/locale_diff.pyAdded+45
i18n/zh_CN.jsonAdded+115
i18n/zh_HK.jsonAdded+115
i18n/zh_SG.jsonAdded+115
i18n/zh_TW.jsonAdded+115
infer-web.pyAdded+1547
infer/infer-pm-index256.pyAdded+199