@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 2a42ae790d
Fork 0

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 10, 16:30 UTC

[ROCm][CI] Fix ModernBERT token classification test numerical accuracy on ROCm (#31820)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>

Andreas Karatzas committed Jan 6, 2026 at 17:21 UTC 2a42ae790d3f42a381b782a504947255aa0db090
1 file changed +29
tests/models/language/pooling/conftest.py new
+29
@@ -0,0 +1,29 @@
1 +# SPDX-License-Identifier: Apache-2.0
2 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 +"""Pytest configuration for vLLM language generation tests."""
4 +
5 +import warnings
6 +
7 +import torch
8 +
9 +from vllm.platforms import current_platform
10 +
11 +
12 +def pytest_sessionstart(session):
13 + """Configure ROCm-specific settings before test session starts."""
14 + if not current_platform.is_rocm():
15 + return
16 +
17 + # Disable Flash/MemEfficient SDP on ROCm to avoid HF Transformers
18 + # accuracy issues: https://github.com/vllm-project/vllm/issues/30167
19 + # TODO: Remove once ROCm SDP accuracy issues are resolved on HuggingFace
20 + torch.backends.cuda.enable_flash_sdp(False)
21 + torch.backends.cuda.enable_mem_efficient_sdp(False)
22 + torch.backends.cuda.enable_math_sdp(True)
23 + torch.set_float32_matmul_precision("high")
24 + warnings.warn(
25 + "ROCm: Disabled flash_sdp and mem_efficient_sdp, enabled math_sdp "
26 + "to avoid HuggingFace Transformers accuracy issues",
27 + UserWarning,
28 + stacklevel=1,
29 + )