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
4d5a96e4
Unverified
Commit
4d5a96e4
authored
Apr 02, 2025
by
jiqing-feng
Committed by
GitHub
Apr 02, 2025
Browse files
fix autocast (#11190)
Signed-off-by:
jiqing-feng
<
jiqing.feng@intel.com
>
parent
a7f07c1e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
tests/quantization/bnb/test_mixed_int8.py
tests/quantization/bnb/test_mixed_int8.py
+1
-1
No files found.
tests/quantization/bnb/test_mixed_int8.py
View file @
4d5a96e4
...
@@ -221,7 +221,7 @@ class BnB8bitBasicTests(Base8bitTests):
...
@@ -221,7 +221,7 @@ class BnB8bitBasicTests(Base8bitTests):
self
.
assertTrue
(
module
.
weight
.
dtype
==
torch
.
int8
)
self
.
assertTrue
(
module
.
weight
.
dtype
==
torch
.
int8
)
# test if inference works.
# test if inference works.
with
torch
.
no_grad
()
and
torch
.
amp
.
autocast
(
"cuda"
,
dtype
=
torch
.
float16
):
with
torch
.
no_grad
()
and
torch
.
autocast
(
model
.
device
.
type
,
dtype
=
torch
.
float16
):
input_dict_for_transformer
=
self
.
get_dummy_inputs
()
input_dict_for_transformer
=
self
.
get_dummy_inputs
()
model_inputs
=
{
model_inputs
=
{
k
:
v
.
to
(
device
=
torch_device
)
for
k
,
v
in
input_dict_for_transformer
.
items
()
if
not
isinstance
(
v
,
bool
)
k
:
v
.
to
(
device
=
torch_device
)
for
k
,
v
in
input_dict_for_transformer
.
items
()
if
not
isinstance
(
v
,
bool
)
...
...
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