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
OpenDAS
AutoAWQ
Commits
149236e4
Unverified
Commit
149236e4
authored
Jan 24, 2024
by
Casper
Committed by
GitHub
Jan 24, 2024
Browse files
Up to 60% faster context processing (#316)
parent
c6c7b065
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
awq/modules/linear/gemm.py
awq/modules/linear/gemm.py
+17
-3
No files found.
awq/modules/linear/gemm.py
View file @
149236e4
...
...
@@ -153,9 +153,23 @@ class WQLinear_GEMM(nn.Module):
x
=
x
.
half
()
if
AWQ_INSTALLED
:
out
=
awq_ext
.
gemm_forward_cuda
(
x
.
reshape
(
-
1
,
x
.
shape
[
-
1
]),
self
.
qweight
,
self
.
scales
,
self
.
qzeros
,
8
)
FP16_MATMUL_HEURISTIC_CONDITION
=
x
.
shape
[
0
]
*
x
.
shape
[
1
]
>=
1024
if
FP16_MATMUL_HEURISTIC_CONDITION
:
out
=
awq_ext
.
dequantize_weights_cuda
(
self
.
qweight
,
self
.
scales
,
self
.
qzeros
,
0
,
0
,
0
,
False
)
out
=
torch
.
matmul
(
x
,
out
)
else
:
out
=
awq_ext
.
gemm_forward_cuda
(
x
.
reshape
(
-
1
,
x
.
shape
[
-
1
]),
self
.
qweight
,
self
.
scales
,
self
.
qzeros
,
8
)
else
:
out
=
dequantize_gemm
(
self
.
qweight
,
...
...
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