Skip to content

Commit c4de198

Browse files
authored
fix QA IPEX example fp32 input issue (#1661)
Signed-off-by: Cheng, Zixuan <zixuan.cheng@intel.com>
1 parent b0dc0de commit c4de198

File tree

1 file changed

+4
-1
lines changed
  • examples/pytorch/nlp/huggingface_models/question-answering/quantization/ptq_static/ipex

1 file changed

+4
-1
lines changed

examples/pytorch/nlp/huggingface_models/question-answering/quantization/ptq_static/ipex/run_qa.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,10 @@ def eval_func(model):
687687
example_inputs = get_example_inputs(model, eval_dataloader)
688688
model = ipex.optimize(model)
689689
with torch.no_grad():
690-
model = torch.jit.trace(model, example_kwarg_inputs=example_inputs, strict=False)
690+
if isinstance(example_inputs, dict):
691+
model = torch.jit.trace(model, example_kwarg_inputs=example_inputs, strict=False)
692+
else:
693+
model = torch.jit.trace(model, example_inputs, strict=False)
691694
model = torch.jit.freeze(model)
692695

693696
if model_args.benchmark or model_args.accuracy_only:

0 commit comments

Comments
 (0)