Add files via upload
This commit is contained in:
1 parent
5d8d214e9b
commit
fb46b5e6a1
6 files changed
+129
-22
No files matched your search
+18
-4
@@ -273,14 +273,28 @@ class KokoroTTSEngine:
|
||||
try:
|
||||
self._pipeline = _create_pipeline()
|
||||
except Exception as _first_err:
|
||||
# Offline flag set but model not cached yet → download once
|
||||
# Offline flag set but model not cached yet → clear flags and download once.
|
||||
# Keywords cover multiple huggingface_hub error message variants across versions.
|
||||
_e = str(_first_err).lower()
|
||||
if any(k in _e for k in ("offline", "not found", "cache", "localentry", "does not exist")):
|
||||
print("[TTS] Kokoro model not cached — downloading (internet required for first run)…")
|
||||
_offline_keywords = (
|
||||
"offline", "not found", "cache", "localentry",
|
||||
"does not exist", "outgoing", "local_files_only",
|
||||
)
|
||||
if any(k in _e for k in _offline_keywords):
|
||||
print("[TTS] Kokoro model not in local cache — downloading (one-time, internet required)…")
|
||||
os.environ.pop("HF_HUB_OFFLINE", None)
|
||||
os.environ.pop("TRANSFORMERS_OFFLINE", None)
|
||||
os.environ.pop("HF_DATASETS_OFFLINE", None)
|
||||
self._pipeline = _create_pipeline()
|
||||
try:
|
||||
self._pipeline = _create_pipeline()
|
||||
except Exception as _dl_err:
|
||||
raise RuntimeError(
|
||||
f"Kokoro model download failed.\n"
|
||||
f"Internet access is required the first time to download the voice model (~330 MB).\n"
|
||||
f"After the first download it runs fully offline.\n"
|
||||
f"Tip: Switch to EdgeTTS (free, no download) in the Configure panel if offline.\n"
|
||||
f"Details: {_dl_err}"
|
||||
) from _dl_err
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
Reference in new issue
Block a user