Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions awq/quantize/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,13 @@ def forward(self, *args, **kwargs):
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]
Expand Down