Skip to content

Commit

Permalink
Merge branch 'main' into fix_sparsity_test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsikka authored Oct 31, 2024
2 parents d4affb2 + 60c766f commit 30c2315
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 30c2315

Please sign in to comment.