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
6f516b8d
Unverified
Commit
6f516b8d
authored
Nov 16, 2023
by
Casper
Committed by
GitHub
Nov 16, 2023
Browse files
Fixed multi-GPU quantization (#196)
parent
74d0fe44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
awq/quantize/quantizer.py
awq/quantize/quantizer.py
+8
-1
No files found.
awq/quantize/quantizer.py
View file @
6f516b8d
...
@@ -69,8 +69,15 @@ class AwqQuantizer:
...
@@ -69,8 +69,15 @@ class AwqQuantizer:
def
quantize
(
self
):
def
quantize
(
self
):
for
i
in
tqdm
(
range
(
len
(
self
.
modules
)),
desc
=
"AWQ"
):
for
i
in
tqdm
(
range
(
len
(
self
.
modules
)),
desc
=
"AWQ"
):
# Move module and inputs to correct device
common_device
=
next
(
self
.
modules
[
i
].
parameters
()).
device
if
common_device
is
None
or
str
(
common_device
)
==
"cpu"
:
self
.
modules
[
i
]
=
self
.
modules
[
i
].
cuda
()
common_device
=
next
(
self
.
modules
[
i
].
parameters
()).
device
self
.
inps
=
self
.
inps
.
to
(
common_device
)
# [STEP 1]: Get layer, extract linear modules, extract input features
# [STEP 1]: Get layer, extract linear modules, extract input features
self
.
modules
[
i
]
=
self
.
modules
[
i
].
cuda
()
named_linears
=
get_named_linears
(
self
.
modules
[
i
])
named_linears
=
get_named_linears
(
self
.
modules
[
i
])
input_feat
=
self
.
_get_input_feat
(
self
.
modules
[
i
],
named_linears
)
input_feat
=
self
.
_get_input_feat
(
self
.
modules
[
i
],
named_linears
)
clear_memory
()
clear_memory
()
...
...
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