Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
965fd5d5
Commit
965fd5d5
authored
Sep 20, 2023
by
Ruslan Svirschevski
Browse files
test update
parent
4c11d6dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tests/test_linear4bit.py
tests/test_linear4bit.py
+3
-3
No files found.
tests/test_linear4bit.py
View file @
965fd5d5
...
@@ -56,11 +56,11 @@ def test_linear4_state_dict(quant_type, compress_statistics, bias):
...
@@ -56,11 +56,11 @@ def test_linear4_state_dict(quant_type, compress_statistics, bias):
compute_dtype
=
compute_dtype
,
compute_dtype
=
compute_dtype
,
compress_statistics
=
compress_statistics
,
compress_statistics
=
compress_statistics
,
quant_type
=
quant_type
,
quant_type
=
quant_type
,
device
=
device
,
device
=
'meta'
,
)
)
linear_q2
.
weight
=
weight2
.
to
(
device
)
linear_q2
.
weight
=
weight2
.
to
(
device
)
if
bias
:
if
bias
:
linear_q2
.
bias
.
data
=
bias_data2
linear_q2
.
bias
=
torch
.
nn
.
Parameter
(
bias_data2
)
# matching
# matching
a
,
b
=
linear_q
.
weight
,
linear_q2
.
weight
a
,
b
=
linear_q
.
weight
,
linear_q2
.
weight
...
@@ -93,7 +93,7 @@ def test_linear4_state_dict(quant_type, compress_statistics, bias):
...
@@ -93,7 +93,7 @@ def test_linear4_state_dict(quant_type, compress_statistics, bias):
assert
torch
.
equal
(
a
,
b
)
assert
torch
.
equal
(
a
,
b
)
# Forward test
# Forward test
x
=
torch
.
rand
(
42
,
l
inear_q
.
shape
[
-
1
],
device
=
device
)
x
=
torch
.
rand
(
42
,
l
ayer_
shape
[
0
],
device
=
device
)
a
=
linear_q
(
x
)
a
=
linear_q
(
x
)
b
=
linear_q2
(
x
)
b
=
linear_q2
(
x
)
assert
a
.
device
==
b
.
device
assert
a
.
device
==
b
.
device
...
...
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