[Bugfix] Fix fallback loading for IndexTTS external models (#6137)

Signed-off-by: boatman <109857087+sphinxkkkbc@users.noreply.github.com>
This commit is contained in:
boatman authored and GitHub committed 2026-09-04 19:58:33 -07:00
1 parent 1e74807c35
commit 66bbebd9d3
4 files changed
+38 -9

No files matched your search

@@ -82,3 +82,31 @@ def test_model_asset_resolver_supports_native_checkpoints_layout(tmp_path):
checkpoint.touch()
assert preprocess_utils.resolve_model_file(str(tmp_path), "codec.pth") == str(checkpoint)
def test_campplus_falls_back_to_hub_for_local_model_dir(tmp_path, monkeypatch):
import huggingface_hub
from vllm_omni.model_executor.models.indextts2.utils.campplus import dtdnn
checkpoint = tmp_path / "downloaded-campplus.bin"
checkpoint.touch()
downloads = []
class FakeCAMPPlus(torch.nn.Module):
def load_state_dict(self, state, strict=True):
self.loaded_state = (state, strict)
monkeypatch.setattr(dtdnn, "CAMPPlus", lambda **_kwargs: FakeCAMPPlus())
monkeypatch.setattr(
huggingface_hub,
"hf_hub_download",
lambda repo_id, filename: downloads.append((repo_id, filename)) or str(checkpoint),
)
monkeypatch.setattr(preprocess_utils.torch, "load", lambda *_args, **_kwargs: {"weight": torch.ones(1)})
preprocess_utils._campplus_cache.clear()
model = preprocess_utils.load_campplus(str(tmp_path), torch.device("cpu"))
assert isinstance(model, FakeCAMPPlus)
assert downloads == [("funasr/campplus", "campplus_cn_common.bin")]