onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

CalibrationMethod.Entropy failing

Open piedras77 opened this issue 3 years ago • 1 comments

Describe the issue

While I try to use any Histogram-based calibrator, such as CalibrationMethod.Entropy, I get the following error: ValueError: Histogram has not been collected. Please run collect() first There is no documentation or whatsoever on how to call collect(), and this function has a required parameter, that I don't know what it is or how to generate

To reproduce

I face the issue while following this official tutorial: https://github.com/microsoft/onnxruntime-inference-examples/tree/main/quantization/nlp/bert/trt

Urgency

Blocked without quantization

Platform

Linux

OS Version

Ubuntu 18.04.6

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.12.1

ONNX Runtime API

Python

Architecture

X86

Execution Provider

CUDA, TensorRT

Execution Provider Library Version

No response

piedras77 avatar Sep 21 '22 22:09 piedras77

Did you call collection_data as the example shows here: https://github.com/microsoft/onnxruntime-inference-examples/blob/743a310db7a90db1e8ffddc2768cb48258e2674b/quantization/nlp/bert/trt/e2e_tensorrt_bert_example.py#L251

yufenglee avatar Sep 22 '22 16:09 yufenglee

Yes, I did. The issue actually was a syntax error from my side nested deep in the code, where the op_types_to_quantize had a comma at the end, making it a tuple, the exception catch was generic and showing this although it had nothing to do with it. Thanks for the fast reply nonetheless.

piedras77 avatar Sep 23 '22 18:09 piedras77