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
9848b6a4
Commit
9848b6a4
authored
Sep 20, 2023
by
Casper Hansen
Browse files
Correct comments
parent
c9d01ac3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
awq/quantize/quantizer.py
awq/quantize/quantizer.py
+2
-3
No files found.
awq/quantize/quantizer.py
View file @
9848b6a4
...
...
@@ -176,14 +176,13 @@ class AwqQuantizer:
# create new scales
ratio
=
ratio
/
n_grid
#
s^-1
#
NOTE: s^-1 * x is fused here, according to paper
scales
=
(
x_max
.
pow
(
ratio
)
/
w_max
.
pow
(
1
-
ratio
)).
clamp
(
min
=
1e-4
)
scales
=
scales
/
(
scales
.
max
()
*
scales
.
min
()).
sqrt
()
scales_view
=
scales
.
view
(
1
,
-
1
).
to
(
device
)
#
NOTE: s^-1 * x is fused here, according to paper
#
Q(W * s)
for
fc
in
linears2scale
:
# Q(W * s)
fc
.
weight
.
mul_
(
scales_view
)
fc
.
weight
.
data
=
self
.
pseudo_quantize_tensor
(
fc
.
weight
.
data
)
/
scales_view
...
...
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