Zhen-Dong / HAWQ

Quantization library for PyTorch. Support low-precision and mixed-precision quantization, with hardware implementation through TVM.
MIT License
406 stars 83 forks source link

ModelZoo file formats #8

Closed wowow11111 closed 3 years ago

wowow11111 commented 3 years ago

When you unpack the downloaded model files from modleZoo files, some of them have different file formats. The instruction says as if they should all contain checkpoint.pth.tar file but, for example, resnet18_baseline.tar.gz, resnet18_uniform8, resnet50_baseline files contains just resnet.pth file.

What do I do with these file formats? Is it okay to just change the format?

Zhen-Dong commented 3 years ago

Hi, sorry for the confusion. To clarify, baseline files are not quantized, they contain pre-trained models from PyTorchCV. I double checked resnet18_uniform8 and found it has correct format checkpoint.pth.tar. In this codebase the baseline pre-trained model is automatically used if --pretrained is used in the command. Hope these clarifications can solve the problem.

wowow11111 commented 3 years ago

Thanks for the reply

wowow11111 commented 3 years ago

The file is not correct I think.

:137 need to be changed to params['module.quant_init_block_convbn.weight_integer']

also, the k value in line :141 should be changed to 2

also in line :149, the quant_identity_convbn is not in every stage, therefore error occurs.

IDK how this is run in your device... the whole hawq_utils_resnet50.py must be different from the one on your github page.

wowow11111 commented 3 years ago

The file "hawq_utils_resnet50.py" obviously only matches to 'resnet50' network format, and makes multiple errors for resnet18_uniform8, and even you run on resnet50 uniform8, this code still has problem with 'keyerror' which is also filed as an issue in other one.