Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
1e402b95
Unverified
Commit
1e402b95
authored
Feb 15, 2024
by
Titus
Committed by
GitHub
Feb 16, 2024
Browse files
add test marker to run all tests with @require_bitsandbytes (#28278)
parent
f3aa7db4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
pyproject.toml
pyproject.toml
+1
-0
src/transformers/testing_utils.py
src/transformers/testing_utils.py
+10
-2
No files found.
pyproject.toml
View file @
1e402b95
...
...
@@ -32,4 +32,5 @@ doctest_optionflags="NUMBER NORMALIZE_WHITESPACE ELLIPSIS"
doctest_glob
=
"**/*.md"
markers
=
[
"flash_attn_test: marks tests related to flash attention (deselect with '-m
\"
not flash_attn_test
\"
')"
,
"bitsandbytes: select (or deselect with `not`) bitsandbytes integration tests"
,
]
\ No newline at end of file
src/transformers/testing_utils.py
View file @
1e402b95
...
...
@@ -966,9 +966,17 @@ def require_aqlm(test_case):
def
require_bitsandbytes
(
test_case
):
"""
Decorator
for
bits
and
bytes
(bnb) dependency
Decorator
marking a test that requires the
bitsandbytes
library. Will be skipped when the library or its hard dependency torch is not installed.
"""
return
unittest
.
skipUnless
(
is_bitsandbytes_available
(),
"test requires bnb"
)(
test_case
)
if
is_bitsandbytes_available
()
and
is_torch_available
():
try
:
import
pytest
return
pytest
.
mark
.
bitsandbytes
(
test_case
)
except
ImportError
:
return
test_case
else
:
return
unittest
.
skip
(
"test requires bitsandbytes and torch"
)(
test_case
)
def
require_optimum
(
test_case
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment