main 7ef19867780c cached
209 files
1.1 MB
357.3k tokens
805 symbols
1 requests
Download .txt
Showing preview only (1,227K chars total). Download the full file or copy to clipboard to get everything.
Repository: RVC-Project/Retrieval-based-Voice-Conversion-WebUI
Branch: main
Commit: 7ef19867780c
Files: 209
Total size: 1.1 MB

Directory structure:
gitextract_o1tw_l2e/

├── .github/
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       ├── docker.yml
│       ├── genlocale.yml
│       ├── pull_format.yml
│       ├── push_format.yml
│       ├── sync_dev.yml
│       └── unitest.yml
├── .gitignore
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── MIT协议暨相关引用库协议
├── README.md
├── Retrieval_based_Voice_Conversion_WebUI.ipynb
├── Retrieval_based_Voice_Conversion_WebUI_v2.ipynb
├── api_231006.py
├── api_240604.py
├── assets/
│   ├── Synthesizer_inputs.pth
│   ├── hubert/
│   │   ├── .gitignore
│   │   └── hubert_inputs.pth
│   ├── indices/
│   │   └── .gitignore
│   ├── pretrained/
│   │   └── .gitignore
│   ├── pretrained_v2/
│   │   └── .gitignore
│   ├── rmvpe/
│   │   ├── .gitignore
│   │   └── rmvpe_inputs.pth
│   ├── uvr5_weights/
│   │   └── .gitignore
│   └── weights/
│       └── .gitignore
├── configs/
│   ├── config.json
│   ├── config.py
│   ├── inuse/
│   │   ├── .gitignore
│   │   ├── v1/
│   │   │   └── .gitignore
│   │   └── v2/
│   │       └── .gitignore
│   ├── v1/
│   │   ├── 32k.json
│   │   ├── 40k.json
│   │   └── 48k.json
│   └── v2/
│       ├── 32k.json
│       └── 48k.json
├── docker-compose.yml
├── docs/
│   ├── cn/
│   │   ├── Changelog_CN.md
│   │   └── faq.md
│   ├── en/
│   │   ├── Changelog_EN.md
│   │   ├── README.en.md
│   │   ├── faiss_tips_en.md
│   │   ├── faq_en.md
│   │   └── training_tips_en.md
│   ├── fr/
│   │   ├── Changelog_FR.md
│   │   ├── README.fr.md
│   │   ├── faiss_tips_fr.md
│   │   ├── faq_fr.md
│   │   └── training_tips_fr.md
│   ├── jp/
│   │   ├── Changelog_JA.md
│   │   ├── README.ja.md
│   │   ├── faiss_tips_ja.md
│   │   ├── faq_ja.md
│   │   └── training_tips_ja.md
│   ├── kr/
│   │   ├── Changelog_KO.md
│   │   ├── README.ko.han.md
│   │   ├── README.ko.md
│   │   ├── faiss_tips_ko.md
│   │   ├── faq_ko.md
│   │   └── training_tips_ko.md
│   ├── pt/
│   │   ├── Changelog_pt.md
│   │   ├── README.pt.md
│   │   ├── faiss_tips_pt.md
│   │   ├── faq_pt.md
│   │   └── training_tips_pt.md
│   ├── tr/
│   │   ├── Changelog_TR.md
│   │   ├── README.tr.md
│   │   ├── faiss_tips_tr.md
│   │   ├── faq_tr.md
│   │   └── training_tips_tr.md
│   └── 小白简易教程.doc
├── environment_dml.yaml
├── go-realtime-gui-dml.bat
├── go-realtime-gui.bat
├── go-web-dml.bat
├── go-web.bat
├── gui_v1.py
├── i18n/
│   ├── i18n.py
│   ├── locale/
│   │   ├── en_US.json
│   │   ├── es_ES.json
│   │   ├── fr_FR.json
│   │   ├── it_IT.json
│   │   ├── ja_JP.json
│   │   ├── ko_KR.json
│   │   ├── pt_BR.json
│   │   ├── ru_RU.json
│   │   ├── tr_TR.json
│   │   ├── zh_CN.json
│   │   ├── zh_HK.json
│   │   ├── zh_SG.json
│   │   └── zh_TW.json
│   ├── locale_diff.py
│   └── scan_i18n.py
├── infer/
│   ├── lib/
│   │   ├── audio.py
│   │   ├── infer_pack/
│   │   │   ├── attentions.py
│   │   │   ├── attentions_onnx.py
│   │   │   ├── commons.py
│   │   │   ├── models.py
│   │   │   ├── models_onnx.py
│   │   │   ├── modules/
│   │   │   │   └── F0Predictor/
│   │   │   │       ├── DioF0Predictor.py
│   │   │   │       ├── F0Predictor.py
│   │   │   │       ├── HarvestF0Predictor.py
│   │   │   │       ├── PMF0Predictor.py
│   │   │   │       └── __init__.py
│   │   │   ├── modules.py
│   │   │   ├── onnx_inference.py
│   │   │   └── transforms.py
│   │   ├── jit/
│   │   │   ├── __init__.py
│   │   │   ├── get_hubert.py
│   │   │   ├── get_rmvpe.py
│   │   │   └── get_synthesizer.py
│   │   ├── rmvpe.py
│   │   ├── rtrvc.py
│   │   ├── slicer2.py
│   │   ├── train/
│   │   │   ├── data_utils.py
│   │   │   ├── losses.py
│   │   │   ├── mel_processing.py
│   │   │   ├── process_ckpt.py
│   │   │   └── utils.py
│   │   └── uvr5_pack/
│   │       ├── lib_v5/
│   │       │   ├── dataset.py
│   │       │   ├── layers.py
│   │       │   ├── layers_123812KB .py
│   │       │   ├── layers_123821KB.py
│   │       │   ├── layers_33966KB.py
│   │       │   ├── layers_537227KB.py
│   │       │   ├── layers_537238KB.py
│   │       │   ├── layers_new.py
│   │       │   ├── model_param_init.py
│   │       │   ├── modelparams/
│   │       │   │   ├── 1band_sr16000_hl512.json
│   │       │   │   ├── 1band_sr32000_hl512.json
│   │       │   │   ├── 1band_sr33075_hl384.json
│   │       │   │   ├── 1band_sr44100_hl1024.json
│   │       │   │   ├── 1band_sr44100_hl256.json
│   │       │   │   ├── 1band_sr44100_hl512.json
│   │       │   │   ├── 1band_sr44100_hl512_cut.json
│   │       │   │   ├── 2band_32000.json
│   │       │   │   ├── 2band_44100_lofi.json
│   │       │   │   ├── 2band_48000.json
│   │       │   │   ├── 3band_44100.json
│   │       │   │   ├── 3band_44100_mid.json
│   │       │   │   ├── 3band_44100_msb2.json
│   │       │   │   ├── 4band_44100.json
│   │       │   │   ├── 4band_44100_mid.json
│   │       │   │   ├── 4band_44100_msb.json
│   │       │   │   ├── 4band_44100_msb2.json
│   │       │   │   ├── 4band_44100_reverse.json
│   │       │   │   ├── 4band_44100_sw.json
│   │       │   │   ├── 4band_v2.json
│   │       │   │   ├── 4band_v2_sn.json
│   │       │   │   ├── 4band_v3.json
│   │       │   │   └── ensemble.json
│   │       │   ├── nets.py
│   │       │   ├── nets_123812KB.py
│   │       │   ├── nets_123821KB.py
│   │       │   ├── nets_33966KB.py
│   │       │   ├── nets_537227KB.py
│   │       │   ├── nets_537238KB.py
│   │       │   ├── nets_61968KB.py
│   │       │   ├── nets_new.py
│   │       │   └── spec_utils.py
│   │       ├── name_params.json
│   │       └── utils.py
│   └── modules/
│       ├── ipex/
│       │   ├── __init__.py
│       │   ├── attention.py
│       │   ├── gradscaler.py
│       │   └── hijacks.py
│       ├── onnx/
│       │   └── export.py
│       ├── train/
│       │   ├── extract/
│       │   │   ├── extract_f0_print.py
│       │   │   ├── extract_f0_rmvpe.py
│       │   │   └── extract_f0_rmvpe_dml.py
│       │   ├── extract_feature_print.py
│       │   ├── preprocess.py
│       │   └── train.py
│       ├── uvr5/
│       │   ├── mdxnet.py
│       │   ├── modules.py
│       │   └── vr.py
│       └── vc/
│           ├── __init__.py
│           ├── modules.py
│           ├── pipeline.py
│           └── utils.py
├── infer-web.py
├── pyproject.toml
├── requirements-amd.txt
├── requirements-dml.txt
├── requirements-ipex.txt
├── requirements-py311.txt
├── requirements-win-for-realtime_vc_gui-dml.txt
├── requirements-win-for-realtime_vc_gui.txt
├── requirements.txt
├── run.sh
├── tools/
│   ├── app.py
│   ├── calc_rvc_model_similarity.py
│   ├── dlmodels.bat
│   ├── dlmodels.sh
│   ├── download_models.py
│   ├── export_onnx.py
│   ├── infer/
│   │   ├── infer-pm-index256.py
│   │   ├── train-index-v2.py
│   │   ├── train-index.py
│   │   └── trans_weights.py
│   ├── infer_batch_rvc.py
│   ├── infer_cli.py
│   ├── onnx_inference_demo.py
│   ├── rvc_for_realtime.py
│   └── torchgate/
│       ├── __init__.py
│       ├── torchgate.py
│       └── utils.py
└── venv.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
# Pull request checklist

- [ ] The PR has a proper title. Use [Semantic Commit Messages](https://seesparkbox.com/foundry/semantic_commit_messages). (No more branch-name title please)
- [ ] Make sure this is ready to be merged into the relevant branch. Please don't create a PR and let it hang for a few days.
- [ ] Ensure you can run the codes you submitted succesfully. These submissions will be prioritized for review:

    Introduce improvements in program execution speed;

    Introduce improvements in synthesis quality;

    Fix existing bugs reported by user feedback (or you met);

    Introduce more convenient user operations.

# PR type

- Bug fix / new feature / synthesis quality improvement / program execution speed improvement

# Description

- Describe what this pull request is for.
- What will it affect.

# Screenshot

- Please include a screenshot if applicable


================================================
FILE: .github/workflows/docker.yml
================================================
name: Build and Push Docker Image

on:
  workflow_dispatch:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
    steps:
      - uses: actions/checkout@v3
      - name: Set time zone
        uses: szenius/set-timezone@v1.0
        with:
          timezoneLinux: "Asia/Shanghai"
          timezoneMacos: "Asia/Shanghai"
          timezoneWindows: "China Standard Time"

      # # 如果有 dockerhub 账户,可以在github的secrets中配置下面两个,然后取消下面注释的这几行,并在meta步骤的images增加一行 ${{ github.repository }}
      # - name: Login to DockerHub
      #   uses: docker/login-action@v1
      #   with:
      #     username: ${{ secrets.DOCKERHUB_USERNAME }}
      #     password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Login to GHCR
        uses: docker/login-action@v2
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v4
        with:
          images: |
            ghcr.io/${{ github.repository }}
          # generate Docker tags based on the following events/attributes
          #   nightly, master, pr-2, 1.2.3, 1.2, 1
          tags: |
            type=schedule,pattern=nightly
            type=edge
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2

      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v4
        with:
          context: .
          platforms: linux/amd64,linux/arm64
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}


================================================
FILE: .github/workflows/genlocale.yml
================================================
name: Generate and Sync Locale
on:
  push:
    branches:
      - main
      - dev
jobs:
  genlocale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master

      - name: Run locale generation
        run: |
          python3 i18n/scan_i18n.py
          cd i18n
          python3 locale_diff.py

      - name: Commit back
        if: ${{ !github.head_ref }}
        id: commitback
        continue-on-error: true
        run: |
          git config --local user.name 'github-actions[bot]'
          git config --local user.email 'github-actions[bot]@users.noreply.github.com'
          git add --all
          git commit -m "chore(i18n): sync locale on ${{github.ref_name}}"

      - name: Create Pull Request
        if: steps.commitback.outcome == 'success'
        continue-on-error: true
        uses: peter-evans/create-pull-request@v5
        with:
          delete-branch: true
          body: "Automatically sync i18n translation jsons"
          title: "chore(i18n): sync locale on ${{github.ref_name}}"
          commit-message: "chore(i18n): sync locale on ${{github.ref_name}}"
          branch: genlocale-${{github.ref_name}}


================================================
FILE: .github/workflows/pull_format.yml
================================================
name: Check Pull Format

on:
  pull_request_target:
    types: [opened, reopened]

jobs:
  # This workflow closes invalid PR
  close_pr:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    permissions: write-all

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - name: Close PR if it is not pointed to dev branch
        if: github.event.pull_request.base.ref != 'dev'
        uses: superbrothers/close-pull-request@v3
        with:
          # Optional. Post a issue comment just before closing a pull request.
          comment: "Invalid PR to `non-dev` branch `${{ github.event.pull_request.base.ref }}`."

  pull_format:
    runs-on: ubuntu-latest
    permissions:
      contents: write

    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[jupyter]"

      - name: Run Black
        # run: black $(git ls-files '*.py')
        run: black .


================================================
FILE: .github/workflows/push_format.yml
================================================
name: Standardize Code Format

on:
  push:
    branches:
      - main
      - dev

jobs:
  push_format:
    runs-on: ubuntu-latest

    permissions:
      contents: write
      pull-requests: write

    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[jupyter]"

      - 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 "chore(format): run black on ${{github.ref_name}}"

      - name: Create Pull Request
        if: steps.commitback.outcome == 'success'
        continue-on-error: true
        uses: peter-evans/create-pull-request@v5
        with:
          delete-branch: true
          body: "Automatically apply code formatter change"
          title: "chore(format): run black on ${{github.ref_name}}"
          commit-message: "chore(format): run black on ${{github.ref_name}}"
          branch: formatter-${{github.ref_name}}


================================================
FILE: .github/workflows/sync_dev.yml
================================================
name: Merge dev into main

on:
  workflow_dispatch:

jobs:
  sync_dev:
    runs-on: ubuntu-latest

    permissions:
      contents: write
      pull-requests: write

    steps:
      - uses: actions/checkout@v3
        with:
          ref: main

      - name: Create Pull Request
        run: |
          gh pr create --title "chore(sync): merge dev into main" --body "Merge dev to main" --base main --head dev
        env:
          GH_TOKEN: ${{ github.token }}


================================================
FILE: .github/workflows/unitest.yml
================================================
name: Unit Test
on: [ push, pull_request ]
jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10"]
        os: [ubuntu-latest]
      fail-fast: true

    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 infer/modules/train/preprocess.py logs/mute/0_gt_wavs 48000 8 logs/mi-test True 3.7
        touch logs/mi-test/extract_f0_feature.log
        python infer/modules/train/extract/extract_f0_print.py logs/mi-test $(nproc) pm
        python infer/modules/train/extract_feature_print.py cpu 1 0 0 logs/mi-test v1 True


================================================
FILE: .gitignore
================================================
.DS_Store
__pycache__
/TEMP
*.pyd
.venv
/opt
tools/aria2c/
tools/flag.txt

# Imported from huggingface.co/lj1995/VoiceConversionWebUI
/pretrained
/pretrained_v2
/uvr5_weights
hubert_base.pt
rmvpe.onnx
rmvpe.pt

# Generated by RVC
/logs
/weights

# To set a Python version for the project
.tool-versions

