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
78b59d73
Unverified
Commit
78b59d73
authored
Dec 11, 2023
by
Younes Belkada
Committed by
GitHub
Dec 11, 2023
Browse files
[`core`] Fix quantization issues with transformers==4.36.0 (#249)
parent
ae24f424
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
awq/quantize/quantizer.py
awq/quantize/quantizer.py
+7
-0
No files found.
awq/quantize/quantizer.py
View file @
78b59d73
...
...
@@ -342,6 +342,13 @@ class AwqQuantizer:
self
.
model
(
samples
.
to
(
next
(
self
.
model
.
parameters
()).
device
))
except
ValueError
:
# work with early exit
pass
# Update the layer kwargs with `prepare_inputs_for_generation` method
# that takes care of everything to avoid unexpected errors.
layer_kwargs
=
self
.
model
.
prepare_inputs_for_generation
(
samples
,
**
layer_kwargs
)
# Pop the input_ids as they are not needed at all.
layer_kwargs
.
pop
(
"input_ids"
)
del
samples
modules
[
0
]
=
modules
[
0
].
module
# restore
inps
=
inps
[
0
]
...
...
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