-
Notifications
You must be signed in to change notification settings - Fork 281
Add PTQ example for PyTorch CV - Segment Anything Model #1464
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refer to torchvision example for a similar format and process:
- After quantization,
q_model
needs to be saved, then loaded for accuracy and benchmark. - Users should be able to load either fp32 or int8 model.
- Need to add benchmark part using INC's
BenchmarkConfig
. - The example should include bash scripts to run tuning and benchmark separately.
Hi, |
Please update the flag name in comment as well as in shell scripts and README. There are also some spell errors in pre-ci. Others look good to me, thanks! |
There are 2 new components used by this PR, |
Type of Change
I am adding one more CV example (first segmentation foundation model) to demonstrate the usage of INC.
Description
SAM is the first segmentation foundation model in the CV domain. It is composed of ViT and several image decoding layers. By applying suitable quantizations on specific layers, it is found that there is only a slight drop in the dice metric (~0.01). This can be an example of CV users adapting INC in their use case.
Expected Behavior & Potential Risk
Users will base on the example code to experiment INC on SAM. No risk to the existing code base.
How has this PR been tested?
Replicate the steps according to the readme in a new environment.
It is tested on Intel(R) Xeon(R) Platinum 8280 CPU @ 2.70GHz
Dependency Change?
Users have to install the following packages in order to run the example. 'torchmetrics' is a new package to the user.
torchvision
tdqm
torchmetrics
neural-compressor