fix: improve scales change and revert conditional

This commit is contained in:
drbh 2024-08-14 16:38:15 +00:00
parent ab4d480d91
commit 4b10c8c30b
1 changed files with 5 additions and 2 deletions

View File

@ -38,9 +38,12 @@ class GPTQMarlinFP8Linear(nn.Module):
log_once(logger.info, "GPU does not support FP8, using Marlin FP8 kernel")
# if scales is a scalar (0D tensor), convert it to a 1D tensor
if scales.dim() == 0:
scales = scales.unsqueeze(0)
scales = scales.unsqueeze(0)
# repack weights for Marlin if a single scale is provided
if scales.size(0) == 1:
if scales.shape[1] == 1:
out_features, in_features = qweight.shape
scales = scales.repeat(1, out_features)
qweight, scales = repack_fp8_for_marlin(qweight, scales)