A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 3, 01:45 UTC
[CI] De-flake renderers/test_hf.py::test_resolve_content_format_fallbacks[Qwen/Qwen-VL-string] (#43064)
Signed-off-by: haosdent <haosdent@gmail.com>
haosdent committed
May 22, 2026 at 12:15 UTC
1fe3303983e1829fae25edfb0b93e8cbcfad96e6
5 files changed
+62
-5
tests/models/multimodal/conftest.py
+10
@@ -5,11 +5,21 @@
5
import os
6
import warnings
7
8
+import pytest
9
import torch
10
11
+from tests.utils import prewarm_hf_cache
12
from vllm.platforms import current_platform
13
14
15
+@pytest.fixture(scope="session", autouse=True)
16
+def _prewarm_hf_cache():
17
+ # tokenization_qwen.py downloads SimSun.ttf from
18
+ # qianwen-res.oss-cn-beijing.aliyuncs.com; both Qwen/Qwen-VL and
19
+ # Qwen/Qwen-VL-Chat look it up from the Chat repo.
20
+ prewarm_hf_cache([("Qwen/Qwen-VL-Chat", "SimSun.ttf")])
21
+
22
+
23
def pytest_configure(config):
24
"""Early ROCm configuration that must happen before test collection."""
25
if not current_platform.is_rocm():
tests/models/multimodal/processing/test_common.py
-5
@@ -423,11 +423,6 @@ def test_processing_correctness(
423
)
424
if model_id == "jinaai/jina-reranker-m0":
425
pytest.skip("Fix later")
426
- if model_id in {"Qwen/Qwen-VL", "Qwen/Qwen-VL-Chat"}:
427
- pytest.skip(
428
- "Qwen-VL tokenizer requires downloading a font file from "
429
- "servers that often refuse connections in CI"
430
- )
426
if model_id == "mistralai/Voxtral-Mini-4B-Realtime-2602":
427
pytest.skip(
428
"Voxtral Realtime doesn't make use of any place-holder "
tests/renderers/conftest.py
new
+14
@@ -0,0 +1,14 @@
1
+# SPDX-License-Identifier: Apache-2.0
2
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+
4
+import pytest
5
+
6
+from tests.utils import prewarm_hf_cache
7
+
8
+
9
+@pytest.fixture(scope="session", autouse=True)
10
+def _prewarm_hf_cache():
11
+ # tokenization_qwen.py downloads SimSun.ttf from
12
+ # qianwen-res.oss-cn-beijing.aliyuncs.com; both Qwen/Qwen-VL and
13
+ # Qwen/Qwen-VL-Chat look it up from the Chat repo.
14
+ prewarm_hf_cache([("Qwen/Qwen-VL-Chat", "SimSun.ttf")])
tests/tokenizers_/conftest.py
new
+14
@@ -0,0 +1,14 @@
1
+# SPDX-License-Identifier: Apache-2.0
2
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+
4
+import pytest
5
+
6
+from tests.utils import prewarm_hf_cache
7
+
8
+
9
+@pytest.fixture(scope="session", autouse=True)
10
+def _prewarm_hf_cache():
11
+ # tokenization_qwen.py downloads SimSun.ttf from
12
+ # qianwen-res.oss-cn-beijing.aliyuncs.com; both Qwen/Qwen-VL and
13
+ # Qwen/Qwen-VL-Chat look it up from the Chat repo.
14
+ prewarm_hf_cache([("Qwen/Qwen-VL-Chat", "SimSun.ttf")])
tests/utils.py
+24
@@ -33,6 +33,8 @@ import pytest
33
import requests
34
import torch
35
import torch.nn.functional as F
36
+from huggingface_hub import hf_hub_download
37
+from huggingface_hub.constants import HF_HUB_OFFLINE
38
from openai.types.completion import Completion
39
from typing_extensions import ParamSpec
40
@@ -44,6 +46,7 @@ from vllm.distributed import (
46
)
47
from vllm.engine.arg_utils import AsyncEngineArgs
48
from vllm.entrypoints.cli.serve import ServeSubcommand
49
+from vllm.logger import init_logger
50
from vllm.model_executor.kernels.linear import (
51
_KernelT,
52
init_fp8_linear_kernel,
@@ -61,8 +64,29 @@ from vllm.utils.torch_utils import (
64
set_random_seed, # noqa: F401 - re-exported for use in test files
65
)
66
67
+logger = init_logger(__name__)
68
+
69
FP8_DTYPE = current_platform.fp8_dtype()
70
71
+
72
+def prewarm_hf_cache(assets: list[tuple[str, str]]) -> None:
73
+ """Pre-populate the HF cache for (repo_id, filename) pairs that upstream
74
+ trust_remote_code modules would otherwise fetch from third-party CDNs
75
+ (often unreachable from US-based CI)."""
76
+ if HF_HUB_OFFLINE:
77
+ return
78
+ for repo_id, filename in assets:
79
+ try:
80
+ hf_hub_download(repo_id=repo_id, filename=filename)
81
+ except Exception as e:
82
+ logger.warning(
83
+ "Failed to prefetch %s/%s: %r. Tests depending on this asset may fail.",
84
+ repo_id,
85
+ filename,
86
+ e,
87
+ )
88
+
89
+
90
if current_platform.is_rocm():
91
from amdsmi import (
92
amdsmi_get_gpu_vram_usage,