Spaces:
Runtime error
Runtime error
Update finetune_xtts_hf.py
Browse files- finetune_xtts_hf.py +10 -7
finetune_xtts_hf.py
CHANGED
|
@@ -9,23 +9,26 @@ DATASET_PATH = "/home/user/app/dataset" # Ruta a tu dataset
|
|
| 9 |
OUTPUT_PATH = "/tmp/output_model"
|
| 10 |
BASE_MODEL = "coqui/XTTS-v2"
|
| 11 |
|
| 12 |
-
os.makedirs("
|
| 13 |
-
os.
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Cache seguro (en Spaces siempre se puede escribir en /tmp)
|
| 16 |
-
|
| 17 |
os.makedirs(HF_CACHE_DIR, exist_ok=True)
|
| 18 |
-
|
| 19 |
-
hf_cache_dir = "/tmp/hf_cache/models--coqui--XTTS-v2"
|
| 20 |
-
os.makedirs(hf_cache_dir, exist_ok=True)
|
| 21 |
os.chmod(hf_cache_dir, 0o777)
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
print("=== Descargando modelo base desde Hugging Face ===")
|
| 24 |
|
| 25 |
model_dir = snapshot_download(
|
| 26 |
repo_id="coqui/XTTS-v2",
|
| 27 |
local_dir="/tmp/xtts_model", # 👈 Descargar modelo en /tmp
|
| 28 |
-
cache_dir=
|
| 29 |
force_download=False, # Descarga solo si no existe
|
| 30 |
)
|
| 31 |
|
|
|
|
| 9 |
OUTPUT_PATH = "/tmp/output_model"
|
| 10 |
BASE_MODEL = "coqui/XTTS-v2"
|
| 11 |
|
| 12 |
+
os.makedirs("/tmp/xtts_model", exist_ok=True)
|
| 13 |
+
os.chmod("/tmp/xtts_model", 0o777)
|
| 14 |
+
os.makedirs("/tmp/output", exist_ok=True)
|
| 15 |
+
os.chmod("/tmp/output", 0o777)
|
| 16 |
|
| 17 |
# Cache seguro (en Spaces siempre se puede escribir en /tmp)
|
| 18 |
+
hf_cache_dir = "/tmp/hf_cache"
|
| 19 |
os.makedirs(HF_CACHE_DIR, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
| 20 |
os.chmod(hf_cache_dir, 0o777)
|
| 21 |
|
| 22 |
+
hf_cache_dir_2 = "/tmp/hf_cache/models--coqui--XTTS-v2"
|
| 23 |
+
os.makedirs(hf_cache_dir_2, exist_ok=True)
|
| 24 |
+
os.chmod(hf_cache_dir_2, 0o777)
|
| 25 |
+
|
| 26 |
print("=== Descargando modelo base desde Hugging Face ===")
|
| 27 |
|
| 28 |
model_dir = snapshot_download(
|
| 29 |
repo_id="coqui/XTTS-v2",
|
| 30 |
local_dir="/tmp/xtts_model", # 👈 Descargar modelo en /tmp
|
| 31 |
+
cache_dir=hf_cache_dir, # 👈 Forzar caché también en /tmp
|
| 32 |
force_download=False, # Descarga solo si no existe
|
| 33 |
)
|
| 34 |
|