microsoft / microsoft/onnxruntime-inference-examples
DenseNet static quantization error
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 414
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 14
Description
I fine tuned a PyTorch DenseNet121 for binary classification and exported it as .onnx model. It works just fine with onnxruntime. Then, I followed this sample implementation https://github.com/microsoft/onnxruntime-inference-examples/blob/c9a65be0c649870a56b5d702d54b2b927de212e7/quantization/image_classification/cpu/run.py for static quantization. It creates the .quant.onnx file, but gives an error when benchmarking. Specifically, the error is thrown at session = onnxruntime.InferenceSession(model_path) call. Below is the error code:
Traceback (most recent call last):
File "C:\venvs\pytorch10_py38\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 324, in __init__
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\venvs\pytorch10_py38\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 369, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during initialization: D:\a\_work\1\s\onnxruntime\contrib_ops\cpu\qlinear_concat.cc:35 onnxruntime::contrib::QLinearConcat::QLinearConcat input_def_count >= 8 && (input_def_count - 2) % 3 == 0 was false. At least two inputs are needed, and each input must be (tensor, scale, zero_point) tuple!
Process finished with exit code 1
Is this fixable or DenseNet is not yet supported?
Thank you.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with quantization/image_classification/cpu/run.py from the linked ONNX Runtime example and reproduce the failure at onnxruntime.InferenceSession(model_path). Inspect the generated .quant.onnx model and the QLinearConcat error to determine whether DenseNet121 is supported. Done means establishing a reproducible resolution or documenting the support limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100