Skip to content
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
6 changes: 6 additions & 0 deletions backends/vulkan/_passes/int4_weight_only_quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ def _create_quantized_state_dict(
self.groupsize,
self.precision, # dtype for scales_and_zeros
)
# If the packing of 2 4-bit values into a single 8-bit value was not
# performed in the previous function call, then do it manually now.
if w_int4x8.shape == weight.shape:
w_int4x8 = (w_int4x8[::, ::2] << 4 | w_int4x8[::, 1::2]).to(
torch.uint8
)
# In the original implementation, w_int4x8 is packed via calling the
# _convert_weight_to_int4pack operator before storing the weight. However
# the Vulkan implementation does not expect the weights to be packed, so
Expand Down
Loading