-
Notifications
You must be signed in to change notification settings - Fork 240
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
[Torch] Serialize and load NNCF transformations #2531
[Torch] Serialize and load NNCF transformations #2531
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2531 +/- ##
============================================
- Coverage 91.20% 29.88% -61.32%
============================================
Files 493 495 +2
Lines 45519 45961 +442
============================================
- Hits 41514 13734 -27780
- Misses 4005 32227 +28222
... and 323 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
922170d
to
953f395
Compare
86d1356
to
e8f7f15
Compare
d616ca0
to
ec9e451
Compare
42d0b67
to
c95fcf6
Compare
5f834bb
to
59ab905
Compare
Preparation for #2531 ### Changes 1) `PTQuantizerInsertionCommand` is removed and replaced with create_quantizer_insertion_command function 2) `SharedFNInsertionCommand` updates with one new attribute: compression_module_type 3) `ExtraOpCallHook` doesn't require context in constructor anymore 4) Multidevice support is moved from `apply_quantizers_insertion_commands_transformation` to `apply_insertion_transformation` ### Reason for changes 1) To make it easier to store and restore commands: less commands - less amount of adapters are needed 2) To make it possible to express `PTQuantizerInsertionCommand` by `SharedFNInsertionCommand` 3) To make it possible to create `ExtraOpCallHook` outside of the `PTModelTransformer` 4) To unify multidevice support for all insertion operations ### Related tickets 2531 ### Tests 1)`test_quantizer_insertion_transformation` is updated 2) - 3) `test_shared_fn_insertion_point` is updated 4) `test_pt_insertion_command` is introduced
59ab905
to
8ec693f
Compare
808d068
to
f14aa92
Compare
API code moved to a separate PR
846fe06
to
fa077fa
Compare
nncf/torch/layer_utils.py
Outdated
""" | ||
|
||
@abstractmethod | ||
def get_state(self) -> Dict[str, Any]: |
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.
What do you think about get_config
, from_config
to align with high-level API?
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.
Done
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.
LGTM
### Changes `_compression_lr_multiplier` attribute introduced in #2531 is removed from the `CompressionParameter` ### Reason for changes `_compression_lr_multiplier` makes the `CompressionParameter` a stateful parameter which for some reason does not work properly in distributed/dataparallel mode ### Tests torch_nightly/213/ - finished successfully
On top of #2584 #2595
Changes
serialize_transformations
andload_transformations
functions are introduced:serialize_transformations
could serializePTTransformationLayout
to a dict which could be serialized by json; serialized transformation could be recovered by theload_transformations
function.StatefullTorchModuleInterface
is introduced to make it possible to serialize all compression modules for quantization, sparisification, weights compression and pruning algorithmsReason for changes
nncf.quantize
and quantizes initializationRelated tickets
129586
Tests