Open sandeep1404 opened 9 months ago
Hello @sandeep1404 Could you please share minimal script to reproduce the issue?
Hi @quic-hitameht Thanks for the reply, PFA of my notebook file for your kind reference. ptq_test_aimet-resnet50_mnist_final.pdf
Hi, I was trying to do mnist classification using the VGG model, and when was trying to perform AutoQuant on the model, I was getting an accuracy of 0.09 i.e. 9%. I don't understand what's happening inside the autoquant, it is trying to perform CLE,adaround, and batch norm folding. When I was trying to give mnist test dataset for the calibration data, I was getting an accuracy of less than 10%, why is there a huge drop even with 32-bit floating point weights and activation? When I try to print the predictions, almost all the predictions are the same why is this happening?PFA of the code file. Can you please let me know where I am going wrong? I am following the below documentation https://quic.github.io/aimet-pages/releases/latest/api_docs/tensorflow_auto_quant.html .
This picture shows the accuracy obtained after performing batchnorm folding and autoquant operations, but still, the accuracy is the same as floating point accuracy, so there is some mistake at my end that I cannot figure out can someone kindly check it and let me know where I am going wrong.
Hi Team, Any update on this issue? Can someone look it and tell me whats going wrong.
hello @sandeep1404 sorry for delayed response.
It seems there is an issue with your eval_callback
function. Before you run AutoQuant.apply(...)
, you should first simply evaluate model with your eval_callback
function to get W32A32 (or FP32) accuracy and that should be same as when you run model.evaluate
which gives you Test accuracy: 0.991599977016449
to begin with. This will help us to narrow down the issue. Once this is fixed, we can go ahead and apply AutoQuant API.
AutoQuant internally applies BN fold, Cross-layer equalization and Adaround in a best-effort manner until the model meets the evaluation goal given as allowed_accuracy_drop
.
Please find following responses to your questions.
eval_callback
function is incorrectly calculated, the target accuracy is also incorrect and negative (0.0924 - 0.15) as allowed_accuracy_drop
is 0.15. Due to this, only BN fold technique is applied and the exit conditions are met that is the reason why your "quantized accuracy" is same as FP32 accuracy! Furthermore, you can specify per-tensor vs per-channel quantization configurations via config file when invoking AutoQuant
object. Please refer to API doc for more details.eval_callback
function and thus only BN fold technique is applied and has same accuracy as FP32 accuracy because BN folded model is mathematically equivalent to a model w/ BN layers from an inference perspective.Hope this helps. Please let us know if you have further questions.
Hi all, I was trying to use ResNet50 model for mnist digit classification, after training the model i was trying to perform Autoquant operation on the model it is always giving eval accuracy as 0, I am not sure where i went wrong and cannot able to debug the problem, can someone help in resolving this issue. Thank you in Advance.