Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -282,14 +282,21 @@ def finetune_voice(segment_paths, epochs, learning_rate, batch_size, progress_ca
|
|
| 282 |
home = Path.home()
|
| 283 |
search_roots = [cwd, home, Path("/app"), Path("/home/user")]
|
| 284 |
found_any = False
|
|
|
|
| 285 |
for root in search_roots:
|
| 286 |
if not root.exists():
|
| 287 |
continue
|
| 288 |
for pattern in ["**/model_last*.pt", "**/model_last*.safetensors",
|
| 289 |
"**/ckpts/**/*.pt", "**/ckpts/**/*.safetensors"]:
|
| 290 |
for f in root.glob(pattern):
|
| 291 |
-
|
| 292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
found_any = True
|
| 294 |
if not found_any:
|
| 295 |
# Log what's in common checkpoint dirs for debugging
|
|
|
|
| 282 |
home = Path.home()
|
| 283 |
search_roots = [cwd, home, Path("/app"), Path("/home/user")]
|
| 284 |
found_any = False
|
| 285 |
+
voice_model_resolved = VOICE_MODEL_DIR.resolve()
|
| 286 |
for root in search_roots:
|
| 287 |
if not root.exists():
|
| 288 |
continue
|
| 289 |
for pattern in ["**/model_last*.pt", "**/model_last*.safetensors",
|
| 290 |
"**/ckpts/**/*.pt", "**/ckpts/**/*.safetensors"]:
|
| 291 |
for f in root.glob(pattern):
|
| 292 |
+
dest = VOICE_MODEL_DIR / f.name
|
| 293 |
+
# Skip if source and destination are the same file
|
| 294 |
+
if f.resolve() == dest.resolve():
|
| 295 |
+
logger.info(f"Skipping (same file): {f}")
|
| 296 |
+
found_any = True
|
| 297 |
+
continue
|
| 298 |
+
shutil.copy2(str(f), str(dest))
|
| 299 |
+
logger.info(f"Copied checkpoint: {f} -> {dest}")
|
| 300 |
found_any = True
|
| 301 |
if not found_any:
|
| 302 |
# Log what's in common checkpoint dirs for debugging
|