Update app.py
Browse files
app.py
CHANGED
|
@@ -30,12 +30,32 @@ class RealRVCTrainer:
|
|
| 30 |
|
| 31 |
progress(0.3, desc="Installing dependencies...")
|
| 32 |
|
| 33 |
-
# Install
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
progress(0.6, desc="Downloading pretrained models...")
|
| 41 |
|
|
@@ -55,9 +75,24 @@ class RealRVCTrainer:
|
|
| 55 |
|
| 56 |
output_path = pretrained_dir / filename
|
| 57 |
if not output_path.exists():
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
self.setup_complete = True
|
| 63 |
progress(1.0, desc="Setup complete!")
|
|
@@ -74,7 +109,27 @@ class RealRVCTrainer:
|
|
| 74 |
"""
|
| 75 |
|
| 76 |
except Exception as e:
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
def prepare_dataset(self, audio_files, model_name, progress=gr.Progress()):
|
| 80 |
"""Prepare dataset in RVC format"""
|
|
|
|
| 30 |
|
| 31 |
progress(0.3, desc="Installing dependencies...")
|
| 32 |
|
| 33 |
+
# Install core dependencies manually (avoid conflicts)
|
| 34 |
+
core_packages = [
|
| 35 |
+
"torch",
|
| 36 |
+
"torchaudio",
|
| 37 |
+
"torchvision",
|
| 38 |
+
"numpy",
|
| 39 |
+
"scipy",
|
| 40 |
+
"librosa",
|
| 41 |
+
"soundfile",
|
| 42 |
+
"faiss-cpu",
|
| 43 |
+
"praat-parselmouth",
|
| 44 |
+
"pyworld",
|
| 45 |
+
"scikit-learn",
|
| 46 |
+
"numba",
|
| 47 |
+
"resampy",
|
| 48 |
+
"pydub",
|
| 49 |
+
"ffmpeg-python"
|
| 50 |
+
]
|
| 51 |
+
|
| 52 |
+
for pkg in core_packages:
|
| 53 |
+
try:
|
| 54 |
+
subprocess.run([
|
| 55 |
+
sys.executable, "-m", "pip", "install", "-q", pkg
|
| 56 |
+
], timeout=60)
|
| 57 |
+
except:
|
| 58 |
+
pass # Continue if one package fails
|
| 59 |
|
| 60 |
progress(0.6, desc="Downloading pretrained models...")
|
| 61 |
|
|
|
|
| 75 |
|
| 76 |
output_path = pretrained_dir / filename
|
| 77 |
if not output_path.exists():
|
| 78 |
+
try:
|
| 79 |
+
# Try with wget
|
| 80 |
+
subprocess.run([
|
| 81 |
+
"wget", "-q", "-O", str(output_path), url
|
| 82 |
+
], timeout=300)
|
| 83 |
+
except:
|
| 84 |
+
try:
|
| 85 |
+
# Fallback to curl
|
| 86 |
+
subprocess.run([
|
| 87 |
+
"curl", "-L", "-o", str(output_path), url
|
| 88 |
+
], timeout=300)
|
| 89 |
+
except:
|
| 90 |
+
# Fallback to Python requests
|
| 91 |
+
import requests
|
| 92 |
+
response = requests.get(url, stream=True, timeout=300)
|
| 93 |
+
with open(output_path, 'wb') as f:
|
| 94 |
+
for chunk in response.iter_content(chunk_size=8192):
|
| 95 |
+
f.write(chunk)
|
| 96 |
|
| 97 |
self.setup_complete = True
|
| 98 |
progress(1.0, desc="Setup complete!")
|
|
|
|
| 109 |
"""
|
| 110 |
|
| 111 |
except Exception as e:
|
| 112 |
+
error_msg = str(e)
|
| 113 |
+
return f"""❌ Installation failed: {error_msg}
|
| 114 |
+
|
| 115 |
+
🔧 Troubleshooting:
|
| 116 |
+
|
| 117 |
+
1. **Try Manual Installation:**
|
| 118 |
+
Run these commands in your Space terminal:
|
| 119 |
+
```
|
| 120 |
+
git clone https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
|
| 121 |
+
pip install torch torchaudio numpy scipy librosa soundfile faiss-cpu
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
2. **Or use Google Colab (Recommended):**
|
| 125 |
+
- Free GPU available
|
| 126 |
+
- Faster training (hours instead of days)
|
| 127 |
+
- Better compatibility
|
| 128 |
+
|
| 129 |
+
3. **Alternative:** Use a simpler RVC training space or local installation
|
| 130 |
+
|
| 131 |
+
Would you like a Google Colab notebook instead?
|
| 132 |
+
"""
|
| 133 |
|
| 134 |
def prepare_dataset(self, audio_files, model_name, progress=gr.Progress()):
|
| 135 |
"""Prepare dataset in RVC format"""
|