Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scales when variable is unsigned #35599

Merged
merged 1 commit into from
Sep 12, 2021

Conversation

wozna
Copy link
Contributor

@wozna wozna commented Sep 8, 2021

PR types

Bug fixes

PR changes

Others

Describe

This PR:

  • fixes updating scales in the quant-aware training quantization process. In this process we tag vars which are after relu op, to unsigned. But if this var was before tagged as signed, it means that the scales for this var were already computed for signed data. To resolve that, scales for this var must be multiplied by 2 to fill the entire range of uint8. This change should improve accuracy in QAT models.
  • changes batch size in inference_quant2_int8_image_classification_test because the above fix improve acc in resnet50 test and acc comparison QAT with PTQ int8 failed.

Graph showing the change:
Scales

@paddle-bot-old
Copy link

paddle-bot-old bot commented Sep 8, 2021

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@jczaja jczaja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wozna
Copy link
Contributor Author

wozna commented Sep 10, 2021

Please wait with the merging until I finish functional tests for all models.

Copy link
Contributor

@lidanqing-intel lidanqing-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It solved QAT LSTM accuracy diff issue. Thanks

@jczaja jczaja merged commit b480664 into PaddlePaddle:develop Sep 12, 2021
AnnaTrainingG pushed a commit to AnnaTrainingG/Paddle that referenced this pull request Sep 29, 2021
@wozna wozna deleted the quant2_acc_lstm branch February 24, 2023 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants