Skip to content

Commit

Permalink
Fix step size when computing clipping (casper-hansen#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
casper-hansen authored Jul 2, 2024
1 parent c025b15 commit 2be6ccc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion awq/quantize/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,11 @@ def _compute_best_clip(
group_size = self.group_size if self.group_size > 0 else org_w_shape[1]
input_feat = input_feat.view(-1, input_feat.shape[-1])
input_feat = input_feat.reshape(1, input_feat.shape[0], -1, group_size)
input_feat = input_feat[:, 0 :: input_feat.shape[1] // n_sample_token]

# Compute input feature step size (minimum 1)
step_size = max(1, input_feat.shape[1] // n_sample_token)
input_feat = input_feat[:, ::step_size]

w = w.reshape(org_w_shape[0], 1, -1, group_size)

oc_batch_size = 256 if org_w_shape[0] % 256 == 0 else 64 # prevent OOM
Expand Down

0 comments on commit 2be6ccc

Please sign in to comment.