-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
[ROCm][CI] Fix ModernBERT token classification test numerical accuracy on ROCm #31820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
robertgshaw2-redhat
merged 3 commits into
vllm-project:main
from
ROCm:akaratza_lang_pool
Jan 6, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f08f1af
Enforce high float32 matmul precision for ROCm in pooling tests
AndreasKaratzas c20c13c
Merge remote-tracking branch 'origin/main' into akaratza_lang_pool
AndreasKaratzas 49ec054
Migrating from flex attention to triton backend - no need for highest…
AndreasKaratzas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the vLLM project | ||
| """Pytest configuration for vLLM language generation tests.""" | ||
|
|
||
| import warnings | ||
|
|
||
| import torch | ||
|
|
||
| from vllm.platforms import current_platform | ||
|
|
||
|
|
||
| def pytest_sessionstart(session): | ||
| """Configure ROCm-specific settings before test session starts.""" | ||
| if not current_platform.is_rocm(): | ||
| return | ||
|
|
||
| # Disable Flash/MemEfficient SDP on ROCm to avoid HF Transformers | ||
| # accuracy issues: https://github.com/vllm-project/vllm/issues/30167 | ||
| # TODO: Remove once ROCm SDP accuracy issues are resolved on HuggingFace | ||
| torch.backends.cuda.enable_flash_sdp(False) | ||
| torch.backends.cuda.enable_mem_efficient_sdp(False) | ||
| torch.backends.cuda.enable_math_sdp(True) | ||
| torch.set_float32_matmul_precision("high") | ||
| warnings.warn( | ||
| "ROCm: Disabled flash_sdp and mem_efficient_sdp, enabled math_sdp " | ||
| "to avoid HuggingFace Transformers accuracy issues", | ||
| UserWarning, | ||
| stacklevel=1, | ||
| ) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
pytest_sessionstartto modify global state liketorchsettings can have unintended side effects on other tests that run in the same session, as these settings are not reverted. This can lead to slower execution or unexpected behavior in unrelated tests.A more robust and idiomatic pytest approach is to use a fixture with
autouse=Trueand an appropriate scope (e.g.,module). This ensures that the settings are applied only for the relevant tests and, crucially, that the original settings are restored after the tests in the module have completed, preventing any impact on other parts of the test suite.I've suggested a refactoring to use a module-scoped autouse fixture which encapsulates the setup and teardown logic cleanly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a bit too overengineered, and might even not be functional. The problem is in one specific test inside the
Language Models Test (Extended Pooling)group.