/runtime
/assets/weights/*
ffmpeg.*
ffprobe.*

================================================
FILE: CONTRIBUTING.md
================================================
# 贡献规则
1. 一般来说,作者`@RVC-Boss`将拒绝所有的算法更改,除非它是为了修复某个代码层面的错误或警告
2. 您可以贡献本仓库的其他位置,如翻译和WebUI,但请尽量作最小更改
3. 所有更改都需要由`@RVC-Boss`批准,因此您的PR可能会被搁置
4. 由此带来的不便请您谅解

# Contributing Rules
1. Generally, the author `@RVC-Boss` will reject all algorithm changes unless what is to fix a code-level error or warning.
2. You can contribute to other parts of this repo like translations and WebUI, but please minimize your changes as much as possible.
3. All changes need to be approved by `@RVC-Boss`, so your PR may be put on hold.
4. Please accept our apologies for any inconvenience caused.


================================================
FILE: Dockerfile
================================================
# syntax=docker/dockerfile:1

FROM nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04

EXPOSE 7865

WORKDIR /app

COPY . .

# Install dependenceis to add PPAs
RUN apt-get update && \
    apt-get install -y -qq ffmpeg aria2 && apt clean && \
    apt-get install -y software-properties-common && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Add the deadsnakes PPA to get Python 3.9
RUN add-apt-repository ppa:deadsnakes/ppa

# Install Python 3.9 and pip
RUN apt-get update && \
    apt-get install -y build-essential python-dev python3-dev python3.9-distutils python3.9-dev python3.9 curl && \
    apt-get clean && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
    curl https://bootstrap.pypa.io/get-pip.py | python3.9

# Set Python 3.9 as the default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1

RUN python3 -m pip install --upgrade pip==24.0
RUN python3 -m pip install --no-cache-dir -r requirements.txt

RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D40k.pth -d assets/pretrained_v2/ -o D40k.pth
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G40k.pth -d assets/pretrained_v2/ -o G40k.pth
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0D40k.pth -d assets/pretrained_v2/ -o f0D40k.pth
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/f0G40k.pth -d assets/pretrained_v2/ -o f0G40k.pth

RUN 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 assets/uvr5_weights/ -o HP2-人声vocals+非人声instrumentals.pth
RUN 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 assets/uvr5_weights/ -o HP5-主旋律人声vocals+其他instrumentals.pth

RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d assets/hubert -o hubert_base.pt

RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/rmvpe.pt -d assets/rmvpe -o rmvpe.pt

VOLUME [ "/app/weights", "/app/opt" ]

CMD ["python3", "infer-web.py"]


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2023 liujing04
Copyright (c) 2023 源文雨
Copyright (c) 2023 Ftps

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, 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 THE
SOFTWARE.


================================================
FILE: MIT协议暨相关引用库协议
================================================
本软件及其相关代码以MIT协议开源,作者不对软件具备任何控制力,使用软件者、传播软件导出的声音者自负全责。
如不认可该条款,则不能使用或引用软件包内任何代码和文件。

特此授予任何获得本软件和相关文档文件(以下简称“软件”)副本的人免费使用、复制、修改、合并、出版、分发、再授权和/或销售本软件的权利,以及授予本软件所提供的人使用本软件的权利,但须符合以下条件:
上述版权声明和本许可声明应包含在软件的所有副本或实质部分中。
软件是“按原样”提供的,没有任何明示或暗示的保证,包括但不限于适销性、适用于特定目的和不侵权的保证。在任何情况下,作者或版权持有人均不承担因软件或软件的使用或其他交易而产生、产生或与之相关的任何索赔、损害赔偿或其他责任,无论是在合同诉讼、侵权诉讼还是其他诉讼中。


The LICENCEs for related libraries are as follows.
相关引用库协议如下:

ContentVec
https://github.com/auspicious3000/contentvec/blob/main/LICENSE
MIT License

VITS
https://github.com/jaywalnut310/vits/blob/main/LICENSE
MIT License

HIFIGAN
https://github.com/jik876/hifi-gan/blob/master/LICENSE
MIT License

gradio
https://github.com/gradio-app/gradio/blob/main/LICENSE
Apache License 2.0

ffmpeg
https://github.com/FFmpeg/FFmpeg/blob/master/COPYING.LGPLv3
https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2021-02-28-12-32/ffmpeg-n4.3.2-160-gfbb9368226-win64-lgpl-4.3.zip
LPGLv3 License
MIT License

ultimatevocalremovergui
https://github.com/Anjok07/ultimatevocalremovergui/blob/master/LICENSE
https://github.com/yang123qwe/vocal_separation_by_uvr5
MIT License

audio-slicer
https://github.com/openvpi/audio-slicer/blob/main/LICENSE
MIT License

PySimpleGUI
https://github.com/PySimpleGUI/PySimpleGUI/blob/master/license.txt
LPGLv3 License


================================================
FILE: README.md
================================================
<div align="center">

<h1>Retrieval-based-Voice-Conversion-WebUI</h1>
一个基于VITS的简单易用的变声框架<br><br>

[![madewithlove](https://img.shields.io/badge/made_with-%E2%9D%A4-red?style=for-the-badge&labelColor=orange
)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)

<img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br>

[![Open In Colab](https://img.shields.io/badge/Colab-F9AB00?style=for-the-badge&logo=googlecolab&color=525252)](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
[![Licence](https://img.shields.io/badge/LICENSE-MIT-green.svg?style=for-the-badge)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[![Huggingface](https://img.shields.io/badge/🤗%20-Spaces-yellow.svg?style=for-the-badge)](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)

[![Discord](https://img.shields.io/badge/RVC%20Developers-Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/HcsmBBGyVk)

[**更新日志**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/Changelog_CN.md) | [**常见问题解答**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94) | [**AutoDL·5毛钱训练AI歌手**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/Autodl%E8%AE%AD%E7%BB%83RVC%C2%B7AI%E6%AD%8C%E6%89%8B%E6%95%99%E7%A8%8B) | [**对照实验记录**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/Autodl%E8%AE%AD%E7%BB%83RVC%C2%B7AI%E6%AD%8C%E6%89%8B%E6%95%99%E7%A8%8B](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%AF%B9%E7%85%A7%E5%AE%9E%E9%AA%8C%C2%B7%E5%AE%9E%E9%AA%8C%E8%AE%B0%E5%BD%95)) | [**在线演示**](https://modelscope.cn/studios/FlowerCry/RVCv2demo)

[**English**](./docs/en/README.en.md) | [**中文简体**](./README.md) | [**日本語**](./docs/jp/README.ja.md) | [**한국어**](./docs/kr/README.ko.md) ([**韓國語**](./docs/kr/README.ko.han.md)) | [**Français**](./docs/fr/README.fr.md) | [**Türkçe**](./docs/tr/README.tr.md) | [**Português**](./docs/pt/README.pt.md)

</div>

> 底模使用接近50小时的开源高质量VCTK训练集训练,无版权方面的顾虑,请大家放心使用

> 请期待RVCv3的底模,参数更大,数据更大,效果更好,基本持平的推理速度,需要训练数据量更少。

<table>
   <tr>
		<td align="center">训练推理界面</td>
		<td align="center">实时变声界面</td>
	</tr>
  <tr>
		<td align="center"><img src="https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/assets/129054828/092e5c12-0d49-4168-a590-0b0ef6a4f630"></td>
    <td align="center"><img src="https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/assets/129054828/730b4114-8805-44a1-ab1a-04668f3c30a6"></td>
	</tr>
	<tr>
		<td align="center">go-web.bat</td>
		<td align="center">go-realtime-gui.bat</td>
	</tr>
  <tr>
    <td align="center">可以自由选择想要执行的操作。</td>
		<td align="center">我们已经实现端到端170ms延迟。如使用ASIO输入输出设备,已能实现端到端90ms延迟,但非常依赖硬件驱动支持。</td>
	</tr>
</table>

## 简介
本仓库具有以下特点
+ 使用top1检索替换输入源特征为训练集特征来杜绝音色泄漏
+ 即便在相对较差的显卡上也能快速训练
+ 使用少量数据进行训练也能得到较好结果(推荐至少收集10分钟低底噪语音数据)
+ 可以通过模型融合来改变音色(借助ckpt处理选项卡中的ckpt-merge)
+ 简单易用的网页界面
+ 可调用UVR5模型来快速分离人声和伴奏
+ 使用最先进的[人声音高提取算法InterSpeech2023-RMVPE](#参考项目)根绝哑音问题。效果最好(显著地)但比crepe_full更快、资源占用更小
+ A卡I卡加速支持

点此查看我们的[演示视频](https://www.bilibili.com/video/BV1pm4y1z7Gm/) !

## 环境配置
以下指令需在 Python 版本大于3.8的环境中执行。  

### Windows/Linux/MacOS等平台通用方法
下列方法任选其一。
#### 1. 通过 pip 安装依赖
1. 安装Pytorch及其核心依赖,若已安装则跳过。参考自: https://pytorch.org/get-started/locally/
```bash
pip install torch torchvision torchaudio
```
2. 如果是 win 系统 + Nvidia Ampere 架构(RTX30xx),根据 #21 的经验,需要指定 pytorch 对应的 cuda 版本
```bash
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
```
3. 根据自己的显卡安装对应依赖
- N卡
```bash
pip install -r requirements.txt
```
- A卡/I卡
```bash
pip install -r requirements-dml.txt
```
- A卡ROCM(Linux)
```bash
pip install -r requirements-amd.txt
```
- I卡IPEX(Linux)
```bash
pip install -r requirements-ipex.txt
```

#### 2. 通过 poetry 来安装依赖
安装 Poetry 依赖管理工具,若已安装则跳过。参考自: https://python-poetry.org/docs/#installation
```bash
curl -sSL https://install.python-poetry.org | python3 -
```

通过 Poetry 安装依赖时,python 建议使用 3.7-3.10 版本,其余版本在安装 llvmlite==0.39.0 时会出现冲突
```bash
poetry init -n
poetry env use "path to your python.exe"
poetry run pip install -r requirments.txt
```

### MacOS
可以通过 `run.sh` 来安装依赖
```bash
sh ./run.sh
```

## 其他预模型准备
RVC需要其他一些预模型来推理和训练。

你可以从我们的[Hugging Face space](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)下载到这些模型。

### 1. 下载 assets
以下是一份清单,包括了所有RVC所需的预模型和其他文件的名称。你可以在`tools`文件夹找到下载它们的脚本。

- ./assets/hubert/hubert_base.pt

- ./assets/pretrained 

- ./assets/uvr5_weights

想使用v2版本模型的话,需要额外下载

- ./assets/pretrained_v2

### 2. 安装 ffmpeg
若ffmpeg和ffprobe已安装则跳过。

#### Ubuntu/Debian 用户
```bash
sudo apt install ffmpeg
```
#### MacOS 用户
```bash
brew install ffmpeg
```
#### Windows 用户
下载后放置在根目录。
- 下载[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe)

- 下载[ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe)

### 3. 下载 rmvpe 人声音高提取算法所需文件

如果你想使用最新的RMVPE人声音高提取算法,则你需要下载音高提取模型参数并放置于RVC根目录。

- 下载[rmvpe.pt](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/rmvpe.pt)

#### 下载 rmvpe 的 dml 环境(可选, A卡/I卡用户)

- 下载[rmvpe.onnx](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/rmvpe.onnx)

### 4. AMD显卡Rocm(可选, 仅Linux)

如果你想基于AMD的Rocm技术在Linux系统上运行RVC,请先在[这里](https://rocm.docs.amd.com/en/latest/deploy/linux/os-native/install.html)安装所需的驱动。

若你使用的是Arch Linux,可以使用pacman来安装所需驱动:
````
pacman -S rocm-hip-sdk rocm-opencl-sdk
````
对于某些型号的显卡,你可能需要额外配置如下的环境变量(如:RX6700XT):
````
export ROCM_PATH=/opt/rocm
export HSA_OVERRIDE_GFX_VERSION=10.3.0
````
同时确保你的当前用户处于`render`与`video`用户组内:
````
sudo usermod -aG render $USERNAME
sudo usermod -aG video $USERNAME
````

## 开始使用
### 直接启动
使用以下指令来启动 WebUI
```bash
python infer-web.py
```

若先前使用 Poetry 安装依赖,则可以通过以下方式启动WebUI
```bash
poetry run python infer-web.py
```

### 使用整合包
下载并解压`RVC-beta.7z`
#### Windows 用户
双击`go-web.bat`
#### MacOS 用户
```bash
sh ./run.sh
```
### 对于需要使用IPEX技术的I卡用户(仅Linux)
```bash
source /opt/intel/oneapi/setvars.sh
```

## 参考项目
+ [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)
+ [Vocal pitch extraction:RMVPE](https://github.com/Dream-High/RMVPE)
  + The pretrained model is trained and tested by [yxlllc](https://github.com/yxlllc/RMVPE) and [RVC-Boss](https://github.com/RVC-Boss).

## 感谢所有贡献者作出的努力
<a href="https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank">
  <img src="https://contrib.rocks/image?repo=RVC-Project/Retrieval-based-Voice-Conversion-WebUI" />
</a>


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


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


================================================
FILE: api_231006.py
================================================
#api for 231006 release version by Xiaokai
import os
import sys
import json
import re
import time
import librosa
import torch
import numpy as np
import torch.nn.functional as F
import torchaudio.transforms as tat
import sounddevice as sd
from dotenv import load_dotenv
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import threading
import uvicorn
import logging

# Initialize the logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# Define FastAPI app
app = FastAPI()

class GUIConfig:
    def __init__(self) -> None:
        self.pth_path: str = ""
        self.index_path: str = ""
        self.pitch: int = 0
        self.samplerate: int = 40000
        self.block_time: float = 1.0  # s
        self.buffer_num: int = 1
        self.threhold: int = -60
        self.crossfade_time: float = 0.05
        self.extra_time: float = 2.5
        self.I_noise_reduce = False
        self.O_noise_reduce = False
        self.rms_mix_rate = 0.0
        self.index_rate = 0.3
        self.f0method = "rmvpe"
        self.sg_input_device = ""
        self.sg_output_device = ""

class ConfigData(BaseModel):
    pth_path: str
    index_path: str
    sg_input_device: str
    sg_output_device: str
    threhold: int = -60
    pitch: int = 0
    index_rate: float = 0.3
    rms_mix_rate: float = 0.0
    block_time: float = 0.25
    crossfade_length: float = 0.05
    extra_time: float = 2.5
    n_cpu: int = 4
    I_noise_reduce: bool = False
    O_noise_reduce: bool = False

class AudioAPI:
    def __init__(self) -> None:
        self.gui_config = GUIConfig()
        self.config = None  # Initialize Config object as None
        self.flag_vc = False
        self.function = "vc"
        self.delay_time = 0
        self.rvc = None  # Initialize RVC object as None

    def load(self):
        input_devices, output_devices, _, _ = self.get_devices()
        try:
            with open("configs/config.json", "r", encoding='utf-8') as j:
                data = json.load(j)
                data["rmvpe"] = True  # Ensure rmvpe is the only f0method
                if data["sg_input_device"] not in input_devices:
                    data["sg_input_device"] = input_devices[sd.default.device[0]]
                if data["sg_output_device"] not in output_devices:
                    data["sg_output_device"] = output_devices[sd.default.device[1]]
        except Exception as e:
            logger.error(f"Failed to load configuration: {e}")
            with open("configs/config.json", "w", encoding='utf-8') as j:
                data = {
                    "pth_path": " ",
                    "index_path": " ",
                    "sg_input_device": input_devices[sd.default.device[0]],
                    "sg_output_device": output_devices[sd.default.device[1]],
                    "threhold": "-60",
                    "pitch": "0",
                    "index_rate": "0",
                    "rms_mix_rate": "0",
                    "block_time": "0.25",
                    "crossfade_length": "0.05",
                    "extra_time": "2.5",
                    "f0method": "rmvpe",
                    "use_jit": False,
                }
                data["rmvpe"] = True  # Ensure rmvpe is the only f0method
                json.dump(data, j, ensure_ascii=False)
        return data

    def set_values(self, values):
        logger.info(f"Setting values: {values}")
        if not values.pth_path.strip():
            raise HTTPException(status_code=400, detail="Please select a .pth file")
        if not values.index_path.strip():
            raise HTTPException(status_code=400, detail="Please select an index file")
        self.set_devices(values.sg_input_device, values.sg_output_device)
        self.config.use_jit = False
        self.gui_config.pth_path = values.pth_path
        self.gui_config.index_path = values.index_path
        self.gui_config.threhold = values.threhold
        self.gui_config.pitch = values.pitch
        self.gui_config.block_time = values.block_time
        self.gui_config.crossfade_time = values.crossfade_length
        self.gui_config.extra_time = values.extra_time
        self.gui_config.I_noise_reduce = values.I_noise_reduce
        self.gui_config.O_noise_reduce = values.O_noise_reduce
        self.gui_config.rms_mix_rate = values.rms_mix_rate
        self.gui_config.index_rate = values.index_rate
        self.gui_config.n_cpu = values.n_cpu
        self.gui_config.f0method = "rmvpe"
        return True

    def start_vc(self):
        torch.cuda.empty_cache()
        self.flag_vc = True
        self.rvc = rvc_for_realtime.RVC(
            self.gui_config.pitch,
            self.gui_config.pth_path,
            self.gui_config.index_path,
            self.gui_config.index_rate,
            0,
            0,
            0,
            self.config,
            self.rvc if self.rvc else None,
        )
        self.gui_config.samplerate = self.rvc.tgt_sr
        self.zc = self.rvc.tgt_sr // 100
        self.block_frame = (
            int(
                np.round(
                    self.gui_config.block_time
                    * self.gui_config.samplerate
                    / self.zc
                )
            )
            * self.zc
        )
        self.block_frame_16k = 160 * self.block_frame // self.zc
        self.crossfade_frame = (
            int(
                np.round(
                    self.gui_config.crossfade_time
                    * self.gui_config.samplerate
                    / self.zc
                )
            )
            * self.zc
        )
        self.sola_search_frame = self.zc
        self.extra_frame = (
            int(
                np.round(
                    self.gui_config.extra_time
                    * self.gui_config.samplerate
                    / self.zc
                )
            )
            * self.zc
        )
        self.input_wav = torch.zeros(
            self.extra_frame + self.crossfade_frame + self.sola_search_frame + self.block_frame,
            device=self.config.device,
            dtype=torch.float32,
        )
        self.input_wav_res = torch.zeros(
            160 * self.input_wav.shape[0] // self.zc,
            device=self.config.device,
            dtype=torch.float32,
        )
        self.pitch = np.zeros(self.input_wav.shape[0] // self.zc, dtype="int32")
        self.pitchf = np.zeros(self.input_wav.shape[0] // self.zc, dtype="float64")
        self.sola_buffer = torch.zeros(self.crossfade_frame, device=self.config.device, dtype=torch.float32)
        self.nr_buffer = self.sola_buffer.clone()
        self.output_buffer = self.input_wav.clone()
        self.res_buffer = torch.zeros(2 * self.zc, device=self.config.device, dtype=torch.float32)
        self.valid_rate = 1 - (self.extra_frame - 1) / self.input_wav.shape[0]
        self.fade_in_window = (
            torch.sin(0.5 * np.pi * torch.linspace(0.0, 1.0, steps=self.crossfade_frame, device=self.config.device, dtype=torch.float32)) ** 2
        )
        self.fade_out_window = 1 - self.fade_in_window
        self.resampler = tat.Resample(
            orig_freq=self.gui_config.samplerate,
            new_freq=16000,
            dtype=torch.float32,
        ).to(self.config.device)
        self.tg = TorchGate(
            sr=self.gui_config.samplerate, n_fft=4 * self.zc, prop_decrease=0.9
        ).to(self.config.device)
        thread_vc = threading.Thread(target=self.soundinput)
        thread_vc.start()

    def soundinput(self):
        channels = 1 if sys.platform == "darwin" else 2
        with sd.Stream(
            channels=channels,
            callback=self.audio_callback,
            blocksize=self.block_frame,
            samplerate=self.gui_config.samplerate,
            dtype="float32",
        ) as stream:
            global stream_latency
            stream_latency = stream.latency[-1]
            while self.flag_vc:
                time.sleep(self.gui_config.block_time)
                logger.info("Audio block passed.")
        logger.info("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.gui_config.threhold > -60:
            rms = librosa.feature.rms(y=indata, frame_length=4 * self.zc, hop_length=self.zc)
            db_threhold = (librosa.amplitude_to_db(rms, ref=1.0)[0] < self.gui_config.threhold)
            for i in range(db_threhold.shape[0]):
                if db_threhold[i]:
                    indata[i * self.zc : (i + 1) * self.zc] = 0
        self.input_wav[: -self.block_frame] = self.input_wav[self.block_frame :].clone()
        self.input_wav[-self.block_frame :] = torch.from_numpy(indata).to(self.config.device)
        self.input_wav_res[: -self.block_frame_16k] = self.input_wav_res[self.block_frame_16k :].clone()
        if self.gui_config.I_noise_reduce and self.function == "vc":
            input_wav = self.input_wav[-self.crossfade_frame - self.block_frame - 2 * self.zc :]
            input_wav = self.tg(input_wav.unsqueeze(0), self.input_wav.unsqueeze(0))[0, 2 * self.zc :]
            input_wav[: self.crossfade_frame] *= self.fade_in_window
            input_wav[: self.crossfade_frame] += self.nr_buffer * self.fade_out_window
            self.nr_buffer[:] = input_wav[-self.crossfade_frame :]
            input_wav = torch.cat((self.res_buffer[:], input_wav[: self.block_frame]))
            self.res_buffer[:] = input_wav[-2 * self.zc :]
            self.input_wav_res[-self.block_frame_16k - 160 :] = self.resampler(input_wav)[160:]
        else:
            self.input_wav_res[-self.block_frame_16k - 160 :] = self.resampler(self.input_wav[-self.block_frame - 2 * self.zc :])[160:]
        if self.function == "vc":
            f0_extractor_frame = self.block_frame_16k + 800
            if self.gui_config.f0method == "rmvpe":
                f0_extractor_frame = (5120 * ((f0_extractor_frame - 1) // 5120 + 1) - 160)
            infer_wav = self.rvc.infer(
                self.input_wav_res,
                self.input_wav_res[-f0_extractor_frame:].cpu().numpy(),
                self.block_frame_16k,
                self.valid_rate,
                self.pitch,
                self.pitchf,
                self.gui_config.f0method,
            )
            infer_wav = infer_wav[-self.crossfade_frame - self.sola_search_frame - self.block_frame :]
        else:
            infer_wav = self.input_wav[-self.crossfade_frame - self.sola_search_frame - self.block_frame :].clone()
        if (self.gui_config.O_noise_reduce and self.function == "vc") or (self.gui_config.I_noise_reduce and self.function == "im"):
            self.output_buffer[: -self.block_frame] = self.output_buffer[self.block_frame :].clone()
            self.output_buffer[-self.block_frame :] = infer_wav[-self.block_frame :]
            infer_wav = self.tg(infer_wav.unsqueeze(0), self.output_buffer.unsqueeze(0)).squeeze(0)
        if self.gui_config.rms_mix_rate < 1 and self.function == "vc":
            rms1 = librosa.feature.rms(y=self.input_wav_res[-160 * infer_wav.shape[0] // self.zc :].cpu().numpy(), frame_length=640, hop_length=160)
            rms1 = torch.from_numpy(rms1).to(self.config.device)
            rms1 = F.interpolate(rms1.unsqueeze(0), size=infer_wav.shape[0] + 1, mode="linear", align_corners=True)[0, 0, :-1]
            rms2 = librosa.feature.rms(y=infer_wav[:].cpu().numpy(), frame_length=4 * self.zc, hop_length=self.zc)
            rms2 = torch.from_numpy(rms2).to(self.config.device)
            rms2 = F.interpolate(rms2.unsqueeze(0), size=infer_wav.shape[0] + 1, mode="linear", align_corners=True)[0, 0, :-1]
            rms2 = torch.max(rms2, torch.zeros_like(rms2) + 1e-3)
            infer_wav *= torch.pow(rms1 / rms2, torch.tensor(1 - self.gui_config.rms_mix_rate))
        conv_input = infer_wav[None, None, : self.crossfade_frame + self.sola_search_frame]
        cor_nom = F.conv1d(conv_input, self.sola_buffer[None, None, :])
        cor_den = torch.sqrt(F.conv1d(conv_input**2, torch.ones(1, 1, self.crossfade_frame, device=self.config.device)) + 1e-8)
        if sys.platform == "darwin":
            _, sola_offset = torch.max(cor_nom[0, 0] / cor_den[0, 0])
            sola_offset = sola_offset.item()
        else:
            sola_offset = torch.argmax(cor_nom[0, 0] / cor_den[0, 0])
        logger.info(f"sola_offset = {sola_offset}")
        infer_wav = infer_wav[sola_offset : sola_offset + self.block_frame + self.crossfade_frame]
        infer_wav[: self.crossfade_frame] *= self.fade_in_window
        infer_wav[: self.crossfade_frame] += self.sola_buffer * self.fade_out_window
        self.sola_buffer[:] = infer_wav[-self.crossfade_frame :]
        if sys.platform == "darwin":
            outdata[:] = infer_wav[: -self.crossfade_frame].cpu().numpy()[:, np.newaxis]
        else:
            outdata[:] = infer_wav[: -self.crossfade_frame].repeat(2, 1).t().cpu().numpy()
        total_time = time.perf_counter() - start_time
        logger.info(f"Infer time: {total_time:.2f}")

    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"] if "index" in d else d["name"]
            for d in devices
            if d["max_input_channels"] > 0
        ]
        output_devices_indices = [
            d["index"] if "index" in d else d["name"]
            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()
        logger.debug(f"Available input devices: {input_devices}")
        logger.debug(f"Available output devices: {output_devices}")
        logger.debug(f"Selected input device: {input_device}")
        logger.debug(f"Selected output device: {output_device}")

        if input_device not in input_devices:
            logger.error(f"Input device '{input_device}' is not in the list of available devices")
            raise HTTPException(status_code=400, detail=f"Input device '{input_device}' is not available")
        
        if output_device not in output_devices:
            logger.error(f"Output device '{output_device}' is not in the list of available devices")
            raise HTTPException(status_code=400, detail=f"Output device '{output_device}' is not available")

        sd.default.device[0] = input_device_indices[input_devices.index(input_device)]
        sd.default.device[1] = output_device_indices[output_devices.index(output_device)]
        logger.info(f"Input device set to {sd.default.device[0]}: {input_device}")
        logger.info(f"Output device set to {sd.default.device[1]}: {output_device}")

audio_api = AudioAPI()

@app.get("/inputDevices", response_model=list)
def get_input_devices():
    try:
        input_devices, _, _, _ = audio_api.get_devices()
        return input_devices
    except Exception as e:
        logger.error(f"Failed to get input devices: {e}")
        raise HTTPException(status_code=500, detail="Failed to get input devices")

@app.get("/outputDevices", response_model=list)
def get_output_devices():
    try:
        _, output_devices, _, _ = audio_api.get_devices()
        return output_devices
    except Exception as e:
        logger.error(f"Failed to get output devices: {e}")
        raise HTTPException(status_code=500, detail="Failed to get output devices")

@app.post("/config")
def configure_audio(config_data: ConfigData):
    try:
        logger.info(f"Configuring audio with data: {config_data}")
        if audio_api.set_values(config_data):
            settings = config_data.dict()
            settings["use_jit"] = False
            settings["f0method"] = "rmvpe"
            with open("configs/config.json", "w", encoding='utf-8') as j:
                json.dump(settings, j, ensure_ascii=False)
            logger.info("Configuration set successfully")
            return {"message": "Configuration set successfully"}
    except HTTPException as e:
        logger.error(f"Configuration error: {e.detail}")
        raise
    except Exception as e:
        logger.error(f"Configuration failed: {e}")
        raise HTTPException(status_code=400, detail=f"Configuration failed: {e}")

@app.post("/start")
def start_conversion():
    try:
        if not audio_api.flag_vc:
            audio_api.start_vc()
            return {"message": "Audio conversion started"}
        else:
            logger.warning("Audio conversion already running")
            raise HTTPException(status_code=400, detail="Audio conversion already running")
    except HTTPException as e:
        logger.error(f"Start conversion error: {e.detail}")
        raise
    except Exception as e:
        logger.error(f"Failed to start conversion: {e}")
        raise HTTPException(status_code=500, detail=f"Failed to start conversion: {e}")

@app.post("/stop")
def stop_conversion():
    try:
        if audio_api.flag_vc:
            audio_api.flag_vc = False
            global stream_latency
            stream_latency = -1
            return {"message": "Audio conversion stopped"}
        else:
            logger.warning("Audio conversion not running")
            raise HTTPException(status_code=400, detail="Audio conversion not running")
    except HTTPException as e:
        logger.error(f"Stop conversion error: {e.detail}")
        raise
    except Exception as e:
        logger.error(f"Failed to stop conversion: {e}")
        raise HTTPException(status_code=500, detail=f"Failed to stop conversion: {e}")

if __name__ == "__main__":
    if sys.platform == "win32":
        from multiprocessing import freeze_support
        freeze_support()
    load_dotenv()
    os.environ["OMP_NUM_THREADS"] = "4"
    if sys.platform == "darwin":
        os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
    from tools.torchgate import TorchGate
    import tools.rvc_for_realtime as rvc_for_realtime
    from configs.config import Config
    audio_api.config = Config()
    uvicorn.run(app, host="0.0.0.0", port=6242)


================================================
FILE: api_240604.py
================================================
#api for 240604 release version by Xiaokai
import os
import sys
import json
import re
import time
import librosa
import torch
import numpy as np
import torch.nn.functional as F
import torchaudio.transforms as tat
import sounddevice as sd
from dotenv import load_dotenv
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import threading
import uvicorn
import logging
from multiprocessing import Queue, Process, cpu_count, freeze_support

# Initialize the logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# Define FastAPI app
app = FastAPI()

class GUIConfig:
    def __init__(self) -> None:
        self.pth_path: str = ""
        self.index_path: str = ""
        self.pitch: int = 0
        self.formant: float = 0.0
        self.sr_type: str = "sr_model"
        self.block_time: float = 0.25  # s
        self.threhold: int = -60
        self.crossfade_time: float = 0.05
        self.extra_time: float = 2.5
        self.I_noise_reduce: bool = False
        self.O_noise_reduce: bool = False
        self.use_pv: bool = False
        self.rms_mix_rate: float = 0.0
        self.index_rate: float = 0.0
        self.n_cpu: int = 4
        self.f0method: str = "fcpe"
        self.sg_input_device: str = ""
        self.sg_output_device: str = ""

class ConfigData(BaseModel):
    pth_path: str
    index_path: str
    sg_input_device: str
    sg_output_device: str
    threhold: int = -60
    pitch: int = 0
    formant: float = 0.0
    index_rate: float = 0.3
    rms_mix_rate: float = 0.0
    block_time: float = 0.25
    crossfade_length: float = 0.05
    extra_time: float = 2.5
    n_cpu: int = 4
    I_noise_reduce: bool = False
    O_noise_reduce: bool = False
    use_pv: bool = False
    f0method: str = "fcpe"

class Harvest(Process):
    def __init__(self, inp_q, opt_q):
        super(Harvest, self).__init__()
        self.inp_q = inp_q
        self.opt_q = opt_q

    def run(self):
        import numpy as np
        import pyworld
        while True:
            idx, x, res_f0, n_cpu, ts = self.inp_q.get()
            f0, t = pyworld.harvest(
                x.astype(np.double),
                fs=16000,
                f0_ceil=1100,
                f0_floor=50,
                frame_period=10,
            )
            res_f0[idx] = f0
            if len(res_f0.keys()) >= n_cpu:
                self.opt_q.put(ts)

class AudioAPI:
    def __init__(self) -> None:
        self.gui_config = GUIConfig()
        self.config = None  # Initialize Config object as None
        self.flag_vc = False
        self.function = "vc"
        self.delay_time = 0
        self.rvc = None  # Initialize RVC object as None
        self.inp_q = None
        self.opt_q = None
        self.n_cpu = min(cpu_count(), 8)

    def initialize_queues(self):
        self.inp_q = Queue()
        self.opt_q = Queue()
        for _ in range(self.n_cpu):
            p = Harvest(self.inp_q, self.opt_q)
            p.daemon = True
            p.start()

    def load(self):
        input_devices, output_devices, _, _ = self.get_devices()
        try:
            with open("configs/config.json", "r", encoding='utf-8') as j:
                data = json.load(j)
                if data["sg_input_device"] not in input_devices:
                    data["sg_input_device"] = input_devices[sd.default.device[0]]
                if data["sg_output_device"] not in output_devices:
                    data["sg_output_device"] = output_devices[sd.default.device[1]]
        except Exception as e:
            logger.error(f"Failed to load configuration: {e}")
            with open("configs/config.json", "w", encoding='utf-8') as j:
                data = {
                    "pth_path": "",
                    "index_path": "",
                    "sg_input_device": input_devices[sd.default.device[0]],
                    "sg_output_device": output_devices[sd.default.device[1]],
                    "threhold": -60,
                    "pitch": 0,
                    "formant": 0.0,
                    "index_rate": 0,
                    "rms_mix_rate": 0,
                    "block_time": 0.25,
                    "crossfade_length": 0.05,
                    "extra_time": 2.5,
                    "n_cpu": 4,
                    "f0method": "fcpe",
                    "use_jit": False,
                    "use_pv": False,
                }
                json.dump(data, j, ensure_ascii=False)
        return data

    def set_values(self, values):
        logger.info(f"Setting values: {values}")
        if not values.pth_path.strip():
            raise HTTPException(status_code=400, detail="Please select a .pth file")
        if not values.index_path.strip():
            raise HTTPException(status_code=400, detail="Please select an index file")
        self.set_devices(values.sg_input_device, values.sg_output_device)
        self.config.use_jit = False
        self.gui_config.pth_path = values.pth_path
        self.gui_config.index_path = values.index_path
        self.gui_config.threhold = values.threhold
        self.gui_config.pitch = values.pitch
        self.gui_config.formant = values.formant
        self.gui_config.block_time = values.block_time
        self.gui_config.crossfade_time = values.crossfade_length
        self.gui_config.extra_time = values.extra_time
        self.gui_config.I_noise_reduce = values.I_noise_reduce
        self.gui_config.O_noise_reduce = values.O_noise_reduce
        self.gui_config.rms_mix_rate = values.rms_mix_rate
        self.gui_config.index_rate = values.index_rate
        self.gui_config.n_cpu = values.n_cpu
        self.gui_config.use_pv = values.use_pv
        self.gui_config.f0method = values.f0method
        return True

    def start_vc(self):
        torch.cuda.empty_cache()
        self.flag_vc = True
        self.rvc = rvc_for_realtime.RVC(
            self.gui_config.pitch,
            self.gui_config.pth_path,
            self.gui_config.index_path,
            self.gui_config.index_rate,
            self.gui_config.n_cpu,
            self.inp_q,
            self.opt_q,
            self.config,
            self.rvc if self.rvc else None,
        )
        self.gui_config.samplerate = (
            self.rvc.tgt_sr
            if self.gui_config.sr_type == "sr_model"
            else self.get_device_samplerate()
        )
        self.zc = self.gui_config.samplerate // 100
        self.block_frame = (
            int(
                np.round(
                    self.gui_config.block_time
                    * self.gui_config.samplerate
                    / self.zc
                )
            )
            * self.zc
        )
        self.block_frame_16k = 160 * self.block_frame // self.zc
        self.crossfade_frame = (
            int(
                np.round(
                    self.gui_config.crossfade_time
                    * self.gui_config.samplerate
                    / self.zc
                )
            )
            * self.zc
        )
        self.sola_buffer_frame = min(self.crossfade_frame, 4 * self.zc)
        self.sola_search_frame = self.zc
        self.extra_frame = (
            int(
                np.round(
                    self.gui_config.extra_time
                    * self.gui_config.samplerate
                    / self.zc
                )
            )
            * self.zc
        )
        self.input_wav = torch.zeros(
            self.extra_frame
            + self.crossfade_frame
            + self.sola_search_frame
            + self.block_frame,
            device=self.config.device,
            dtype=torch.float32,
        )
        self.input_wav_denoise = self.input_wav.clone()
        self.input_wav_res = torch.zeros(
            160 * self.input_wav.shape[0] // self.zc,
            device=self.config.device,
            dtype=torch.float32,
        )
        self.rms_buffer = np.zeros(4 * self.zc, dtype="float32")
        self.sola_buffer = torch.zeros(
            self.sola_buffer_frame, device=self.config.device, dtype=torch.float32
        )
        self.nr_buffer = self.sola_buffer.clone()
        self.output_buffer = self.input_wav.clone()
        self.skip_head = self.extra_frame // self.zc
        self.return_length = (
            self.block_frame + self.sola_buffer_frame + self.sola_search_frame
        ) // self.zc
        self.fade_in_window = (
            torch.sin(
                0.5
                * np.pi
                * torch.linspace(
                    0.0,
                    1.0,
                    steps=self.sola_buffer_frame,
                    device=self.config.device,
                    dtype=torch.float32,
                )
            )
            ** 2
        )
        self.fade_out_window = 1 - self.fade_in_window
        self.resampler = tat.Resample(
            orig_freq=self.gui_config.samplerate,
            new_freq=16000,
            dtype=torch.float32,
        ).to(self.config.device)
        if self.rvc.tgt_sr != self.gui_config.samplerate:
            self.resampler2 = tat.Resample(
                orig_freq=self.rvc.tgt_sr,
                new_freq=self.gui_config.samplerate,
                dtype=torch.float32,
            ).to(self.config.device)
        else:
            self.resampler2 = None
        self.tg = TorchGate(
            sr=self.gui_config.samplerate, n_fft=4 * self.zc, prop_decrease=0.9
        ).to(self.config.device)
        thread_vc = threading.Thread(target=self.soundinput)
        thread_vc.start()

    def soundinput(self):
        channels = 1 if sys.platform == "darwin" else 2
        with sd.Stream(
            channels=channels,
            callback=self.audio_callback,
            blocksize=self.block_frame,
            samplerate=self.gui_config.samplerate,
            dtype="float32",
        ) as stream:
            global stream_latency
            stream_latency = stream.latency[-1]
            while self.flag_vc:
                time.sleep(self.gui_config.block_time)
                logger.info("Audio block passed.")
        logger.info("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.gui_config.threhold > -60:
            indata = np.append(self.rms_buffer, indata)
            rms = librosa.feature.rms(y=indata, frame_length=4 * self.zc, hop_length=self.zc)[:, 2:]
            self.rms_buffer[:] = indata[-4 * self.zc :]
            indata = indata[2 * self.zc - self.zc // 2 :]
            db_threhold = (
                librosa.amplitude_to_db(rms, ref=1.0)[0] < self.gui_config.threhold
            )
            for i in range(db_threhold.shape[0]):
                if db_threhold[i]:
                    indata[i * self.zc : (i + 1) * self.zc] = 0
            indata = indata[self.zc // 2 :]
        self.input_wav[: -self.block_frame] = self.input_wav[self.block_frame :].clone()
        self.input_wav[-indata.shape[0] :] = torch.from_numpy(indata).to(self.config.device)
        self.input_wav_res[: -self.block_frame_16k] = self.input_wav_res[self.block_frame_16k :].clone()
        # input noise reduction and resampling
        if self.gui_config.I_noise_reduce:
            self.input_wav_denoise[: -self.block_frame] = self.input_wav_denoise[self.block_frame :].clone()
            input_wav = self.input_wav[-self.sola_buffer_frame - self.block_frame :]
            input_wav = self.tg(input_wav.unsqueeze(0), self.input_wav.unsqueeze(0)).squeeze(0)
            input_wav[: self.sola_buffer_frame] *= self.fade_in_window
            input_wav[: self.sola_buffer_frame] += self.nr_buffer * self.fade_out_window
            self.input_wav_denoise[-self.block_frame :] = input_wav[: self.block_frame]
            self.nr_buffer[:] = input_wav[self.block_frame :]
            self.input_wav_res[-self.block_frame_16k - 160 :] = self.resampler(
                self.input_wav_denoise[-self.block_frame - 2 * self.zc :]
            )[160:]
        else:
            self.input_wav_res[-160 * (indata.shape[0] // self.zc + 1) :] = (
                self.resampler(self.input_wav[-indata.shape[0] - 2 * self.zc :])[160:]
            )
        # infer
        if self.function == "vc":
            infer_wav = self.rvc.infer(
                self.input_wav_res,
                self.block_frame_16k,
                self.skip_head,
                self.return_length,
                self.gui_config.f0method,
            )
            if self.resampler2 is not None:
                infer_wav = self.resampler2(infer_wav)
        elif self.gui_config.I_noise_reduce:
            infer_wav = self.input_wav_denoise[self.extra_frame :].clone()
        else:
            infer_wav = self.input_wav[self.extra_frame :].clone()
        # output noise reduction
        if self.gui_config.O_noise_reduce and self.function == "vc":
            self.output_buffer[: -self.block_frame] = self.output_buffer[self.block_frame :].clone()
            self.output_buffer[-self.block_frame :] = infer_wav[-self.block_frame :]
            infer_wav = self.tg(infer_wav.unsqueeze(0), self.output_buffer.unsqueeze(0)).squeeze(0)
        # volume envelop mixing
        if self.gui_config.rms_mix_rate < 1 and self.function == "vc":
            if self.gui_config.I_noise_reduce:
                input_wav = self.input_wav_denoise[self.extra_frame :]
            else:
                input_wav = self.input_wav[self.extra_frame :]
            rms1 = librosa.feature.rms(
                y=input_wav[: infer_wav.shape[0]].cpu().numpy(),
                frame_length=4 * self.zc,
                hop_length=self.zc,
            )
            rms1 = torch.from_numpy(rms1).to(self.config.device)
            rms1 = F.interpolate(
                rms1.unsqueeze(0),
                size=infer_wav.shape[0] + 1,
                mode="linear",
                align_corners=True,
            )[0, 0, :-1]
            rms2 = librosa.feature.rms(
                y=infer_wav[:].cpu().numpy(),
                frame_length=4 * self.zc,
                hop_length=self.zc,
            )
            rms2 = torch.from_numpy(rms2).to(self.config.device)
            rms2 = F.interpolate(
                rms2.unsqueeze(0),
                size=infer_wav.shape[0] + 1,
                mode="linear",
                align_corners=True,
            )[0, 0, :-1]
            rms2 = torch.max(rms2, torch.zeros_like(rms2) + 1e-3)
            infer_wav *= torch.pow(
                rms1 / rms2, torch.tensor(1 - self.gui_config.rms_mix_rate)
            )
        # SOLA algorithm from https://github.com/yxlllc/DDSP-SVC
        conv_input = infer_wav[None, None, : self.sola_buffer_frame + self.sola_search_frame]
        cor_nom = F.conv1d(conv_input, self.sola_buffer[None, None, :])
        cor_den = torch.sqrt(
            F.conv1d(
                conv_input**2,
                torch.ones(1, 1, self.sola_buffer_frame, device=self.config.device),
            )
            + 1e-8
        )
        if sys.platform == "darwin":
            _, sola_offset = torch.max(cor_nom[0, 0] / cor_den[0, 0])
            sola_offset = sola_offset.item()
        else:
            sola_offset = torch.argmax(cor_nom[0, 0] / cor_den[0, 0])
        logger.info(f"sola_offset = {sola_offset}")
        infer_wav = infer_wav[sola_offset:]
        if "privateuseone" in str(self.config.device) or not self.gui_config.use_pv:
            infer_wav[: self.sola_buffer_frame] *= self.fade_in_window
            infer_wav[: self.sola_buffer_frame] += self.sola_buffer * self.fade_out_window
        else:
            infer_wav[: self.sola_buffer_frame] = phase_vocoder(
                self.sola_buffer,
                infer_wav[: self.sola_buffer_frame],
                self.fade_out_window,
                self.fade_in_window,
            )
        self.sola_buffer[:] = infer_wav[
            self.block_frame : self.block_frame + self.sola_buffer_frame
        ]
        if sys.platform == "darwin":
            outdata[:] = infer_wav[: self.block_frame].cpu().numpy()[:, np.newaxis]
        else:
            outdata[:] = infer_wav[: self.block_frame].repeat(2, 1).t().cpu().numpy()
        total_time = time.perf_counter() - start_time
        logger.info(f"Infer time: {total_time:.2f}")

    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"] if "index" in d else d["name"]
            for d in devices
            if d["max_input_channels"] > 0
        ]
        output_devices_indices = [
            d["index"] if "index" in d else d["name"]
            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()
        logger.debug(f"Available input devices: {input_devices}")
        logger.debug(f"Available output devices: {output_devices}")
        logger.debug(f"Selected input device: {input_device}")
        logger.debug(f"Selected output device: {output_device}")

        if input_device not in input_devices:
            logger.error(f"Input device '{input_device}' is not in the list of available devices")
            raise HTTPException(status_code=400, detail=f"Input device '{input_device}' is not available")
        
        if output_device not in output_devices:
            logger.error(f"Output device '{output_device}' is not in the list of available devices")
            raise HTTPException(status_code=400, detail=f"Output device '{output_device}' is not available")

        sd.default.device[0] = input_device_indices[input_devices.index(input_device)]
        sd.default.device[1] = output_device_indices[output_devices.index(output_device)]
        logger.info(f"Input device set to {sd.default.device[0]}: {input_device}")
        logger.info(f"Output device set to {sd.default.device[1]}: {output_device}")

audio_api = AudioAPI()

@app.get("/inputDevices", response_model=list)
def get_input_devices():
    try:
        input_devices, _, _, _ = audio_api.get_devices()
        return input_devices
    except Exception as e:
        logger.error(f"Failed to get input devices: {e}")
        raise HTTPException(status_code=500, detail="Failed to get input devices")

@app.get("/outputDevices", response_model=list)
def get_output_devices():
    try:
        _, output_devices, _, _ = audio_api.get_devices()
        return output_devices
    except Exception as e:
        logger.error(f"Failed to get output devices: {e}")
        raise HTTPException(status_code=500, detail="Failed to get output devices")

@app.post("/config")
def configure_audio(config_data: ConfigData):
    try:
        logger.info(f"Configuring audio with data: {config_data}")
        if audio_api.set_values(config_data):
            settings = config_data.dict()
            settings["use_jit"] = False
            with open("configs/config.json", "w", encoding='utf-8') as j:
                json.dump(settings, j, ensure_ascii=False)
            logger.info("Configuration set successfully")
            return {"message": "Configuration set successfully"}
    except HTTPException as e:
        logger.error(f"Configuration error: {e.detail}")
        raise
    except Exception as e:
        logger.error(f"Configuration failed: {e}")
        raise HTTPException(status_code=400, detail=f"Configuration failed: {e}")

@app.post("/start")
def start_conversion():
    try:
        if not audio_api.flag_vc:
            audio_api.start_vc()
            return {"message": "Audio conversion started"}
        else:
            logger.warning("Audio conversion already running")
            raise HTTPException(status_code=400, detail="Audio conversion already running")
    except HTTPException as e:
        logger.error(f"Start conversion error: {e.detail}")
        raise
    except Exception as e:
        logger.error(f"Failed to start conversion: {e}")
        raise HTTPException(status_code=500, detail="Failed to start conversion: {e}")

@app.post("/stop")
def stop_conversion():
    try:
        if audio_api.flag_vc:
            audio_api.flag_vc = False
            global stream_latency
            stream_latency = -1
            return {"message": "Audio conversion stopped"}
        else:
            logger.warning("Audio conversion not running")
            raise HTTPException(status_code=400, detail="Audio conversion not running")
    except HTTPException as e:
        logger.error(f"Stop conversion error: {e.detail}")
        raise
    except Exception as e:
        logger.error(f"Failed to stop conversion: {e}")
        raise HTTPException(status_code=500, detail="Failed to stop conversion: {e}")

if __name__ == "__main__":
    if sys.platform == "win32":
        freeze_support()
    load_dotenv()
    os.environ["OMP_NUM_THREADS"] = "4"
    if sys.platform == "darwin":
        os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
    from tools.torchgate import TorchGate
    import tools.rvc_for_realtime as rvc_for_realtime
    from configs.config import Config
    audio_api.config = Config()
    audio_api.initialize_queues()
    uvicorn.run(app, host="0.0.0.0", port=6242)


================================================
FILE: assets/hubert/.gitignore
================================================
*
!.gitignore
!hubert_inputs.pth

================================================
FILE: assets/indices/.gitignore
================================================
*
!.gitignore


================================================
FILE: assets/pretrained/.gitignore
================================================
*
!.gitignore


================================================
FILE: assets/pretrained_v2/.gitignore
================================================
*
!.gitignore


================================================
FILE: assets/rmvpe/.gitignore
================================================
*
!.gitignore
!rmvpe_inputs.pth

================================================
FILE: assets/uvr5_weights/.gitignore
================================================
*
!.gitignore


================================================
FILE: assets/weights/.gitignore
================================================
*
!.gitignore


================================================
FILE: configs/config.json
================================================
{"pth_path": "assets/weights/kikiV1.pth", "index_path": "logs/kikiV1.index", "sg_hostapi": "MME", "sg_wasapi_exclusive": false, "sg_input_device": "VoiceMeeter Output (VB-Audio Vo", "sg_output_device": "VoiceMeeter Input (VB-Audio Voi", "sr_type": "sr_device", "threhold": -60.0, "pitch": 12.0, "formant": 0.0, "rms_mix_rate": 0.5, "index_rate": 0.0, "block_time": 0.15, "crossfade_length": 0.08, "extra_time": 2.0, "n_cpu": 4.0, "use_jit": false, "use_pv": false, "f0method": "fcpe"}

================================================
FILE: configs/config.py
================================================
import argparse
import os
import sys
import json
import shutil
from multiprocessing import cpu_count

import torch

try:
    import intel_extension_for_pytorch as ipex  # pylint: disable=import-error, unused-import

    if torch.xpu.is_available():
        from infer.modules.ipex import ipex_init

        ipex_init()
except Exception:  # pylint: disable=broad-exception-caught
    pass
import logging

logger = logging.getLogger(__name__)


version_config_list = [
    "v1/32k.json",
    "v1/40k.json",
    "v1/48k.json",
    "v2/48k.json",
    "v2/32k.json",
]


def singleton_variable(func):
    def wrapper(*args, **kwargs):
        if not wrapper.instance:
            wrapper.instance = func(*args, **kwargs)
        return wrapper.instance

    wrapper.instance = None
    return wrapper


@singleton_variable
class Config:
    def __init__(self):
        self.device = "cuda:0"
        self.is_half = True
        self.use_jit = False
        self.n_cpu = 0
        self.gpu_name = None
        self.json_config = self.load_config_json()
        self.gpu_mem = None
        (
            self.python_cmd,
            self.listen_port,
            self.iscolab,
            self.noparallel,
            self.noautoopen,
            self.dml,
        ) = self.arg_parse()
        self.instead = ""
        self.preprocess_per = 3.7
        self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()

    @staticmethod
    def load_config_json() -> dict:
        d = {}
        for config_file in version_config_list:
            p = f"configs/inuse/{config_file}"
            if not os.path.exists(p):
                shutil.copy(f"configs/{config_file}", p)
            with open(f"configs/inuse/{config_file}", "r") as f:
                d[config_file] = json.load(f)
        return d

    @staticmethod
    def arg_parse() -> tuple:
        exe = sys.executable or "python"
        parser = argparse.ArgumentParser()
        parser.add_argument("--port", type=int, default=7865, help="Listen port")
        parser.add_argument("--pycmd", type=str, default=exe, 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",
        )
        parser.add_argument(
            "--dml",
            action="store_true",
            help="torch_dml",
        )
        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,
            cmd_opts.dml,
        )

    # has_mps is only available in nightly pytorch (for now) and MasOS 12.3+.
    # check `getattr` and try it for compatibility
    @staticmethod
    def has_mps() -> bool:
        if not torch.backends.mps.is_available():
            return False
        try:
            torch.zeros(1).to(torch.device("mps"))
            return True
        except Exception:
            return False

    @staticmethod
    def has_xpu() -> bool:
        if hasattr(torch, "xpu") and torch.xpu.is_available():
            return True
        else:
            return False

    def use_fp32_config(self):
        for config_file in version_config_list:
            self.json_config[config_file]["train"]["fp16_run"] = False
            with open(f"configs/inuse/{config_file}", "r") as f:
                strr = f.read().replace("true", "false")
            with open(f"configs/inuse/{config_file}", "w") as f:
                f.write(strr)
            logger.info("overwrite " + config_file)
        self.preprocess_per = 3.0
        logger.info("overwrite preprocess_per to %d" % (self.preprocess_per))

    def device_config(self) -> tuple:
        if torch.cuda.is_available():
            if self.has_xpu():
                self.device = self.instead = "xpu:0"
                self.is_half = True
            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 "P10" in self.gpu_name.upper()
                or "1060" in self.gpu_name
                or "1070" in self.gpu_name
                or "1080" in self.gpu_name
            ):
                logger.info("Found GPU %s, force to fp32", self.gpu_name)
                self.is_half = False
                self.use_fp32_config()
            else:
                logger.info("Found GPU %s", self.gpu_name)
            self.gpu_mem = int(
                torch.cuda.get_device_properties(i_device).total_memory
                / 1024
                / 1024
                / 1024
                + 0.4
            )
            if self.gpu_mem <= 4:
                self.preprocess_per = 3.0
        elif self.has_mps():
            logger.info("No supported Nvidia GPU found")
            self.device = self.instead = "mps"
            self.is_half = False
            self.use_fp32_config()
        else:
            logger.info("No supported Nvidia GPU found")
            self.device = self.instead = "cpu"
            self.is_half = False
            self.use_fp32_config()

        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 is not None and self.gpu_mem <= 4:
            x_pad = 1
            x_query = 5
            x_center = 30
            x_max = 32
        if self.dml:
            logger.info("Use DirectML instead")
            if (
                os.path.exists(
                    "runtime\Lib\site-packages\onnxruntime\capi\DirectML.dll"
                )
                == False
            ):
                try:
                    os.rename(
                        "runtime\Lib\site-packages\onnxruntime",
                        "runtime\Lib\site-packages\onnxruntime-cuda",
                    )
                except:
                    pass
                try:
                    os.rename(
                        "runtime\Lib\site-packages\onnxruntime-dml",
                        "runtime\Lib\site-packages\onnxruntime",
                    )
                except:
                    pass
            # if self.device != "cpu":
            import torch_directml

            self.device = torch_directml.device(torch_directml.default_device())
            self.is_half = False
        else:
            if self.instead:
                logger.info(f"Use {self.instead} instead")
            if (
                os.path.exists(
                    "runtime\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"
                )
                == False
            ):
                try:
                    os.rename(
                        "runtime\Lib\site-packages\onnxruntime",
                        "runtime\Lib\site-packages\onnxruntime-dml",
                    )
                except:
                    pass
                try:
                    os.rename(
                        "runtime\Lib\site-packages\onnxruntime-cuda",
                        "runtime\Lib\site-packages\onnxruntime",
                    )
                except:
                    pass
        logger.info(
            "Half-precision floating-point: %s, device: %s"
            % (self.is_half, self.device)
        )
        return x_pad, x_query, x_center, x_max


================================================
FILE: configs/inuse/.gitignore
================================================
*
!.gitignore
!v1
!v2


================================================
FILE: configs/inuse/v1/.gitignore
================================================
*
!.gitignore


================================================
FILE: configs/inuse/v2/.gitignore
================================================
*
!.gitignore


================================================
FILE: configs/v1/32k.json
================================================
{
  "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
  }
}


================================================
FILE: configs/v1/40k.json
================================================
{
  "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
  }
}


================================================
FILE: configs/v1/48k.json
================================================
{
  "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
  }
}


================================================
FILE: configs/v2/32k.json
================================================
{
  "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,8,2,2],
    "upsample_initial_channel": 512,
    "upsample_kernel_sizes": [20,16,4,4],
    "use_spectral_norm": false,
    "gin_channels": 256,
    "spk_embed_dim": 109
  }
}


================================================
FILE: configs/v2/48k.json
================================================
{
  "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": 17280,
    "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": [12,10,2,2],
    "upsample_initial_channel": 512,
    "upsample_kernel_sizes": [24,20,4,4],
    "use_spectral_norm": false,
    "gin_channels": 256,
    "spk_embed_dim": 109
  }
}


================================================
FILE: docker-compose.yml
================================================
version: "3.8"
services:
  rvc:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: rvc
    volumes:
      - ./weights:/app/assets/weights
      - ./opt:/app/opt
      # - ./dataset:/app/dataset # you can use this folder in order to provide your dataset for model training
    ports:
      - 7865:7865
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

================================================
FILE: docs/cn/Changelog_CN.md
================================================
### 20231006更新

我们制作了一个用于实时变声的界面go-realtime-gui.bat/gui_v1.py(事实上早就存在了),本次更新重点也优化了实时变声的性能。对比0813版:
 - 1、优优化界面操作:参数热更新(调整参数不需要中止再启动),懒加载模型(已加载过的模型不需要重新加载),增加响度因子参数(响度向输入音频靠近)
 - 2、优化自带降噪效果与速度
 - 3、大幅优化推理速度

注意输入输出设备应该选择同种类型,例如都选MME类型。

1006版本整体的更新为:
 - 1、继续提升rmvpe音高提取算法效果,对于男低音有更大的提升
 - 2、优化推理界面布局

### 20230813更新
1-常规bug修复
 - 保存频率总轮数最低改为1 总轮数最低改为2
 - 修复无pretrain模型训练报错
 - 增加伴奏人声分离完毕清理显存
 - faiss保存路径绝对路径改为相对路径
 - 支持路径包含空格(训练集路径+实验名称均支持,不再会报错)
 - filelist取消强制utf8编码
 - 解决实时变声中开启索引导致的CPU极大占用问题

2-重点更新
 - 训练出当前最强开源人声音高提取模型RMVPE,并用于RVC的训练、离线/实时推理,支持pytorch/onnx/DirectML
 - 通过pytorch-dml支持A卡和I卡的
(1)实时变声(2)推理(3)人声伴奏分离(4)训练暂未支持,会切换至CPU训练;通过onnx_dml支持rmvpe_gpu的推理

### 20230618更新
- v2增加32k和48k两个新预训练模型
- 修复非f0模型推理报错
- 对于超过一小时的训练集的索引建立环节,自动kmeans缩小特征处理以加速索引训练、加入和查询
- 附送一个人声转吉他玩具仓库
- 数据处理剔除异常值切片
- onnx导出选项卡

失败的实验:
- ~~特征检索增加时序维度:寄,没啥效果~~
- ~~特征检索增加PCAR降维可选项:寄,数据大用kmeans缩小数据量,数据小降维操作耗时比省下的匹配耗时还多~~
- ~~支持onnx推理(附带仅推理的小压缩包):寄,生成nsf还是需要pytorch~~
- ~~训练时在音高、gender、eq、噪声等方面对输入进行随机增强:寄,没啥效果~~
- ~~接入小型声码器调研:寄,效果变差~~

todolist:
- ~~训练集音高识别支持crepe:已经被RMVPE取代,不需要~~
- ~~多进程harvest推理:已经被RMVPE取代,不需要~~
- ~~crepe的精度支持和RVC-config同步:已经被RMVPE取代,不需要。支持这个还要同步torchcrepe的库,麻烦~~
- 对接F0编辑器
  
  
### 20230528更新
- 增加v2的jupyter notebook,韩文changelog,增加一些环境依赖
- 增加呼吸、清辅音、齿音保护模式
- 支持crepe-full推理
- UVR5人声伴奏分离加上3个去延迟模型和MDX-Net去混响模型,增加HP3人声提取模型
- 索引名称增加版本和实验名称
- 人声伴奏分离、推理批量导出增加音频导出格式选项
- 废弃32k模型的训练

### 20230513更新
- 清除一键包内部老版本runtime内残留的lib.infer_pack和uvr5_pack
- 修复训练集预处理伪多进程的bug
- 增加harvest识别音高可选通过中值滤波削弱哑音现象,可调整中值滤波半径
- 导出音频增加后处理重采样
- 训练n_cpu进程数从"仅调整f0提取"改为"调整数据预处理和f0提取"
- 自动检测logs文件夹下的index路径,提供下拉列表功能
- tab页增加"常见问题解答"(也可参考github-rvc-wiki)
- 相同路径的输入音频推理增加了音高缓存(用途:使用harvest音高提取,整个pipeline会经历漫长且重复的音高提取过程,如果不使用缓存,实验不同音色、索引、音高中值滤波半径参数的用户在第一次测试后的等待结果会非常痛苦)

### 20230514更新
- 音量包络对齐输入混合(可以缓解“输入静音输出小幅度噪声”的问题。如果输入音频背景底噪大则不建议开启,默认不开启(值为1可视为不开启))
- 支持按照指定频率保存提取的小模型(假如你想尝试不同epoch下的推理效果,但是不想保存所有大checkpoint并且每次都要ckpt手工处理提取小模型,这项功能会非常实用)
- 通过设置环境变量解决服务端开了系统全局代理导致浏览器连接错误的问题
- 支持v2预训练模型(目前只公开了40k版本进行测试,另外2个采样率还没有训练完全)
- 推理前限制超过1的过大音量
- 微调数据预处理参数


### 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与不懈怠音高模型的支持

### 后续计划:
功能:
- 支持多人训练选项卡(至多4人)

底模:
- 收集呼吸wav加入训练集修正呼吸变声电音的问题
- 我们正在训练增加了歌声训练集的底模,未来会公开



================================================
FILE: docs/cn/faq.md
================================================
## Q1:ffmpeg error/utf8 error.

大概率不是ffmpeg问题,而是音频路径问题;<br>
ffmpeg读取路径带空格、()等特殊符号,可能出现ffmpeg error;训练集音频带中文路径,在写入filelist.txt的时候可能出现utf8 error;<br>

## Q2:一键训练结束没有索引

显示"Training is done. The program is closed."则模型训练成功,后续紧邻的报错是假的;<br>

一键训练结束完成没有added开头的索引文件,可能是因为训练集太大卡住了添加索引的步骤;已通过批处理add索引解决内存add索引对内存需求过大的问题。临时可尝试再次点击"训练索引"按钮。<br>

## Q3:训练结束推理没看到训练集的音色
点刷新音色再看看,如果还没有看看训练有没有报错,控制台和webui的截图,logs/实验名下的log,都可以发给开发者看看。<br>

## Q4:如何分享模型
  rvc_root/logs/实验名 下面存储的pth不是用来分享模型用来推理的,而是为了存储实验状态供复现,以及继续训练用的。用来分享的模型应该是weights文件夹下大小为60+MB的pth文件;<br>
  后续将把weights/exp_name.pth和logs/exp_name/added_xxx.index合并打包成weights/exp_name.zip省去填写index的步骤,那么zip文件用来分享,不要分享pth文件,除非是想换机器继续训练;<br>
  如果你把logs文件夹下的几百MB的pth文件复制/分享到weights文件夹下强行用于推理,可能会出现f0,tgt_sr等各种key不存在的报错。你需要用ckpt选项卡最下面,手工或自动(本地logs下如果能找到相关信息则会自动)选择是否携带音高、目标音频采样率的选项后进行ckpt小模型提取(输入路径填G开头的那个),提取完在weights文件夹下会出现60+MB的pth文件,刷新音色后可以选择使用。<br>

## Q5:Connection Error.
也许你关闭了控制台(黑色窗口)。<br>

## Q6:WebUI弹出Expecting value: line 1 column 1 (char 0).
请关闭系统局域网代理/全局代理。<br>

这个不仅是客户端的代理,也包括服务端的代理(例如你使用autodl设置了http_proxy和https_proxy学术加速,使用时也需要unset关掉)<br>

## Q7:不用WebUI如何通过命令训练推理
训练脚本:<br>
可先跑通WebUI,消息窗内会显示数据集处理和训练用命令行;<br>

推理脚本:<br>
https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/myinfer.py<br>

例子:<br>

runtime\python.exe myinfer.py 0 "E:\codes\py39\RVC-beta\todo-songs\1111.wav" "E:\codes\py39\logs\mi-test\added_IVF677_Flat_nprobe_7.index" harvest "test.wav" "weights/mi-test.pth" 0.6 cuda:0 True<br>

f0up_key=sys.argv[1]<br>
input_path=sys.argv[2]<br>
index_path=sys.argv[3]<br>
f0method=sys.argv[4]#harvest or pm<br>
opt_path=sys.argv[5]<br>
model_path=sys.argv[6]<br>
index_rate=float(sys.argv[7])<br>
device=sys.argv[8]<br>
is_half=bool(sys.argv[9])<br>

## Q8:Cuda error/Cuda out of memory.
小概率是cuda配置问题、设备不支持;大概率是显存不够(out of memory);<br>

训练的话缩小batch size(如果缩小到1还不够只能更换显卡训练),推理的话酌情缩小config.py结尾的x_pad,x_query,x_center,x_max。4G以下显存(例如1060(3G)和各种2G显卡)可以直接放弃,4G显存显卡还有救。<br>

## Q9:total_epoch调多少比较好

如果训练集音质差底噪大,20~30足够了,调太高,底模音质无法带高你的低音质训练集<br>
如果训练集音质高底噪低时长多,可以调高,200是ok的(训练速度很快,既然你有条件准备高音质训练集,显卡想必条件也不错,肯定不在乎多一些训练时间)<br>

## Q10:需要多少训练集时长
  推荐10min至50min<br>
  保证音质高底噪低的情况下,如果有个人特色的音色统一,则多多益善<br>
  高水平的训练集(精简+音色有特色),5min至10min也是ok的,仓库作者本人就经常这么玩<br>
  也有人拿1min至2min的数据来训练并且训练成功的,但是成功经验是其他人不可复现的,不太具备参考价值。这要求训练集音色特色非常明显(比如说高频气声较明显的萝莉少女音),且音质高;<br>
  1min以下时长数据目前没见有人尝试(成功)过。不建议进行这种鬼畜行为。<br>

## Q11:index rate干嘛用的,怎么调(科普)
  如果底模和推理源的音质高于训练集的音质,他们可以带高推理结果的音质,但代价可能是音色往底模/推理源的音色靠,这种现象叫做"音色泄露";<br>
  index rate用来削减/解决音色泄露问题。调到1,则理论上不存在推理源的音色泄露问题,但音质更倾向于训练集。如果训练集音质比推理源低,则index rate调高可能降低音质。调到0,则不具备利用检索混合来保护训练集音色的效果;<br>
  如果训练集优质时长多,可调高total_epoch,此时模型本身不太会引用推理源和底模的音色,很少存在"音色泄露"问题,此时index_rate不重要,你甚至可以不建立/分享index索引文件。<br>

## Q11:推理怎么选gpu
config.py文件里device cuda:后面选择卡号;<br>
卡号和显卡的映射关系,在训练选项卡的显卡信息栏里能看到。<br>

## Q12:如何推理训练中间保存的pth
通过ckpt选项卡最下面提取小模型。<br>


## Q13:如何中断和继续训练
现阶段只能关闭WebUI控制台双击go-web.bat重启程序。网页参数也要刷新重新填写;<br>
继续训练:相同网页参数点训练模型,就会接着上次的checkpoint继续训练。<br>

## Q14:训练时出现文件页面/内存error
进程开太多了,内存炸了。你可能可以通过如下方式解决<br>
1、"提取音高和处理数据使用的CPU进程数"  酌情拉低;<br>
2、训练集音频手工切一下,不要太长。<br>


## Q15:如何中途加数据训练
1、所有数据新建一个实验名;<br>
2、拷贝上一次的最新的那个G和D文件(或者你想基于哪个中间ckpt训练,也可以拷贝中间的)到新实验名;下<br>
3、一键训练新实验名,他会继续上一次的最新进度训练。<br>

## Q16: error about llvmlite.dll

OSError: Could not load shared object file: llvmlite.dll

FileNotFoundError: Could not find module lib\site-packages\llvmlite\binding\llvmlite.dll (or one of its dependencies). Try using the full path with constructor syntax.

win平台会报这个错,装上https://aka.ms/vs/17/release/vc_redist.x64.exe这个再重启WebUI就好了。

## Q17: RuntimeError: The expanded size of the tensor (17280) must match the existing size (0) at non-singleton dimension 1.  Target sizes: [1, 17280].  Tensor sizes: [0]

wavs16k文件夹下,找到文件大小显著比其他都小的一些音频文件,删掉,点击训练模型,就不会报错了,不过由于一键流程中断了你训练完模型还要点训练索引。

## Q18: RuntimeError: The size of tensor a (24) must match the size of tensor b (16) at non-singleton dimension 2

不要中途变更采样率继续训练。如果一定要变更,应更换实验名从头训练。当然你也可以把上次提取的音高和特征(0/1/2/2b folders)拷贝过去加速训练流程。


================================================
FILE: docs/en/Changelog_EN.md
================================================
### 2023-10-06
- We have created a GUI for real-time voice change: go-realtime-gui.bat/gui_v1.py (Note that you should choose the same type of input and output device, e.g. MME and MME).
- We trained a better pitch extract RMVPE model.
- Optimize inference GUI layout.

### 2023-08-13
1-Regular bug fix
- Change the minimum total epoch number to 1, and change the minimum total epoch number to 2
- Fix training errors of not using pre-train models
- After accompaniment vocals separation, clear graphics memory
- Change faiss save path absolute path to relative path
- Support path containing spaces (both training set path and experiment name are supported, and errors will no longer be reported)
- Filelist cancels mandatory utf8 encoding
- Solve the CPU consumption problem caused by faiss searching during real-time voice changes

2-Key updates
- Train the current strongest open-source vocal pitch extraction model RMVPE, and use it for RVC training, offline/real-time inference, supporting PyTorch/Onnx/DirectML
- Support for AMD and Intel graphics cards through Pytorch_DML

(1) Real time voice change (2) Inference (3) Separation of vocal accompaniment (4) Training not currently supported, will switch to CPU training; supports RMVPE inference of gpu by Onnx_Dml


### 2023-06-18
- New pretrained v2 models: 32k and 48k
- Fix non-f0 model inference errors
- For training-set exceeding 1 hour, do automatic minibatch-kmeans to reduce feature shape, so that index training, adding, and searching will be much faster.
- Provide a toy vocal2guitar huggingface space
- Auto delete outlier short cut training-set audios
- Onnx export tab

Failed experiments:
- ~~Feature retrieval: add temporal feature retrieval: not effective~~
- ~~Feature retrieval: add PCAR dimensionality reduction: searching is even slower~~
- ~~Random data augmentation when training: not effective~~

todolist:
- ~~Vocos-RVC (tiny vocoder): not effective~~
- ~~Crepe support for training:replaced by RMVPE~~
- ~~Half precision crepe inference:replaced by RMVPE. And hard to achive.~~
- F0 editor support

### 2023-05-28
- Add v2 jupyter notebook, korean changelog, fix some environment requirments
- Add voiceless consonant and breath protection mode
- Support crepe-full pitch detect
- UVR5 vocal separation: support dereverb models and de-echo models
- Add experiment name and version on the name of index
- Support users to manually select export format of output audios when batch voice conversion processing and UVR5 vocal separation
- v1 32k model training is no more supported

### 2023-05-13
- Clear the redundant codes in the old version of runtime in the one-click-package: lib.infer_pack and uvr5_pack
- Fix pseudo multiprocessing bug in training set preprocessing
- Adding median filtering radius adjustment for harvest pitch recognize algorithm
- Support post processing resampling for exporting audio
- Multi processing "n_cpu" setting for training is changed from "f0 extraction" to "data preprocessing and f0 extraction"
- Automatically detect the index paths under the logs folder and provide a drop-down list function
- Add "Frequently Asked Questions and Answers" on the tab page (you can also refer to github RVC wiki)
- When inference, harvest pitch is cached when using same input audio path (purpose: using harvest pitch extraction, the entire pipeline will go through a long and repetitive pitch extraction process. If caching is not used, users who experiment with different timbre, index, and pitch median filtering radius settings will experience a very painful waiting process after the first inference)

### 2023-05-14
- Use volume envelope of input to mix or replace the volume envelope of output (can alleviate the problem of "input muting and output small amplitude noise". If the input audio background noise is high, it is not recommended to turn it on, and it is not turned on by default (1 can be considered as not turned on)
- Support saving extracted small models at a specified frequency (if you want to see the performance under different epochs, but do not want to save all large checkpoints and manually extract small models by ckpt-processing every time, this feature will be very practical)
- Resolve the issue of "connection errors" caused by the server's global proxy by setting environment variables
- Supports pre-trained v2 models (currently only 40k versions are publicly available for testing, and the other two sampling rates have not been fully trained yet)
- Limit excessive volume exceeding 1 before inference
- Slightly adjusted the settings of training-set preprocessing


#######################

History changelogs:

### 2023-04-09
- Fixed training parameters to improve GPU utilization rate: A100 increased from 25% to around 90%, V100: 50% to around 90%, 2060S: 60% to around 85%, P40: 25% to around 95%; significantly improved training speed
- Changed parameter: total batch_size is now per GPU batch_size
- Changed total_epoch: maximum limit increased from 100 to 1000; default increased from 10 to 20
- Fixed issue of ckpt extraction recognizing pitch incorrectly, causing abnormal inference
- Fixed issue of distributed training saving ckpt for each rank
- Applied nan feature filtering for feature extraction
- Fixed issue with silent input/output producing random consonants or noise (old models need to retrain with a new dataset)

### 2023-04-16 Update
- Added local real-time voice changing mini-GUI, start by double-clicking go-realtime-gui.bat
- Applied filtering for frequency bands below 50Hz during training and inference
- Lowered the minimum pitch extraction of pyworld from the default 80 to 50 for training and inference, allowing male low-pitched voices between 50-80Hz not to be muted
- WebUI supports changing languages according to system locale (currently supporting en_US, ja_JP, zh_CN, zh_HK, zh_SG, zh_TW; defaults to en_US if not supported)
- Fixed recognition of some GPUs (e.g., V100-16G recognition failure, P4 recognition failure)

### 2023-04-28 Update
- Upgraded faiss index settings for faster speed and higher quality
- Removed dependency on total_npy; future model sharing will not require total_npy input
- Unlocked restrictions for the 16-series GPUs, providing 4GB inference settings for 4GB VRAM GPUs
- Fixed bug in UVR5 vocal accompaniment separation for certain audio formats
- Real-time voice changing mini-GUI now supports non-40k and non-lazy pitch models

### Future Plans:
Features:
- Add option: extract small models for each epoch save
- Add option: export additional mp3 to the specified path during inference
- Support multi-person training tab (up to 4 people)

Base model:
- Collect breathing wav files to add to the training dataset to fix the issue of distorted breath sounds
- We are currently training a base model with an extended singing dataset, which will be released in the future


================================================
FILE: docs/en/README.en.md
================================================
<div align="center">

<h1>Retrieval-based-Voice-Conversion-WebUI</h1>
An easy-to-use Voice Conversion framework based on VITS.<br><br>

[![madewithlove](https://img.shields.io/badge/made_with-%E2%9D%A4-red?style=for-the-badge&labelColor=orange
)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)

<img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br>
  
[![Open In Colab](https://img.shields.io/badge/Colab-F9AB00?style=for-the-badge&logo=googlecolab&color=525252)](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
[![Licence](https://img.shields.io/github/license/RVC-Project/Retrieval-based-Voice-Conversion-WebUI?style=for-the-badge)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[![Huggingface](https://img.shields.io/badge/🤗%20-Spaces-yellow.svg?style=for-the-badge)](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)

[![Discord](https://img.shields.io/badge/RVC%20Developers-Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/HcsmBBGyVk)

[**Changelog**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/Changelog_EN.md) | [**FAQ (Frequently Asked Questions)**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/FAQ-(Frequently-Asked-Questions)) 

[**English**](../en/README.en.md) | [**中文简体**](../../README.md) | [**日本語**](../jp/README.ja.md) | [**한국어**](../kr/README.ko.md) ([**韓國語**](../kr/README.ko.han.md)) | [**Français**](../fr/README.fr.md) | [**Türkçe**](../tr/README.tr.md) | [**Português**](../pt/README.pt.md)

</div>

> Check out our [Demo Video](https://www.bilibili.com/video/BV1pm4y1z7Gm/) here!

<table>
   <tr>
		<td align="center">Training and inference Webui</td>
		<td align="center">Real-time voice changing GUI</td>
	</tr>
  <tr>
		<td align="center"><img src="https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/assets/129054828/092e5c12-0d49-4168-a590-0b0ef6a4f630"></td>
    <td align="center"><img src="https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/assets/129054828/730b4114-8805-44a1-ab1a-04668f3c30a6"></td>
	</tr>
	<tr>
		<td align="center">go-web.bat</td>
		<td align="center">go-realtime-gui.bat</td>
	</tr>
  <tr>
    <td align="center">You can freely choose the action you want to perform.</td>
		<td align="center">We have achieved an end-to-end latency of 170ms. With the use of ASIO input and output devices, we have managed to achieve an end-to-end latency of 90ms, but it is highly dependent on hardware driver support.</td>
	</tr>
</table>

> The dataset for the pre-training model uses nearly 50 hours of high quality audio from the VCTK open source dataset.

> High quality licensed song datasets will be added to the training-set often for your use, without having to worry about copyright infringement.

> Please look forward to the pretrained base model of RVCv3, which has larger parameters, more training data, better results, unchanged inference speed, and requires less training data for training.

## Features:
+ Reduce tone leakage by replacing the source feature to training-set feature using top1 retrieval;
+ Easy + fast training, even on poor graphics cards;
+ Training with a small amounts of data (>=10min low noise speech recommended);
+ Model fusion to change timbres (using ckpt processing tab->ckpt merge);
+ Easy-to-use WebUI;
+ UVR5 model to quickly separate vocals and instruments;
+ High-pitch Voice Extraction Algorithm [InterSpeech2023-RMVPE](#Credits) to prevent a muted sound problem. Provides the best results (significantly) and is faster with lower resource consumption than Crepe_full;
+ AMD/Intel graphics cards acceleration supported;
+ Intel ARC graphics cards acceleration with IPEX supported.

## Preparing the environment
The following commands need to be executed with Python 3.8 or higher.

(Windows/Linux)
First install the main dependencies through pip:
```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/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/21
#pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

#For Linux + AMD Cards, you need to use the following pytorch versions:
#pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2
```

Then can use poetry to install the other dependencies:
```bash
# Install the Poetry dependency management tool, skip if installed
# Reference: https://python-poetry.org/docs/#installation
curl -sSL https://install.python-poetry.org | python3 -

# Install the project dependencies
poetry install
```

You can also use pip to install them:
```bash

for Nvidia graphics cards
  pip install -r requirements.txt

for AMD/Intel graphics cards on Windows (DirectML):
  pip install -r requirements-dml.txt

for Intel ARC graphics cards on Linux / WSL using Python 3.10: 
  pip install -r requirements-ipex.txt

for AMD graphics cards on Linux (ROCm):
  pip install -r requirements-amd.txt
```

------
Mac users can install dependencies via `run.sh`:
```bash
sh ./run.sh
```

## Preparation of other Pre-models
RVC requires other pre-models to infer and train.

```bash
#Download all needed models from https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/
python tools/download_models.py
```

Or just download them by yourself from our [Huggingface space](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/).

Here's a list of Pre-models and other files that RVC needs:
```bash
./assets/hubert/hubert_base.pt

./assets/pretrained 

./assets/uvr5_weights

Additional downloads are required if you want to test the v2 version of the model.

./assets/pretrained_v2

If you want to test the v2 version model (the v2 version model has changed the input from the 256 dimensional feature of 9-layer Hubert+final_proj to the 768 dimensional feature of 12-layer Hubert, and has added 3 period discriminators), you will need to download additional features

./assets/pretrained_v2

If you want to use the latest SOTA RMVPE vocal pitch extraction algorithm, you need to download the RMVPE weights and place them in the RVC root directory

https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/rmvpe.pt

    For AMD/Intel graphics cards users you need download:

    https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/rmvpe.onnx

```

### 2. Install FFmpeg
If you have FFmpeg and FFprobe installed on your computer, you can skip this step.

#### For Ubuntu/Debian users
```bash
sudo apt install ffmpeg
```
#### For MacOS users
```bash
brew install ffmpeg
```
#### For Windows users
Download these files and place them in the root folder:
- [ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe)

- [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe)

## ROCm Support for AMD graphic cards (Linux only)
To use ROCm on Linux install all required drivers as described [here](https://rocm.docs.amd.com/en/latest/deploy/linux/os-native/install.html).

On Arch use pacman to install the driver:
````
pacman -S rocm-hip-sdk rocm-opencl-sdk
````

You might also need to set these environment variables (e.g. on a RX6700XT):
````
export ROCM_PATH=/opt/rocm
export HSA_OVERRIDE_GFX_VERSION=10.3.0
````
Make sure your user is part of the `render` and `video` group:
````
sudo usermod -aG render $USERNAME
sudo usermod -aG video $USERNAME
````

## Get started
### start up directly
Use the following command to start WebUI:
```bash
python infer-web.py
```
### Use the integration package
Download and extract file `RVC-beta.7z`, then follow the steps below according to your system:
#### For Windows users
Double click `go-web.bat`
#### For MacOS users
```bash
sh ./run.sh
```
### For Intel IPEX users (Linux Only)
```bash
source /opt/intel/oneapi/setvars.sh
```
## 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)
+ [Vocal pitch extraction:RMVPE](https://github.com/Dream-High/RMVPE)
  + The pretrained model is trained and tested by [yxlllc](https://github.com/yxlllc/RMVPE) and [RVC-Boss](https://github.com/RVC-Boss).
  
## Thanks to all contributors for their efforts
<a href="https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank">
  <img src="https://contrib.rocks/image?repo=RVC-Project/Retrieval-based-Voice-Conversion-WebUI" />
</a>



================================================
FILE: docs/en/faiss_tips_en.md
================================================
faiss tuning TIPS
==================
# about faiss
faiss 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 RVC
In 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 overview
In '/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 factory
An 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:

```python
index = 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 notation
https://github.com/facebookresearch/faiss/wiki/The-index-factory

## index for distance
There 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.

```python
X_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.

```python
index = faiss.index_factory(dimention, text, faiss.METRIC_INNER_PRODUCT)
```

## IVF
IVF (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 parameter
There 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.

```python
index = faiss.index_factory(256, "IVF1024,PQ128x4fs,RFlat")
```

## Recommended parameters for IVF
Consider 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.

## FastScan
FastScan 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)

## RFlat
RFlat 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.


================================================
FILE: docs/en/faq_en.md
================================================
## Q1:ffmpeg error/utf8 error.
It is most likely not a FFmpeg issue, but rather an audio path issue;

FFmpeg may encounter an error when reading paths containing special characters like spaces and (), which may cause an FFmpeg error; and when the training set's audio contains Chinese paths, writing it into filelist.txt may cause a utf8 error.<br>

## Q2:Cannot find index file after "One-click Training".
If it displays "Training is done. The program is closed," then the model has been trained successfully, and the subsequent errors are fake;

The lack of an 'added' index file after One-click training may be due to the training set being too large, causing the addition of the index to get stuck; this has been resolved by using batch processing to add the index, which solves the problem of memory overload when adding the index. As a temporary solution, try clicking the "Train Index" button again.<br>

## Q3:Cannot find the model in “Inferencing timbre” after training
Click “Refresh timbre list” and check again; if still not visible, check if there are any errors during training and send screenshots of the console, web UI, and logs/experiment_name/*.log to the developers for further analysis.<br>

## Q4:How to share a model/How to use others' models?
The pth files stored in rvc_root/logs/experiment_name are not meant for sharing or inference, but for storing the experiment checkpoits for reproducibility and further training. The model to be shared should be the 60+MB pth file in the weights folder;

In the future, weights/exp_name.pth and logs/exp_name/added_xxx.index will be merged into a single weights/exp_name.zip file to eliminate the need for manual index input; so share the zip file, not the pth file, unless you want to continue training on a different machine;

Copying/sharing the several hundred MB pth files from the logs folder to the weights folder for forced inference may result in errors such as missing f0, tgt_sr, or other keys. You need to use the ckpt tab at the bottom to manually or automatically (if the information is found in the logs/exp_name), select whether to include pitch infomation and target audio sampling rate options and then extract the smaller model. After extraction, there will be a 60+ MB pth file in the weights folder, and you can refresh the voices to use it.<br>

## Q5:Connection Error.
You may have closed the console (black command line window).<br>

## Q6:WebUI popup 'Expecting value: line 1 column 1 (char 0)'.
Please disable system LAN proxy/global proxy and then refresh.<br>

## Q7:How to train and infer without the WebUI?
Training script:<br>
You can run training in WebUI first, and the command-line versions of dataset preprocessing and training will be displayed in the message window.<br>

Inference script:<br>
https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/myinfer.py<br>


e.g.<br>

runtime\python.exe myinfer.py 0 "E:\codes\py39\RVC-beta\todo-songs\1111.wav" "E:\codes\py39\logs\mi-test\added_IVF677_Flat_nprobe_7.index" harvest "test.wav" "weights/mi-test.pth" 0.6 cuda:0 True<br>


f0up_key=sys.argv[1]<br>
input_path=sys.argv[2]<br>
index_path=sys.argv[3]<br>
f0method=sys.argv[4]#harvest or pm<br>
opt_path=sys.argv[5]<br>
model_path=sys.argv[6]<br>
index_rate=float(sys.argv[7])<br>
device=sys.argv[8]<br>
is_half=bool(sys.argv[9])<br>

## Q8:Cuda error/Cuda out of memory.
There is a small chance that there is a problem with the CUDA configuration or the device is not supported; more likely, there is not enough memory (out of memory).<br>

For training, reduce the batch size (if reducing to 1 is still not enough, you may need to change the graphics card); for inference, adjust the x_pad, x_query, x_center, and x_max settings in the config.py file as needed. 4G or lower memory cards (e.g. 1060(3G) and various 2G cards) can be abandoned, while 4G memory cards still have a chance.<br>

## Q9:How many total_epoch are optimal?
If the training dataset's audio quality is poor and the noise floor is high, 20-30 epochs are sufficient. Setting it too high won't improve the audio quality of your low-quality training set.<br>

If the training set audio quality is high, the noise floor is low, and there is sufficient duration, you can increase it. 200 is acceptable (since training is fast, and if you're able to prepare a high-quality training set, your GPU likely can handle a longer training duration without issue).<br>

## Q10:How much training set duration is needed?

A dataset of around 10min to 50min is recommended.<br>

With guaranteed high sound quality and low bottom noise, more can be added if the dataset's timbre is uniform.<br>

For a high-level training set (lean + distinctive tone), 5min to 10min is fine.<br>

There are some people who have trained successfully with 1min to 2min data, but the success is not reproducible by others and is not very informative. <br>This requires that the training set has a very distinctive timbre (e.g. a high-frequency airy anime girl sound) and the quality of the audio is high;
Data of less than 1min duration has not been successfully attempted so far. This is not recommended.<br>


## Q11:What is the index rate for and how to adjust it?
If the tone quality of the pre-trained model and inference source is higher than that of the training set, they can bring up the tone quality of the inference result, but at the cost of a possible tone bias towards the tone of the underlying model/inference source rather than the tone of the training set, which is generally referred to as "tone leakage".<br>

The index rate is used to reduce/resolve the timbre leakage problem. If the index rate is set to 1, theoretically there is no timbre leakage from the inference source and the timbre quality is more biased towards the training set. If the training set has a lower sound quality than the inference source, then a higher index rate may reduce the sound quality. Turning it down to 0 does not have the effect of using retrieval blending to protect the training set tones.<br>

If the training set has good audio quality and long duration, turn up the total_epoch, when the model itself is less likely to refer to the inferred source and the pretrained underlying model, and there is little "tone leakage", the index_rate is not important and you can even not create/share the index file.<br>

## Q12:How to choose the gpu when inferring?
In the config.py file, select the card number after "device cuda:".<br>

The mapping between card number and graphics card can be seen in the graphics card information section of the training tab.<br>

## Q13:How to use the model saved in the middle of training?
Save via model extraction at the bottom of the ckpt processing tab.

## Q14:File/memory error(when training)?
Too many processes and your memory is not enough. You may fix it by:

1、decrease the input in field "Threads of CPU".

2、pre-cut trainset to shorter audio files.

## Q15: How to continue training using more data

step1: put all wav data to path2.

step2: exp_name2+path2 -> process dataset and extract feature.

step3: copy the latest G and D file of exp_name1 (your previous experiment) into exp_name2 folder.

step4: click "train the model", and it will continue training from the beginning of your previous exp model epoch.

## Q16: error about llvmlite.dll

OSError: Could not load shared object file: llvmlite.dll

FileNotFoundError: Could not find module lib\site-packages\llvmlite\binding\llvmlite.dll (or one of its dependencies). Try using the full path with constructor syntax.

The issue will happen in windows, install https://aka.ms/vs/17/release/vc_redist.x64.exe and it will be fixed.

## Q17: RuntimeError: The expanded size of the tensor (17280) must match the existing size (0) at non-singleton dimension 1.  Target sizes: [1, 17280].  Tensor sizes: [0]

Delete the wav files whose size is significantly smaller than others, and that won't happen again. Than click "train the model"and "train the index".

## Q18: RuntimeError: The size of tensor a (24) must match the size of tensor b (16) at non-singleton dimension 2

Do not change the sampling rate and then continue training. If it is necessary to change, the exp name should be changed and the model will be trained from scratch. You can also copy the pitch and features (0/1/2/2b folders) extracted last time to accelerate the training process.



================================================
FILE: docs/en/training_tips_en.md
================================================
Instructions and tips for RVC training
======================================
This TIPS explains how data training is done.

# Training flow
I will explain along the steps in the training tab of the GUI.

## step1
Set 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/`.

## step2a
Loads and preprocesses audio.

### load audio
If 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.

### denoising
The audio is smoothed by scipy's filtfilt.

### Audio Split
First, 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 pitch
Extract 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_print
Convert 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`.

## step3
train the model.
### Glossary for Beginners
In 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 model
RVC 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 index
RVC 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.

================================================
FILE: docs/fr/Changelog_FR.md
================================================
### 2023-08-13
1-Corrections régulières de bugs
- Modification du nombre total d'époques minimum à 1 et changement du nombre total d'époques minimum à 2
- Correction des erreurs d'entraînement sans utiliser de modèles pré-entraînés
- Après la séparation des voix d'accompagnement, libération de la mémoire graphique
- Changement du chemin absolu d'enregistrement de faiss en chemin relatif
- Prise en charge des chemins contenant des espaces (le chemin du jeu de données d'entraînement et le nom de l'expérience sont pris en charge, et aucune erreur ne sera signalée)
- La liste de fichiers annule l'encodage utf8 obligatoire
- Résolution du problème de consommation de CPU causé par la recherche faiss lors des changements de voix en temps réel

2-Mises à jour clés
- Entraînement du modèle d'extraction de hauteur vocale open-source le plus puissant actuel, RMVPE, et utilisation pour l'entraînement, l'inférence hors ligne/en temps réel de RVC, supportant PyTorch/Onnx/DirectML
- Prise en charge des cartes graphiques AMD et Intel via Pytorch_DML

(1) Changement de voix en temps réel (2) Inférence (3) Séparation de l'accompagnement vocal (4) L'entraînement n'est pas actuellement pris en charge, passera à l'entraînement CPU; prend en charge l'inférence RMVPE de la GPU par Onnx_Dml

### 2023-06-18
- Nouveaux modèles pré-entraînés v2 : 32k et 48k
- Correction des erreurs d'inférence du modèle non-f0
- Pour un jeu de données d'entraînement dépassant 1 heure, réalisation automatique de minibatch-kmeans pour réduire la forme des caractéristiques, afin que l'entraînement, l'ajout et la recherche d'index soient beaucoup plus rapides.
- Fourniture d'un espace huggingface vocal2guitar jouet
- Suppression automatique des audios de jeu de données d'entraînement court-circuitant les valeurs aberrantes
- Onglet d'exportation Onnx

Expériences échouées:
- ~~Récupération de caractéristiques : ajout de la récupération de caractéristiques temporelles : non efficace~~
- ~~Récupération de caractéristiques : ajout de la réduction de dimensionnalité PCAR : la recherche est encore plus lente~~
- ~~Augmentation aléatoire des données lors de l'entraînement : non efficace~~

Liste de tâches:
- ~~Vocos-RVC (vocodeur minuscule) : non efficace~~
- ~~Support de Crepe pour l'entraînement : remplacé par RMVPE~~
- ~~Inférence de précision à moitié crepe : remplacée par RMVPE. Et difficile à réaliser.~~
- Support de l'éditeur F0

### 2023-05-28
- Ajout d'un cahier v2, changelog coréen, correction de certaines exigences environnementales
- Ajout d'un mode de protection des consonnes muettes et de la respiration
- Support de la détection de hauteur crepe-full
- Séparation vocale UVR5 : support des modèles de déréverbération et de désécho
- Ajout du nom de l'expérience et de la version sur le nom de l'index
- Support pour les utilisateurs de sélectionner manuellement le format d'exportation des audios de sortie lors du traitement de conversion vocale en lots et de la séparation vocale UVR5
- L'entraînement du modèle v1 32k n'est plus pris en charge

### 2023-05-13
- Nettoyage des codes redondants de l'ancienne version du runtime dans le package en un clic : lib.infer_pack et uvr5_pack
- Correction du bug de multiprocessus pseudo dans la préparation du jeu de données d'entraînement
- Ajout de l'ajustement du rayon de filtrage médian pour l'algorithme de reconnaissance de hauteur de récolte
- Prise en charge du rééchantillonnage post-traitement pour l'exportation audio
- Réglage de multi-traitement "n_cpu" pour l'entraînement est passé de "extraction f0" à "prétraitement des données et extraction f0"
- Détection automatique des chemins d'index sous le dossier de logs et fourniture d'une fonction de liste déroulante
- Ajout de "Questions fréquemment posées et réponses" sur la page d'onglet (vous pouvez également consulter le wiki github RVC)
- Lors de l'inférence, la hauteur de la récolte est mise en cache lors de l'utilisation du même chemin d'accès audio d'entrée (objectif : en utilisant l'extraction de

 la hauteur de la récolte, l'ensemble du pipeline passera par un long processus d'extraction de la hauteur répétitif. Si la mise en cache n'est pas utilisée, les utilisateurs qui expérimentent différents timbres, index, et réglages de rayon de filtrage médian de hauteur connaîtront un processus d'attente très douloureux après la première inférence)

### 2023-05-14
- Utilisation de l'enveloppe de volume de l'entrée pour mixer ou remplacer l'enveloppe de volume de la sortie (peut atténuer le problème du "muet en entrée et bruit de faible amplitude en sortie". Si le bruit de fond de l'audio d'entrée est élevé, il n'est pas recommandé de l'activer, et il n'est pas activé par défaut (1 peut être considéré comme n'étant pas activé)
- Prise en charge de la sauvegarde des modèles extraits à une fréquence spécifiée (si vous voulez voir les performances sous différentes époques, mais que vous ne voulez pas sauvegarder tous les grands points de contrôle et extraire manuellement les petits modèles par ckpt-processing à chaque fois, cette fonctionnalité sera très pratique)
- Résolution du problème des "erreurs de connexion" causées par le proxy global du serveur en définissant des variables d'environnement
- Prise en charge des modèles pré-entraînés v2 (actuellement, seule la version 40k est disponible au public pour les tests, et les deux autres taux d'échantillonnage n'ont pas encore été entièrement entraînés)
- Limite le volume excessif dépassant 1 avant l'inférence
- Réglages légèrement ajustés de la préparation du jeu de données d'entraînement

#######################

Historique des changelogs:

### 2023-04-09
- Correction des paramètres d'entraînement pour améliorer le taux d'utilisation du GPU : A100 est passé de 25% à environ 90%, V100 : de 50% à environ 90%, 2060S : de 60% à environ 85%, P40 : de 25% à environ 95% ; amélioration significative de la vitesse d'entraînement
- Changement de paramètre : la taille de batch_size totale est maintenant la taille de batch_size par GPU
- Changement de total_epoch : la limite maximale est passée de 100 à 1000 ; la valeur par défaut est passée de 10 à 20
- Correction du problème d'extraction de ckpt reconnaissant la hauteur de manière incorrecte, causant une inférence anormale
- Correction du problème d'entraînement distribué sauvegardant ckpt pour chaque rang
- Application du filtrage des caractéristiques nan pour l'extraction des caractéristiques
- Correction du problème d'entrée/sortie silencieuse produisant des consonnes aléatoires ou du bruit (les anciens modèles doivent être réentraînés avec un nouveau jeu de données)

### 2023-04-16 Mise à jour
- Ajout d'une mini-interface graphique pour le changement de voix en temps réel, démarrage par double-clic sur go-realtime-gui.bat
- Application d'un filtrage pour les bandes de fréquences inférieures à 50Hz pendant l'entraînement et l'inférence
- Abaissement de l'extraction de hauteur minimale de pyworld du défaut 80 à 50 pour l'entraînement et l'inférence, permettant aux voix masculines graves entre 50-80Hz de ne pas être mises en sourdine
- WebUI prend en charge le changement de langue en fonction des paramètres régionaux du système (prise en charge actuelle de en_US, ja_JP, zh_CN, zh_HK, zh_SG, zh_TW ; défaut à en_US si non pris en charge)
- Correction de la reconnaissance de certains GPU (par exemple, échec de reconnaissance V100-16G, échec de reconnaissance P4)

### 2023-04-28 Mise à jour
- Mise à niveau des paramètres d'index de faiss pour une vitesse plus rapide et une meilleure qualité
- Suppression de la dépendance à total_npy ; le partage futur de modèles ne nécessitera pas d'entrée total

_npy
- Levée des restrictions pour les GPU de la série 16, fournissant des paramètres d'inférence de 4 Go pour les GPU VRAM de 4 Go
- Correction d'un bug dans la séparation vocale d'accompagnement UVR5 pour certains formats audio
- La mini-interface de changement de voix en temps réel prend maintenant en charge les modèles de hauteur non-40k et non-lazy

### Plans futurs :
Fonctionnalités :
- Ajouter une option : extraire de petits modèles pour chaque sauvegarde d'époque
- Ajouter une option : exporter un mp3 supplémentaire vers le chemin spécifié pendant l'inférence
- Prise en charge de l'onglet d'entraînement multi-personnes (jusqu'à 4 personnes)

Modèle de base :
- Collecter des fichiers wav de respiration pour les ajouter au jeu de données d'entraînement pour résoudre le problème des sons de respiration déformés
- Nous entraînons actuellement un modèle de base avec un jeu de données de chant étendu, qui sera publié à l'avenir


================================================
FILE: docs/fr/README.fr.md
================================================
<div align="center">

<h1>Retrieval-based-Voice-Conversion-WebUI</h1>
Un framework simple et facile à utiliser pour la conversion vocale (modificateur de voix) basé sur VITS<br><br>

[![madewithlove](https://img.shields.io/badge/made_with-%E2%9D%A4-red?style=for-the-badge&labelColor=orange
)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)

<img src="https://counter.seku.su/cmoe?name=rvc&theme=r34" /><br>

[![Open In Colab](https://img.shields.io/badge/Colab-F9AB00?style=for-the-badge&logo=googlecolab&color=525252)](https://colab.research.google.com/github/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/Retrieval_based_Voice_Conversion_WebUI.ipynb)
[![Licence](https://img.shields.io/badge/LICENSE-MIT-green.svg?style=for-the-badge)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/LICENSE)
[![Huggingface](https://img.shields.io/badge/🤗%20-Spaces-yellow.svg?style=for-the-badge)](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/)

[![Discord](https://img.shields.io/badge/RVC%20Developers-Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/HcsmBBGyVk)

[**Journal de mise à jour**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/Changelog_CN.md) | [**FAQ**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94) | [**AutoDL·Formation d'un chanteur AI pour 5 centimes**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/Autodl%E8%AE%AD%E7%BB%83RVC%C2%B7AI%E6%AD%8C%E6%89%8B%E6%95%99%E7%A8%8B) | [**Enregistrement des expériences comparatives**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%AF%B9%E7%85%A7%E5%AE%9E%E9%AA%8C%C2%B7%E5%AE%9E%E9%AA%8C%E8%AE%B0%E5%BD%95) | [**Démonstration en ligne**](https://huggingface.co/spaces/Ricecake123/RVC-demo)

</div>

------

[**English**](../en/README.en.md) | [ **中文简体**](../../README.md) | [**日本語**](../jp/README.ja.md) | [**한국어**](../kr/README.ko.md) ([**韓國語**](../kr/README.ko.han.md)) | [**Français**](../fr/README.fr.md) | [**Turc**](../tr/README.tr.md) | [**Português**](../pt/README.pt.md)

Cliquez ici pour voir notre [vidéo de démonstration](https://www.bilibili.com/video/BV1pm4y1z7Gm/) !

> Conversion vocale en temps réel avec RVC : [w-okada/voice-changer](https://github.com/w-okada/voice-changer)

> Le modèle de base est formé avec près de 50 heures de données VCTK de haute qualité et open source. Aucun souci concernant les droits d'auteur, n'hésitez pas à l'utiliser.

> Attendez-vous au modèle de base RVCv3 : plus de paramètres, plus de données, de meilleurs résultats, une vitesse d'inférence presque identique, et nécessite moins de données pour la formation.

## Introduction
Ce dépôt a les caractéristiques suivantes :
+ Utilise le top1 pour remplacer les caractéristiques de la source d'entrée par les caractéristiques de l'ensemble d'entraînement pour éliminer les fuites de timbre vocal.
+ Peut être formé rapidement même sur une carte graphique relativement moins performante.
+ Obtient de bons résultats même avec peu de données pour la formation (il est recommandé de collecter au moins 10 minutes de données vocales avec un faible bruit de fond).
+ Peut changer le timbre vocal en fusionnant des modèles (avec l'aide de l'onglet ckpt-merge).
+ Interface web simple et facile à utiliser.
+ Peut appeler le modèle UVR5 pour séparer rapidement la voix et l'accompagnement.
+ Utilise l'algorithme de pitch vocal le plus avancé [InterSpeech2023-RMVPE](#projets-référencés) pour éliminer les problèmes de voix muette. Meilleurs résultats, plus rapide que crepe_full, et moins gourmand en ressources.
+ Support d'accélération pour les cartes AMD et Intel.

## Configuration de l'environnement
Exécutez les commandes suivantes dans un environnement Python de version 3.8 ou supérieure.

(Windows/Linux)  
Installez d'abord les dépendances principales via pip :
```bash
# Installez Pytorch et ses dépendances essentielles, sautez si déjà installé.
# Voir : https://pytorch.org/get-started/locally/
pip install torch torchvision torchaudio

# Pour les utilisateurs de Windows avec une architecture Nvidia Ampere (RTX30xx), en se basant sur l'expérience #21, spécifiez la version CUDA correspondante pour Pytorch.
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

# Pour Linux + carte AMD, utilisez cette version de Pytorch:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2
```

Vous pouvez utiliser poetry pour installer les dépendances :
```bash
# Installez l'outil de gestion des dépendances Poetry, sautez si déjà installé.
# Voir : https://python-poetry.org/docs/#installation
curl -sSL https://install.python-poetry.org | python3 -

# Installez les dépendances avec poetry.
poetry install
```

Ou vous pouvez utiliser pip pour installer les dépendances :
```bash
# Cartes Nvidia :
pip install -r requirements.txt

# Cartes AMD/Intel :
pip install -r requirements-dml.txt

# Cartes Intel avec IPEX
pip install -r requirements-ipex.txt

# Cartes AMD sur Linux (ROCm)
pip install -r requirements-amd.txt
```

------
Les utilisateurs de Mac peuvent exécuter `run.sh` pour installer les dépendances :
```bash
sh ./run.sh
```

## Préparation d'autres modèles pré-entraînés
RVC nécessite d'autres modèles pré-entraînés pour l'inférence et la formation.

```bash
#Télécharger tous les modèles depuis https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/
python tools/download_models.py
```

Ou vous pouvez télécharger ces modèles depuis notre [espace Hugging Face](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/).

Voici une liste des modèles et autres fichiers requis par RVC :
```bash
./assets/hubert/hubert_base.pt

./assets/pretrained 

./assets/uvr5_weights

# Pour tester la version v2 du modèle, téléchargez également :

./assets/pretrained_v2

# Si vous utilisez Windows, vous pourriez avoir besoin de ces fichiers pour ffmpeg et ffprobe, sautez cette étape si vous avez déjà installé ffmpeg et ffprobe. Les utilisateurs d'ubuntu/debian peuvent installer ces deux bibliothèques avec apt install ffmpeg. Les utilisateurs de Mac peuvent les installer avec brew install ffmpeg (prérequis : avoir installé brew).

# ./ffmpeg

https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe

# ./ffprobe

https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe

# Si vous souhaitez utiliser le dernier algorithme RMVPE de pitch vocal, téléchargez les paramètres du modèle de pitch et placez-les dans le répertoire racine de RVC.

https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/rmvpe.pt

    # Les utilisateurs de cartes AMD/Intel nécessitant l'environnement DML doivent télécharger :

    https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/rmvpe.onnx

```
Pour les utilisateurs d'Intel ARC avec IPEX, exécutez d'abord `source /opt/intel/oneapi/setvars.sh`.
Ensuite, exécutez la commande suivante pour démarrer WebUI :
```bash
python infer-web.py
```

Si vous utilisez Windows ou macOS, vous pouvez télécharger et extraire `RVC-beta.7z`. Les utilisateurs de Windows peuvent exécuter `go-web.bat` pour démarrer WebUI, tandis que les utilisateurs de macOS peuvent exécuter `sh ./run.sh`.

## Compatibilité ROCm pour les cartes AMD (seulement Linux)
Installez tous les pilotes décrits [ici](https://rocm.docs.amd.com/en/latest/deploy/linux/os-native/install.html).

Sur Arch utilisez pacman pour installer le pilote:
````
pacman -S rocm-hip-sdk rocm-opencl-sdk
````

Vous devrez peut-être créer ces variables d'environnement (par exemple avec RX6700XT):
````
export ROCM_PATH=/opt/rocm
export HSA_OVERRIDE_GFX_VERSION=10.3.0
````
Assurez-vous que votre utilisateur est dans les groupes `render` et `video`:
````
sudo usermod -aG render $USERNAME
sudo usermod -aG video $USERNAME
````
Enfin vous pouvez exécuter WebUI:
```bash
python infer-web.py
```

## Crédits
+ [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)
+ [Extraction de la hauteur vocale : RMVPE](https://github.com/Dream-High/RMVPE)
  + Le modèle pré-entraîné a été formé et testé par [yxlllc](https://github.com/yxlllc/RMVPE) et [RVC-Boss](https://github.com/RVC-Boss).

## Remerciements à tous les contributeurs pour leurs efforts
<a href="https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/graphs/contributors" target="_blank">
  <img src="https://contrib.rocks/image?repo=RVC-Project/Retrieval-based-Voice-Conversion-WebUI" />
</a>


================================================
FILE: docs/fr/faiss_tips_fr.md
================================================
Conseils de réglage pour faiss
==================
# À propos de faiss
faiss est une bibliothèque de recherches de voisins pour les vecteurs denses, développée par Facebook Research, qui implémente efficacement de nombreuses méthodes de recherche de voisins approximatifs.
La recherche de voisins approximatifs trouve rapidement des vecteurs similaires tout en sacrifiant une certaine précision.

## faiss dans RVC
Dans RVC, pour l'incorporation des caractéristiques converties par HuBERT, nous recherchons des incorporations similaires à l'incorporation générée à partir des données d'entraînement et les mixons pour obtenir une conversion plus proche de la parole originale. Cependant, cette recherche serait longue si elle était effectuée de manière naïve, donc une conversion à haute vitesse est réalisée en utilisant une recherche de voisinage approximatif.

# Vue d'ensemble de la mise en œuvre
Dans '/logs/votre-expérience/3_feature256' où le modèle est situé, les caractéristiques extraites par HuBERT de chaque donnée vocale sont situées.
À partir de là, nous lisons les fichiers npy dans un ordre trié par nom de fichier et concaténons les vecteurs pour créer big_npy. (Ce vecteur a la forme [N, 256].)
Après avoir sauvegardé big_npy comme /logs/votre-expérience/total_fea.npy, nous l'entraînons avec faiss.

Dans cet article, j'expliquerai la signification de ces paramètres.

# Explication de la méthode
## Usine d'index
Une usine d'index est une notation unique de faiss qui exprime un pipeline qui relie plusieurs méthodes de recherche de voisinage approximatif sous forme de chaîne.
Cela vous permet d'essayer diverses méthodes de recherche de voisinage approximatif simplement en changeant la chaîne de l'usine d'index.
Dans RVC, elle est utilisée comme ceci :

```python
index = faiss.index_factory(256, "IVF%s,Flat" % n_ivf)
```

Parmi les arguments de index_factory, le premier est le nombre de dimensions du vecteur, le second est la chaîne de l'usine d'index, et le troisième est la distance à utiliser.

Pour une notation plus détaillée :
https://github.com/facebookresearch/faiss/wiki/The-index-factory

## Index pour la distance
Il existe deux index typiques utilisés comme similarité de l'incorporation comme suit :

- Distance euclidienne (METRIC_L2)
- Produit intérieur (METRIC_INNER_PRODUCT)

La distance euclidienne prend la différence au carré dans chaque dimension, somme les différences dans toutes les dimensions, puis prend la racine carrée. C'est la même chose que la distance en 2D et 3D que nous utilisons au quotidien.
Le produit intérieur n'est pas utilisé comme index de similarité tel quel, et la similarité cosinus qui prend le produit intérieur après avoir été normalisé par la norme L2 est généralement utilisée.

Lequel est le mieux dépend du cas, mais la similarité cosinus est souvent utilisée dans l'incorporation obtenue par word2vec et des modèles de récupération d'images similaires appris par ArcFace. Si vous voulez faire une normalisation l2 sur le vecteur X avec numpy, vous pouvez le faire avec le code suivant avec eps suffisamment petit pour éviter une division par 0.

```python
X_normed = X / np.maximum(eps, np.linalg.norm(X, ord=2, axis=-1, keepdims=True))
```

De plus, pour l'usine d'index, vous pouvez changer l'index de distance utilisé pour le calcul en choisissant la valeur à passer comme troisième argument.

```python
index = faiss.index_factory(dimention, texte, faiss.METRIC_INNER_PRODUCT)
```

## IVF
IVF (Inverted file indexes) est un algorithme similaire à l'index inversé dans la recherche en texte intégral.
Lors de l'apprentissage, la cible de recherche est regroupée avec kmeans, et une partition de Voronoi est effectuée en utilisant le centre du cluster. Chaque point de données est attribué à un cluster, nous créons donc un dictionnaire qui permet de rechercher les points de données à partir des clusters.

Par exemple, si des clusters sont attribués comme suit :
|index|Cluster|
|-----|-------|
|1|A|
|2|B|
|3|A|
|4|C|
|5|B|

L'index inversé résultant ressemble à ceci :

|cluster|index|
|-------|-----|
|A|1, 3|
|B|2, 5|
|C|4|

Lors de la recherche, nous recherchons d'abord n_probe clusters parmi les clusters, puis nous calculons les distances pour les points de données appartenant à chaque cluster.

# Recommandation de paramètre
Il existe des directives officielles sur la façon de choisir un index, je vais donc expliquer en conséquence.
https://github.com/facebookresearch/faiss/wiki/Guidelines-to-choose-an-index

Pour les ensembles de données inférieurs à 1M, 4bit-PQ est la méthode la plus efficace disponible dans faiss en avril 2023.
En combinant cela avec IVF, en réduisant les candidats avec 4bit-PQ, et enfin en recalculant la distance avec un index précis, on peut le décrire en utilisant l'usine d'index suivante.

```python
index = faiss.index_factory(256, "IVF1024,PQ128x4fs,RFlat")
```

## Paramètres recommandés pour IVF
Considérez le cas de trop d'IVF. Par exemple, si une quantification grossière par IVF est effectuée pour le nombre de données, cela revient à une recherche exhaustive naïve et est inefficace.
Pour 1M ou moins, les valeurs IVF sont recommandées entre 4*sqrt(N) ~ 16*sqrt(N) pour N nombre de points de données.

Comme le temps de calcul augmente proportionnellement au nombre de n_probes, veuillez consulter la précision et choisir de manière appropriée. Personnellement, je ne pense pas que RVC ait besoin de tant de précision, donc n_probe = 1 est bien.

## FastScan
FastScan est une méthode qui permet d'approximer rapidement les distances par quantification de produit cartésien en les effectuant dans les registres.
La quantification du produit cartésien effectue un regroupement indépendamment

 pour chaque dimension d (généralement d = 2) pendant l'apprentissage, calcule la distance entre les clusters à l'avance, et crée une table de recherche. Au moment de la prédiction, la distance de chaque dimension peut être calculée en O(1) en consultant la table de recherche.
Le nombre que vous spécifiez après PQ spécifie généralement la moitié de la dimension du vecteur.

Pour une description plus détaillée de FastScan, veuillez consulter la documentation officielle.
https://github.com/facebookresearch/faiss/wiki/Fast-accumulation-of-PQ-and-AQ-codes-(FastScan)

## RFlat
RFlat est une instruction pour recalculer la distance approximative calculée par FastScan avec la distance exacte spécifiée par le troisième argument de l'usine d'index.
Lors de l'obtention de k voisins, k*k_factor points sont recalculés.


================================================
FILE: docs/fr/faq_fr.md
================================================
## Q1: Erreur ffmpeg/erreur utf8.
Il s'agit très probablement non pas d'un problème lié à FFmpeg, mais d'un problème lié au chemin de l'audio ;

FFmpeg peut rencontrer une erreur lors de la lecture de chemins contenant des caractères spéciaux tels que des espaces et (), ce qui peut provoquer une erreur FFmpeg ; et lorsque l'audio du jeu d'entraînement contient des chemins en chinois, l'écrire dans filelist.txt peut provoquer une erreur utf8.<br>

## Q2: Impossible de trouver le fichier index après "Entraînement en un clic".
Si l'affichage indique "L'entraînement est terminé. Le programme est fermé", alors le modèle a été formé avec succès, et les erreurs subséquentes sont fausses ;

L'absence d'un fichier index 'ajouté' après un entraînement en un clic peut être due au fait que le jeu d'entraînement est trop grand, ce qui bloque l'ajout de l'index ; cela a été résolu en utilisant un traitement par lots pour ajouter l'index, ce qui résout le problème de surcharge de mémoire lors de l'ajout de l'index. Comme solution temporaire, essayez de cliquer à nouveau sur le bouton "Entraîner l'index".<br>

## Q3: Impossible de trouver le modèle dans “Inférence du timbre” après l'entraînement
Cliquez sur “Actualiser la liste des timbres” et vérifiez à nouveau ; si vous ne le voyez toujours pas, vérifiez s'il y a des erreurs pendant l'entraînement et envoyez des captures d'écran de la console, de l'interface utilisateur web, et des logs/nom_de_l'expérience/*.log aux développeurs pour une analyse plus approfondie.<br>

## Q4: Comment partager un modèle/Comment utiliser les modèles d'autres personnes ?
Les fichiers pth stockés dans rvc_root/logs/nom_de_l'expérience ne sont pas destinés à être partagés ou inférés, mais à stocker les points de contrôle de l'expérience pour la reproductibilité et l'entraînement ultérieur. Le modèle à partager doit être le fichier pth de 60+MB dans le dossier des poids ;

À l'avenir, les poids/nom_de_l'expérience.pth et les logs/nom_de_l'expérience/ajouté_xxx.index seront fusionnés en un seul fichier poids/nom_de_l'expérience.zip pour éliminer le besoin d'une entrée d'index manuelle ; partagez donc le fichier zip, et non le fichier pth, sauf si vous souhaitez continuer l'entraînement sur une machine différente ;

Copier/partager les fichiers pth de plusieurs centaines de Mo du dossier des logs au dossier des poids pour une inférence forcée peut entraîner des erreurs telles que des f0, tgt_sr, ou d'autres clés manquantes. Vous devez utiliser l'onglet ckpt en bas pour sélectionner manuellement ou automatiquement (si l'information se trouve dans les logs/nom_de_l'expérience), si vous souhaitez inclure les informations sur la hauteur et les options de taux d'échantillonnage audio cible, puis extraire le modèle plus petit. Après extraction, il y aura un fichier pth de 60+ MB dans le dossier des poids, et vous pouvez actualiser les voix pour l'utiliser.<br>

## Q5: Erreur de connexion.
Il se peut que vous ayez fermé la console (fenêtre de ligne de commande noire).<br>

## Q6: WebUI affiche 'Expecting value: line 1 column 1 (char 0)'.
Veuillez désactiver le proxy système LAN/proxy global puis rafraîchir.<br>

## Q7: Comment s'entraîner et déduire sans le WebUI ?
Script d'entraînement :<br>
Vous pouvez d'abord lancer l'entraînement dans WebUI, et les versions en ligne de commande de la préparation du jeu de données et de l'entraînement seront affichées dans la fenêtre de message.<br>

Script d'inférence :<br>
https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/myinfer.py<br>

Par exemple :<br>

runtime\python.exe myinfer.py 0 "E:\codes\py39\RVC-beta\todo-songs\1111.wav" "E:\codes\py39\logs\mi-test\added_IVF677_Flat_nprobe_7.index" récolte "test.wav" "weights/mi-test.pth" 0.6 cuda:0 True<br>

f0up_key=sys.argv[1]<br>
input_path=sys.argv[2]<br>
index_path=sys.argv[3]<br>
f0method=sys.argv[4]#récolte ou pm<br>
opt_path=sys.argv[5]<br>
model_path=sys.argv[6]<br>
index_rate=float(sys.argv[7])<br>
device=sys.argv[8]<br>
is_half=bool(sys.argv[9])<br>

### Explication des arguments :

1. **Numéro de voix cible** : `0` (dans cet exemple)
2. **Chemin du fichier audio d'entrée** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\INPUTS_VOCAL\vocal.wav"`
3. **Chemin du fichier index** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\logs\Hagrid.index"`
4. **Méthode pour l'extraction du pitch (F0)** : `harvest` (dans cet exemple)
5. **Chemin de sortie pour le fichier audio traité** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\INPUTS_VOCAL\test.wav"`
6. **Chemin du modèle** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\weights\HagridFR.pth"`
7. **Taux d'index** : `0.6` (dans cet exemple)
8. **Périphérique pour l'exécution (GPU/CPU)** : `cuda:0` pour une carte NVIDIA, par exemple.
9. **Protection des droits d'auteur (True/False)**.

<!-- Pour myinfer nouveau models :

runtime\python.exe myinfer.py 0 "C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\INPUTS_VOCAL\vocal.wav" "C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\logs\Hagrid.index" harvest "C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\INPUTS_VOCAL\test.wav" "C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\weights\HagridFR.pth" 0.6 cuda:0 True 5 44100 44100 1.0 1.0 True


f0up_key=sys.argv[1]                     
input_path = sys.argv[2]                 
index_path = sys.argv[3]                 
f0method = sys.argv[4]                   
opt_path = sys.argv[5]                   
model_path = sys.argv[6]                 
index_rate = float(sys.argv[7])          
device = sys.argv[8]                     
is_half = bool(sys.argv[9])              
filter_radius = int(sys.argv[10])        
tgt_sr = int(sys.argv[11])               
resample_sr = int(sys.argv[12])          
rms_mix_rate = float(sys.argv[13])       
version = sys.argv[14]                   
protect = sys.argv[15].lower() == 'false' # change for true if needed

### Explication des arguments :

1. **Numéro de voix cible** : `0` (dans cet exemple)
2. **Chemin du fichier audio d'entrée** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\INPUTS_VOCAL\vocal.wav"`
3. **Chemin du fichier index** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\logs\Hagrid.index"`
4. **Méthode pour l'extraction du pitch (F0)** : `harvest` (dans cet exemple)
5. **Chemin de sortie pour le fichier audio traité** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\INPUTS_VOCAL\test.wav"`
6. **Chemin du modèle** : `"C:\ YOUR PATH FOR THE ROOT (RVC0813Nvidia)\weights\HagridFR.pth"`
7. **Taux d'index** : `0.6` (dans cet exemple)
8. **Périphérique pour l'exécution (GPU/CPU)** : `cuda:0` pour une carte NVIDIA, par exemple.
9. **Protection des droits d'auteur (True/False)**.
10. **Rayon du filtre** : `5` (dans cet exemple)
11. **Taux d'échantillonnage cible** : `44100` (dans cet exemple)
12. **Taux d'échantillonnage pour le rééchantillonnage** : `44100` (dans cet exemple)
13. **Taux de mixage RMS** : `1.0` (dans cet exemple)
14. **Version** : `1.0` (dans cet exemple)
15. **Protection** : `True` (dans cet exemple)

Assurez-vous de remplacer les chemins par ceux correspondant à votre configuration et d'ajuster les autres paramètres selon vos besoins.
-->

## Q8: Erreur Cuda/Mémoire Cuda épuisée.
Il y a une faible chance qu'il y ait un problème avec la configuration CUDA ou que le dispositif ne soit pas pris en charge ; plus probablement, il n'y a pas assez de mémoire (manque de mémoire).<br>

Pour l'entraînement, réduisez la taille du lot (si la réduction à 1 n'est toujours pas suffisante, vous devrez peut-être changer la carte graphique) ; pour l'inférence, ajustez les paramètres x_pad, x_query, x_center, et x_max dans le fichier config.py selon les besoins. Les cartes mémoire de 4 Go ou moins (par exemple 1060(3G) et diverses cartes de 2 Go) peuvent être abandonnées, tandis que les cartes mémoire de 4 Go ont encore une chance.<br>

## Q9: Combien de total_epoch sont optimaux ?
Si la qualité audio du jeu d'entraînement est médiocre et que le niveau de bruit est élevé, 20-30 époques sont suffisantes. Le fixer trop haut n'améliorera pas la qualité audio de votre jeu d'entraînement de faible qualité.<br>

Si la qualité audio du jeu d'entraînement est élevée, le niveau de bruit est faible, et la durée est suffisante, vous pouvez l'augmenter. 200 est acceptable (puisque l'entraînement est rapide, et si vous êtes capable de préparer un jeu d'entraînement de haute qualité, votre GPU peut probablement gérer une durée d'entraînement plus longue sans problème).<br>

## Q10: Quelle durée de jeu d'entraînement est nécessaire ?
Un jeu d'environ 10 min à 50 min est recommandé.<br>

Avec une garantie de haute qualité sonore et de faible bruit de fond, plus peut être ajouté si le timbre du jeu est uniforme.<br>

Pour un jeu d'entraînement de haut niveau (ton maigre + ton distinctif), 5 min à 10 min sont suffisantes.<br>

Il y a des personnes qui ont réussi à s'entraîner avec des données de 1 min à 2 min, mais le succès n'est pas reproductible par d'autres et n'est pas très informatif. <br>Cela nécessite que le jeu d'entraînement ait un timbre très distinctif (par exemple, un son de fille d'anime aérien à haute fréquence) et que la qualité de l'audio soit élevée ;
Aucune tentative réussie n'a été faite jusqu'à présent avec des données de moins de 1 min. Cela n'est pas recommandé.<br>

## Q11: À quoi sert le taux d'index et comment l'ajuster ?
Si la qualité tonale du modèle pré-entraîné et de la source d'inférence est supérieure à celle du jeu d'entraînement, ils peuvent améliorer la qualité tonale du résultat d'inférence, mais au prix d'un possible biais tonal vers le ton du modèle sous-jacent/source d'inférence plutôt que le ton du jeu d'entraînement, ce qui est généralement appelé "fuite de ton".<br>

Le taux d'index est utilisé pour réduire/résoudre le problème de la fuite de timbre. Si le taux d'index est fixé à 1, théoriquement il n'y a pas de fuite de timbre de la source d'inférence et la qualité du timbre est plus biaisée vers le jeu d'entraînement. Si le jeu d'entraînement a une qualité sonore inférieure à celle de la source d'inférence, alors un taux d'index plus élevé peut réduire la qualité sonore. Le réduire à 0 n'a pas l'effet d'utiliser le mélange de récupération pour protéger les tons du jeu d'entraînement.<br>

Si le jeu d'entraînement a une bonne qualité audio et une longue durée, augmentez le total_epoch, lorsque le modèle lui-même est moins susceptible de se référer à la source déduite et au modèle sous-jacent pré-entraîné, et qu'il y a peu de "fuite de ton", le taux d'index n'est pas important et vous pouvez même ne pas créer/partager le fichier index.<br>

## Q12: Comment choisir le gpu lors de l'inférence ?
Dans le fichier config.py, sélectionnez le numéro de carte après "device cuda:".<br>

La correspondance entre le numéro de carte et la carte graphique peut être vue dans la section d'information de la carte graphique de l'onglet d'entraînement.<br>

## Q13: Comment utiliser le modèle sauvegardé au milieu de l'entraînement ?
Sauvegardez via l'extraction de modèle en bas de l'onglet de traitement ckpt.

## Q14: Erreur de fichier/erreur de mémoire (lors de l'entraînement) ?
Il y a trop de processus et votre mémoire n'est pas suffisante. Vous pouvez le corriger en :

1. Diminuer l'entrée dans le champ "Threads of CPU".

2. Pré-découper le jeu d'entraînement en fichiers audio plus courts.

## Q15: Comment poursuivre l'entraînement avec plus de données

étape 1 : mettre toutes les données wav dans path2.

étape 2 : exp_name2+path2 -> traiter le jeu de données et extraire la caractéristique.

étape 3 : copier les derniers fichiers G et D de exp_name1 (votre expérience précédente) dans le dossier exp_name2.

étape 4 : cliquez sur "entraîner le modèle", et il continuera l'entraînement depuis le début de votre époque de modèle exp précédente.

## Q16: erreur à propos de llvmlite.dll

OSError: Impossible de charger le fichier objet partagé : llvmlite.dll

FileNotFoundError: Impossible de trouver le module lib\site-packages\llvmlite\binding\llvmlite.dll (ou l'une de ses dépendances). Essayez d'utiliser la syntaxe complète du constructeur.

Le problème se produira sous Windows, installez https://aka.ms/vs/17/release/vc_redist.x64.exe et il sera corrigé.

## Q17: RuntimeError: La taille étendue du tensor (17280) doit correspondre à la taille existante (0) à la dimension non-singleton 1. Tailles cibles : [1, 17280]. Tailles des tensors : [0]

Supprimez les fichiers wav dont la taille est nettement inférieure à celle des autres, et cela ne se reproduira plus. Ensuite, cliquez sur "entraîner le modèle" et "entraîner l'index".

## Q18: RuntimeError: La taille du tensor a (24) doit correspondre à la taille du tensor b (16) à la dimension non-singleton 2

Ne changez pas le taux d'échantillonnage puis continuez l'entraînement. S'il est nécessaire de changer, le nom de l'expérience doit être modifié et le modèle sera formé à partir de zéro. Vous pouvez également copier les hauteurs et caractéristiques (dossiers 0/1/2/2b) extraites la dernière fois pour accélérer le processus d'entraînement.



================================================
FILE: docs/fr/training_tips_fr.md
================================================
Instructions et conseils pour la formation RVC
======================================
Ces conseils expliquent comment se déroule la formation des données.

# Flux de formation
Je vais expliquer selon les étapes de l'onglet de formation de l'interface graphique.

## étape 1
Définissez ici le nom de l'expérience.

Vous pouvez également définir ici si le modèle doit prendre en compte le pitch.
Si le modèle ne considère pas le pitch, le modèle sera plus léger, mais pas adapté au chant.

Les données de chaque expérience sont placées dans `/logs/nom-de-votre-experience/`.

## étape 2a
Charge et pré-traite l'audio.

### charger l'audio
Si vous spécifiez un dossier avec de l'audio, les fichiers audio de ce dossier seront lus automatiquement.
Par exemple, si vous spécifiez `C:Users\hoge\voices`, `C:Users\hoge\voices\voice.mp3` sera chargé, mais `C:Users\hoge\voices\dir\voice.mp3` ne sera pas chargé.

Comme ffmpeg est utilisé en interne pour lire l'audio, si l'extension est prise en charge par ffmpeg, elle sera lue automatiquement.
Après la conversion en int16 avec ffmpeg, convertir en float32 et normaliser entre -1 et 1.

### débruitage
L'audio est lissé par filtfilt de scipy.

### Séparation audio
Tout d'abord, l'audio d'entrée est divisé en détectant des parties de silence qui durent plus d'une certaine période (max_sil_kept = 5 secondes ?). Après avoir séparé l'audio sur le silence, séparez l'audio toutes les 4 secondes avec un chevauchement de 0,3 seconde. Pour l'audio séparé en 4 secondes, après normalisation du volume, convertir le fichier wav en `/logs/nom-de-votre-experience/0_gt_wavs` puis le convertir à un taux d'échantillonnage de 16k dans `/logs/nom-de-votre-experience/1_16k_wavs` sous forme de fichier wav.

## étape 2b
### Extraire le pitch
Extrait les informations de pitch des fichiers wav. Extraire les informations de pitch (=f0) en utilisant la méthode intégrée dans parselmouth ou pyworld et les sauvegarder dans `/logs/nom-de-votre-experience/2a_f0`. Convertissez ensuite logarithmiquement les informations de pitch en un entier entre 1 et 255 et sauvegardez-le dans `/logs/nom-de-votre-experience/2b-f0nsf`.

### Extraire l'empreinte de caractéristique
Convertissez le fichier wav en incorporation à l'avance en utilisant HuBERT. Lisez le fichier wav sauvegardé dans `/logs/nom-de-votre-experience/1_16k_wavs`, convertissez le fichier wav en caractéristiques de dimension 256 avec HuBERT, et sauvegardez au format npy dans `/logs/nom-de-votre-experience/3_feature256`.

## étape 3
former le modèle.
### Glossaire pour les débutants
Dans l'apprentissage profond, l'ensemble de données est divisé et l'apprentissage progresse petit à petit. Dans une mise à jour de modèle (étape), les données de batch_size sont récupérées et des prédictions et corrections d'erreur sont effectuées. Faire cela une fois pour un ensemble de données compte comme une époque.

Par conséquent, le temps d'apprentissage est le temps d'apprentissage par étape x (le nombre de données dans l'ensemble de données / taille du lot) x le nombre d'époques. En général, plus la taille du lot est grande, plus l'apprentissage devient stable (temps d'apprentissage par étape ÷ taille du lot) devient plus petit, mais il utilise plus de mémoire GPU. La RAM GPU peut être vérifiée avec la commande nvidia-smi. L'apprentissage peut être effectué en peu de temps en augmentant la taille du lot autant que possible selon la machine de l'environnement d'exécution.

### Spécifier le modèle pré-entraîné
RVC commence à former le modèle à partir de poids pré-entraînés plutôt que de zéro, il peut donc être formé avec un petit ensemble de données.

Par défaut :

- Si vous considérez le pitch, il charge `rvc-location/pretrained/f0G40k.pth` et `rvc-location/pretrained/f0D40k.pth`.
- Si vous ne considérez pas le pitch, il charge `rvc-location/pretrained/f0G40k.pth` et `rvc-location/pretrained/f0D40k.pth`.

Lors de l'apprentissage, les paramètres du modèle sont sauvegardés dans `logs/nom-de-votre-experience/G_{}.pth` et `logs/nom-de-votre-experience/D_{}.pth` pour chaque save_every_epoch, mais en spécifiant ce chemin, vous pouvez démarrer l'apprentissage. Vous pouvez redémarrer ou commencer à former à partir de poids de modèle appris lors d'une expérience différente.

### Index d'apprentissage
RVC sauvegarde les valeurs de caractéristique HuBERT utilisées lors de la formation, et pendant l'inférence, recherche les valeurs de caractéristique qui sont similaires aux valeurs de caractéristique utilisées lors de l'apprentissage pour effectuer l'inférence. Afin d'effectuer cette recherche à haute vitesse, l'index est appris à l'avance.
Pour l'apprentissage d'index, nous utilisons la bibliothèque de recherche de voisinage approximatif fai
Download .txt
gitextract_o1tw_l2e/

├── .github/
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       ├── docker.yml
│       ├── genlocale.yml
│       ├── pull_format.yml
│       ├── push_format.yml
│       ├── sync_dev.yml
│       └── unitest.yml
├── .gitignore
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── MIT协议暨相关引用库协议
├── README.md
├── Retrieval_based_Voice_Conversion_WebUI.ipynb
├── Retrieval_based_Voice_Conversion_WebUI_v2.ipynb
├── api_231006.py
├── api_240604.py
├── assets/
│   ├── Synthesizer_inputs.pth
│   ├── hubert/
│   │   ├── .gitignore
│   │   └── hubert_inputs.pth
│   ├── indices/
│   │   └── .gitignore
│   ├── pretrained/
│   │   └── .gitignore
│   ├── pretrained_v2/
│   │   └── .gitignore
│   ├── rmvpe/
│   │   ├── .gitignore
│   │   └── rmvpe_inputs.pth
│   ├── uvr5_weights/
│   │   └── .gitignore
│   └── weights/
│       └── .gitignore
├── configs/
│   ├── config.json
│   ├── config.py
│   ├── inuse/
│   │   ├── .gitignore
│   │   ├── v1/
│   │   │   └── .gitignore
│   │   └── v2/
│   │       └── .gitignore
│   ├── v1/
│   │   ├── 32k.json
│   │   ├── 40k.json
│   │   └── 48k.json
│   └── v2/
│       ├── 32k.json
│       └── 48k.json
├── docker-compose.yml
├── docs/
│   ├── cn/
│   │   ├── Changelog_CN.md
│   │   └── faq.md
│   ├── en/
│   │   ├── Changelog_EN.md
│   │   ├── README.en.md
│   │   ├── faiss_tips_en.md
│   │   ├── faq_en.md
│   │   └── training_tips_en.md
│   ├── fr/
│   │   ├── Changelog_FR.md
│   │   ├── README.fr.md
│   │   ├── faiss_tips_fr.md
│   │   ├── faq_fr.md
│   │   └── training_tips_fr.md
│   ├── jp/
│   │   ├── Changelog_JA.md
│   │   ├── README.ja.md
│   │   ├── faiss_tips_ja.md
│   │   ├── faq_ja.md
│   │   └── training_tips_ja.md
│   ├── kr/
│   │   ├── Changelog_KO.md
│   │   ├── README.ko.han.md
│   │   ├── README.ko.md
│   │   ├── faiss_tips_ko.md
│   │   ├── faq_ko.md
│   │   └── training_tips_ko.md
│   ├── pt/
│   │   ├── Changelog_pt.md
│   │   ├── README.pt.md
│   │   ├── faiss_tips_pt.md
│   │   ├── faq_pt.md
│   │   └── training_tips_pt.md
│   ├── tr/
│   │   ├── Changelog_TR.md
│   │   ├── README.tr.md
│   │   ├── faiss_tips_tr.md
│   │   ├── faq_tr.md
│   │   └── training_tips_tr.md
│   └── 小白简易教程.doc
├── environment_dml.yaml
├── go-realtime-gui-dml.bat
├── go-realtime-gui.bat
├── go-web-dml.bat
├── go-web.bat
├── gui_v1.py
├── i18n/
│   ├── i18n.py
│   ├── locale/
│   │   ├── en_US.json
│   │   ├── es_ES.json
│   │   ├── fr_FR.json
│   │   ├── it_IT.json
│   │   ├── ja_JP.json
│   │   ├── ko_KR.json
│   │   ├── pt_BR.json
│   │   ├── ru_RU.json
│   │   ├── tr_TR.json
│   │   ├── zh_CN.json
│   │   ├── zh_HK.json
│   │   ├── zh_SG.json
│   │   └── zh_TW.json
│   ├── locale_diff.py
│   └── scan_i18n.py
├── infer/
│   ├── lib/
│   │   ├── audio.py
│   │   ├── infer_pack/
│   │   │   ├── attentions.py
│   │   │   ├── attentions_onnx.py
│   │   │   ├── commons.py
│   │   │   ├── models.py
│   │   │   ├── models_onnx.py
│   │   │   ├── modules/
│   │   │   │   └── F0Predictor/
│   │   │   │       ├── DioF0Predictor.py
│   │   │   │       ├── F0Predictor.py
│   │   │   │       ├── HarvestF0Predictor.py
│   │   │   │       ├── PMF0Predictor.py
│   │   │   │       └── __init__.py
│   │   │   ├── modules.py
│   │   │   ├── onnx_inference.py
│   │   │   └── transforms.py
│   │   ├── jit/
│   │   │   ├── __init__.py
│   │   │   ├── get_hubert.py
│   │   │   ├── get_rmvpe.py
│   │   │   └── get_synthesizer.py
│   │   ├── rmvpe.py
│   │   ├── rtrvc.py
│   │   ├── slicer2.py
│   │   ├── train/
│   │   │   ├── data_utils.py
│   │   │   ├── losses.py
│   │   │   ├── mel_processing.py
│   │   │   ├── process_ckpt.py
│   │   │   └── utils.py
│   │   └── uvr5_pack/
│   │       ├── lib_v5/
│   │       │   ├── dataset.py
│   │       │   ├── layers.py
│   │       │   ├── layers_123812KB .py
│   │       │   ├── layers_123821KB.py
│   │       │   ├── layers_33966KB.py
│   │       │   ├── layers_537227KB.py
│   │       │   ├── layers_537238KB.py
│   │       │   ├── layers_new.py
│   │       │   ├── model_param_init.py
│   │       │   ├── modelparams/
│   │       │   │   ├── 1band_sr16000_hl512.json
│   │       │   │   ├── 1band_sr32000_hl512.json
│   │       │   │   ├── 1band_sr33075_hl384.json
│   │       │   │   ├── 1band_sr44100_hl1024.json
│   │       │   │   ├── 1band_sr44100_hl256.json
│   │       │   │   ├── 1band_sr44100_hl512.json
│   │       │   │   ├── 1band_sr44100_hl512_cut.json
│   │       │   │   ├── 2band_32000.json
│   │       │   │   ├── 2band_44100_lofi.json
│   │       │   │   ├── 2band_48000.json
│   │       │   │   ├── 3band_44100.json
│   │       │   │   ├── 3band_44100_mid.json
│   │       │   │   ├── 3band_44100_msb2.json
│   │       │   │   ├── 4band_44100.json
│   │       │   │   ├── 4band_44100_mid.json
│   │       │   │   ├── 4band_44100_msb.json
│   │       │   │   ├── 4band_44100_msb2.json
│   │       │   │   ├── 4band_44100_reverse.json
│   │       │   │   ├── 4band_44100_sw.json
│   │       │   │   ├── 4band_v2.json
│   │       │   │   ├── 4band_v2_sn.json
│   │       │   │   ├── 4band_v3.json
│   │       │   │   └── ensemble.json
│   │       │   ├── nets.py
│   │       │   ├── nets_123812KB.py
│   │       │   ├── nets_123821KB.py
│   │       │   ├── nets_33966KB.py
│   │       │   ├── nets_537227KB.py
│   │       │   ├── nets_537238KB.py
│   │       │   ├── nets_61968KB.py
│   │       │   ├── nets_new.py
│   │       │   └── spec_utils.py
│   │       ├── name_params.json
│   │       └── utils.py
│   └── modules/
│       ├── ipex/
│       │   ├── __init__.py
│       │   ├── attention.py
│       │   ├── gradscaler.py
│       │   └── hijacks.py
│       ├── onnx/
│       │   └── export.py
│       ├── train/
│       │   ├── extract/
│       │   │   ├── extract_f0_print.py
│       │   │   ├── extract_f0_rmvpe.py
│       │   │   └── extract_f0_rmvpe_dml.py
│       │   ├── extract_feature_print.py
│       │   ├── preprocess.py
│       │   └── train.py
│       ├── uvr5/
│       │   ├── mdxnet.py
│       │   ├── modules.py
│       │   └── vr.py
│       └── vc/
│           ├── __init__.py
│           ├── modules.py
│           ├── pipeline.py
│           └── utils.py
├── infer-web.py
├── pyproject.toml
├── requirements-amd.txt
├── requirements-dml.txt
├── requirements-ipex.txt
├── requirements-py311.txt
├── requirements-win-for-realtime_vc_gui-dml.txt
├── requirements-win-for-realtime_vc_gui.txt
├── requirements.txt
├── run.sh
├── tools/
│   ├── app.py
│   ├── calc_rvc_model_similarity.py
│   ├── dlmodels.bat
│   ├── dlmodels.sh
│   ├── download_models.py
│   ├── export_onnx.py
│   ├── infer/
│   │   ├── infer-pm-index256.py
│   │   ├── train-index-v2.py
│   │   ├── train-index.py
│   │   └── trans_weights.py
│   ├── infer_batch_rvc.py
│   ├── infer_cli.py
│   ├── onnx_inference_demo.py
│   ├── rvc_for_realtime.py
│   └── torchgate/
│       ├── __init__.py
│       ├── torchgate.py
│       └── utils.py
└── venv.sh
Download .txt
SYMBOL INDEX (805 symbols across 76 files)

FILE: api_231006.py
  class GUIConfig (line 27) | class GUIConfig:
    method __init__ (line 28) | def __init__(self) -> None:
  class ConfigData (line 46) | class ConfigData(BaseModel):
  class AudioAPI (line 62) | class AudioAPI:
    method __init__ (line 63) | def __init__(self) -> None:
    method load (line 71) | def load(self):
    method set_values (line 103) | def set_values(self, values):
    method start_vc (line 126) | def start_vc(self):
    method soundinput (line 206) | def soundinput(self):
    method audio_callback (line 222) | def audio_callback(self, indata: np.ndarray, outdata: np.ndarray, fram...
    method get_devices (line 294) | def get_devices(self, update: bool = True):
    method set_devices (line 330) | def set_devices(self, input_device, output_device):
  function get_input_devices (line 358) | def get_input_devices():
  function get_output_devices (line 367) | def get_output_devices():
  function configure_audio (line 376) | def configure_audio(config_data: ConfigData):
  function start_conversion (line 395) | def start_conversion():
  function stop_conversion (line 411) | def stop_conversion():

FILE: api_240604.py
  class GUIConfig (line 28) | class GUIConfig:
    method __init__ (line 29) | def __init__(self) -> None:
  class ConfigData (line 49) | class ConfigData(BaseModel):
  class Harvest (line 68) | class Harvest(Process):
    method __init__ (line 69) | def __init__(self, inp_q, opt_q):
    method run (line 74) | def run(self):
  class AudioAPI (line 90) | class AudioAPI:
    method __init__ (line 91) | def __init__(self) -> None:
    method initialize_queues (line 102) | def initialize_queues(self):
    method load (line 110) | def load(self):
    method set_values (line 143) | def set_values(self, values):
    method start_vc (line 168) | def start_vc(self):
    method soundinput (line 279) | def soundinput(self):
    method audio_callback (line 295) | def audio_callback(self, indata: np.ndarray, outdata: np.ndarray, fram...
    method get_devices (line 420) | def get_devices(self, update: bool = True):
    method set_devices (line 456) | def set_devices(self, input_device, output_device):
  function get_input_devices (line 484) | def get_input_devices():
  function get_output_devices (line 493) | def get_output_devices():
  function configure_audio (line 502) | def configure_audio(config_data: ConfigData):
  function start_conversion (line 520) | def start_conversion():
  function stop_conversion (line 536) | def stop_conversion():

FILE: configs/config.py
  function singleton_variable (line 33) | def singleton_variable(func):
  class Config (line 44) | class Config:
    method __init__ (line 45) | def __init__(self):
    method load_config_json (line 66) | def load_config_json() -> dict:
    method arg_parse (line 77) | def arg_parse() -> tuple:
    method has_mps (line 112) | def has_mps() -> bool:
    method has_xpu (line 122) | def has_xpu() -> bool:
    method use_fp32_config (line 128) | def use_fp32_config(self):
    method device_config (line 139) | def device_config(self) -> tuple:

FILE: gui_v1.py
  function printt (line 19) | def printt(strr, *args):
  function phase_vocoder (line 26) | def phase_vocoder(a, b, fade_out, fade_in):
  class Harvest (line 50) | class Harvest(multiprocessing.Process):
    method __init__ (line 51) | def __init__(self, inp_q, opt_q):
    method run (line 56) | def run(self):
  class GUIConfig (line 114) | class GUIConfig:
    method __init__ (line 115) | def __init__(self) -> None:
  class GUI (line 137) | class GUI:
    method __init__ (line 138) | def __init__(self) -> None:
    method load (line 152) | def load(self):
    method launcher (line 223) | def launcher(self):
    method event_handler (line 534) | def event_handler(self):
    method set_values (line 655) | def set_values(self, values):
    method start_vc (line 707) | def start_vc(self):
    method start_stream (line 818) | def start_stream(self):
    method stop_stream (line 839) | def stop_stream(self):
    method audio_callback (line 848) | def audio_callback(
    method update_devices (line 1010) | def update_devices(self, hostapi_name=None):
    method set_devices (line 1045) | def set_devices(self, input_device, output_device):
    method get_device_samplerate (line 1056) | def get_device_samplerate(self):
    method get_device_channels (line 1061) | def get_device_channels(self):

FILE: i18n/i18n.py
  function load_language_list (line 6) | def load_language_list(language):
  class I18nAuto (line 12) | class I18nAuto:
    method __init__ (line 13) | def __init__(self, language=None):
    method __call__ (line 23) | def __call__(self, key):
    method __repr__ (line 26) | def __repr__(self):

FILE: i18n/scan_i18n.py
  function extract_i18n_strings (line 7) | def extract_i18n_strings(node):

FILE: infer-web.py
  function forward_dml (line 59) | def forward_dml(ctx, x, scale):
  class ToolButton (line 123) | class ToolButton(gr.Button, gr.components.FormComponent):
    method __init__ (line 126) | def __init__(self, **kwargs):
    method get_block_name (line 129) | def get_block_name(self):
  function lookup_indices (line 145) | def lookup_indices(index_root):
  function change_choices (line 161) | def change_choices():
  function clean (line 177) | def clean():
  function export_onnx (line 181) | def export_onnx(ModelPath, ExportedPath):
  function if_done (line 194) | def if_done(done, p):
  function if_done_multi (line 203) | def if_done_multi(done, ps):
  function preprocess_dataset (line 218) | def preprocess_dataset(trainset_dir, exp_dir, sr, n_p):
  function extract_f0_feature (line 258) | def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, version19, g...
  function get_pretrained_models (line 398) | def get_pretrained_models(path_str, f0_str, sr2):
  function change_sr2 (line 433) | def change_sr2(sr2, if_f0_3, version19):
  function change_version19 (line 439) | def change_version19(sr2, if_f0_3, version19):
  function change_f0 (line 455) | def change_f0(if_f0_3, sr2, version19):  # f0method8,pretrained_G14,pret...
  function click_train (line 465) | def click_train(
  function train_index (line 616) | def train_index(exp_dir1, version19):
  function train1key (line 715) | def train1key(
  function change_info_ (line 782) | def change_info_(ckpt_path):
  function change_f0_method (line 801) | def change_f0_method(f0method8):

FILE: infer/lib/audio.py
  function wav2 (line 10) | def wav2(i, o, format):
  function load_audio (line 33) | def load_audio(file, sr):
  function clean_path (line 56) | def clean_path(path_str):

FILE: infer/lib/infer_pack/attentions.py
  class Encoder (line 14) | class Encoder(nn.Module):
    method __init__ (line 15) | def __init__(
    method forward (line 62) | def forward(self, x, x_mask):
  class Decoder (line 80) | class Decoder(nn.Module):
    method __init__ (line 81) | def __init__(
    method forward (line 140) | def forward(self, x, x_mask, h, h_mask):
  class MultiHeadAttention (line 166) | class MultiHeadAttention(nn.Module):
    method __init__ (line 167) | def __init__(
    method forward (line 220) | def forward(
    method attention (line 232) | def attention(
    method _matmul_with_relative_values (line 290) | def _matmul_with_relative_values(self, x, y):
    method _matmul_with_relative_keys (line 299) | def _matmul_with_relative_keys(self, x, y):
    method _get_relative_embeddings (line 308) | def _get_relative_embeddings(self, relative_embeddings, length: int):
    method _relative_position_to_absolute_position (line 327) | def _relative_position_to_absolute_position(self, x):
    method _absolute_position_to_relative_position (line 354) | def _absolute_position_to_relative_position(self, x):
    method _attention_bias_proximal (line 376) | def _attention_bias_proximal(self, length: int):
  class FFN (line 388) | class FFN(nn.Module):
    method __init__ (line 389) | def __init__(
    method padding (line 417) | def padding(self, x: torch.Tensor, x_mask: torch.Tensor) -> torch.Tensor:
    method forward (line 424) | def forward(self, x: torch.Tensor, x_mask: torch.Tensor):
    method _causal_padding (line 435) | def _causal_padding(self, x):
    method _same_padding (line 448) | def _same_padding(self, x):

FILE: infer/lib/infer_pack/attentions_onnx.py
  class Encoder (line 22) | class Encoder(nn.Module):
    method __init__ (line 23) | def __init__(
    method forward (line 70) | def forward(self, x, x_mask):
  class Decoder (line 88) | class Decoder(nn.Module):
    method __init__ (line 89) | def __init__(
    method forward (line 148) | def forward(self, x, x_mask, h, h_mask):
  class MultiHeadAttention (line 174) | class MultiHeadAttention(nn.Module):
    method __init__ (line 175) | def __init__(
    method forward (line 228) | def forward(
    method attention (line 240) | def attention(
    method _matmul_with_relative_values (line 295) | def _matmul_with_relative_values(self, x, y):
    method _matmul_with_relative_keys (line 304) | def _matmul_with_relative_keys(self, x, y):
    method _get_relative_embeddings (line 313) | def _get_relative_embeddings(self, relative_embeddings, length):
    method _relative_position_to_absolute_position (line 330) | def _relative_position_to_absolute_position(self, x):
    method _absolute_position_to_relative_position (line 356) | def _absolute_position_to_relative_position(self, x):
    method _attention_bias_proximal (line 376) | def _attention_bias_proximal(self, length):
  class FFN (line 388) | class FFN(nn.Module):
    method __init__ (line 389) | def __init__(
    method padding (line 417) | def padding(self, x: torch.Tensor, x_mask: torch.Tensor) -> torch.Tensor:
    method forward (line 424) | def forward(self, x: torch.Tensor, x_mask: torch.Tensor):
    method _causal_padding (line 435) | def _causal_padding(self, x):
    method _same_padding (line 448) | def _same_padding(self, x):

FILE: infer/lib/infer_pack/commons.py
  function init_weights (line 10) | def init_weights(m, mean=0.0, std=0.01):
  function get_padding (line 16) | def get_padding(kernel_size, dilation=1):
  function kl_divergence (line 26) | def kl_divergence(m_p, logs_p, m_q, logs_q):
  function rand_gumbel (line 35) | def rand_gumbel(shape):
  function rand_gumbel_like (line 41) | def rand_gumbel_like(x):
  function slice_segments (line 46) | def slice_segments(x, ids_str, segment_size=4):
  function slice_segments2 (line 55) | def slice_segments2(x, ids_str, segment_size=4):
  function rand_slice_segments (line 64) | def rand_slice_segments(x, x_lengths=None, segment_size=4):
  function get_timing_signal_1d (line 74) | def get_timing_signal_1d(length, channels, min_timescale=1.0, max_timesc...
  function add_timing_signal_1d (line 90) | def add_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4):
  function cat_timing_signal_1d (line 96) | def cat_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4, axis...
  function subsequent_mask (line 102) | def subsequent_mask(length):
  function fused_add_tanh_sigmoid_multiply (line 108) | def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels):
  function convert_pad_shape (line 123) | def convert_pad_shape(pad_shape: List[List[int]]) -> List[int]:
  function shift_1d (line 127) | def shift_1d(x):
  function sequence_mask (line 132) | def sequence_mask(length: torch.Tensor, max_length: Optional[int] = None):
  function generate_path (line 139) | def generate_path(duration, mask):
  function clip_grad_value_ (line 157) | def clip_grad_value_(parameters, clip_value, norm_type=2):

FILE: infer/lib/infer_pack/models.py
  class TextEncoder (line 19) | class TextEncoder(nn.Module):
    method __init__ (line 20) | def __init__(
    method forward (line 54) | def forward(
  class ResidualCouplingBlock (line 82) | class ResidualCouplingBlock(nn.Module):
    method __init__ (line 83) | def __init__(
    method forward (line 117) | def forward(
    method remove_weight_norm (line 132) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 136) | def __prepare_scriptable__(self):
  class PosteriorEncoder (line 148) | class PosteriorEncoder(nn.Module):
    method __init__ (line 149) | def __init__(
    method forward (line 178) | def forward(
    method remove_weight_norm (line 191) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 194) | def __prepare_scriptable__(self):
  class Generator (line 204) | class Generator(torch.nn.Module):
    method __init__ (line 205) | def __init__(
    method forward (line 252) | def forward(
    method __prepare_scriptable__ (line 283) | def __prepare_scriptable__(self):
    method remove_weight_norm (line 305) | def remove_weight_norm(self):
  class SineGen (line 312) | class SineGen(torch.nn.Module):
    method __init__ (line 328) | def __init__(
    method _f02uv (line 345) | def _f02uv(self, f0):
    method _f02sine (line 353) | def _f02sine(self, f0, upp):
    method forward (line 371) | def forward(self, f0: torch.Tensor, upp: int):
  class SourceModuleHnNSF (line 391) | class SourceModuleHnNSF(torch.nn.Module):
    method __init__ (line 409) | def __init__(
    method forward (line 433) | def forward(self, x: torch.Tensor, upp: int = 1):
  class GeneratorNSF (line 448) | class GeneratorNSF(torch.nn.Module):
    method __init__ (line 449) | def __init__(
    method forward (line 522) | def forward(
    method remove_weight_norm (line 567) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 573) | def __prepare_scriptable__(self):
  class SynthesizerTrnMs256NSFsid (line 602) | class SynthesizerTrnMs256NSFsid(nn.Module):
    method __init__ (line 603) | def __init__(
    method remove_weight_norm (line 688) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 694) | def __prepare_scriptable__(self):
    method forward (line 721) | def forward(
    method infer (line 746) | def infer(
  class SynthesizerTrnMs768NSFsid (line 779) | class SynthesizerTrnMs768NSFsid(SynthesizerTrnMs256NSFsid):
    method __init__ (line 780) | def __init__(
  class SynthesizerTrnMs256NSFsid_nono (line 836) | class SynthesizerTrnMs256NSFsid_nono(nn.Module):
    method __init__ (line 837) | def __init__(
    method remove_weight_norm (line 919) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 925) | def __prepare_scriptable__(self):
    method forward (line 952) | def forward(self, phone, phone_lengths, y, y_lengths, ds):  # 这里ds是id,...
    method infer (line 964) | def infer(
  class SynthesizerTrnMs768NSFsid_nono (line 994) | class SynthesizerTrnMs768NSFsid_nono(SynthesizerTrnMs256NSFsid_nono):
    method __init__ (line 995) | def __init__(
  class MultiPeriodDiscriminator (line 1052) | class MultiPeriodDiscriminator(torch.nn.Module):
    method __init__ (line 1053) | def __init__(self, use_spectral_norm=False):
    method forward (line 1064) | def forward(self, y, y_hat):
  class MultiPeriodDiscriminatorV2 (line 1082) | class MultiPeriodDiscriminatorV2(torch.nn.Module):
    method __init__ (line 1083) | def __init__(self, use_spectral_norm=False):
    method forward (line 1094) | def forward(self, y, y_hat):
  class DiscriminatorS (line 1112) | class DiscriminatorS(torch.nn.Module):
    method __init__ (line 1113) | def __init__(self, use_spectral_norm=False):
    method forward (line 1128) | def forward(self, x):
  class DiscriminatorP (line 1142) | class DiscriminatorP(torch.nn.Module):
    method __init__ (line 1143) | def __init__(self, period, kernel_size=5, stride=3, use_spectral_norm=...
    method forward (line 1199) | def forward(self, x):

FILE: infer/lib/infer_pack/models_onnx.py
  class TextEncoder256 (line 27) | class TextEncoder256(nn.Module):
    method __init__ (line 28) | def __init__(
    method forward (line 56) | def forward(self, phone, pitch, lengths):
  class TextEncoder768 (line 74) | class TextEncoder768(nn.Module):
    method __init__ (line 75) | def __init__(
    method forward (line 103) | def forward(self, phone, pitch, lengths):
  class ResidualCouplingBlock (line 121) | class ResidualCouplingBlock(nn.Module):
    method __init__ (line 122) | def __init__(
    method forward (line 156) | def forward(self, x, x_mask, g=None, reverse=False):
    method remove_weight_norm (line 165) | def remove_weight_norm(self):
  class PosteriorEncoder (line 170) | class PosteriorEncoder(nn.Module):
    method __init__ (line 171) | def __init__(
    method forward (line 200) | def forward(self, x, x_lengths, g=None):
    method remove_weight_norm (line 211) | def remove_weight_norm(self):
  class Generator (line 215) | class Generator(torch.nn.Module):
    method __init__ (line 216) | def __init__(
    method forward (line 263) | def forward(self, x, g=None):
    method remove_weight_norm (line 284) | def remove_weight_norm(self):
  class SineGen (line 291) | class SineGen(torch.nn.Module):
    method __init__ (line 307) | def __init__(
    method _f02uv (line 324) | def _f02uv(self, f0):
    method _f02sine (line 332) | def _f02sine(self, f0, upp):
    method forward (line 350) | def forward(self, f0: torch.Tensor, upp: int):
  class SourceModuleHnNSF (line 370) | class SourceModuleHnNSF(torch.nn.Module):
    method __init__ (line 388) | def __init__(
    method forward (line 411) | def forward(self, x, upp=None):
  class GeneratorNSF (line 419) | class GeneratorNSF(torch.nn.Module):
    method __init__ (line 420) | def __init__(
    method forward (line 491) | def forward(self, x, f0, g=None):
    method remove_weight_norm (line 515) | def remove_weight_norm(self):
  class SynthesizerTrnMsNSFsidM (line 529) | class SynthesizerTrnMsNSFsidM(nn.Module):
    method __init__ (line 530) | def __init__(
    method remove_weight_norm (line 624) | def remove_weight_norm(self):
    method construct_spkmixmap (line 629) | def construct_spkmixmap(self, n_speaker):
    method forward (line 635) | def forward(self, phone, phone_lengths, pitch, nsff0, g, rnd, max_len=...
  class MultiPeriodDiscriminator (line 652) | class MultiPeriodDiscriminator(torch.nn.Module):
    method __init__ (line 653) | def __init__(self, use_spectral_norm=False):
    method forward (line 664) | def forward(self, y, y_hat):
  class MultiPeriodDiscriminatorV2 (line 682) | class MultiPeriodDiscriminatorV2(torch.nn.Module):
    method __init__ (line 683) | def __init__(self, use_spectral_norm=False):
    method forward (line 694) | def forward(self, y, y_hat):
  class DiscriminatorS (line 712) | class DiscriminatorS(torch.nn.Module):
    method __init__ (line 713) | def __init__(self, use_spectral_norm=False):
    method forward (line 728) | def forward(self, x):
  class DiscriminatorP (line 742) | class DiscriminatorP(torch.nn.Module):
    method __init__ (line 743) | def __init__(self, period, kernel_size=5, stride=3, use_spectral_norm=...
    method forward (line 799) | def forward(self, x):

FILE: infer/lib/infer_pack/modules.py
  class LayerNorm (line 20) | class LayerNorm(nn.Module):
    method __init__ (line 21) | def __init__(self, channels, eps=1e-5):
    method forward (line 29) | def forward(self, x):
  class ConvReluNorm (line 35) | class ConvReluNorm(nn.Module):
    method __init__ (line 36) | def __init__(
    method forward (line 77) | def forward(self, x, x_mask):
  class DDSConv (line 87) | class DDSConv(nn.Module):
    method __init__ (line 92) | def __init__(self, channels, kernel_size, n_layers, p_dropout=0.0):
    method forward (line 121) | def forward(self, x, x_mask, g: Optional[torch.Tensor] = None):
  class WN (line 136) | class WN(torch.nn.Module):
    method __init__ (line 137) | def __init__(
    method forward (line 188) | def forward(
    method remove_weight_norm (line 219) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 227) | def __prepare_scriptable__(self):
  class ResBlock1 (line 252) | class ResBlock1(torch.nn.Module):
    method __init__ (line 253) | def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)):
    method forward (line 328) | def forward(self, x: torch.Tensor, x_mask: Optional[torch.Tensor] = No...
    method remove_weight_norm (line 343) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 349) | def __prepare_scriptable__(self):
  class ResBlock2 (line 367) | class ResBlock2(torch.nn.Module):
    method __init__ (line 368) | def __init__(self, channels, kernel_size=3, dilation=(1, 3)):
    method forward (line 397) | def forward(self, x, x_mask: Optional[torch.Tensor] = None):
    method remove_weight_norm (line 408) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 412) | def __prepare_scriptable__(self):
  class Log (line 423) | class Log(nn.Module):
    method forward (line 424) | def forward(
  class Flip (line 440) | class Flip(nn.Module):
    method forward (line 444) | def forward(
  class ElementwiseAffine (line 459) | class ElementwiseAffine(nn.Module):
    method __init__ (line 460) | def __init__(self, channels):
    method forward (line 466) | def forward(self, x, x_mask, reverse=False, **kwargs):
  class ResidualCouplingLayer (line 477) | class ResidualCouplingLayer(nn.Module):
    method __init__ (line 478) | def __init__(
    method forward (line 512) | def forward(
    method remove_weight_norm (line 539) | def remove_weight_norm(self):
    method __prepare_scriptable__ (line 542) | def __prepare_scriptable__(self):
  class ConvFlow (line 552) | class ConvFlow(nn.Module):
    method __init__ (line 553) | def __init__(
    method forward (line 579) | def forward(

FILE: infer/lib/infer_pack/modules/F0Predictor/DioF0Predictor.py
  class DioF0Predictor (line 7) | class DioF0Predictor(F0Predictor):
    method __init__ (line 8) | def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_ra...
    method interpolate_f0 (line 14) | def interpolate_f0(self, f0):
    method resize_f0 (line 52) | def resize_f0(self, x, target_len):
    method compute_f0 (line 63) | def compute_f0(self, wav, p_len=None):
    method compute_f0_uv (line 78) | def compute_f0_uv(self, wav, p_len=None):

FILE: infer/lib/infer_pack/modules/F0Predictor/F0Predictor.py
  class F0Predictor (line 1) | class F0Predictor(object):
    method compute_f0 (line 2) | def compute_f0(self, wav, p_len):
    method compute_f0_uv (line 10) | def compute_f0_uv(self, wav, p_len):

FILE: infer/lib/infer_pack/modules/F0Predictor/HarvestF0Predictor.py
  class HarvestF0Predictor (line 7) | class HarvestF0Predictor(F0Predictor):
    method __init__ (line 8) | def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_ra...
    method interpolate_f0 (line 14) | def interpolate_f0(self, f0):
    method resize_f0 (line 52) | def resize_f0(self, x, target_len):
    method compute_f0 (line 63) | def compute_f0(self, wav, p_len=None):
    method compute_f0_uv (line 76) | def compute_f0_uv(self, wav, p_len=None):

FILE: infer/lib/infer_pack/modules/F0Predictor/PMF0Predictor.py
  class PMF0Predictor (line 7) | class PMF0Predictor(F0Predictor):
    method __init__ (line 8) | def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_ra...
    method interpolate_f0 (line 14) | def interpolate_f0(self, f0):
    method compute_f0 (line 52) | def compute_f0(self, wav, p_len=None):
    method compute_f0_uv (line 76) | def compute_f0_uv(self, wav, p_len=None):

FILE: infer/lib/infer_pack/onnx_inference.py
  class ContentVec (line 11) | class ContentVec:
    method __init__ (line 12) | def __init__(self, vec_path="pretrained/vec-768-layer-12.onnx", device...
    method __call__ (line 24) | def __call__(self, wav):
    method forward (line 27) | def forward(self, wav):
  function get_f0_predictor (line 38) | def get_f0_predictor(f0_predictor, hop_length, sampling_rate, **kargs):
  class OnnxRVC (line 64) | class OnnxRVC:
    method __init__ (line 65) | def __init__(
    method forward (line 87) | def forward(self, hubert, hubert_length, pitch, pitchf, ds, rnd):
    method inference (line 98) | def inference(

FILE: infer/lib/infer_pack/transforms.py
  function piecewise_rational_quadratic_transform (line 10) | def piecewise_rational_quadratic_transform(
  function searchsorted (line 43) | def searchsorted(bin_locations, inputs, eps=1e-6):
  function unconstrained_rational_quadratic_spline (line 48) | def unconstrained_rational_quadratic_spline(
  function rational_quadratic_spline (line 98) | def rational_quadratic_spline(

FILE: infer/lib/jit/__init__.py
  function load_inputs (line 9) | def load_inputs(path, device, is_half=False):
  function benchmark (line 20) | def benchmark(
  function jit_warm_up (line 33) | def jit_warm_up(model, inputs_path, device=torch.device("cpu"), epoch=5,...
  function to_jit_model (line 37) | def to_jit_model(
  function export (line 76) | def export(
  function load (line 102) | def load(path: str):
  function save (line 107) | def save(ckpt: dict, save_path: str):
  function rmvpe_jit_export (line 112) | def rmvpe_jit_export(
  function synthesizer_jit_export (line 137) | def synthesizer_jit_export(

FILE: infer/lib/jit/get_hubert.py
  function pad_to_multiple (line 14) | def pad_to_multiple(x, multiple, dim=-1, value=0):
  function extract_features (line 28) | def extract_features(
  function compute_mask_indices (line 95) | def compute_mask_indices(
  function apply_mask (line 227) | def apply_mask(self, x, padding_mask, target_list):
  function get_hubert_model (line 266) | def get_hubert_model(

FILE: infer/lib/jit/get_rmvpe.py
  function get_rmvpe (line 4) | def get_rmvpe(model_path="assets/rmvpe/rmvpe.pt", device=torch.device("c...

FILE: infer/lib/jit/get_synthesizer.py
  function get_synthesizer (line 4) | def get_synthesizer(pth_path, device=torch.device("cpu")):

FILE: infer/lib/rmvpe.py
  class STFT (line 29) | class STFT(torch.nn.Module):
    method __init__ (line 30) | def __init__(
    method transform (line 78) | def transform(self, input_data, return_phase=False):
    method inverse (line 109) | def inverse(self, magnitude, phase):
    method forward (line 144) | def forward(self, input_data):
  class BiGRU (line 162) | class BiGRU(nn.Module):
    method __init__ (line 163) | def __init__(self, input_features, hidden_features, num_layers):
    method forward (line 173) | def forward(self, x):
  class ConvBlockRes (line 177) | class ConvBlockRes(nn.Module):
    method __init__ (line 178) | def __init__(self, in_channels, out_channels, momentum=0.01):
    method forward (line 206) | def forward(self, x: torch.Tensor):
  class Encoder (line 213) | class Encoder(nn.Module):
    method __init__ (line 214) | def __init__(
    method forward (line 242) | def forward(self, x: torch.Tensor):
  class ResEncoderBlock (line 251) | class ResEncoderBlock(nn.Module):
    method __init__ (line 252) | def __init__(
    method forward (line 265) | def forward(self, x):
  class Intermediate (line 274) | class Intermediate(nn.Module):  #
    method __init__ (line 275) | def __init__(self, in_channels, out_channels, n_inters, n_blocks, mome...
    method forward (line 287) | def forward(self, x):
  class ResDecoderBlock (line 293) | class ResDecoderBlock(nn.Module):
    method __init__ (line 294) | def __init__(self, in_channels, out_channels, stride, n_blocks=1, mome...
    method forward (line 316) | def forward(self, x, concat_tensor):
  class Decoder (line 324) | class Decoder(nn.Module):
    method __init__ (line 325) | def __init__(self, in_channels, n_decoders, stride, n_blocks, momentum...
    method forward (line 336) | def forward(self, x: torch.Tensor, concat_tensors: List[torch.Tensor]):
  class DeepUnet (line 342) | class DeepUnet(nn.Module):
    method __init__ (line 343) | def __init__(
    method forward (line 366) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class E2E (line 373) | class E2E(nn.Module):
    method __init__ (line 374) | def __init__(
    method forward (line 406) | def forward(self, mel):
  class MelSpectrogram (line 418) | class MelSpectrogram(torch.nn.Module):
    method __init__ (line 419) | def __init__(
    method forward (line 452) | def forward(self, audio, keyshift=0, speed=1, center=True):
  class RMVPE (line 495) | class RMVPE:
    method __init__ (line 496) | def __init__(self, model_path: str, is_half, device=None, use_jit=False):
    method mel2hidden (line 569) | def mel2hidden(self, mel):
    method decode (line 587) | def decode(self, hidden, thred=0.03):
    method infer_from_audio (line 594) | def infer_from_audio(self, audio, thred=0.03):
    method to_local_average_cents (line 622) | def to_local_average_cents(self, salience, thred=0.05):

FILE: infer/lib/rtrvc.py
  function printt (line 31) | def printt(strr, *args):
  class RVC (line 40) | class RVC:
    method __init__ (line 41) | def __init__(
    method change_key (line 192) | def change_key(self, new_key):
    method change_formant (line 195) | def change_formant(self, new_formant):
    method change_index_rate (line 198) | def change_index_rate(self, new_index_rate):
    method get_f0_post (line 205) | def get_f0_post(self, f0):
    method get_f0 (line 218) | def get_f0(self, x, f0_up_key, n_cpu, method="harvest"):
    method get_f0_crepe (line 289) | def get_f0_crepe(self, x, f0_up_key):
    method get_f0_rmvpe (line 313) | def get_f0_rmvpe(self, x, f0_up_key):
    method get_f0_fcpe (line 328) | def get_f0_fcpe(self, x, f0_up_key):
    method infer (line 347) | def infer(

FILE: infer/lib/slicer2.py
  function get_rms (line 5) | def get_rms(
  class Slicer (line 38) | class Slicer:
    method __init__ (line 39) | def __init__(
    method _apply_slice (line 64) | def _apply_slice(self, waveform, begin, end):
    method slice (line 75) | def slice(self, waveform):
  function main (line 182) | def main():

FILE: infer/lib/train/data_utils.py
  class TextAudioLoaderMultiNSFsid (line 15) | class TextAudioLoaderMultiNSFsid(torch.utils.data.Dataset):
    method __init__ (line 22) | def __init__(self, audiopaths_and_text, hparams):
    method _filter (line 34) | def _filter(self):
    method get_sid (line 50) | def get_sid(self, sid):
    method get_audio_text_pair (line 54) | def get_audio_text_pair(self, audiopath_and_text):
    method get_labels (line 83) | def get_labels(self, phone, pitch, pitchf):
    method get_audio (line 98) | def get_audio(self, filename):
    method __getitem__ (line 140) | def __getitem__(self, index):
    method __len__ (line 143) | def __len__(self):
  class TextAudioCollateMultiNSFsid (line 147) | class TextAudioCollateMultiNSFsid:
    method __init__ (line 150) | def __init__(self, return_ids=False):
    method __call__ (line 153) | def __call__(self, batch):
  class TextAudioLoader (line 223) | class TextAudioLoader(torch.utils.data.Dataset):
    method __init__ (line 230) | def __init__(self, audiopaths_and_text, hparams):
    method _filter (line 242) | def _filter(self):
    method get_sid (line 258) | def get_sid(self, sid):
    method get_audio_text_pair (line 262) | def get_audio_text_pair(self, audiopath_and_text):
    method get_labels (line 282) | def get_labels(self, phone):
    method get_audio (line 290) | def get_audio(self, filename):
    method __getitem__ (line 332) | def __getitem__(self, index):
    method __len__ (line 335) | def __len__(self):
  class TextAudioCollate (line 339) | class TextAudioCollate:
    method __init__ (line 342) | def __init__(self, return_ids=False):
    method __call__ (line 345) | def __call__(self, batch):
  class DistributedBucketSampler (line 401) | class DistributedBucketSampler(torch.utils.data.distributed.DistributedS...
    method __init__ (line 411) | def __init__(
    method _create_buckets (line 429) | def _create_buckets(self):
    method __iter__ (line 452) | def __iter__(self):
    method _bisect (line 501) | def _bisect(self, x, lo=0, hi=None):
    method __len__ (line 516) | def __len__(self):

FILE: infer/lib/train/losses.py
  function feature_loss (line 4) | def feature_loss(fmap_r, fmap_g):
  function discriminator_loss (line 15) | def discriminator_loss(disc_real_outputs, disc_generated_outputs):
  function generator_loss (line 31) | def generator_loss(disc_outputs):
  function kl_loss (line 43) | def kl_loss(z_p, logs_q, m_p, logs_p, z_mask):

FILE: infer/lib/train/mel_processing.py
  function dynamic_range_compression_torch (line 11) | def dynamic_range_compression_torch(x, C=1, clip_val=1e-5):
  function dynamic_range_decompression_torch (line 20) | def dynamic_range_decompression_torch(x, C=1):
  function spectral_normalize_torch (line 29) | def spectral_normalize_torch(magnitudes):
  function spectral_de_normalize_torch (line 33) | def spectral_de_normalize_torch(magnitudes):
  function spectrogram_torch (line 42) | def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, cente...
  function spec_to_mel_torch (line 92) | def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax):
  function mel_spectrogram_torch (line 111) | def mel_spectrogram_torch(

FILE: infer/lib/train/process_ckpt.py
  function savee (line 13) | def savee(ckpt, sr, if_f0, name, epoch, version, hps):
  function show_info (line 51) | def show_info(path):
  function extract_small_model (line 64) | def extract_small_model(path, name, sr, if_f0, info, version):
  function change_info (line 194) | def change_info(path, info, name):
  function merge (line 206) | def merge(path1, path2, alpha1, sr, f0, info, name, version):

FILE: infer/lib/train/utils.py
  function load_checkpoint_d (line 20) | def load_checkpoint_d(checkpoint_path, combd, sbd, optimizer=None, load_...
  function load_checkpoint (line 100) | def load_checkpoint(checkpoint_path, model, optimizer=None, load_opt=1):
  function save_checkpoint (line 144) | def save_checkpoint(model, optimizer, learning_rate, iteration, checkpoi...
  function save_checkpoint_d (line 165) | def save_checkpoint_d(combd, sbd, optimizer, learning_rate, iteration, c...
  function summarize (line 191) | def summarize(
  function latest_checkpoint_path (line 210) | def latest_checkpoint_path(dir_path, regex="G_*.pth"):
  function plot_spectrogram_to_numpy (line 218) | def plot_spectrogram_to_numpy(spectrogram):
  function plot_alignment_to_numpy (line 244) | def plot_alignment_to_numpy(alignment, info=None):
  function load_wav_to_torch (line 275) | def load_wav_to_torch(full_path):
  function load_filepaths_and_text (line 280) | def load_filepaths_and_text(filename, split="|"):
  function get_hparams (line 291) | def get_hparams(init=True):
  function get_hparams_from_dir (line 394) | def get_hparams_from_dir(model_dir):
  function get_hparams_from_file (line 405) | def get_hparams_from_file(config_path):
  function check_git_hash (line 414) | def check_git_hash(model_dir):
  function get_logger (line 439) | def get_logger(model_dir, filename="train.log"):
  class HParams (line 454) | class HParams:
    method __init__ (line 455) | def __init__(self, **kwargs):
    method keys (line 461) | def keys(self):
    method items (line 464) | def items(self):
    method values (line 467) | def values(self):
    method __len__ (line 470) | def __len__(self):
    method __getitem__ (line 473) | def __getitem__(self, key):
    method __setitem__ (line 476) | def __setitem__(self, key, value):
    method __contains__ (line 479) | def __contains__(self, key):
    method __repr__ (line 482) | def __repr__(self):

FILE: infer/lib/uvr5_pack/lib_v5/dataset.py
  class VocalRemoverValidationSet (line 12) | class VocalRemoverValidationSet(torch.utils.data.Dataset):
    method __init__ (line 13) | def __init__(self, patch_list):
    method __len__ (line 16) | def __len__(self):
    method __getitem__ (line 19) | def __getitem__(self, idx):
  function make_pair (line 31) | def make_pair(mix_dir, inst_dir):
  function train_val_split (line 54) | def train_val_split(dataset_dir, split_mode, val_rate, val_filelist):
  function augment (line 90) | def augment(X, y, reduction_rate, reduction_mask, mixup_rate, mixup_alpha):
  function make_padding (line 118) | def make_padding(width, cropsize, offset):
  function make_training_set (line 128) | def make_training_set(filelist, cropsize, patches, sr, hop_length, n_fft...
  function make_validation_set (line 153) | def make_validation_set(filelist, cropsize, sr, hop_length, n_fft, offset):

FILE: infer/lib/uvr5_pack/lib_v5/layers.py
  class Conv2DBNActiv (line 8) | class Conv2DBNActiv(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 25) | def __call__(self, x):
  class SeperableConv2DBNActiv (line 29) | class SeperableConv2DBNActiv(nn.Module):
    method __init__ (line 30) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 48) | def __call__(self, x):
  class Encoder (line 52) | class Encoder(nn.Module):
    method __init__ (line 53) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.Leaky...
    method __call__ (line 58) | def __call__(self, x):
  class Decoder (line 65) | class Decoder(nn.Module):
    method __init__ (line 66) | def __init__(
    method __call__ (line 73) | def __call__(self, x, skip=None):
  class ASPPModule (line 86) | class ASPPModule(nn.Module):
    method __init__ (line 87) | def __init__(self, nin, nout, dilations=(4, 8, 16), activ=nn.ReLU):
    method forward (line 107) | def forward(self, x):

FILE: infer/lib/uvr5_pack/lib_v5/layers_123812KB .py
  class Conv2DBNActiv (line 8) | class Conv2DBNActiv(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 25) | def __call__(self, x):
  class SeperableConv2DBNActiv (line 29) | class SeperableConv2DBNActiv(nn.Module):
    method __init__ (line 30) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 48) | def __call__(self, x):
  class Encoder (line 52) | class Encoder(nn.Module):
    method __init__ (line 53) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.Leaky...
    method __call__ (line 58) | def __call__(self, x):
  class Decoder (line 65) | class Decoder(nn.Module):
    method __init__ (line 66) | def __init__(
    method __call__ (line 73) | def __call__(self, x, skip=None):
  class ASPPModule (line 86) | class ASPPModule(nn.Module):
    method __init__ (line 87) | def __init__(self, nin, nout, dilations=(4, 8, 16), activ=nn.ReLU):
    method forward (line 107) | def forward(self, x):

FILE: infer/lib/uvr5_pack/lib_v5/layers_123821KB.py
  class Conv2DBNActiv (line 8) | class Conv2DBNActiv(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 25) | def __call__(self, x):
  class SeperableConv2DBNActiv (line 29) | class SeperableConv2DBNActiv(nn.Module):
    method __init__ (line 30) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 48) | def __call__(self, x):
  class Encoder (line 52) | class Encoder(nn.Module):
    method __init__ (line 53) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.Leaky...
    method __call__ (line 58) | def __call__(self, x):
  class Decoder (line 65) | class Decoder(nn.Module):
    method __init__ (line 66) | def __init__(
    method __call__ (line 73) | def __call__(self, x, skip=None):
  class ASPPModule (line 86) | class ASPPModule(nn.Module):
    method __init__ (line 87) | def __init__(self, nin, nout, dilations=(4, 8, 16), activ=nn.ReLU):
    method forward (line 107) | def forward(self, x):

FILE: infer/lib/uvr5_pack/lib_v5/layers_33966KB.py
  class Conv2DBNActiv (line 8) | class Conv2DBNActiv(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 25) | def __call__(self, x):
  class SeperableConv2DBNActiv (line 29) | class SeperableConv2DBNActiv(nn.Module):
    method __init__ (line 30) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 48) | def __call__(self, x):
  class Encoder (line 52) | class Encoder(nn.Module):
    method __init__ (line 53) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.Leaky...
    method __call__ (line 58) | def __call__(self, x):
  class Decoder (line 65) | class Decoder(nn.Module):
    method __init__ (line 66) | def __init__(
    method __call__ (line 73) | def __call__(self, x, skip=None):
  class ASPPModule (line 86) | class ASPPModule(nn.Module):
    method __init__ (line 87) | def __init__(self, nin, nout, dilations=(4, 8, 16, 32, 64), activ=nn.R...
    method forward (line 113) | def forward(self, x):

FILE: infer/lib/uvr5_pack/lib_v5/layers_537227KB.py
  class Conv2DBNActiv (line 8) | class Conv2DBNActiv(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 25) | def __call__(self, x):
  class SeperableConv2DBNActiv (line 29) | class SeperableConv2DBNActiv(nn.Module):
    method __init__ (line 30) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 48) | def __call__(self, x):
  class Encoder (line 52) | class Encoder(nn.Module):
    method __init__ (line 53) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.Leaky...
    method __call__ (line 58) | def __call__(self, x):
  class Decoder (line 65) | class Decoder(nn.Module):
    method __init__ (line 66) | def __init__(
    method __call__ (line 73) | def __call__(self, x, skip=None):
  class ASPPModule (line 86) | class ASPPModule(nn.Module):
    method __init__ (line 87) | def __init__(self, nin, nout, dilations=(4, 8, 16, 32, 64), activ=nn.R...
    method forward (line 113) | def forward(self, x):

FILE: infer/lib/uvr5_pack/lib_v5/layers_537238KB.py
  class Conv2DBNActiv (line 8) | class Conv2DBNActiv(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 25) | def __call__(self, x):
  class SeperableConv2DBNActiv (line 29) | class SeperableConv2DBNActiv(nn.Module):
    method __init__ (line 30) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 48) | def __call__(self, x):
  class Encoder (line 52) | class Encoder(nn.Module):
    method __init__ (line 53) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.Leaky...
    method __call__ (line 58) | def __call__(self, x):
  class Decoder (line 65) | class Decoder(nn.Module):
    method __init__ (line 66) | def __init__(
    method __call__ (line 73) | def __call__(self, x, skip=None):
  class ASPPModule (line 86) | class ASPPModule(nn.Module):
    method __init__ (line 87) | def __init__(self, nin, nout, dilations=(4, 8, 16, 32, 64), activ=nn.R...
    method forward (line 113) | def forward(self, x):

FILE: infer/lib/uvr5_pack/lib_v5/layers_new.py
  class Conv2DBNActiv (line 8) | class Conv2DBNActiv(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, dilation=1, ac...
    method __call__ (line 25) | def __call__(self, x):
  class Encoder (line 29) | class Encoder(nn.Module):
    method __init__ (line 30) | def __init__(self, nin, nout, ksize=3, stride=1, pad=1, activ=nn.Leaky...
    method __call__ (line 35) | def __call__(self, x):
  class Decoder (line 42) | class Decoder(nn.Module):
    method __init__ (line 43) | def __init__(
    method __call__ (line 51) | def __call__(self, x, skip=None):
  class ASPPModule (line 67) | class ASPPModule(nn.Module):
    method __init__ (line 68) | def __init__(self, nin, nout, dilations=(4, 8, 12), activ=nn.ReLU, dro...
    method forward (line 87) | def forward(self, x):
  class LSTMModule (line 105) | class LSTMModule(nn.Module):
    method __init__ (line 106) | def __init__(self, nin_conv, nin_lstm, nout_lstm):
    method forward (line 116) | def forward(self, x):

FILE: infer/lib/uvr5_pack/lib_v5/model_param_init.py
  function int_keys (line 36) | def int_keys(d):
  class ModelParameters (line 45) | class ModelParameters(object):
    method __init__ (line 46) | def __init__(self, config_path=""):

FILE: infer/lib/uvr5_pack/lib_v5/nets.py
  class BaseASPPNet (line 9) | class BaseASPPNet(nn.Module):
    method __init__ (line 10) | def __init__(self, nin, ch, dilations=(4, 8, 16)):
    method __call__ (line 24) | def __call__(self, x):
  class CascadedASPPNet (line 40) | class CascadedASPPNet(nn.Module):
    method __init__ (line 41) | def __init__(self, n_fft):
    method forward (line 61) | def forward(self, x, aggressiveness=None):
    method predict (line 116) | def predict(self, x_mag, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/nets_123812KB.py
  class BaseASPPNet (line 8) | class BaseASPPNet(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, ch, dilations=(4, 8, 16)):
    method __call__ (line 23) | def __call__(self, x):
  class CascadedASPPNet (line 39) | class CascadedASPPNet(nn.Module):
    method __init__ (line 40) | def __init__(self, n_fft):
    method forward (line 60) | def forward(self, x, aggressiveness=None):
    method predict (line 115) | def predict(self, x_mag, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/nets_123821KB.py
  class BaseASPPNet (line 8) | class BaseASPPNet(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, ch, dilations=(4, 8, 16)):
    method __call__ (line 23) | def __call__(self, x):
  class CascadedASPPNet (line 39) | class CascadedASPPNet(nn.Module):
    method __init__ (line 40) | def __init__(self, n_fft):
    method forward (line 60) | def forward(self, x, aggressiveness=None):
    method predict (line 115) | def predict(self, x_mag, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/nets_33966KB.py
  class BaseASPPNet (line 8) | class BaseASPPNet(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, ch, dilations=(4, 8, 16, 32)):
    method __call__ (line 23) | def __call__(self, x):
  class CascadedASPPNet (line 39) | class CascadedASPPNet(nn.Module):
    method __init__ (line 40) | def __init__(self, n_fft):
    method forward (line 60) | def forward(self, x, aggressiveness=None):
    method predict (line 115) | def predict(self, x_mag, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/nets_537227KB.py
  class BaseASPPNet (line 9) | class BaseASPPNet(nn.Module):
    method __init__ (line 10) | def __init__(self, nin, ch, dilations=(4, 8, 16)):
    method __call__ (line 24) | def __call__(self, x):
  class CascadedASPPNet (line 40) | class CascadedASPPNet(nn.Module):
    method __init__ (line 41) | def __init__(self, n_fft):
    method forward (line 61) | def forward(self, x, aggressiveness=None):
    method predict (line 116) | def predict(self, x_mag, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/nets_537238KB.py
  class BaseASPPNet (line 9) | class BaseASPPNet(nn.Module):
    method __init__ (line 10) | def __init__(self, nin, ch, dilations=(4, 8, 16)):
    method __call__ (line 24) | def __call__(self, x):
  class CascadedASPPNet (line 40) | class CascadedASPPNet(nn.Module):
    method __init__ (line 41) | def __init__(self, n_fft):
    method forward (line 61) | def forward(self, x, aggressiveness=None):
    method predict (line 116) | def predict(self, x_mag, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/nets_61968KB.py
  class BaseASPPNet (line 8) | class BaseASPPNet(nn.Module):
    method __init__ (line 9) | def __init__(self, nin, ch, dilations=(4, 8, 16)):
    method __call__ (line 23) | def __call__(self, x):
  class CascadedASPPNet (line 39) | class CascadedASPPNet(nn.Module):
    method __init__ (line 40) | def __init__(self, n_fft):
    method forward (line 60) | def forward(self, x, aggressiveness=None):
    method predict (line 115) | def predict(self, x_mag, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/nets_new.py
  class BaseNet (line 8) | class BaseNet(nn.Module):
    method __init__ (line 9) | def __init__(
    method __call__ (line 27) | def __call__(self, x):
  class CascadedNet (line 45) | class CascadedNet(nn.Module):
    method __init__ (line 46) | def __init__(self, n_fft, nout=32, nout_lstm=128):
    method forward (line 78) | def forward(self, x):
    method predict_mask (line 116) | def predict_mask(self, x):
    method predict (line 125) | def predict(self, x, aggressiveness=None):

FILE: infer/lib/uvr5_pack/lib_v5/spec_utils.py
  function crop_center (line 12) | def crop_center(h1, h2):
  function wave_to_spectrogram (line 30) | def wave_to_spectrogram(
  function wave_to_spectrogram_mt (line 54) | def wave_to_spectrogram_mt(
  function combine_spectrograms (line 89) | def combine_spectrograms(specs, mp):
  function spectrogram_to_image (line 127) | def spectrogram_to_image(spec, mode="magnitude"):
  function reduce_vocal_aggressively (line 151) | def reduce_vocal_aggressively(X, y, softmask):
  function mask_silence (line 162) | def mask_silence(mag, ref, thres=0.2, min_range=64, fade_size=32):
  function align_wave_head_and_tail (line 200) | def align_wave_head_and_tail(a, b):
  function cache_or_load (line 206) | def cache_or_load(mix_path, inst_path, mp):
  function spectrogram_to_wave (line 295) | def spectrogram_to_wave(spec, hop_length, mid_side, mid_side_b2, reverse):
  function spectrogram_to_wave_mt (line 319) | def spectrogram_to_wave_mt(spec, hop_length, mid_side, reverse, mid_side...
  function cmb_spectrogram_to_wave (line 353) | def cmb_spectrogram_to_wave(spec_m, mp, extra_bins_h=None, extra_bins=No...
  function fft_lp_filter (line 431) | def fft_lp_filter(spec, bin_start, bin_stop):
  function fft_hp_filter (line 442) | def fft_hp_filter(spec, bin_start, bin_stop):
  function mirroring (line 453) | def mirroring(a, spec_m, input_high_end, mp):
  function ensembling (line 493) | def ensembling(a, specs):
  function stft (line 510) | def stft(wave, nfft, hl):
  function istft (line 520) | def istft(spec, hl):

FILE: infer/lib/uvr5_pack/utils.py
  function load_data (line 8) | def load_data(file_name: str = "./infer/lib/uvr5_pack/name_params.json")...
  function make_padding (line 15) | def make_padding(width, cropsize, offset):
  function inference (line 25) | def inference(X_spec, device, model, aggressiveness, data):
  function _get_name_params (line 102) | def _get_name_params(model_path, model_hash):

FILE: infer/modules/ipex/__init__.py
  function ipex_init (line 12) | def ipex_init():  # pylint: disable=too-many-statements

FILE: infer/modules/ipex/attention.py
  function torch_bmm (line 9) | def torch_bmm(input, mat2, *, out=None):
  function scaled_dot_product_attention (line 84) | def scaled_dot_product_attention(
  function attention_init (line 215) | def attention_init():

FILE: infer/modules/ipex/gradscaler.py
  function _unscale_grads_ (line 15) | def _unscale_grads_(
  function unscale_ (line 66) | def unscale_(self, optimizer):
  function update (line 116) | def update(self, new_scale=None):
  function gradscaler_init (line 182) | def gradscaler_init():

FILE: infer/modules/ipex/hijacks.py
  class CondFunc (line 9) | class CondFunc:  # pylint: disable=missing-class-docstring
    method __new__ (line 10) | def __new__(cls, orig_func, sub_func, cond_func):
    method __init__ (line 31) | def __init__(self, orig_func, sub_func, cond_func):
    method __call__ (line 36) | def __call__(self, *args, **kwargs):
  function _shutdown_workers (line 46) | def _shutdown_workers(self):
  class DummyDataParallel (line 80) | class DummyDataParallel(
    method __new__ (line 83) | def __new__(
  function return_null_context (line 91) | def return_null_context(*args, **kwargs):  # pylint: disable=unused-argu...
  function check_device (line 95) | def check_device(device):
  function return_xpu (line 103) | def return_xpu(device):
  function ipex_no_cuda (line 115) | def ipex_no_cuda(orig_func, *args, **kwargs):
  function ipex_autocast (line 124) | def ipex_autocast(*args, **kwargs):
  function torch_cat (line 134) | def torch_cat(tensor, *args, **kwargs):
  function interpolate (line 150) | def interpolate(
  function linalg_solve (line 186) | def linalg_solve(A, B, *args, **kwargs):  # pylint: disable=invalid-name
  function ipex_hijacks (line 196) | def ipex_hijacks():

FILE: infer/modules/onnx/export.py
  function export_onnx (line 6) | def export_onnx(ModelPath, ExportedPath):

FILE: infer/modules/train/extract/extract_f0_print.py
  function printt (line 23) | def printt(strr):
  class FeatureInput (line 33) | class FeatureInput(object):
    method __init__ (line 34) | def __init__(self, samplerate=16000, hop_size=160):
    method compute_f0 (line 44) | def compute_f0(self, path, f0_method):
    method coarse_f0 (line 95) | def coarse_f0(self, f0):
    method go (line 111) | def go(self, paths, f0_method):

FILE: infer/modules/train/extract/extract_f0_rmvpe.py
  function printt (line 27) | def printt(strr):
  class FeatureInput (line 33) | class FeatureInput(object):
    method __init__ (line 34) | def __init__(self, samplerate=16000, hop_size=160):
    method compute_f0 (line 44) | def compute_f0(self, path, f0_method):
    method coarse_f0 (line 58) | def coarse_f0(self, f0):
    method go (line 74) | def go(self, paths, f0_method):

FILE: infer/modules/train/extract/extract_f0_rmvpe_dml.py
  function printt (line 25) | def printt(strr):
  class FeatureInput (line 31) | class FeatureInput(object):
    method __init__ (line 32) | def __init__(self, samplerate=16000, hop_size=160):
    method compute_f0 (line 42) | def compute_f0(self, path, f0_method):
    method coarse_f0 (line 56) | def coarse_f0(self, f0):
    method go (line 72) | def go(self, paths, f0_method):

FILE: infer/modules/train/extract_feature_print.py
  function forward_dml (line 38) | def forward_dml(ctx, x, scale):
  function printt (line 48) | def printt(strr):
  function readwave (line 66) | def readwave(wav_path, normalize=False):

FILE: infer/modules/train/preprocess.py
  function println (line 29) | def println(strr):
  class PreProcess (line 35) | class PreProcess:
    method __init__ (line 36) | def __init__(self, sr, exp_dir, per=3.7):
    method norm_write (line 59) | def norm_write(self, tmp_audio, idx0, idx1):
    method pipeline (line 81) | def pipeline(self, path, idx0):
    method pipeline_mp (line 107) | def pipeline_mp(self, infos):
    method pipeline_mp_inp_dir (line 111) | def pipeline_mp_inp_dir(self, inp_root, n_p):
  function preprocess_trainset (line 134) | def preprocess_trainset(inp_root, sr, n_p, exp_dir, per):

FILE: infer/modules/train/train.py
  class EpochRecorder (line 82) | class EpochRecorder:
    method __init__ (line 83) | def __init__(self):
    method record (line 86) | def record(self):
  function main (line 95) | def main():
  function run (line 120) | def run(rank, n_gpus, hps, logger: logging.Logger):
  function train_and_evaluate (line 299) | def train_and_evaluate(

FILE: infer/modules/uvr5/mdxnet.py
  class ConvTDFNetTrim (line 15) | class ConvTDFNetTrim:
    method __init__ (line 16) | def __init__(
    method stft (line 41) | def stft(self, x):
    method istft (line 58) | def istft(self, x, freq_pad=None):
  function get_models (line 78) | def get_models(device, dim_f, dim_t, n_fft):
  class Predictor (line 90) | class Predictor:
    method __init__ (line 91) | def __init__(self, args):
    method demix (line 109) | def demix(self, mix):
    method demix_base (line 143) | def demix_base(self, mixes, margin_size):
    method prediction (line 199) | def prediction(self, m, vocal_root, others_root, format):
  class MDXNetDereverb (line 241) | class MDXNetDereverb:
    method __init__ (line 242) | def __init__(self, chunks, device):
    method _path_audio_ (line 255) | def _path_audio_(self, input, vocal_root, others_root, format, is_hp3=...

FILE: infer/modules/uvr5/modules.py
  function uvr (line 17) | def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg...

FILE: infer/modules/uvr5/vr.py
  class AudioPre (line 18) | class AudioPre:
    method __init__ (line 19) | def __init__(self, agg, model_path, device, is_half, tta=False):
    method _path_audio_ (line 44) | def _path_audio_(
  class AudioPreDeEcho (line 198) | class AudioPreDeEcho:
    method __init__ (line 199) | def __init__(self, agg, model_path, device, is_half, tta=False):
    method _path_audio_ (line 225) | def _path_audio_(

FILE: infer/modules/vc/modules.py
  class VC (line 22) | class VC:
    method __init__ (line 23) | def __init__(self, config):
    method get_vc (line 36) | def get_vc(self, sid, *to_return_protect):
    method vc_single (line 146) | def vc_single(
    method vc_multi (line 227) | def vc_multi(

FILE: infer/modules/vc/pipeline.py
  function cache_harvest_f0 (line 30) | def cache_harvest_f0(input_audio_path, fs, f0max, f0min, frame_period):
  function change_rms (line 43) | def change_rms(data1, sr1, data2, sr2, rate):  # 1是输入音频,2是输出音频,rate是2的占比
  class Pipeline (line 65) | class Pipeline(object):
    method __init__ (line 66) | def __init__(self, tgt_sr, config):
    method get_f0 (line 84) | def get_f0(
    method vc (line 186) | def vc(
    method pipeline (line 281) | def pipeline(

FILE: infer/modules/vc/utils.py
  function get_index_path_from_model (line 6) | def get_index_path_from_model(sid):
  function load_hubert (line 22) | def load_hubert(config):

FILE: tools/calc_rvc_model_similarity.py
  function cal_cross_attn (line 13) | def cal_cross_attn(to_q, to_k, to_v, rand_input):
  function model_hash (line 32) | def model_hash(filename):
  function eval (line 46) | def eval(model, n, input):
  function main (line 56) | def main(path, root):

FILE: tools/download_models.py
  function dl_model (line 10) | def dl_model(link, model_name, dir_name):

FILE: tools/infer/infer-pm-index256.py
  function get_f0 (line 88) | def get_f0(x, p_len, f0_up_key=0):

FILE: tools/infer_batch_rvc.py
  function arg_parse (line 19) | def arg_parse() -> tuple:
  function main (line 41) | def main():

FILE: tools/infer_cli.py
  function arg_parse (line 19) | def arg_parse() -> tuple:
  function main (line 41) | def main():

FILE: tools/rvc_for_realtime.py
  function printt (line 38) | def printt(strr, *args):
  class RVC (line 47) | class RVC:
    method __init__ (line 48) | def __init__(
    method change_key (line 195) | def change_key(self, new_key):
    method change_index_rate (line 198) | def change_index_rate(self, new_index_rate):
    method get_f0_post (line 205) | def get_f0_post(self, f0):
    method get_f0 (line 218) | def get_f0(self, x, f0_up_key, n_cpu, method="harvest"):
    method get_f0_crepe (line 289) | def get_f0_crepe(self, x, f0_up_key):
    method get_f0_rmvpe (line 313) | def get_f0_rmvpe(self, x, f0_up_key):
    method get_f0_fcpe (line 328) | def get_f0_fcpe(self, x, f0_up_key):
    method infer (line 347) | def infer(

FILE: tools/torchgate/torchgate.py
  class TorchGate (line 8) | class TorchGate(torch.nn.Module):
    method __init__ (line 33) | def __init__(
    method _generate_mask_smoothing_filter (line 75) | def _generate_mask_smoothing_filter(self) -> Union[torch.Tensor, None]:
    method _stationary_mask (line 128) | def _stationary_mask(
    method _nonstationary_mask (line 178) | def _nonstationary_mask(self, X_abs: torch.Tensor) -> torch.Tensor:
    method forward (line 210) | def forward(

FILE: tools/torchgate/utils.py
  function amp_to_db (line 6) | def amp_to_db(
  function temperature_sigmoid (line 29) | def temperature_sigmoid(x: torch.Tensor, x0: float, temp_coeff: float) -...
  function linspace (line 45) | def linspace(
Condensed preview — 209 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,265K chars).
[
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 885,
    "preview": "# Pull request checklist\n\n- [ ] The PR has a proper title. Use [Semantic Commit Messages](https://seesparkbox.com/foundr"
  },
  {
    "path": ".github/workflows/docker.yml",
    "chars": 2121,
    "preview": "name: Build and Push Docker Image\n\non:\n  workflow_dispatch:\n  push:\n    # Sequence of patterns matched against refs/tags"
  },
  {
    "path": ".github/workflows/genlocale.yml",
    "chars": 1160,
    "preview": "name: Generate and Sync Locale\non:\n  push:\n    branches:\n      - main\n      - dev\njobs:\n  genlocale:\n    runs-on: ubuntu"
  },
  {
    "path": ".github/workflows/pull_format.yml",
    "chars": 1305,
    "preview": "name: Check Pull Format\n\non:\n  pull_request_target:\n    types: [opened, reopened]\n\njobs:\n  # This workflow closes invali"
  },
  {
    "path": ".github/workflows/push_format.yml",
    "chars": 1428,
    "preview": "name: Standardize Code Format\n\non:\n  push:\n    branches:\n      - main\n      - dev\n\njobs:\n  push_format:\n    runs-on: ubu"
  },
  {
    "path": ".github/workflows/sync_dev.yml",
    "chars": 464,
    "preview": "name: Merge dev into main\n\non:\n  workflow_dispatch:\n\njobs:\n  sync_dev:\n    runs-on: ubuntu-latest\n\n    permissions:\n    "
  },
  {
    "path": ".github/workflows/unitest.yml",
    "chars": 1396,
    "preview": "name: Unit Test\non: [ push, pull_request ]\njobs:\n  build:\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix:\n    "
  },
  {
    "path": ".gitignore",
    "chars": 349,
    "preview": ".DS_Store\n__pycache__\n/TEMP\n*.pyd\n.venv\n/opt\ntools/aria2c/\ntools/flag.txt\n\n# Imported from huggingface.co/lj1995/VoiceCo"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 572,
    "preview": "# 贡献规则\n1. 一般来说,作者`@RVC-Boss`将拒绝所有的算法更改,除非它是为了修复某个代码层面的错误或警告\n2. 您可以贡献本仓库的其他位置,如翻译和WebUI,但请尽量作最小更改\n3. 所有更改都需要由`@RVC-Boss`批"
  },
  {
    "path": "Dockerfile",
    "chars": 2596,
    "preview": "# syntax=docker/dockerfile:1\n\nFROM nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04\n\nEXPOSE 7865\n\nWORKDIR /app\n\nCOPY . .\n\n#"
  },
  {
    "path": "LICENSE",
    "chars": 1136,
    "preview": "MIT License\r\n\r\nCopyright (c) 2023 liujing04\r\nCopyright (c) 2023 源文雨\r\nCopyright (c) 2023 Ftps\r\n\r\nPermission is hereby gra"
  },
  {
    "path": "MIT协议暨相关引用库协议",
    "chars": 1296,
    "preview": "本软件及其相关代码以MIT协议开源,作者不对软件具备任何控制力,使用软件者、传播软件导出的声音者自负全责。\n如不认可该条款,则不能使用或引用软件包内任何代码和文件。\n\n特此授予任何获得本软件和相关文档文件(以下简称“软件”)副本的人免费使用"
  },
  {
    "path": "README.md",
    "chars": 7010,
    "preview": "<div align=\"center\">\n\n<h1>Retrieval-based-Voice-Conversion-WebUI</h1>\n一个基于VITS的简单易用的变声框架<br><br>\n\n[![madewithlove](https"
  },
  {
    "path": "Retrieval_based_Voice_Conversion_WebUI.ipynb",
    "chars": 15075,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# [Retrieval-"
  },
  {
    "path": "Retrieval_based_Voice_Conversion_WebUI_v2.ipynb",
    "chars": 18065,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# [Retrieval-"
  },
  {
    "path": "api_231006.py",
    "chars": 19023,
    "preview": "#api for 231006 release version by Xiaokai\nimport os\nimport sys\nimport json\nimport re\nimport time\nimport librosa\nimport "
  },
  {
    "path": "api_240604.py",
    "chars": 22181,
    "preview": "#api for 240604 release version by Xiaokai\nimport os\nimport sys\nimport json\nimport re\nimport time\nimport librosa\nimport "
  },
  {
    "path": "assets/hubert/.gitignore",
    "chars": 32,
    "preview": "*\n!.gitignore\n!hubert_inputs.pth"
  },
  {
    "path": "assets/indices/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  },
  {
    "path": "assets/pretrained/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  },
  {
    "path": "assets/pretrained_v2/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  },
  {
    "path": "assets/rmvpe/.gitignore",
    "chars": 31,
    "preview": "*\n!.gitignore\n!rmvpe_inputs.pth"
  },
  {
    "path": "assets/uvr5_weights/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  },
  {
    "path": "assets/weights/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  },
  {
    "path": "configs/config.json",
    "chars": 484,
    "preview": "{\"pth_path\": \"assets/weights/kikiV1.pth\", \"index_path\": \"logs/kikiV1.index\", \"sg_hostapi\": \"MME\", \"sg_wasapi_exclusive\":"
  },
  {
    "path": "configs/config.py",
    "chars": 8020,
    "preview": "import argparse\nimport os\nimport sys\nimport json\nimport shutil\nfrom multiprocessing import cpu_count\n\nimport torch\n\ntry:"
  },
  {
    "path": "configs/inuse/.gitignore",
    "chars": 22,
    "preview": "*\n!.gitignore\n!v1\n!v2\n"
  },
  {
    "path": "configs/inuse/v1/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  },
  {
    "path": "configs/inuse/v2/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  },
  {
    "path": "configs/v1/32k.json",
    "chars": 1048,
    "preview": "{\n  \"train\": {\n    \"log_interval\": 200,\n    \"seed\": 1234,\n    \"epochs\": 20000,\n    \"learning_rate\": 1e-4,\n    \"betas\": ["
  },
  {
    "path": "configs/v1/40k.json",
    "chars": 1046,
    "preview": "{\n  \"train\": {\n    \"log_interval\": 200,\n    \"seed\": 1234,\n    \"epochs\": 20000,\n    \"learning_rate\": 1e-4,\n    \"betas\": ["
  },
  {
    "path": "configs/v1/48k.json",
    "chars": 1049,
    "preview": "{\n  \"train\": {\n    \"log_interval\": 200,\n    \"seed\": 1234,\n    \"epochs\": 20000,\n    \"learning_rate\": 1e-4,\n    \"betas\": ["
  },
  {
    "path": "configs/v2/32k.json",
    "chars": 1044,
    "preview": "{\n  \"train\": {\n    \"log_interval\": 200,\n    \"seed\": 1234,\n    \"epochs\": 20000,\n    \"learning_rate\": 1e-4,\n    \"betas\": ["
  },
  {
    "path": "configs/v2/48k.json",
    "chars": 1046,
    "preview": "{\n  \"train\": {\n    \"log_interval\": 200,\n    \"seed\": 1234,\n    \"epochs\": 20000,\n    \"learning_rate\": 1e-4,\n    \"betas\": ["
  },
  {
    "path": "docker-compose.yml",
    "chars": 482,
    "preview": "version: \"3.8\"\nservices:\n  rvc:\n    build:\n      context: .\n      dockerfile: Dockerfile\n    container_name: rvc\n    vol"
  },
  {
    "path": "docs/cn/Changelog_CN.md",
    "chars": 2803,
    "preview": "### 20231006更新\n\n我们制作了一个用于实时变声的界面go-realtime-gui.bat/gui_v1.py(事实上早就存在了),本次更新重点也优化了实时变声的性能。对比0813版:\n - 1、优优化界面操作:参数热更新(调整"
  },
  {
    "path": "docs/cn/faq.md",
    "chars": 3954,
    "preview": "## Q1:ffmpeg error/utf8 error.\n\n大概率不是ffmpeg问题,而是音频路径问题;<br>\nffmpeg读取路径带空格、()等特殊符号,可能出现ffmpeg error;训练集音频带中文路径,在写入filelis"
  },
  {
    "path": "docs/en/Changelog_EN.md",
    "chars": 6882,
    "preview": "### 2023-10-06\n- We have created a GUI for real-time voice change: go-realtime-gui.bat/gui_v1.py (Note that you should c"
  },
  {
    "path": "docs/en/README.en.md",
    "chars": 9145,
    "preview": "<div align=\"center\">\n\n<h1>Retrieval-based-Voice-Conversion-WebUI</h1>\nAn easy-to-use Voice Conversion framework based on"
  },
  {
    "path": "docs/en/faiss_tips_en.md",
    "chars": 5747,
    "preview": "faiss tuning TIPS\n==================\n# about faiss\nfaiss is a library of neighborhood searches for dense vectors, develo"
  },
  {
    "path": "docs/en/faq_en.md",
    "chars": 8403,
    "preview": "## Q1:ffmpeg error/utf8 error.\nIt is most likely not a FFmpeg issue, but rather an audio path issue;\n\nFFmpeg may encount"
  },
  {
    "path": "docs/en/training_tips_en.md",
    "chars": 4540,
    "preview": "Instructions and tips for RVC training\n======================================\nThis TIPS explains how data training is do"
  },
  {
    "path": "docs/fr/Changelog_FR.md",
    "chars": 8622,
    "preview": "### 2023-08-13\n1-Corrections régulières de bugs\n- Modification du nombre total d'époques minimum à 1 et changement du no"
  },
  {
    "path": "docs/fr/README.fr.md",
    "chars": 8972,
    "preview": "<div align=\"center\">\n\n<h1>Retrieval-based-Voice-Conversion-WebUI</h1>\nUn framework simple et facile à utiliser pour la c"
  },
  {
    "path": "docs/fr/faiss_tips_fr.md",
    "chars": 6545,
    "preview": "Conseils de réglage pour faiss\n==================\n# À propos de faiss\nfaiss est une bibliothèque de recherches de voisin"
  },
  {
    "path": "docs/fr/faq_fr.md",
    "chars": 13077,
    "preview": "## Q1: Erreur ffmpeg/erreur utf8.\nIl s'agit très probablement non pas d'un problème lié à FFmpeg, mais d'un problème lié"
  },
  {
    "path": "docs/fr/training_tips_fr.md",
    "chars": 5430,
    "preview": "Instructions et conseils pour la formation RVC\n======================================\nCes conseils expliquent comment se"
  },
  {
    "path": "docs/jp/Changelog_JA.md",
    "chars": 4235,
    "preview": "### 2023 年 10 月 6 日更新\n\nリアルタイム声変換のためのインターフェース go-realtime-gui.bat/gui_v1.py を作成しました(実際には既に存在していました)。今回のアップデートでは、リアルタイム声変換"
  },
  {
    "path": "docs/jp/README.ja.md",
    "chars": 7454,
    "preview": "<div align=\"center\">\n\n<h1>Retrieval-based-Voice-Conversion-WebUI</h1>\nVITSに基づく使いやすい音声変換(voice changer)framework<br><br>\n"
  },
  {
    "path": "docs/jp/faiss_tips_ja.md",
    "chars": 3030,
    "preview": "faiss tuning TIPS\n==================\n# about faiss\nfaissはfacebook researchの開発する、密なベクトルに対する近傍探索をまとめたライブラリで、多くの近似近傍探索の手法を効"
  },
  {
    "path": "docs/jp/faq_ja.md",
    "chars": 5410,
    "preview": "## Q1: ffmpeg error/utf8 error\n\n大体の場合、ffmpeg の問題ではなく、音声パスの問題です。<br>\nffmpeg は空白や()などの特殊文字を含むパスを読み込む際に ffmpeg error が発生する可"
  },
  {
    "path": "docs/jp/training_tips_ja.md",
    "chars": 2409,
    "preview": "RVCの訓練における説明、およびTIPS\n===============================\n本TIPSではどのようにデータの訓練が行われているかを説明します。\n\n# 訓練の流れ\nGUIの訓練タブのstepに沿って説明します。\n"
  },
  {
    "path": "docs/kr/Changelog_KO.md",
    "chars": 4338,
    "preview": "### 2023년 10월 6일 업데이트\n\n실시간 음성 변환을 위한 인터페이스인 go-realtime-gui.bat/gui_v1.py를 제작했습니다(사실 이는 이미 존재했었습니다). 이번 업데이트는 주로 실시간 음성 "
  },
  {
    "path": "docs/kr/README.ko.han.md",
    "chars": 3967,
    "preview": "<div align=\"center\">\n\n<h1>Retrieval-based-Voice-Conversion-WebUI</h1>\nVITS基盤의 簡單하고使用하기 쉬운音聲變換틀<br><br>\n\n[![madewithlove]"
  },
  {
    "path": "docs/kr/README.ko.md",
    "chars": 7339,
    "preview": "<div align=\"center\">\n\n<h1>Retrieval-based-Voice-Conversion-WebUI</h1>\nVITS 기반의 간단하고 사용하기 쉬운 음성 변환 프레임워크.<br><br>\n\n[![mad"
  },
  {
    "path": "docs/kr/faiss_tips_ko.md",
    "chars": 5539,
    "preview": "Facebook AI Similarity Search (Faiss) 팁\n==================\n# Faiss에 대하여\nFaiss 는 Facebook Research가 개발하는, 고밀도 벡터 이웃 검색 라이"
  },
  {
    "path": "docs/kr/faq_ko.md",
    "chars": 5452,
    "preview": "## Q1:ffmpeg 오류/utf8 오류\n\n대부분의 경우 ffmpeg 문제가 아니라 오디오 경로 문제입니다. <br>\nffmpeg가 공백, () 등의 특수 문자가 포함된 경로를 읽을 때 ffmpeg 오류가 발생할 "
  },
  {
    "path": "docs/kr/training_tips_ko.md",
    "chars": 2598,
    "preview": "RVC 훈련에 대한 설명과 팁들\n======================================\n본 팁에서는 어떻게 데이터 훈련이 이루어지고 있는지 설명합니다.\n\n# 훈련의 흐름\nGUI의 훈련 탭의 단계를 따라"
  },
  {
    "path": "docs/pt/Changelog_pt.md",
    "chars": 8275,
    "preview": "### 2023-10-06\n- Criamos uma GUI para alteração de voz em tempo real: go-realtime-gui.bat/gui_v1.py (observe que você de"
  },
  {
    "path": "docs/pt/README.pt.md",
    "chars": 8959,
    "preview": "<div align=\"center\">\n\n<h1>Retrieval-based-Voice-Conversion-WebUI</h1>\nUma estrutura de conversão de voz fácil de usar ba"
  },
  {
    "path": "docs/pt/faiss_tips_pt.md",
    "chars": 6112,
    "preview": "pONTAS de afinação FAISS\n==================\n# sobre faiss\nfaiss é uma biblioteca de pesquisas de vetores densos na área,"
  },
  {
    "path": "docs/pt/faq_pt.md",
    "chars": 15505,
    "preview": "# <b>FAQ AI HUB BRASIL</b>\n## <span style=\"color: #337dff;\">O que é epoch, quantos utilizar, quanto de dataset utilizar "
  },
  {
    "path": "docs/pt/training_tips_pt.md",
    "chars": 4936,
    "preview": "Instruções e dicas para treinamento RVC\n======================================\nEstas DICAS explicam como o treinamento d"
  },
  {
    "path": "docs/tr/Changelog_TR.md",
    "chars": 7158,
    "preview": "\n### 2023-08-13\n1- Düzenli hata düzeltmeleri\n- Minimum toplam epoch sayısını 1 olarak değiştirin ve minimum toplam epoch"
  },
  {
    "path": "docs/tr/README.tr.md",
    "chars": 7340,
    "preview": "\n<div align=\"center\">\n\n<h1>Çekme Temelli Ses Dönüşümü Web Arayüzü</h1>\nVITS'e dayalı kullanımı kolay bir Ses Dönüşümü çe"
  },
  {
    "path": "docs/tr/faiss_tips_tr.md",
    "chars": 5635,
    "preview": "\n# faiss Ayar İpuçları\n==================\n\n# faiss Hakkında\nfaiss, yoğun vektörler için komşuluk aramalarının bir kütüph"
  },
  {
    "path": "docs/tr/faq_tr.md",
    "chars": 7639,
    "preview": "## Q1: FFmpeg Hatası/UTF8 Hatası\nBüyük olasılıkla bu bir FFmpeg sorunu değil, daha çok ses dosyası yolunda bir sorun;\n\nF"
  },
  {
    "path": "docs/tr/training_tips_tr.md",
    "chars": 4712,
    "preview": "## RVC Eğitimi için Talimatlar ve İpuçları\n======================================\nBu TALİMAT, veri eğitiminin nasıl yapı"
  },
  {
    "path": "environment_dml.yaml",
    "chars": 5871,
    "preview": "name: pydml\nchannels:\n  - pytorch\n  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main\n  - https://mirrors.tuna.t"
  },
  {
    "path": "go-realtime-gui-dml.bat",
    "chars": 70,
    "preview": "runtime\\python.exe gui_v1.py --pycmd runtime\\python.exe --dml\r\npause\r\n"
  },
  {
    "path": "go-realtime-gui.bat",
    "chars": 37,
    "preview": "runtime\\python.exe gui_v1.py\r\npause\r\n"
  },
  {
    "path": "go-web-dml.bat",
    "chars": 83,
    "preview": "runtime\\python.exe infer-web.py --pycmd runtime\\python.exe --port 7897 --dml\npause\n"
  },
  {
    "path": "go-web.bat",
    "chars": 77,
    "preview": "runtime\\python.exe infer-web.py --pycmd runtime\\python.exe --port 7897\npause\n"
  },
  {
    "path": "gui_v1.py",
    "chars": 48185,
    "preview": "import os\r\nimport sys\r\nfrom dotenv import load_dotenv\r\nimport shutil\r\n\r\nload_dotenv()\r\n\r\nos.environ[\"OMP_NUM_THREADS\"] ="
  },
  {
    "path": "i18n/i18n.py",
    "chars": 790,
    "preview": "import json\nimport locale\nimport os\n\n\ndef load_language_list(language):\n    with open(f\"./i18n/locale/{language}.json\", "
  },
  {
    "path": "i18n/locale/en_US.json",
    "chars": 12366,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \"If >=3: apply median filtering to the harvested pitch results. Th"
  },
  {
    "path": "i18n/locale/es_ES.json",
    "chars": 13666,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \"Si es >=3, entonces use el resultado del reconocimiento de tono d"
  },
  {
    "path": "i18n/locale/fr_FR.json",
    "chars": 15173,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \"Si >=3 : appliquer un filtrage médian aux résultats de la reconna"
  },
  {
    "path": "i18n/locale/it_IT.json",
    "chars": 11004,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \"Se >=3: applica il filtro mediano ai risultati del pitch raccolto"
  },
  {
    "path": "i18n/locale/ja_JP.json",
    "chars": 8115,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \">=3 次に、harvestピッチの認識結果に対してメディアンフィルタを使用します。値はフィルター半径で、ミュートを減衰させるため"
  },
  {
    "path": "i18n/locale/ko_KR.json",
    "chars": 8196,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \">=3인 경우 harvest 피치 인식 결과에 중간값 필터 적용, 필터 반경은 값으로 지정, 사용 시 무성음 감소 가"
  },
  {
    "path": "i18n/locale/pt_BR.json",
    "chars": 13452,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \">=3, use o filtro mediano para o resultado do reconhecimento do t"
  },
  {
    "path": "i18n/locale/ru_RU.json",
    "chars": 12778,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \"Если значение больше 3: применить медианную фильтрацию к вытащенн"
  },
  {
    "path": "i18n/locale/tr_TR.json",
    "chars": 12459,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \"Eğer >=3 ise, elde edilen pitch sonuçlarına median filtreleme uyg"
  },
  {
    "path": "i18n/locale/zh_CN.json",
    "chars": 6815,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\",\n    \"A模型权重\": \"A模型权"
  },
  {
    "path": "i18n/locale/zh_HK.json",
    "chars": 6826,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音\",\n    \"A模型权重\": \"A模型權"
  },
  {
    "path": "i18n/locale/zh_SG.json",
    "chars": 6826,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音\",\n    \"A模型权重\": \"A模型權"
  },
  {
    "path": "i18n/locale/zh_TW.json",
    "chars": 6826,
    "preview": "{\n    \">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音\": \">=3則使用對harvest音高識別的結果使用中值濾波,數值為濾波半徑,使用可以削弱啞音\",\n    \"A模型权重\": \"A模型權"
  },
  {
    "path": "i18n/locale_diff.py",
    "chars": 1461,
    "preview": "import json\nimport os\nfrom collections import OrderedDict\n\n# Define the standard file name\nstandard_file = \"locale/zh_CN"
  },
  {
    "path": "i18n/scan_i18n.py",
    "chars": 1931,
    "preview": "import ast\nimport glob\nimport json\nfrom collections import OrderedDict\n\n\ndef extract_i18n_strings(node):\n    i18n_string"
  },
  {
    "path": "infer/lib/audio.py",
    "chars": 1842,
    "preview": "import platform, os\r\nimport ffmpeg\r\nimport numpy as np\r\nimport av\r\nfrom io import BytesIO\r\nimport traceback\r\nimport re\r\n"
  },
  {
    "path": "infer/lib/infer_pack/attentions.py",
    "chars": 16241,
    "preview": "import copy\r\nimport math\r\nfrom typing import Optional\r\n\r\nimport numpy as np\r\nimport torch\r\nfrom torch import nn\r\nfrom to"
  },
  {
    "path": "infer/lib/infer_pack/attentions_onnx.py",
    "chars": 16292,
    "preview": "############################## Warning! ##############################\r\n#                                               "
  },
  {
    "path": "infer/lib/infer_pack/commons.py",
    "chars": 5541,
    "preview": "from typing import List, Optional\r\nimport math\r\n\r\nimport numpy as np\r\nimport torch\r\nfrom torch import nn\r\nfrom torch.nn "
  },
  {
    "path": "infer/lib/infer_pack/models.py",
    "chars": 42608,
    "preview": "import math\nimport logging\nfrom typing import Optional\n\nlogger = logging.getLogger(__name__)\n\nimport numpy as np\nimport "
  },
  {
    "path": "infer/lib/infer_pack/models_onnx.py",
    "chars": 27622,
    "preview": "############################## Warning! ##############################\n#                                                "
  },
  {
    "path": "infer/lib/infer_pack/modules/F0Predictor/DioF0Predictor.py",
    "chars": 3233,
    "preview": "import numpy as np\r\nimport pyworld\r\n\r\nfrom infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor\r\n\r\n\r\n"
  },
  {
    "path": "infer/lib/infer_pack/modules/F0Predictor/F0Predictor.py",
    "chars": 442,
    "preview": "class F0Predictor(object):\r\n    def compute_f0(self, wav, p_len):\r\n        \"\"\"\r\n        input: wav:[signal_length]\r\n    "
  },
  {
    "path": "infer/lib/infer_pack/modules/F0Predictor/HarvestF0Predictor.py",
    "chars": 3064,
    "preview": "import numpy as np\r\nimport pyworld\r\n\r\nfrom infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor\r\n\r\n\r\n"
  },
  {
    "path": "infer/lib/infer_pack/modules/F0Predictor/PMF0Predictor.py",
    "chars": 3472,
    "preview": "import numpy as np\r\nimport parselmouth\r\n\r\nfrom infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor\r\n"
  },
  {
    "path": "infer/lib/infer_pack/modules/F0Predictor/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "infer/lib/infer_pack/modules.py",
    "chars": 20917,
    "preview": "import copy\r\nimport math\r\nfrom typing import Optional, Tuple\r\n\r\nimport numpy as np\r\nimport scipy\r\nimport torch\r\nfrom tor"
  },
  {
    "path": "infer/lib/infer_pack/onnx_inference.py",
    "chars": 5382,
    "preview": "import librosa\r\nimport numpy as np\r\nimport onnxruntime\r\nimport soundfile\r\n\r\nimport logging\r\n\r\nlogger = logging.getLogger"
  },
  {
    "path": "infer/lib/infer_pack/transforms.py",
    "chars": 7458,
    "preview": "import numpy as np\r\nimport torch\r\nfrom torch.nn import functional as F\r\n\r\nDEFAULT_MIN_BIN_WIDTH = 1e-3\r\nDEFAULT_MIN_BIN_"
  },
  {
    "path": "infer/lib/jit/__init__.py",
    "chars": 4861,
    "preview": "from io import BytesIO\nimport pickle\nimport time\nimport torch\nfrom tqdm import tqdm\nfrom collections import OrderedDict\n"
  },
  {
    "path": "infer/lib/jit/get_hubert.py",
    "chars": 11680,
    "preview": "import math\nimport random\nfrom typing import Optional, Tuple\nfrom fairseq.checkpoint_utils import load_model_ensemble_an"
  },
  {
    "path": "infer/lib/jit/get_rmvpe.py",
    "chars": 311,
    "preview": "import torch\n\n\ndef get_rmvpe(model_path=\"assets/rmvpe/rmvpe.pt\", device=torch.device(\"cpu\")):\n    from infer.lib.rmvpe i"
  },
  {
    "path": "infer/lib/jit/get_synthesizer.py",
    "chars": 1291,
    "preview": "import torch\n\n\ndef get_synthesizer(pth_path, device=torch.device(\"cpu\")):\n    from infer.lib.infer_pack.models import (\n"
  },
  {
    "path": "infer/lib/rmvpe.py",
    "chars": 24701,
    "preview": "from io import BytesIO\r\nimport os\r\nfrom typing import List, Optional, Tuple\r\nimport numpy as np\r\nimport torch\r\n\r\nfrom in"
  },
  {
    "path": "infer/lib/rtrvc.py",
    "chars": 17447,
    "preview": "from io import BytesIO\r\nimport os\r\nimport sys\r\nimport traceback\r\nfrom infer.lib import jit\r\nfrom infer.lib.jit.get_synth"
  },
  {
    "path": "infer/lib/slicer2.py",
    "chars": 9195,
    "preview": "import numpy as np\r\n\r\n\r\n# This function is obtained from librosa.\r\ndef get_rms(\r\n    y,\r\n    frame_length=2048,\r\n    hop"
  },
  {
    "path": "infer/lib/train/data_utils.py",
    "chars": 18736,
    "preview": "import os\r\nimport traceback\r\nimport logging\r\n\r\nlogger = logging.getLogger(__name__)\r\n\r\nimport numpy as np\r\nimport torch\r"
  },
  {
    "path": "infer/lib/train/losses.py",
    "chars": 1444,
    "preview": "import torch\r\n\r\n\r\ndef feature_loss(fmap_r, fmap_g):\r\n    loss = 0\r\n    for dr, dg in zip(fmap_r, fmap_g):\r\n        for r"
  },
  {
    "path": "infer/lib/train/mel_processing.py",
    "chars": 3821,
    "preview": "import torch\r\nimport torch.utils.data\r\nfrom librosa.filters import mel as librosa_mel_fn\r\nimport logging\r\n\r\nlogger = log"
  },
  {
    "path": "infer/lib/train/process_ckpt.py",
    "chars": 8012,
    "preview": "import os\nimport sys\nimport traceback\nfrom collections import OrderedDict\n\nimport torch\n\nfrom i18n.i18n import I18nAuto\n"
  },
  {
    "path": "infer/lib/train/utils.py",
    "chars": 15592,
    "preview": "import argparse\r\nimport glob\r\nimport json\r\nimport logging\r\nimport os\r\nimport subprocess\r\nimport sys\r\nimport shutil\r\n\r\nim"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/dataset.py",
    "chars": 5838,
    "preview": "import os\nimport random\n\nimport numpy as np\nimport torch\nimport torch.utils.data\nfrom tqdm import tqdm\n\nfrom . import sp"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/layers.py",
    "chars": 3690,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass Conv2DBNActiv(nn.Mod"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/layers_123812KB .py",
    "chars": 3690,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass Conv2DBNActiv(nn.Mod"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/layers_123821KB.py",
    "chars": 3690,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass Conv2DBNActiv(nn.Mod"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/layers_33966KB.py",
    "chars": 4018,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass Conv2DBNActiv(nn.Mod"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/layers_537227KB.py",
    "chars": 4018,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass Conv2DBNActiv(nn.Mod"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/layers_537238KB.py",
    "chars": 4018,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass Conv2DBNActiv(nn.Mod"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/layers_new.py",
    "chars": 3986,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass Conv2DBNActiv(nn.Mod"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/model_param_init.py",
    "chars": 1674,
    "preview": "import json\nimport os\nimport pathlib\n\ndefault_param = {}\ndefault_param[\"bins\"] = 768\ndefault_param[\"unstable_bins\"] = 9 "
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/1band_sr16000_hl512.json",
    "chars": 292,
    "preview": "{\n\t\"bins\": 1024,\n\t\"unstable_bins\": 0,\n\t\"reduction_bins\": 0,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 16000,\n\t\t\t\"hl\": 512,\n\t\t\t\"n_fft\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/1band_sr32000_hl512.json",
    "chars": 294,
    "preview": "{\n\t\"bins\": 1024,\n\t\"unstable_bins\": 0,\n\t\"reduction_bins\": 0,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 32000,\n\t\t\t\"hl\": 512,\n\t\t\t\"n_fft\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/1band_sr33075_hl384.json",
    "chars": 292,
    "preview": "{\n\t\"bins\": 1024,\n\t\"unstable_bins\": 0,\n\t\"reduction_bins\": 0,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 33075,\n\t\t\t\"hl\": 384,\n\t\t\t\"n_fft\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/1band_sr44100_hl1024.json",
    "chars": 293,
    "preview": "{\n\t\"bins\": 1024,\n\t\"unstable_bins\": 0,\n\t\"reduction_bins\": 0,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 44100,\n\t\t\t\"hl\": 1024,\n\t\t\t\"n_fft"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/1band_sr44100_hl256.json",
    "chars": 287,
    "preview": "{\n\t\"bins\": 256,\n\t\"unstable_bins\": 0,\n\t\"reduction_bins\": 0,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 44100,\n\t\t\t\"hl\": 256,\n\t\t\t\"n_fft\":"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/1band_sr44100_hl512.json",
    "chars": 292,
    "preview": "{\n\t\"bins\": 1024,\n\t\"unstable_bins\": 0,\n\t\"reduction_bins\": 0,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 44100,\n\t\t\t\"hl\": 512,\n\t\t\t\"n_fft\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/1band_sr44100_hl512_cut.json",
    "chars": 290,
    "preview": "{\n\t\"bins\": 1024,\n\t\"unstable_bins\": 0,\n\t\"reduction_bins\": 0,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 44100,\n\t\t\t\"hl\": 512,\n\t\t\t\"n_fft\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/2band_32000.json",
    "chars": 483,
    "preview": "{\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 705,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 6000,\n\t\t\t\"hl\": 66,\n\t\t\t\"n_fft\":"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/2band_44100_lofi.json",
    "chars": 485,
    "preview": "{\n\t\"bins\": 512,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 510,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t\t\"hl\": 160,\n\t\t\t\"n_fft"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/2band_48000.json",
    "chars": 482,
    "preview": "{\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 705,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 6000,\n\t\t\t\"hl\": 66,\n\t\t\t\"n_fft\":"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/3band_44100.json",
    "chars": 695,
    "preview": "{\n\t\"bins\": 768,\n\t\"unstable_bins\": 5,\n\t\"reduction_bins\": 733,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t\t\"hl\": 128,\n\t\t\t\"n_fft"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/3band_44100_mid.json",
    "chars": 714,
    "preview": "{\n\t\"mid_side\": true,\n\t\"bins\": 768,\n\t\"unstable_bins\": 5,\n\t\"reduction_bins\": 733,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t\t\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/3band_44100_msb2.json",
    "chars": 714,
    "preview": "{\n\t\"mid_side_b2\": true,\n\t\"bins\": 640,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 565,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_44100.json",
    "chars": 906,
    "preview": "{\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 668,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t\t\"hl\": 128,\n\t\t\t\"n_fft"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_44100_mid.json",
    "chars": 925,
    "preview": "{\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"mid_side\": true,\n\t\"reduction_bins\": 668,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t\t\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_44100_msb.json",
    "chars": 926,
    "preview": "{\n\t\"mid_side_b\": true,\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 668,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_44100_msb2.json",
    "chars": 926,
    "preview": "{\n\t\"mid_side_b\": true,\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 668,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_44100_reverse.json",
    "chars": 923,
    "preview": "{\n\t\"reverse\": true,\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 668,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t\t\"h"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_44100_sw.json",
    "chars": 924,
    "preview": "{\n\t\"stereo_w\": true,\n\t\"bins\": 768,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 668,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n\t\t\t\""
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_v2.json",
    "chars": 894,
    "preview": "{\n\t\"bins\": 672,\n\t\"unstable_bins\": 8,\n\t\"reduction_bins\": 637,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 7350,\n\t\t\t\"hl\": 80,\n\t\t\t\"n_fft\":"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_v2_sn.json",
    "chars": 929,
    "preview": "{\n\t\"bins\": 672,\n\t\"unstable_bins\": 8,\n\t\"reduction_bins\": 637,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 7350,\n\t\t\t\"hl\": 80,\n\t\t\t\"n_fft\":"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/4band_v3.json",
    "chars": 944,
    "preview": "{\r\n\t\"bins\": 672,\r\n\t\"unstable_bins\": 8,\r\n\t\"reduction_bins\": 530,\r\n\t\"band\": {\r\n\t\t\"1\": {\r\n\t\t\t\"sr\": 7350,\r\n\t\t\t\"hl\": 80,\r\n\t\t\t"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/modelparams/ensemble.json",
    "chars": 719,
    "preview": "{\n\t\"mid_side_b2\": true,\n\t\"bins\": 1280,\n\t\"unstable_bins\": 7,\n\t\"reduction_bins\": 565,\n\t\"band\": {\n\t\t\"1\": {\n\t\t\t\"sr\": 11025,\n"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets.py",
    "chars": 3827,
    "preview": "import layers\nimport torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import spec_utils\n\n\nclass BaseAS"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets_123812KB.py",
    "chars": 3830,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import layers_123821KB as layers\n\n\nclass BaseA"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets_123821KB.py",
    "chars": 3830,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import layers_123821KB as layers\n\n\nclass BaseA"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets_33966KB.py",
    "chars": 3831,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import layers_33966KB as layers\n\n\nclass BaseAS"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets_537227KB.py",
    "chars": 3852,
    "preview": "import numpy as np\nimport torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import layers_537238KB as l"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets_537238KB.py",
    "chars": 3852,
    "preview": "import numpy as np\nimport torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import layers_537238KB as l"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets_61968KB.py",
    "chars": 3830,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import layers_123821KB as layers\n\n\nclass BaseA"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/nets_new.py",
    "chars": 4225,
    "preview": "import torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom . import layers_new\n\n\nclass BaseNet(nn.Module):\n"
  },
  {
    "path": "infer/lib/uvr5_pack/lib_v5/spec_utils.py",
    "chars": 21595,
    "preview": "import hashlib\nimport json\nimport math\nimport os\n\nimport librosa\nimport numpy as np\nimport soundfile as sf\nfrom tqdm imp"
  },
  {
    "path": "infer/lib/uvr5_pack/name_params.json",
    "chars": 12311,
    "preview": "{\n    \"equivalent\" : [\n        {\n            \"model_hash_name\" : [\n                {\n                    \"hash_name\": \"4"
  },
  {
    "path": "infer/lib/uvr5_pack/utils.py",
    "chars": 3623,
    "preview": "import json\n\nimport numpy as np\nimport torch\nfrom tqdm import tqdm\n\n\ndef load_data(file_name: str = \"./infer/lib/uvr5_pa"
  },
  {
    "path": "infer/modules/ipex/__init__.py",
    "chars": 9284,
    "preview": "import os\nimport sys\nimport contextlib\nimport torch\nimport intel_extension_for_pytorch as ipex  # pylint: disable=import"
  },
  {
    "path": "infer/modules/ipex/attention.py",
    "chars": 8846,
    "preview": "import torch\nimport intel_extension_for_pytorch as ipex  # pylint: disable=import-error, unused-import\n\n# pylint: disabl"
  },
  {
    "path": "infer/modules/ipex/gradscaler.py",
    "chars": 8517,
    "preview": "from collections import defaultdict\nimport torch\nimport intel_extension_for_pytorch as ipex  # pylint: disable=import-er"
  },
  {
    "path": "infer/modules/ipex/hijacks.py",
    "chars": 12635,
    "preview": "import contextlib\nimport importlib\nimport torch\nimport intel_extension_for_pytorch as ipex  # pylint: disable=import-err"
  },
  {
    "path": "infer/modules/onnx/export.py",
    "chars": 1816,
    "preview": "import torch\nimport onnxsim\nimport onnx\nfrom infer.lib.infer_pack.models_onnx import SynthesizerTrnMsNSFsidM\n\ndef export"
  },
  {
    "path": "infer/modules/train/extract/extract_f0_print.py",
    "chars": 5752,
    "preview": "import os\r\nimport sys\r\nimport traceback\r\n\r\nimport parselmouth\r\n\r\nnow_dir = os.getcwd()\r\nsys.path.append(now_dir)\r\nimport"
  },
  {
    "path": "infer/modules/train/extract/extract_f0_rmvpe.py",
    "chars": 4527,
    "preview": "import os\r\nimport sys\r\nimport traceback\r\n\r\nimport parselmouth\r\n\r\nnow_dir = os.getcwd()\r\nsys.path.append(now_dir)\r\nimport"
  },
  {
    "path": "infer/modules/train/extract/extract_f0_rmvpe_dml.py",
    "chars": 4452,
    "preview": "import os\r\nimport sys\r\nimport traceback\r\n\r\nimport parselmouth\r\n\r\nnow_dir = os.getcwd()\r\nsys.path.append(now_dir)\r\nimport"
  },
  {
    "path": "infer/modules/train/extract_feature_print.py",
    "chars": 4433,
    "preview": "import os\r\nimport sys\r\nimport traceback\r\n\r\nos.environ[\"PYTORCH_ENABLE_MPS_FALLBACK\"] = \"1\"\r\nos.environ[\"PYTORCH_MPS_HIGH"
  },
  {
    "path": "infer/modules/train/preprocess.py",
    "chars": 4384,
    "preview": "import multiprocessing\nimport os\nimport sys\n\nfrom scipy import signal\n\nnow_dir = os.getcwd()\nsys.path.append(now_dir)\npr"
  },
  {
    "path": "infer/modules/train/train.py",
    "chars": 22067,
    "preview": "import os\nimport sys\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nnow_dir = os.getcwd()\nsys.path.append(os.path"
  },
  {
    "path": "infer/modules/uvr5/mdxnet.py",
    "chars": 8590,
    "preview": "import os\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nimport librosa\nimport numpy as np\nimport soundfile as sf"
  },
  {
    "path": "infer/modules/uvr5/modules.py",
    "chars": 3902,
    "preview": "import os\nimport traceback\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nimport ffmpeg\nimport torch\n\nfrom config"
  },
  {
    "path": "infer/modules/uvr5/vr.py",
    "chars": 14794,
    "preview": "import os\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nimport librosa\nimport numpy as np\nimport soundfile as sf"
  },
  {
    "path": "infer/modules/vc/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "infer/modules/vc/modules.py",
    "chars": 10137,
    "preview": "import traceback\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nimport numpy as np\nimport soundfile as sf\nimport "
  },
  {
    "path": "infer/modules/vc/pipeline.py",
    "chars": 15753,
    "preview": "import os\nimport sys\nimport traceback\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nfrom functools import lru_ca"
  },
  {
    "path": "infer/modules/vc/utils.py",
    "chars": 851,
    "preview": "import os\n\nfrom fairseq import checkpoint_utils\n\n\ndef get_index_path_from_model(sid):\n    return next(\n        (\n       "
  },
  {
    "path": "infer-web.py",
    "chars": 59700,
    "preview": "import os\nimport sys\nfrom dotenv import load_dotenv\n\nnow_dir = os.getcwd()\nsys.path.append(now_dir)\nload_dotenv()\nfrom i"
  },
  {
    "path": "pyproject.toml",
    "chars": 1306,
    "preview": "[tool.poetry]\nname = \"rvc-beta\"\nversion = \"0.1.0\"\ndescription = \"\"\nauthors = [\"lj1995\"]\nlicense = \"MIT\"\n\n[tool.poetry.de"
  },
  {
    "path": "requirements-amd.txt",
    "chars": 713,
    "preview": "tensorflow-rocm\njoblib>=1.1.0\nnumba==0.56.4\nnumpy==1.23.5\nscipy\nlibrosa==0.10.2\nllvmlite==0.39.0\nfairseq==0.12.2\nfaiss-c"
  },
  {
    "path": "requirements-dml.txt",
    "chars": 689,
    "preview": "joblib>=1.1.0\nnumba==0.56.4\nnumpy==1.23.5\nscipy\nlibrosa==0.10.2\nllvmlite==0.39.0\nfairseq==0.12.2\nfaiss-cpu==1.7.3\ngradio"
  },
  {
    "path": "requirements-ipex.txt",
    "chars": 1102,
    "preview": "torch==2.0.1a0\nintel_extension_for_pytorch==2.0.110+xpu\ntorchvision==0.15.2a0\nhttps://github.com/Disty0/Retrieval-based-"
  },
  {
    "path": "requirements-py311.txt",
    "chars": 757,
    "preview": "joblib>=1.1.0\nnumba\nnumpy\nscipy\nlibrosa==0.10.2\nllvmlite\nfairseq @ git+https://github.com/One-sixth/fairseq.git\nfaiss-cp"
  },
  {
    "path": "requirements-win-for-realtime_vc_gui-dml.txt",
    "chars": 573,
    "preview": "#1.Install torch from pytorch.org:\n#torch 2.0 with cuda 11.8\n#pip3 install torch torchvision torchaudio --index-url http"
  },
  {
    "path": "requirements-win-for-realtime_vc_gui.txt",
    "chars": 552,
    "preview": "#1.Install torch from pytorch.org:\n#torch 2.0 with cuda 11.8\n#pip3 install torch torchvision torchaudio --index-url http"
  },
  {
    "path": "requirements.txt",
    "chars": 754,
    "preview": "aria2\njoblib>=1.1.0\nnumba==0.56.4\nnumpy==1.23.5\nscipy\nlibrosa==0.9.1\nllvmlite==0.39.0\nfairseq==0.12.2\nfaiss-cpu==1.7.3\ng"
  },
  {
    "path": "run.sh",
    "chars": 1807,
    "preview": "#!/bin/sh\n\nif [ \"$(uname)\" = \"Darwin\" ]; then\n  # macOS specific env:\n  export PYTORCH_ENABLE_MPS_FALLBACK=1\n  export PY"
  },
  {
    "path": "tools/app.py",
    "chars": 5060,
    "preview": "import logging\nimport os\n\n# os.system(\"wget -P cvec/ https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hub"
  },
  {
    "path": "tools/calc_rvc_model_similarity.py",
    "chars": 2956,
    "preview": "# This code references https://huggingface.co/JosephusCheung/ASimilarityCalculatior/blob/main/qwerty.py\n# Fill in the pa"
  },
  {
    "path": "tools/dlmodels.bat",
    "chars": 16256,
    "preview": "@echo off && chcp 65001\n\necho working dir is %cd%\necho downloading requirement aria2 check.\necho=\ndir /a:d/b | findstr \""
  },
  {
    "path": "tools/dlmodels.sh",
    "chars": 2902,
    "preview": "#!/bin/sh\n\nprintf \"working dir is %s\\n\" \"$PWD\"\necho \"downloading requirement aria2 check.\"\n\nif command -v aria2c > /dev/"
  },
  {
    "path": "tools/download_models.py",
    "chars": 2477,
    "preview": "import os\nfrom pathlib import Path\nimport requests\n\nRVC_DOWNLOAD_LINK = \"https://huggingface.co/lj1995/VoiceConversionWe"
  },
  {
    "path": "tools/export_onnx.py",
    "chars": 1854,
    "preview": "import torch\r\nfrom infer.lib.infer_pack.models_onnx import SynthesizerTrnMsNSFsidM\r\n\r\nif __name__ == \"__main__\":\r\n    Mo"
  },
  {
    "path": "tools/infer/infer-pm-index256.py",
    "chars": 6891,
    "preview": "\"\"\"\r\n\r\n对源特征进行检索\r\n\"\"\"\r\n\r\nimport os\r\nimport logging\r\n\r\nlogger = logging.getLogger(__name__)\r\n\r\nimport parselmouth\r\nimport "
  },
  {
    "path": "tools/infer/train-index-v2.py",
    "chars": 2243,
    "preview": "\"\"\"\r\n格式:直接cid为自带的index位;aid放不下了,通过字典来查,反正就5w个\r\n\"\"\"\r\n\r\nimport os\r\nimport traceback\r\nimport logging\r\n\r\nlogger = logging.ge"
  },
  {
    "path": "tools/infer/train-index.py",
    "chars": 1203,
    "preview": "\"\"\"\r\n格式:直接cid为自带的index位;aid放不下了,通过字典来查,反正就5w个\r\n\"\"\"\r\n\r\nimport os\r\nimport logging\r\n\r\nlogger = logging.getLogger(__name__)\r"
  },
  {
    "path": "tools/infer/trans_weights.py",
    "chars": 762,
    "preview": "import pdb\r\n\r\nimport torch\r\n\r\n# a=torch.load(r\"E:\\codes\\py39\\vits_vc_gpu_train\\logs\\ft-mi-suc\\G_1000.pth\")[\"model\"]#sim_"
  },
  {
    "path": "tools/infer_batch_rvc.py",
    "chars": 2422,
    "preview": "import argparse\nimport os\nimport sys\n\nprint(\"Command-line arguments:\", sys.argv)\n\nnow_dir = os.getcwd()\nsys.path.append("
  },
  {
    "path": "tools/infer_cli.py",
    "chars": 2068,
    "preview": "import argparse\nimport os\nimport sys\n\nnow_dir = os.getcwd()\nsys.path.append(now_dir)\nfrom dotenv import load_dotenv\nfrom"
  },
  {
    "path": "tools/onnx_inference_demo.py",
    "chars": 655,
    "preview": "import soundfile\r\n\r\nfrom ..infer.lib.infer_pack.onnx_inference import OnnxRVC\r\n\r\nhop_size = 512\r\nsampling_rate = 40000  "
  }
]

// ... and 9 more files (download for full content)

About this extraction

This page contains the full source code of the RVC-Project/Retrieval-based-Voice-Conversion-WebUI GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 209 files (1.1 MB), approximately 357.3k tokens, and a symbol index with 805 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!