Home

Awesome

<div align="center"> <h2>PD-Quant</h2> <h4>PD-Quant: Post-Training Quantization Based on Prediction Difference Metric</h4> <div> <a href="https://arxiv.org/abs/2212.07048">[arXiv]</a> </div> </div>

Usage

1. Download pre-trained FP model.

The pre-trained FP models in our experiment comes from BRECQ, they can be downloaded in link. And modify the path of the pre-trained model in hubconf.py.

2. Installation.

python >= 3.7.13
numpy >= 1.21.6
torch >= 1.11.0
torchvision >= 0.12.0

3. Run experiments

You can run run_script.py for different models including ResNet18, ResNet50, RegNet600, RegNet3200, MobilenetV2, and MNasNet. It will experiment on 4 bit settings including W2A2, W4A2, W2A4, and W4A4.

Take ResNet18 as an example:

python run_script.py resnet18

Results

MethodsBits (W/A)Res18Res50MNV2Reg600MReg3.2GMNasx2
Full Prec.32/3271.0176.6372.6273.5278.4676.52
PD-Quant4/469.3075.0968.3371.0476.5773.30
PD-Quant2/465.0770.9255.2764.0072.4363.33
PD-Quant4/258.6564.1820.4051.2962.7638.89
PD-Quant2/253.0856.9814.1740.9255.1328.03

Reference

@article{liu2022pd,
  title={PD-Quant: Post-Training Quantization based on Prediction Difference Metric},
  author={Liu, Jiawei and Niu, Lin and Yuan, Zhihang and Yang, Dawei and Wang, Xinggang and Liu, Wenyu},
  journal={arXiv preprint arXiv:2212.07048},
  year={2022}
}

Thanks

Our code is based on QDROP by @wimh966.