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
renzhc
diffusers_dcu
Commits
d4dc4d76
Unverified
Commit
d4dc4d76
authored
Jun 02, 2025
by
Sayak Paul
Committed by
GitHub
Jun 02, 2025
Browse files
[chore] misc changes in the bnb tests for consistency. (#11355)
misc changes in the bnb tests for consistency.
parent
3a31b291
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
tests/quantization/bnb/test_4bit.py
tests/quantization/bnb/test_4bit.py
+2
-2
tests/quantization/bnb/test_mixed_int8.py
tests/quantization/bnb/test_mixed_int8.py
+2
-2
No files found.
tests/quantization/bnb/test_4bit.py
View file @
d4dc4d76
...
...
@@ -526,7 +526,7 @@ class SlowBnb4BitTests(Base4bitTests):
reason
=
"Test will pass after https://github.com/huggingface/accelerate/pull/3223 is in a release."
,
strict
=
True
,
)
def
test_pipeline_
device
_placement_works_with_nf4
(
self
):
def
test_pipeline_
cuda
_placement_works_with_nf4
(
self
):
transformer_nf4_config
=
BitsAndBytesConfig
(
load_in_4bit
=
True
,
bnb_4bit_quant_type
=
"nf4"
,
...
...
@@ -560,7 +560,7 @@ class SlowBnb4BitTests(Base4bitTests):
).
to
(
torch_device
)
# Check if inference works.
_
=
pipeline_4bit
(
"table"
,
max_sequence_length
=
20
,
num_inference_steps
=
2
)
_
=
pipeline_4bit
(
self
.
prompt
,
max_sequence_length
=
20
,
num_inference_steps
=
2
)
del
pipeline_4bit
...
...
tests/quantization/bnb/test_mixed_int8.py
View file @
d4dc4d76
...
...
@@ -492,7 +492,7 @@ class SlowBnb8bitTests(Base8bitTests):
self
.
assertTrue
(
max_diff
<
1e-2
)
# 8bit models cannot be offloaded to CPU.
self
.
assertTrue
(
self
.
pipeline_8bit
.
transformer
.
device
.
type
==
"cuda"
)
self
.
assertTrue
(
self
.
pipeline_8bit
.
transformer
.
device
.
type
==
torch_device
)
# calling it again shouldn't be a problem
_
=
self
.
pipeline_8bit
(
prompt
=
self
.
prompt
,
...
...
@@ -534,7 +534,7 @@ class SlowBnb8bitTests(Base8bitTests):
).
to
(
device
)
# Check if inference works.
_
=
pipeline_8bit
(
"table"
,
max_sequence_length
=
20
,
num_inference_steps
=
2
)
_
=
pipeline_8bit
(
self
.
prompt
,
max_sequence_length
=
20
,
num_inference_steps
=
2
)
del
pipeline_8bit
...
...
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