Does PyTorch 2.1 Support Learnable Post-Training Quantization?

I’m exploring PyTorch 2.1’s quantization features and have a question: Is learnable post-training quantization (PTQ) supported in this version? Specifically, I’m interested in adjusting quantization parameters, like scales, while keeping other model weights fixed.

Thank you for your assistance and insights.

yes, it’s possible to support this, you’ll need to write your own quantizer though: How to Write a Quantizer for PyTorch 2 Export Quantization — PyTorch Tutorials 2.1.1+cu121 documentation and you can use this to specify the LearnableFakeQuant: https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/quantizer/quantizer.py#L59
https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/_learnable_fake_quantize.py

I’m not sure what learnable PTQ means actually

1 Like