Skip to content

quantize onnx models to INT8 #24374

@suyash-narain

Description

@suyash-narain

How can we quantize FP32 pretrained ONNX models to INT8 (static)?
the current method as mentioned for static quantization follows the below method:

quantize_static(
        input_model_path,
        output_model_path,
        dr,
        quant_format=args.quant_format,
        per_channel=args.per_channel,
        weight_type=QuantType.QInt8,
    )

where dr is the data_reader class directory.
seems like it needs to be defined in the model class.
But for models which are not trained by me at all, how can i quantize them to INT8?
can i use a dummy dataset based on input shape like we do fro TFLite?

is there any other way to quantize the model to INT8 just for the purposes of inferencing with dummy data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    quantizationissues related to quantizationstaleissues that have not been addressed in a while; categorized by a bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions