Merge pull request #1130 from jamiepine/prep/pr-1112

Fix infinite HF retry storm when loading a cached model offline
This commit is contained in:
capy-ai-staging[bot]
2026-10-04 00:05:46 +00:00
committed by GitHub
8 changed files with 351 additions and 90 deletions
+3 -1
View File
@@ -15,6 +15,7 @@ from typing import Callable, List, Optional, Tuple
import numpy as np
from ..utils.audio import normalize_audio, load_audio
from ..utils.hf_offline_patch import force_offline_if_cached
from ..utils.progress import get_progress_manager
from ..utils.hf_progress import HFProgressTracker, create_hf_progress_callback
from ..utils.tasks import get_task_manager
@@ -319,7 +320,8 @@ def model_load_progress(
)
try:
yield tracker_context
with force_offline_if_cached(is_cached, model_name):
yield tracker_context
except Exception as e:
# Report error to both managers
progress_manager.mark_error(model_name, str(e))
+7 -1
View File
@@ -29,11 +29,17 @@ logger = logging.getLogger(__name__)
CHATTERBOX_HF_REPO = "ResembleAI/chatterbox"
# Files that must be present for the multilingual model
# The files ChatterboxMultilingualTTS.from_pretrained() downloads, as of
# chatterbox-tts 0.1.7 (mtl_tts.py allow_patterns). The load runs with HF
# offline mode forced when this reports cached, so a partial snapshot must not
# count as cached -- if upstream adds a file to that list, add it here too.
_MTL_WEIGHT_FILES = [
"t3_mtl23ls_v2.safetensors",
"s3gen.pt",
"ve.pt",
"grapheme_mtl_merged_expanded_v1.json",
"conds.pt",
"Cangjie5_TC.json",
]
+9 -1
View File
@@ -29,11 +29,19 @@ logger = logging.getLogger(__name__)
CHATTERBOX_TURBO_HF_REPO = "ResembleAI/chatterbox-turbo"
# Files that must be present for the turbo model
# The files ChatterboxTurboTTS.from_local() reads, as of chatterbox-tts 0.1.7:
# the three weight files, the GPT-2 tokenizer files AutoTokenizer needs, and
# the built-in voice. The load runs with HF offline mode forced when this
# reports cached, so a partial snapshot must not count as cached -- if upstream
# starts reading another file, add it here too.
_TURBO_WEIGHT_FILES = [
"t3_turbo_v1.safetensors",
"s3gen_meanflow.safetensors",
"ve.safetensors",
"tokenizer_config.json",
"vocab.json",
"merges.txt",
"conds.pt",
]
+12 -2
View File
@@ -35,6 +35,9 @@ logger = logging.getLogger(__name__)
# HuggingFace repos
TADA_CODEC_REPO = "HumeAI/tada-codec"
# TADA hardcodes the gated meta-llama/Llama-3.2-1B tokenizer; we load it from
# this ungated mirror instead (see load_model).
TADA_TOKENIZER_REPO = "unsloth/Llama-3.2-1B"
TADA_1B_REPO = "HumeAI/tada-1b"
TADA_3B_ML_REPO = "HumeAI/tada-3b-ml"
@@ -52,6 +55,12 @@ _TADA_CODEC_WEIGHT_FILES = [
"encoder/model.safetensors",
]
_TADA_TOKENIZER_FILES = [
"tokenizer.json",
"tokenizer_config.json",
"special_tokens_map.json",
]
class HumeTadaBackend:
"""HumeAI TADA TTS backend for high-quality voice cloning."""
@@ -80,7 +89,8 @@ class HumeTadaBackend:
repo = TADA_MODEL_REPOS.get(model_size, TADA_1B_REPO)
model_cached = is_model_cached(repo, required_files=_TADA_MODEL_WEIGHT_FILES)
codec_cached = is_model_cached(TADA_CODEC_REPO, required_files=_TADA_CODEC_WEIGHT_FILES)
return model_cached and codec_cached
tokenizer_cached = is_model_cached(TADA_TOKENIZER_REPO, required_files=_TADA_TOKENIZER_FILES)
return model_cached and codec_cached and tokenizer_cached
async def load_model(self, model_size: str = "1B") -> None:
"""Load the TADA model and encoder."""
@@ -140,7 +150,7 @@ class HumeTadaBackend:
# local cache path so we can point TADA at it directly.
logger.info("Downloading Llama tokenizer (ungated mirror)...")
tokenizer_path = snapshot_download(
repo_id="unsloth/Llama-3.2-1B",
repo_id=TADA_TOKENIZER_REPO,
token=None,
allow_patterns=["tokenizer*", "special_tokens*"],
)