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
46415f5a
Unverified
Commit
46415f5a
authored
Jan 04, 2024
by
Blake Wyatt
Committed by
GitHub
Jan 04, 2024
Browse files
Add CPU-loaded multi-GPU quantization (#289)
parent
2edb3f6f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
awq/quantize/quantizer.py
awq/quantize/quantizer.py
+8
-2
No files found.
awq/quantize/quantizer.py
View file @
46415f5a
...
@@ -81,9 +81,15 @@ class AwqQuantizer:
...
@@ -81,9 +81,15 @@ class AwqQuantizer:
# Move module and inputs to correct device
# Move module and inputs to correct device
common_device
=
next
(
self
.
modules
[
i
].
parameters
()).
device
common_device
=
next
(
self
.
modules
[
i
].
parameters
()).
device
if
common_device
is
None
or
str
(
common_device
)
==
"cpu"
:
if
common_device
is
None
or
str
(
common_device
)
==
"cpu"
:
self
.
modules
[
i
]
=
self
.
modules
[
i
].
cuda
()
self
.
modules
[
i
]
=
self
.
modules
[
i
].
cuda
(
"cuda:"
+
str
(
i
%
torch
.
cuda
.
device_count
())
)
common_device
=
next
(
self
.
modules
[
i
].
parameters
()).
device
common_device
=
next
(
self
.
modules
[
i
].
parameters
()).
device
if
self
.
module_kwargs
.
get
(
"position_ids"
)
is
not
None
:
self
.
module_kwargs
[
"position_ids"
]
=
self
.
module_kwargs
[
"position_ids"
].
to
(
common_device
)
if
self
.
module_kwargs
.
get
(
"attention_mask"
)
is
not
None
:
self
.
module_kwargs
[
"attention_mask"
]
=
self
.
module_kwargs
[
"attention_mask"
].
to
(
common_device
)
self
.
inps
=
self
.
inps
.
to
(
common_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
...
...
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