diff --git a/tests/models/multimodal/conftest.py b/tests/models/multimodal/conftest.py index d00c3df786..9283556d30 100644 --- a/tests/models/multimodal/conftest.py +++ b/tests/models/multimodal/conftest.py @@ -5,11 +5,21 @@ import os import warnings +import pytest import torch +from tests.utils import prewarm_hf_cache from vllm.platforms import current_platform +@pytest.fixture(scope="session", autouse=True) +def _prewarm_hf_cache(): + # tokenization_qwen.py downloads SimSun.ttf from + # qianwen-res.oss-cn-beijing.aliyuncs.com; both Qwen/Qwen-VL and + # Qwen/Qwen-VL-Chat look it up from the Chat repo. + prewarm_hf_cache([("Qwen/Qwen-VL-Chat", "SimSun.ttf")]) + + def pytest_configure(config): """Early ROCm configuration that must happen before test collection.""" if not current_platform.is_rocm(): diff --git a/tests/models/multimodal/processing/test_common.py b/tests/models/multimodal/processing/test_common.py index edfc2ac4b6..26ab67e5d9 100644 --- a/tests/models/multimodal/processing/test_common.py +++ b/tests/models/multimodal/processing/test_common.py @@ -423,11 +423,6 @@ def test_processing_correctness( ) if model_id == "jinaai/jina-reranker-m0": pytest.skip("Fix later") - if model_id in {"Qwen/Qwen-VL", "Qwen/Qwen-VL-Chat"}: - pytest.skip( - "Qwen-VL tokenizer requires downloading a font file from " - "servers that often refuse connections in CI" - ) if model_id == "mistralai/Voxtral-Mini-4B-Realtime-2602": pytest.skip( "Voxtral Realtime doesn't make use of any place-holder " diff --git a/tests/renderers/conftest.py b/tests/renderers/conftest.py new file mode 100644 index 0000000000..c33ab35160 --- /dev/null +++ b/tests/renderers/conftest.py @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +import pytest + +from tests.utils import prewarm_hf_cache + + +@pytest.fixture(scope="session", autouse=True) +def _prewarm_hf_cache(): + # tokenization_qwen.py downloads SimSun.ttf from + # qianwen-res.oss-cn-beijing.aliyuncs.com; both Qwen/Qwen-VL and + # Qwen/Qwen-VL-Chat look it up from the Chat repo. + prewarm_hf_cache([("Qwen/Qwen-VL-Chat", "SimSun.ttf")]) diff --git a/tests/tokenizers_/conftest.py b/tests/tokenizers_/conftest.py new file mode 100644 index 0000000000..c33ab35160 --- /dev/null +++ b/tests/tokenizers_/conftest.py @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project + +import pytest + +from tests.utils import prewarm_hf_cache + + +@pytest.fixture(scope="session", autouse=True) +def _prewarm_hf_cache(): + # tokenization_qwen.py downloads SimSun.ttf from + # qianwen-res.oss-cn-beijing.aliyuncs.com; both Qwen/Qwen-VL and + # Qwen/Qwen-VL-Chat look it up from the Chat repo. + prewarm_hf_cache([("Qwen/Qwen-VL-Chat", "SimSun.ttf")]) diff --git a/tests/utils.py b/tests/utils.py index 68a9031a2c..4b5fb5848f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -33,6 +33,8 @@ import pytest import requests import torch import torch.nn.functional as F +from huggingface_hub import hf_hub_download +from huggingface_hub.constants import HF_HUB_OFFLINE from openai.types.completion import Completion from typing_extensions import ParamSpec @@ -44,6 +46,7 @@ from vllm.distributed import ( ) from vllm.engine.arg_utils import AsyncEngineArgs from vllm.entrypoints.cli.serve import ServeSubcommand +from vllm.logger import init_logger from vllm.model_executor.kernels.linear import ( _KernelT, init_fp8_linear_kernel, @@ -61,8 +64,29 @@ from vllm.utils.torch_utils import ( set_random_seed, # noqa: F401 - re-exported for use in test files ) +logger = init_logger(__name__) + FP8_DTYPE = current_platform.fp8_dtype() + +def prewarm_hf_cache(assets: list[tuple[str, str]]) -> None: + """Pre-populate the HF cache for (repo_id, filename) pairs that upstream + trust_remote_code modules would otherwise fetch from third-party CDNs + (often unreachable from US-based CI).""" + if HF_HUB_OFFLINE: + return + for repo_id, filename in assets: + try: + hf_hub_download(repo_id=repo_id, filename=filename) + except Exception as e: + logger.warning( + "Failed to prefetch %s/%s: %r. Tests depending on this asset may fail.", + repo_id, + filename, + e, + ) + + if current_platform.is_rocm(): from amdsmi import ( amdsmi_get_gpu_vram_usage,