Nekochu commited on
Commit
df1d59b
·
verified ·
1 Parent(s): b4817f7

restore all files

Browse files
Files changed (5) hide show
  1. README.md +194 -5
  2. app.py +0 -0
  3. gitignore +19 -0
  4. requirements-training.txt +32 -0
  5. requirements.txt +13 -0
README.md CHANGED
@@ -1,12 +1,201 @@
1
  ---
2
- title: Rvc Beatrice Voice Conversion
3
- emoji: 🚀
4
  colorFrom: red
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 6.10.0
 
8
  app_file: app.py
9
  pinned: false
 
 
 
 
 
 
 
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: RVC-v2 + Beatrice-v2 Voice Conversion + training
3
+ emoji: 🎤
4
  colorFrom: red
5
+ colorTo: yellow
6
  sdk: gradio
7
+ python_version: "3.10"
8
+ sdk_version: 6.3.0
9
  app_file: app.py
10
  pinned: false
11
+ license: mit
12
+ tags:
13
+ - voice-conversion
14
+ - rvc
15
+ - beatrice
16
+ - beatrice-v2
17
+ - audio
18
+ - mcp-server
19
+ short_description: RVC-v2 Beatrice-v2 - CPU inference + training
20
  ---
21
 
22
+ # RVC + Beatrice Voice Conversion
23
+
24
+ **CPU Inference + Training** - Single-file app for HuggingFace Spaces.
25
+
26
+ ## Features
27
+
28
+ - **Voice Conversion** - RVC v2 (.pth) + Beatrice v2 (.pt.gz)
29
+ - **Training** - Train both model types (GPU recommended, CPU works but slow)
30
+ - **Single File** - Everything in one `app.py`
31
+ - **CLI Support** - Command-line interface for batch processing
32
+
33
+ ## Voice Conversion
34
+
35
+ 1. Upload source audio (any format)
36
+ 2. Select **Model Type**: RVC v2 or Beatrice v2
37
+ 3. Upload model file (.pth for RVC, .pt.gz for Beatrice)
38
+ 4. Adjust pitch shift if needed
39
+ 5. Click Convert
40
+
41
+ **Default model:** [audo/Benee-RVC](https://huggingface.co/audo/Benee-RVC) (RVC v2)
42
+
43
+ ## Training
44
+
45
+ 1. Select **Trainer**: RVC v2 or Beatrice v2
46
+ 2. Upload training audio (10+ minutes recommended)
47
+ 3. Enter model name
48
+ 4. Adjust epochs and batch size
49
+ 5. Click Start Training
50
+
51
+ **Note:** CPU training works but is slow. For faster training, clone locally with CUDA GPU.
52
+
53
+ ## Compatibility
54
+
55
+ - **RVC v1** (256-dim HuBERT) - with f0 or no-f0
56
+ - **RVC v2** (768-dim HuBERT) - with f0 or no-f0
57
+ - **Beatrice v2** - 16kHz input, 24kHz output, per-speaker VQ
58
+ - **Index retrieval** (.index files) for RVC voice matching
59
+
60
+ Model version and f0 flag are auto-detected from the checkpoint.
61
+
62
+ Find models: [HuggingFace](https://huggingface.co/models?search=rvc) | [Weights.gg](https://weights.gg)
63
+
64
+ ---
65
+
66
+ ## API
67
+
68
+ ### Python Client - Voice Conversion
69
+
70
+ ```python
71
+ from gradio_client import Client, handle_file
72
+
73
+ client = Client("Luminia/rvc-voice-conversion")
74
+
75
+ # RVC v2 inference
76
+ result = client.predict(
77
+ source_audio=handle_file("voice.wav"),
78
+ model_type="RVC v2",
79
+ model_file=handle_file("model.pth"),
80
+ index_file=None, # Optional .index file
81
+ beatrice_model_file=None, # Not used for RVC
82
+ beatrice_target_speaker=0, # Not used for RVC
83
+ beatrice_formant_shift=0.0, # Not used for RVC
84
+ pitch_shift=0, # -12 to 12 semitones
85
+ f0_method="pm", # "pm" or "harvest"
86
+ index_rate=0.75, # 0-1, voice retrieval strength
87
+ protect=0.33, # 0-0.5, voiceless consonant protection
88
+ api_name="/convert"
89
+ )
90
+ print(result) # (output_path, status_message)
91
+
92
+ # Beatrice v2 inference
93
+ result = client.predict(
94
+ source_audio=handle_file("voice.wav"),
95
+ model_type="Beatrice v2",
96
+ model_file=None, # Not used for Beatrice
97
+ index_file=None, # Not used for Beatrice
98
+ beatrice_model_file=handle_file("beatrice_model.pt.gz"),
99
+ beatrice_target_speaker=0, # Speaker index
100
+ beatrice_formant_shift=0.0, # -2 to 2
101
+ pitch_shift=0, # -12 to 12 semitones
102
+ f0_method="pm", # Ignored for Beatrice
103
+ index_rate=0.75, # Ignored for Beatrice
104
+ protect=0.33, # Ignored for Beatrice
105
+ api_name="/convert"
106
+ )
107
+ print(result) # (output_path, status_message)
108
+ ```
109
+
110
+ ### Python Client - Training
111
+
112
+ ```python
113
+ from gradio_client import Client, handle_file
114
+
115
+ client = Client("Luminia/rvc-voice-conversion")
116
+
117
+ # RVC v2 training
118
+ result = client.predict(
119
+ trainer="RVC v2",
120
+ train_audio=handle_file("voice.wav"),
121
+ train_model_name="my_voice",
122
+ train_epochs=50, # 50-500
123
+ train_batch=2, # Batch size
124
+ train_sr=40000, # 32000, 40000, or 48000
125
+ beatrice_epochs=30, # Ignored for RVC
126
+ beatrice_batch=8, # Ignored for RVC
127
+ beatrice_resume=False, # Ignored for RVC
128
+ api_name="/train"
129
+ )
130
+ print(result) # (model_path, status_log)
131
+
132
+ # Beatrice v2 training
133
+ result = client.predict(
134
+ trainer="Beatrice v2",
135
+ train_audio=handle_file("voice.wav"),
136
+ train_model_name="my_voice",
137
+ train_epochs=50, # Ignored for Beatrice
138
+ train_batch=2, # Ignored for Beatrice
139
+ train_sr=40000, # Ignored for Beatrice
140
+ beatrice_epochs=30, # 20-50 recommended
141
+ beatrice_batch=8, # Batch size
142
+ beatrice_resume=False, # Resume from checkpoint
143
+ api_name="/train"
144
+ )
145
+ print(result) # (model_path, status_log)
146
+ ```
147
+
148
+ ### MCP (Model Context Protocol)
149
+
150
+ This Space supports MCP for AI assistants (Claude Desktop, Cursor, VS Code).
151
+
152
+ 1. Click **MCP** badge → **Add to MCP tools**
153
+ 2. The `convert` and `train` tools become available
154
+
155
+ **MCP Config:**
156
+ ```json
157
+ {
158
+ "mcpServers": {
159
+ "rvc": {"url": "https://luminia-rvc-voice-conversion.hf.space/gradio_api/mcp/"}
160
+ }
161
+ }
162
+ ```
163
+
164
+ ---
165
+
166
+ ## CLI Usage
167
+
168
+ ### Inference
169
+ ```bash
170
+ # RVC v2
171
+ python app.py infer -i voice.wav -m model.pth -o output.wav
172
+
173
+ # Beatrice v2 (auto-detected from .pt.gz extension)
174
+ python app.py infer -i voice.wav -m beatrice_model.pt.gz -o output.wav
175
+
176
+ # With pitch shift
177
+ python app.py infer -i voice.wav -m model.pth -p 2 -o output.wav
178
+
179
+ # Beatrice with speaker/formant options
180
+ python app.py infer -i voice.wav -m beatrice.pt.gz --speaker 0 --formant-shift 1.0 -o output.wav
181
+ ```
182
+
183
+ ### Training
184
+ ```bash
185
+ # RVC v2 training
186
+ python app.py train -a voice.mp3 -o ./my_model --epochs 100
187
+
188
+ # Beatrice v2 training
189
+ python app.py train-beatrice -a voice.mp3 -o ./beatrice_model --epochs 30
190
+
191
+ # Beatrice resume training
192
+ python app.py train-beatrice -a voice.mp3 -o ./beatrice_model --epochs 30 --resume
193
+ ```
194
+
195
+ ---
196
+
197
+ - Local real-time model usage: https://huggingface.co/wok000/vcclient000/tree/main
198
+
199
+ ## Credits
200
+
201
+ Based on [RVC-Project](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)-[Mangio-UI-Fork](https://github.com/Mangio621/Mangio-RVC-Fork), [Applio](https://github.com/IAHispano/Applio) data processing, and [Beatrice v2](https://huggingface.co/fierce-cats/beatrice-trainer)
app.py ADDED
The diff for this file is too large to render. See raw diff
 
gitignore ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.pyc
3
+ *.wav
4
+ *.flac
5
+ *.mp3
6
+ *.index
7
+ *.pth
8
+ nul
9
+
10
+ # Test/training artifacts
11
+ test_*/
12
+ train_*/
13
+ F_p340_*/
14
+ beatrice_test/
15
+
16
+ # Dev scripts
17
+ detect_noise.py
18
+ test_applio_ab.py
19
+ app_beatrice.py
requirements-training.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RVC Training Requirements (CUDA GPU required)
2
+ # Run: pip install -r requirements-training.txt
3
+
4
+ # PyTorch with CUDA (install separately based on your CUDA version)
5
+ # pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
6
+
7
+ # Core
8
+ numpy
9
+ scipy
10
+ librosa
11
+ soundfile
12
+ praat-parselmouth
13
+
14
+ # Training
15
+ fairseq
16
+ pyworld
17
+ faiss-gpu # Use faiss-cpu if no GPU
18
+ torchcrepe
19
+
20
+ # F0 extraction
21
+ onnxruntime-gpu # Use onnxruntime for CPU
22
+
23
+ # Web UI
24
+ gradio>=4.0.0
25
+
26
+ # Utils
27
+ tqdm
28
+ tensorboard
29
+ ffmpeg-python
30
+
31
+ # For model export
32
+ onnx
requirements.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --extra-index-url https://download.pytorch.org/whl/cpu
2
+ torch
3
+ torchaudio
4
+ gradio>=6.0.0
5
+ numpy
6
+ librosa
7
+ soundfile
8
+ huggingface_hub
9
+ transformers
10
+ praat-parselmouth
11
+ pyworld
12
+ faiss-cpu
13
+ scipy