From 07abbf3b9d9a7ec1f497a192241030181c480d66 Mon Sep 17 00:00:00 2001 From: Kyle Sayers Date: Wed, 23 Oct 2024 15:25:05 -0400 Subject: [PATCH] [Bugfix] Move observer and g_idx until after module in onloaded (#195) --- .../quantization/lifecycle/calibration.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/compressed_tensors/quantization/lifecycle/calibration.py b/src/compressed_tensors/quantization/lifecycle/calibration.py index 66dc35a0..c9e51813 100644 --- a/src/compressed_tensors/quantization/lifecycle/calibration.py +++ b/src/compressed_tensors/quantization/lifecycle/calibration.py @@ -64,14 +64,12 @@ def set_module_for_calibration(module: Module, quantize_weights_upfront: bool = quantization_args=module.quantization_scheme.weights, ) - observer = module.weight_observer - - g_idx = getattr(module, "weight_g_idx", None) - offloaded = is_module_offloaded(module) if offloaded: module._hf_hook.pre_forward(module) + observer = module.weight_observer + g_idx = getattr(module, "weight_g_idx", None) scale, zero_point = observer(module.weight, g_idx=g_idx) update_parameter_data(module, scale, "weight_scale") update_parameter_data(module, zero_point, "weight_zero_point")