Skip to content

Commit

Permalink
Bugfix get observer from name (#883)
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Tuli <[email protected]>
  • Loading branch information
rahul-tuli authored Oct 31, 2024
1 parent 18e9a9f commit 60c766f
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from llmcompressor.modifiers.utils import SPARSITY_THRESHOLD
from llmcompressor.modifiers.utils.compression_wrapper import ModuleCompressionWrapper
from llmcompressor.observers import Observer
from llmcompressor.pytorch.utils.helpers import tensor_sparsity
from llmcompressor.utils import getattr_chain
from llmcompressor.utils.metric_logging import (
Expand Down Expand Up @@ -303,6 +304,7 @@ def _update_quantization_parameters(self, args: QuantizationArgs, W: torch.Tenso
:param W: weight to calculate quantization parameters from
"""
observer = args.get_observer()
observer = Observer.load_from_registry(observer, quantization_args=args)
_scale, _zero_point = observer(W, g_idx=None)
update_parameter_data(self.layer, _scale, "weight_scale")
update_parameter_data(self.layer, _zero_point, "weight_zero_point")
Expand Down

0 comments on commit 60c766f

Please sign in to comment.