Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove set_mode from import_encoding fcns #2751

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ def import_param_encodings(self, encodings: Dict[str, List[Dict]], ignore_when_q
"configuration as the quantsim which was used to export the encodings")


self.set_mode(QcQuantizeOpMode.ACTIVE)

def import_output_encodings(self, encodings: Dict[str, Dict], ignore_when_quantizer_disabled: bool = False):
"""
Import output encodings represented in below format:
Expand Down Expand Up @@ -580,8 +578,6 @@ def _import_encoding(self, encodings, quantizers, ignore_when_quantizer_disabled
else:
raise RuntimeError("Unrecognized encodings datatype")

self.set_mode(QcQuantizeOpMode.ACTIVE)


class StaticGridQuantWrapper(QcQuantizeWrapper):
""" A custom PyTorch module that derives from QcQuantizeWrapper and quantizes modules """
Expand Down
3 changes: 3 additions & 0 deletions TrainingExtensions/torch/src/python/aimet_torch/quantsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,9 @@ def load_encodings_to_sim(quant_sim_model: QuantizationSimModel, pytorch_encodin
if not isinstance(module, ExportableQuantModule):
continue

if isinstance(module, QcQuantizeWrapper):
module.set_mode(QcQuantizeOpMode.ACTIVE)

param_encoding = {
param_name: param_encodings[f'{module_name}.{param_name}']
for param_name, _ in module.param_quantizers.items()
Expand Down
Loading