Skip to content

Commit

Permalink
[Bugfix] Move observer and g_idx until after module in onloaded (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylesayrs authored Oct 23, 2024
1 parent d3dea3f commit 07abbf3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/compressed_tensors/quantization/lifecycle/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 07abbf3

Please sign in to comment.