forked from openvinotoolkit/nncf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prepare_for_inference function for PyTorch models (openvinotoolki…
…t#1526) ### Changes 1. Add `prepare_for_inference` that convert compressed model to inference in PyTorch format without NNCF specific operations. - Convert `AsymmetricQuantizer` and `SymmetricQuantizer` to `FakeQuantize`. - Apply filter pruning masks to weights. by filing zeroes. - Apply sparsity binary masks to weights. 2. The class has also been fixed `ModelPruner`. 3. Fixed `get_scale_zp_from_input_low_input_high`, the zero_point type was incorrectly shifted by -1. ### Reason for changes Converting model to OpenVINO format directory. ### Related tickets CVS-92247 ### Tests - test_converting_symmetric_quantizer - test_converting_asymmetric_quantizer - test_prepare_for_inference_quantization - test_prepare_for_inference_pruning - test_prepare_for_inference_quantization_and_pruning - test_save_original_model Added `data_generators.py` to create input tensors with values in the middle of the quant points. To detect errors in this points that happens by difference in calculation in nncf and torch quantization formulas. <img src="https://user-images.githubusercontent.com/48012821/218319569-32339bc2-2790-4a3b-9b23-9bb480ffed16.png" height="400">
- Loading branch information
1 parent
7bad8e9
commit f79e9f7
Showing
21 changed files
with
1,838 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.