Skip to content
Merged
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
5 changes: 4 additions & 1 deletion neural_compressor/utils/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,10 @@ def recover_model_from_json(model, json_file_path, example_inputs):
ipex = LazyImport("intel_extension_for_pytorch")
from torch.ao.quantization.observer import MinMaxObserver

qconfig = ipex.quantization.get_smooth_quant_qconfig_mapping(alpha=0.5, act_observer=MinMaxObserver())
if ipex.__version__ >= "2.1.100":
qconfig = ipex.quantization.get_smooth_quant_qconfig_mapping(alpha=0.5, act_observer=MinMaxObserver)
else:
qconfig = ipex.quantization.get_smooth_quant_qconfig_mapping(alpha=0.5, act_observer=MinMaxObserver())
if isinstance(example_inputs, dict):
model = ipex.quantization.prepare(model, qconfig, example_kwarg_inputs=example_inputs, inplace=True)
else:
Expand Down