Skip to content

Commit 07abbf3

Browse files
authored
[Bugfix] Move observer and g_idx until after module in onloaded (#195)
1 parent d3dea3f commit 07abbf3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/compressed_tensors/quantization/lifecycle/calibration.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,12 @@ def set_module_for_calibration(module: Module, quantize_weights_upfront: bool =
6464
quantization_args=module.quantization_scheme.weights,
6565
)
6666

67-
observer = module.weight_observer
68-
69-
g_idx = getattr(module, "weight_g_idx", None)
70-
7167
offloaded = is_module_offloaded(module)
7268
if offloaded:
7369
module._hf_hook.pre_forward(module)
7470

71+
observer = module.weight_observer
72+
g_idx = getattr(module, "weight_g_idx", None)
7573
scale, zero_point = observer(module.weight, g_idx=g_idx)
7674
update_parameter_data(module, scale, "weight_scale")
7775
update_parameter_data(module, zero_point, "weight_zero_point")

0 commit comments

Comments
 (0)