RVC Inference
Translations provided by GPT-4.
This project is a lightweight, fast, and memory efficient api that runs v1/v2 RVC models. It is intended for use in production environments and compatibility with existing codebases. It makes integrating RVC as a stage in a pipeline or workflow easy. Installation is quick using pip and should be compatible with Linux/Windows/Mac and the latest python versions.
Install
If using Python 3.11+ install the fairseq fork first as fairseq is not yet compatible with 3.11. (Will take a minute).
Pip install the repo like below and all dependencies will be installed automatically.
pip uninstall inferrvc
pip install inferrvc --no-cache-dir
By default pypi installs the pytorch cpu build. To install for gpu using Nvidia or AMD, visit https://pytorch.org/get-started/locally/ and pip install torch and torchaudio with gpu before installing this library.
Support should be available for Python 3.8-3.12 but only 3.11 was tested. If there are any problems with installation or compatibility please open an issue and I'll push out fixes. PR's with fixes and improvements are welcome.
Usage
First set the optional environment variables:
import os
os.environ['RVC_MODELDIR']='path/to/rvc_model_dir' #where model.pth files are stored.
os.environ['RVC_INDEXDIR']='path/to/rvc_index_dir' #where model.index files are stored.
#the audio output frequency, default is 44100.
os.environ['RVC_OUTPUTFREQ']='44100'
#If the output audio tensor should block until fully loaded, this can be ignored. But if you want to run in a larger torch pipeline, setting to False will improve performance a little.
os.environ['RVC_RETURNBLOCKING']='True'
Notes on environment variables:
- Both
RVC_OUTPUTFREQandRVC_RETURNBLOCKINGset defaults for theRVCclass, but they can be overriden per instance withself.outputfreqandself.returnblocking. - Setting
RVC_OUTPUTFREQtoNonewill disable standard resampling and return the model's native sample rate. - If you do not set
RVC_INDEXDIRtheRVCclass will fallback toRVC_MODELDIRand lastly the absolute path of the model directoryos.path.dirname(model_path). - If you do not set
RVC_MODELDIRthen argmodelmust be an absolute path.
Load models:
from inferrvc import RVC
whis,obama=RVC('Whis.pth',index='added_IVF1972_Flat_nprobe_1_Whis_v2'),RVC(model='obama')
print(whis.name)
print('Paths',whis.model_path,whis.index_path)
print(obama.name)
print('Paths',obama.model_path,obama.index_path)
Model: Whis, Index: added_IVF1972_Flat_nprobe_1_Whis_v2
Paths Z:\Models\RVC\Models\Whis.pth Z:\Models\RVC\Indexes\added_IVF1972_Flat_nprobe_1_Whis_v2.index
Model: obama, Index: obama
Paths Z:\Models\RVC\Models\obama.pth Z:\Models\RVC\Indexes\obama.index
Run Inferencing:
from inferrvc import load_torchaudio
aud,sr = load_torchaudio('path/to/audio.wav')
paudio1=whis(aud,f0_up_key=6,output_device='cpu',output_volume=RVC.MATCH_ORIGINAL,index_rate=.75)
paudio2=obama(aud,5,output_device='cpu',output_volume=RVC.MATCH_ORIGINAL,index_rate=.9)
import soundfile as sf
sf.write('path/to/audio_whis.wav',paudio1,44100)
sf.write('path/to/audio_obama.wav',paudio2,44100)
Changes from the original repo:
- Removed most code not related to inferencing. Now much fewer dependencies.
- Made a streamlined inference class and pipeline.
- Performance and memory efficiency improvements.
- Generic models are now managed by
huggingface_huband cached through the pathHF_HOMEenvironment variable. - Flexible referencing of RVC model directory and files.
- Disabled the butterworth filter by default as there is usually no difference and might slightly reduce quality. Can be enabled with
inferrvc.pipeline.enable_butterfilter=True.
Metadata
Release files for inferrvc 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| inferrvc-1.0.tar.gz | 42.4 kB | Without provenance | Details for inferrvc-1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inferrvc-1.0-py3-none-any.whl | Python 3 | none | any | Details for inferrvc-1.0-py3-none-any.whl |
Total release size: 91.2 kB
Release files / inferrvc-1.0.tar.gz
| Download URL | inferrvc-1.0.tar.gz |
|---|---|
| Size | 42.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e80b73bab06823fb21902366b00de4bb94b8c865b815cbaf4ae0e176b26da8c7
|
|
BLAKE2b-256 checksum How to use checksums |
af78934b9befd9f75f0433fb6bb40f5dfc5b82647a2d3bea7c417739cb73d56e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Release files / inferrvc-1.0-py3-none-any.whl
| Download URL | inferrvc-1.0-py3-none-any.whl |
|---|---|
| Size | 48.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ce4f0538761bafcf02ff723cc55f4fa97bf38a5c207f200f06d313f6f291d4f
|
|
BLAKE2b-256 checksum How to use checksums |
aee9e9e33dfcf4a6f32ebcf86523e5eda9477bf9fde17f9bc9beff92546a43fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Security for inferrvc 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.