[Rebase] Rebase to vLLM 0.30.0 (#7820)
Signed-off-by: tzhouam <tzhouam@connect.ust.hk> Signed-off-by: Gao Han <hgaoaf@connect.ust.hk> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
This commit is contained in:
59 files changed
+1032
-300
No files matched your search
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from vllm_omni.model_executor.models.indextts2 import codec as codec_module
|
||||
@@ -84,10 +85,33 @@ def test_model_asset_resolver_supports_native_checkpoints_layout(tmp_path):
|
||||
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
|
||||
def test_campplus_local_dir_does_not_silently_download(tmp_path, monkeypatch):
|
||||
"""A local bundle missing CAMPPlus must fail closed, not hit the Hub.
|
||||
|
||||
origin/main ``load_campplus`` treats ``os.path.isdir(model_path)`` as a
|
||||
complete local snapshot and raises FileNotFoundError instead of
|
||||
downloading ``funasr/campplus``. The old test name
|
||||
``test_campplus_falls_back_to_hub_for_local_model_dir`` encoded the
|
||||
pre-guard behavior.
|
||||
"""
|
||||
from vllm_omni.model_executor.models.indextts2.utils.campplus import dtdnn
|
||||
|
||||
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())
|
||||
preprocess_utils._campplus_cache.clear()
|
||||
|
||||
with pytest.raises(FileNotFoundError, match="CAMPPlus checkpoint is missing from local bundle"):
|
||||
preprocess_utils.load_campplus(str(tmp_path), torch.device("cpu"))
|
||||
|
||||
|
||||
def test_campplus_falls_back_to_hub_for_repo_id(tmp_path, monkeypatch):
|
||||
from types import SimpleNamespace
|
||||
|
||||
from vllm_omni.model_executor.models.indextts2.utils.campplus import dtdnn
|
||||
from vllm_omni.transformers_utils import repo_utils
|
||||
|
||||
checkpoint = tmp_path / "downloaded-campplus.bin"
|
||||
checkpoint.touch()
|
||||
@@ -99,14 +123,16 @@ def test_campplus_falls_back_to_hub_for_local_model_dir(tmp_path, monkeypatch):
|
||||
|
||||
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),
|
||||
repo_utils,
|
||||
"hf_api",
|
||||
lambda: SimpleNamespace(
|
||||
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"))
|
||||
model = preprocess_utils.load_campplus("IndexTeam/IndexTTS-2", torch.device("cpu"))
|
||||
|
||||
assert isinstance(model, FakeCAMPPlus)
|
||||
assert downloads == [("funasr/campplus", "campplus_cn_common.bin")]
|
||||
Reference in new issue
Block a user