NeoPy commited on
Commit
5f9f3b0
·
verified ·
1 Parent(s): eeed8c8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +145 -138
README.md CHANGED
@@ -1,138 +1,145 @@
1
- # RVC-Python-FastInference
2
-
3
- A streamlined Python wrapper for fast inference with RVC.
4
- Specifically designed for inference tasks.
5
-
6
- ## Introduction
7
-
8
- This streamlined wrapper offers an efficient solution for integrating RVC into your Python projects, focusing primarily on rapid inference. Whether you're working on voice conversion applications or related projects, this tool simplifies the process while maintaining performance.
9
-
10
- ## Key Features
11
- - Preloaded Models: Accelerate inference by loading models into memory beforehand, minimizing latency during runtime.
12
- - Batch Processing: Enhance efficiency by enabling batch processing, allowing for simultaneous conversion of multiple inputs, further optimizing throughput.
13
- - Support for Array Input and Output: Facilitate seamless integration with existing data pipelines by accepting and returning arrays, enhancing compatibility across various platforms and frameworks.
14
-
15
- ## Getting Started
16
-
17
- ### Prerequisites
18
-
19
- - You need to have ffmpeg and Python 3.10 installed.
20
- - In windows is needed to install Microsoft Visual C++ Build Tools, MSVC and Windows 10 SDK:
21
-
22
- * Go to the [Visual Studio downloads page](https://visualstudio.microsoft.com/visual-cpp-build-tools/); Or maybe you already have **Visual Studio Installer**? Open it. If you have it already click modify.
23
- * Download and install the "Build Tools for Visual Studio" if you don't have it.
24
- * During installation, under "Workloads", select "C++ build tools" and ensure the latest versions of "MSVCv142 - VS 2019 C++ x64/x86 build tools" and "Windows 10 SDK" are selected ("Windows 11 SDK" if you are using Windows 11); OR go to individual components and find those two listed.
25
- * Complete the installation.
26
-
27
- ### Installation
28
-
29
- ```
30
- pip install infer_rvc_python
31
- ```
32
-
33
- # Usage
34
-
35
- ## Initialize the base class
36
-
37
- ```
38
- from infer_rvc_python import BaseLoader
39
-
40
- converter = BaseLoader(only_cpu=False, hubert_path=None, rmvpe_path=None)
41
- ```
42
-
43
- ## Define a tag and select the model along with other parameters.
44
-
45
- ```
46
- converter.apply_conf(
47
- tag="yoimiya",
48
- file_model="model.pth",
49
- pitch_algo="rmvpe+",
50
- pitch_lvl=0,
51
- file_index="model.index",
52
- index_influence=0.66,
53
- respiration_median_filtering=3,
54
- envelope_ratio=0.25,
55
- consonant_breath_protection=0.33
56
- )
57
- ```
58
-
59
- ## Select the audio or audios you want to convert.
60
-
61
- ```
62
- # audio_files = ["audio.wav", "haha.mp3"]
63
- audio_files = "myaudio.mp3"
64
-
65
- # speakers_list = ["sunshine", "yoimiya"]
66
- speakers_list = "yoimiya"
67
- ```
68
-
69
- ## Perform inference
70
-
71
- ```
72
- result = converter(
73
- audio_files,
74
- speakers_list,
75
- overwrite=False,
76
- parallel_workers=4
77
- )
78
- ```
79
- The `result` is a list with the paths of the converted files.
80
-
81
- ## Unload models
82
- ```
83
- converter.unload_models()
84
- ```
85
-
86
- # Preloading model (Reduces inference time)
87
-
88
- The initial execution will preload the model for the tag. Subsequent calls to inference with the same tag will benefit from preloaded components, thereby reducing inference time.
89
- ```
90
- result_array, sample_rate = converter.generate_from_cache(
91
- audio_data="myaudiofile_path.wav",
92
- tag="yoimiya",
93
- )
94
- ```
95
-
96
- The param audio_data can be a path or a tuple with (array_data, sampling_rate)
97
-
98
- ```
99
- # array_data = np.array([-22, -22, -15, ..., 0, 0, 0], dtype=np.int16)
100
- # source_sample_rate = 16000
101
- data = (array_data, source_sample_rate)
102
- result_array, sample_rate = converter.generate_from_cache(
103
- audio_data=data,
104
- tag="yoimiya",
105
- )
106
- ```
107
- The result in both cases will be (array, sample_rate), which you can save or play in a notebook
108
-
109
- ```
110
- # Save
111
- import soundfile as sf
112
-
113
- sf.write(
114
- file="output_file.wav",
115
- samplerate=sample_rate,
116
- data=result_array
117
- )
118
- ```
119
-
120
- ```
121
- # Play; need to install ipython
122
- from IPython.display import Audio
123
-
124
- Audio(result_array, rate=sample_rate)
125
- ```
126
- When settings or the tag are altered, the model requires reloading. To maintain multiple preloaded models, you can instantiate another BaseLoader object.
127
- ```
128
- second_converter = BaseLoader()
129
- ```
130
- # Credits
131
- - RVC-Project
132
- - FFMPEG
133
-
134
- # License
135
- This project is licensed under the MIT License.
136
-
137
- # Disclaimer
138
- This software is provided for educational and research purposes only. The authors and contributors of this project do not endorse or encourage any misuse or unethical use of this software. Any use of this software for purposes other than those intended is solely at the user's own risk. The authors and contributors shall not be held responsible for any damages or liabilities arising from the use of this software inappropriately.
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model:
4
+ - NeoPy/rvc-base
5
+ tags:
6
+ - code
7
+ ---
8
+ # RVC-Python-Inference
9
+
10
+ A streamlined Python wrapper for fast inference with RVC.
11
+ Specifically designed for inference tasks.
12
+
13
+ ## Introduction
14
+
15
+ This streamlined wrapper offers an efficient solution for integrating RVC into your Python projects, focusing primarily on rapid inference. Whether you're working on voice conversion applications or related projects, this tool simplifies the process while maintaining performance.
16
+
17
+ ## Key Features
18
+ - Preloaded Models: Accelerate inference by loading models into memory beforehand, minimizing latency during runtime.
19
+ - Batch Processing: Enhance efficiency by enabling batch processing, allowing for simultaneous conversion of multiple inputs, further optimizing throughput.
20
+ - Support for Array Input and Output: Facilitate seamless integration with existing data pipelines by accepting and returning arrays, enhancing compatibility across various platforms and frameworks.
21
+
22
+ ## Getting Started
23
+
24
+ ### Prerequisites
25
+
26
+ - You need to have ffmpeg and Python 3.10 installed.
27
+ - In windows is needed to install Microsoft Visual C++ Build Tools, MSVC and Windows 10 SDK:
28
+
29
+ * Go to the [Visual Studio downloads page](https://visualstudio.microsoft.com/visual-cpp-build-tools/); Or maybe you already have **Visual Studio Installer**? Open it. If you have it already click modify.
30
+ * Download and install the "Build Tools for Visual Studio" if you don't have it.
31
+ * During installation, under "Workloads", select "C++ build tools" and ensure the latest versions of "MSVCv142 - VS 2019 C++ x64/x86 build tools" and "Windows 10 SDK" are selected ("Windows 11 SDK" if you are using Windows 11); OR go to individual components and find those two listed.
32
+ * Complete the installation.
33
+
34
+ ### Installation
35
+
36
+ ```
37
+ pip install infer_rvc_python
38
+ ```
39
+
40
+ # Usage
41
+
42
+ ## Initialize the base class
43
+
44
+ ```
45
+ from infer_rvc_python import BaseLoader
46
+
47
+ converter = BaseLoader(only_cpu=False, hubert_path=None, rmvpe_path=None)
48
+ ```
49
+
50
+ ## Define a tag and select the model along with other parameters.
51
+
52
+ ```
53
+ converter.apply_conf(
54
+ tag="yoimiya",
55
+ file_model="model.pth",
56
+ pitch_algo="rmvpe+",
57
+ pitch_lvl=0,
58
+ file_index="model.index",
59
+ index_influence=0.66,
60
+ respiration_median_filtering=3,
61
+ envelope_ratio=0.25,
62
+ consonant_breath_protection=0.33
63
+ )
64
+ ```
65
+
66
+ ## Select the audio or audios you want to convert.
67
+
68
+ ```
69
+ # audio_files = ["audio.wav", "haha.mp3"]
70
+ audio_files = "myaudio.mp3"
71
+
72
+ # speakers_list = ["sunshine", "yoimiya"]
73
+ speakers_list = "yoimiya"
74
+ ```
75
+
76
+ ## Perform inference
77
+
78
+ ```
79
+ result = converter(
80
+ audio_files,
81
+ speakers_list,
82
+ overwrite=False,
83
+ parallel_workers=4
84
+ )
85
+ ```
86
+ The `result` is a list with the paths of the converted files.
87
+
88
+ ## Unload models
89
+ ```
90
+ converter.unload_models()
91
+ ```
92
+
93
+ # Preloading model (Reduces inference time)
94
+
95
+ The initial execution will preload the model for the tag. Subsequent calls to inference with the same tag will benefit from preloaded components, thereby reducing inference time.
96
+ ```
97
+ result_array, sample_rate = converter.generate_from_cache(
98
+ audio_data="myaudiofile_path.wav",
99
+ tag="yoimiya",
100
+ )
101
+ ```
102
+
103
+ The param audio_data can be a path or a tuple with (array_data, sampling_rate)
104
+
105
+ ```
106
+ # array_data = np.array([-22, -22, -15, ..., 0, 0, 0], dtype=np.int16)
107
+ # source_sample_rate = 16000
108
+ data = (array_data, source_sample_rate)
109
+ result_array, sample_rate = converter.generate_from_cache(
110
+ audio_data=data,
111
+ tag="yoimiya",
112
+ )
113
+ ```
114
+ The result in both cases will be (array, sample_rate), which you can save or play in a notebook
115
+
116
+ ```
117
+ # Save
118
+ import soundfile as sf
119
+
120
+ sf.write(
121
+ file="output_file.wav",
122
+ samplerate=sample_rate,
123
+ data=result_array
124
+ )
125
+ ```
126
+
127
+ ```
128
+ # Play; need to install ipython
129
+ from IPython.display import Audio
130
+
131
+ Audio(result_array, rate=sample_rate)
132
+ ```
133
+ When settings or the tag are altered, the model requires reloading. To maintain multiple preloaded models, you can instantiate another BaseLoader object.
134
+ ```
135
+ second_converter = BaseLoader()
136
+ ```
137
+ # Credits
138
+ - RVC-Project
139
+ - FFMPEG
140
+
141
+ # License
142
+ This project is licensed under the MIT License.
143
+
144
+ # Disclaimer
145
+ This software is provided for educational and research purposes only. The authors and contributors of this project do not endorse or encourage any misuse or unethical use of this software. Any use of this software for purposes other than those intended is solely at the user's own risk. The authors and contributors shall not be held responsible for any damages or liabilities arising from the use of this software inappropriately.