CVPR 2023 paper - Hard Sample Matters a Lot in Zero-Shot Quantization paper
Python >= 3.7.10
Pytorch == 1.8.1
take cifar10 as an example:
cd data_generate
"--save_path_head" in run_generate_cifar10.sh/run_generate_imagenet.sh is the path where you want to save your generated data pickle.
bash run_generate_cifar10.sh
cd ..
-
Modify "qw" and "qa" in cifar10_resnet20.hocon to select desired bit-width.
-
Modify "dataPath" in cifar10_resnet20.hocon to the real dataset path (for construct the test dataloader).
-
Modify "generateDataPath" and ""generateLabelPath" in cifar10_resnet20.hocon to the data_path and label_path you just generate from Stage1.
-
Use the commands in run.sh to train the quantized network. Please note that the model that generates the data and the quantized model should be the same.