Spaces:
Sleeping
Sleeping
AI Assistant commited on
Commit ·
4401a6e
1
Parent(s): 43dc9d5
Fix noisereduce, UI progress, remove spaces.GPU for L4, and add train_cli.py
Browse files- app.py +5 -1
- pipeline/rvc_training.py +1 -1
- requirements.txt +2 -0
- train_cli.py +38 -0
app.py
CHANGED
|
@@ -121,6 +121,10 @@ def train_voice_model(audio_file, model_name, progress=gr.Progress()):
|
|
| 121 |
except Exception as e:
|
| 122 |
return f"Error: {str(e)}", None
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
def get_model_choices():
|
| 125 |
models = list_models()
|
| 126 |
if not models:
|
|
@@ -291,7 +295,7 @@ with gr.Blocks(title="Voice Clone RVC", theme=gr.themes.Soft()) as app:
|
|
| 291 |
)
|
| 292 |
|
| 293 |
rvc_train_btn.click(
|
| 294 |
-
fn=
|
| 295 |
inputs=[rvc_audio, rvc_model_name, rvc_epochs, rvc_batch_size, rvc_f0_method, rvc_save_every],
|
| 296 |
outputs=[rvc_status, rvc_download],
|
| 297 |
)
|
|
|
|
| 121 |
except Exception as e:
|
| 122 |
return f"Error: {str(e)}", None
|
| 123 |
|
| 124 |
+
def train_rvc_model_ui(audio_path, model_name, epochs, batch_size, f0_method, save_every, progress=gr.Progress()):
|
| 125 |
+
return train_rvc_model(audio_path, model_name, epochs, batch_size, f0_method, save_every, progress=progress)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
def get_model_choices():
|
| 129 |
models = list_models()
|
| 130 |
if not models:
|
|
|
|
| 295 |
)
|
| 296 |
|
| 297 |
rvc_train_btn.click(
|
| 298 |
+
fn=train_rvc_model_ui,
|
| 299 |
inputs=[rvc_audio, rvc_model_name, rvc_epochs, rvc_batch_size, rvc_f0_method, rvc_save_every],
|
| 300 |
outputs=[rvc_status, rvc_download],
|
| 301 |
)
|
pipeline/rvc_training.py
CHANGED
|
@@ -44,7 +44,7 @@ except Exception as e:
|
|
| 44 |
RVC_IMPORT_ERROR = str(e)
|
| 45 |
RVC_LOGIC_AVAILABLE = False
|
| 46 |
|
| 47 |
-
|
| 48 |
def train_rvc_model(audio_path, model_name, epochs=100, batch_size=4, f0_method="rmvpe", save_every=10, progress=None):
|
| 49 |
if not RVC_LOGIC_AVAILABLE:
|
| 50 |
return f"Error: rvc_logic module failed to load. Reason: {RVC_IMPORT_ERROR}", None
|
|
|
|
| 44 |
RVC_IMPORT_ERROR = str(e)
|
| 45 |
RVC_LOGIC_AVAILABLE = False
|
| 46 |
|
| 47 |
+
# Removing spaces.GPU decorator so it doesn't limit execution on L4
|
| 48 |
def train_rvc_model(audio_path, model_name, epochs=100, batch_size=4, f0_method="rmvpe", save_every=10, progress=None):
|
| 49 |
if not RVC_LOGIC_AVAILABLE:
|
| 50 |
return f"Error: rvc_logic module failed to load. Reason: {RVC_IMPORT_ERROR}", None
|
requirements.txt
CHANGED
|
@@ -42,3 +42,5 @@ tensorboardX
|
|
| 42 |
wget
|
| 43 |
static-ffmpeg
|
| 44 |
pydantic
|
|
|
|
|
|
|
|
|
| 42 |
wget
|
| 43 |
static-ffmpeg
|
| 44 |
pydantic
|
| 45 |
+
noisereduce
|
| 46 |
+
|
train_cli.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
import sys
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
def main():
|
| 6 |
+
parser = argparse.ArgumentParser(description="Entrenamiento RVC por Consola")
|
| 7 |
+
parser.add_argument("--audio", required=True, help="Ruta al archivo de audio (WAV/MP3)")
|
| 8 |
+
parser.add_argument("--name", required=True, help="Nombre del modelo (sin espacios)")
|
| 9 |
+
parser.add_argument("--epochs", type=int, default=100, help="Número de epochs (defecto: 100)")
|
| 10 |
+
parser.add_argument("--batch_size", type=int, default=8, help="Tamaño de lote (defecto: 8 para L4)")
|
| 11 |
+
parser.add_argument("--f0_method", type=str, default="rmvpe", choices=["rmvpe", "crepe", "fcpe"], help="Método F0")
|
| 12 |
+
parser.add_argument("--save_every", type=int, default=10, help="Guardar checkpoint cada X epochs")
|
| 13 |
+
|
| 14 |
+
args = parser.parse_args()
|
| 15 |
+
|
| 16 |
+
# Import locally
|
| 17 |
+
from pipeline.rvc_training import train_rvc_model
|
| 18 |
+
|
| 19 |
+
print(f"\n🚀 Iniciando entrenamiento por consola para el modelo: {args.name}")
|
| 20 |
+
print(f"📊 Parámetros: Epochs={args.epochs}, Batch={args.batch_size}, F0={args.f0_method}\n")
|
| 21 |
+
|
| 22 |
+
status, download_path = train_rvc_model(
|
| 23 |
+
audio_path=args.audio,
|
| 24 |
+
model_name=args.name,
|
| 25 |
+
epochs=args.epochs,
|
| 26 |
+
batch_size=args.batch_size,
|
| 27 |
+
f0_method=args.f0_method,
|
| 28 |
+
save_every=args.save_every,
|
| 29 |
+
progress=None
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
print("\n✅ ESTADO FINAL:")
|
| 33 |
+
print(status)
|
| 34 |
+
if download_path:
|
| 35 |
+
print(f"📁 Archivo generado en: {download_path}")
|
| 36 |
+
|
| 37 |
+
if __name__ == "__main__":
|
| 38 |
+
main()
|