Compare commits

...

1 Commits

Author SHA1 Message Date
Wing Lian
1a22d16842 handle empty offset for quant state 2025-05-01 13:01:00 -04:00

View File

@@ -55,12 +55,15 @@ def dequantize(
target_device = W.device
# Extract quantization state
nested = False
if not isinstance(quant_state, list):
# New style quant_state class
absmax = quant_state.absmax.to(target_device)
shape = quant_state.shape
dtype = quant_state.dtype
blocksize = quant_state.blocksize
if quant_state.nested:
nested = True
offset = quant_state.offset.to(target_device)
state2 = quant_state.state2
absmax2 = state2.absmax.to(target_device)
@@ -115,6 +118,7 @@ def dequantize(
ctypes.c_int(n_elements_absmax),
)
if nested:
out_absmax += offset
# Choose appropriate dequantization function