Spaces:
Sleeping
Sleeping
Commit ·
612a411
1
Parent(s): b18dcd9
Add __init__.py files and fix sys.path for rvc_logic
Browse files- pipeline/rvc_training.py +14 -1
- requirements.txt +1 -0
- rvc_logic/__init__.py +0 -0
- rvc_logic/rvc/configs/__init__.py +0 -0
- rvc_logic/rvc/infer/__init__.py +0 -0
- rvc_logic/rvc/lib/__init__.py +0 -0
- rvc_logic/rvc/lib/predictors/__init__.py +0 -0
- rvc_logic/rvc/lib/tools/__init__.py +0 -0
- rvc_logic/rvc/train/__init__.py +0 -0
- rvc_logic/rvc/train/extract/__init__.py +0 -0
- rvc_logic/rvc/train/models/__init__.py +0 -0
- rvc_logic/rvc/train/preprocess/__init__.py +0 -0
- rvc_logic/rvc/train/process/__init__.py +0 -0
pipeline/rvc_training.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import shutil
|
| 3 |
import logging
|
| 4 |
import traceback
|
|
@@ -7,6 +8,12 @@ from huggingface_hub import HfApi
|
|
| 7 |
# Set up logging
|
| 8 |
logger = logging.getLogger(__name__)
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
try:
|
| 11 |
import spaces
|
| 12 |
except ImportError:
|
|
@@ -23,18 +30,24 @@ os.environ["URVC_AUDIO_DIR"] = os.path.abspath("rvc_audio")
|
|
| 23 |
os.environ["URVC_TEMP_DIR"] = os.path.abspath("rvc_temp")
|
| 24 |
|
| 25 |
# Import the core functions from our LOCAL rvc_logic
|
|
|
|
| 26 |
try:
|
| 27 |
from rvc_logic.core_train import prepare, extract, train
|
| 28 |
from rvc_logic.typing_extra import TrainingSampleRate, F0Method, EmbedderModel
|
| 29 |
RVC_LOGIC_AVAILABLE = True
|
| 30 |
except ImportError as e:
|
| 31 |
logger.error(f"Failed to import rvc_logic: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
RVC_LOGIC_AVAILABLE = False
|
| 33 |
|
| 34 |
@spaces.GPU(duration=1000)
|
| 35 |
def train_rvc_model(audio_path, model_name, epochs=100, progress=None):
|
| 36 |
if not RVC_LOGIC_AVAILABLE:
|
| 37 |
-
return "Error: rvc_logic module
|
| 38 |
|
| 39 |
if not audio_path:
|
| 40 |
return "Error: Please upload an audio file.", None
|
|
|
|
| 1 |
import os
|
| 2 |
+
import sys
|
| 3 |
import shutil
|
| 4 |
import logging
|
| 5 |
import traceback
|
|
|
|
| 8 |
# Set up logging
|
| 9 |
logger = logging.getLogger(__name__)
|
| 10 |
|
| 11 |
+
# Add the parent directory (app root) to sys.path so we can import rvc_logic
|
| 12 |
+
# since this script is in the 'pipeline' subdirectory
|
| 13 |
+
app_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
| 14 |
+
if app_root not in sys.path:
|
| 15 |
+
sys.path.insert(0, app_root)
|
| 16 |
+
|
| 17 |
try:
|
| 18 |
import spaces
|
| 19 |
except ImportError:
|
|
|
|
| 30 |
os.environ["URVC_TEMP_DIR"] = os.path.abspath("rvc_temp")
|
| 31 |
|
| 32 |
# Import the core functions from our LOCAL rvc_logic
|
| 33 |
+
RVC_IMPORT_ERROR = None
|
| 34 |
try:
|
| 35 |
from rvc_logic.core_train import prepare, extract, train
|
| 36 |
from rvc_logic.typing_extra import TrainingSampleRate, F0Method, EmbedderModel
|
| 37 |
RVC_LOGIC_AVAILABLE = True
|
| 38 |
except ImportError as e:
|
| 39 |
logger.error(f"Failed to import rvc_logic: {e}")
|
| 40 |
+
RVC_IMPORT_ERROR = str(e)
|
| 41 |
+
RVC_LOGIC_AVAILABLE = False
|
| 42 |
+
except Exception as e:
|
| 43 |
+
logger.error(f"Unexpected error loading rvc_logic: {e}")
|
| 44 |
+
RVC_IMPORT_ERROR = str(e)
|
| 45 |
RVC_LOGIC_AVAILABLE = False
|
| 46 |
|
| 47 |
@spaces.GPU(duration=1000)
|
| 48 |
def train_rvc_model(audio_path, model_name, epochs=100, progress=None):
|
| 49 |
if not RVC_LOGIC_AVAILABLE:
|
| 50 |
+
return f"Error: rvc_logic module failed to load. Reason: {RVC_IMPORT_ERROR}", None
|
| 51 |
|
| 52 |
if not audio_path:
|
| 53 |
return "Error: Please upload an audio file.", None
|
requirements.txt
CHANGED
|
@@ -12,6 +12,7 @@ numpy<2.0
|
|
| 12 |
soxr
|
| 13 |
ffmpeg-python>=0.2.0
|
| 14 |
pedalboard
|
|
|
|
| 15 |
|
| 16 |
# Demucs (stem separation)
|
| 17 |
demucs
|
|
|
|
| 12 |
soxr
|
| 13 |
ffmpeg-python>=0.2.0
|
| 14 |
pedalboard
|
| 15 |
+
lazy-loader
|
| 16 |
|
| 17 |
# Demucs (stem separation)
|
| 18 |
demucs
|
rvc_logic/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/configs/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/infer/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/lib/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/lib/predictors/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/lib/tools/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/train/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/train/extract/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/train/models/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/train/preprocess/__init__.py
ADDED
|
File without changes
|
rvc_logic/rvc/train/process/__init__.py
ADDED
|
File without changes
|