Skip to content

Commit 2a9b828

Browse files
authored
Merge pull request #156 from pytorch-labs/094_fix_shape_gptq
shape fix for gptq
2 parents 095b222 + f2c6534 commit 2a9b828

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

quantize.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,10 @@ def __init__(self, mod, groupsize=128, inner_k_tiles=8, padding=True):
458458
# we need to do the padding here, both for q and the qparams if necessary
459459
def make_names_and_values_dict_func(q, qparams):
460460
k = q.shape[1]
461-
new_k = find_multiple(k, 1024)
461+
if not _check_linear_int4_k(k, groupsize, inner_k_tiles):
462+
new_k = find_multiple(k, 1024)
463+
else:
464+
new_k = k
462465
# how much we need to pad the weight
463466
delta_k = new_k - q.shape[1]
464467
final_q = torch.ops.aten._convert_weight_to_int4pack(F.pad(q, pad=(0, delta_k)), inner_k_tiles)

0 commit comments

Comments
 (0)