aimet_encoding error
Hi, I followed the instructions to run the yolov8_det_quantized model demo and got following error. Can you please help me fix the issue. Thanks.
Traceback (most recent call last):
File "***********************lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "***********************lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "***********************lib/python3.8/site-packages/qai_hub_models/models/yolov8_det_quantized/demo.py", line 25, in
main()
File "***********************lib/python3.8/site-packages/qai_hub_models/models/yolov8_det_quantized/demo.py", line 15, in main
yolo_detection_demo(
File "***********************lib/python3.8/site-packages/qai_hub_models/models/_shared/yolo/demo.py", line 57, in yolo_detection_demo
model = demo_model_from_cli_args(model_type, model_id, args)
File "***********************lib/python3.8/site-packages/qai_hub_models/utils/args.py", line 323, in demo_model_from_cli_args
inference_model = model_from_cli_args(model_cls, cli_args)
File "***********************lib/python3.8/site-packages/qai_hub_models/utils/args.py", line 262, in model_from_cli_args
return model_cls.from_pretrained(**get_model_kwargs(model_cls, vars(cli_args)))
File "***********************lib/python3.8/site-packages/qai_hub_models/models/yolov8_det_quantized/model.py", line 85, in from_pretrained
load_encodings_to_sim(sim, aimet_encodings)
File "***********************lib/python3.8/site-packages/aimet_torch/utils.py", line 1205, in fn_wrapper
return _callable(*args, **kwargs)
File "***********************lib/python3.8/site-packages/aimet_torch/quantsim.py", line 2195, in load_encodings_to_sim
quant_sim_model.load_encodings(pytorch_encoding_path,
File "***********************lib/python3.8/site-packages/aimet_torch/quantsim.py", line 1687, in load_encodings
self._load_encodings_impl(encodings, strict, partial, requires_grad, allow_overwrite)
File "***********************lib/python3.8/site-packages/aimet_torch/quantsim.py", line 1715, in _load_encodings_impl
raise RuntimeError(msg)
RuntimeError: Encoding dictionary contains modules/parameters that doesn't exist in the model: model.model.22.module_truediv, module_truediv_2
Thanks for reporting. Will look into it.
It works for me now by changing the model loading from
.from_pretrained(
ckpt_name="yolov8s.pt"
)
to
.from_pretrained(
ckpt_name="yolov8s.pt", aimet_encodings=None, include_postprocessing=True
)
This is fixed in our latest release, v0.15.0. Let us know if you still hit the issue.