PTQ4ViT
PTQ4ViT copied to clipboard
How to load the quantized models with PTQ4ViT into the net?
Hi! Thanks for your great work! There was a problem when I was trying to load the quantized model 'vit_base_patch16_384.pth' (you've provided) into the net created by timm.create_model. The error is as follows.
RuntimeError: Error(s) in loading state_dict for VisionTransformer: Missing key(s) in state_dict: "cls_token", "pos_embed", "patch_embed.proj.weight", "patch_embed.proj.bias", "blocks.0.norm1.weight", "blocks.0.norm1.bias", "blocks.0.attn.qkv.weight", "blocks.0.attn.qkv.bias", "blocks.0.attn.proj.weight", "blocks.0.attn.proj.bias", "blocks.0.norm2.weight", "blocks.0.norm2.bias", "blocks.0.mlp.fc1.weight", "blocks.0.mlp.fc1.bias", "blocks.0.mlp.fc2.weight", "blocks.0.mlp.fc2.bias".......
Would you please provide the correct method to load your quantized model? Thank you a lot~
The quantized models only contains NN parameters in int8, which cannot be loaded and put into use directly. I would suggest you follow the given example files and quantize a model from given FP32 ones, which doesn't take too much time in our experiment setting.
I've only taken notice of the issues recently. I'll start working on a more user-friendly interface ASAP, so that you don't have to quantize a model from scratch .
Many thanks!!
Excellent work! But Ialso want to know when will the quantized model can be loaded by myself ? Looking forward your reply, thank you and have a good work!