-
Notifications
You must be signed in to change notification settings - Fork 244
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
[NNCF]: Optimized memory footprint by removing redundant collected statistics #2563
Conversation
TODO: Integrate the method into the pipeline
In .build/ folder as well
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2563 +/- ##
============================================
- Coverage 77.91% 52.32% -25.59%
============================================
Files 494 494
Lines 45387 45387
============================================
- Hits 35363 23749 -11614
- Misses 10024 21638 +11614
... and 276 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Thank you for looking into the issue!
General recommendation: I suggest beginning with Test-Driven Development (TDD) by initially crafting a test case.
- Add multiple statistical points.
- Subsequently remove some of them/all. Don't forget about edge cases.
- Concluding with a final verification to ensure the function operates as intended.
Co-authored-by: Aleksei Kashapov <[email protected]>
@kshpv Are any actions expected from me any further? |
Could you add a test on this functionality? You can create a file Also, it would be beneficial if you provide the memory usage before and after your changes for some of NNCF examples Thank you! |
Yes, absolutely! I shall request a re-review for another PR tomorrow (hopefully) with a test for this and I'll give the results of a benchmark before/after the change Thank you for responding so quickly! |
Forgot to refer to the re-newed algorithm_name parameter
TODO: Fix the initialization of target_node
Benchmark ExamplesBeforeAfter |
@KodiaqQ Are any actions expected from me any further? |
Hi, @AdiKsOnDev. Thank you for your contribution. |
Hi, can it be that in the |
remove_statistic_point() is now integrated in the pipeline
@AdiKsOnDev Hi! |
Hello! I remember this, don't worry I am still extremely eager to finish, but I have a huge workload on me right now. I shall continue working this weekend Very sorry for the silence |
Ok Then! |
@kshpv @KodiaqQ For some reason (that is unknown to me, lol) FAILED tests/onnx/quantization/test_bias_correction.py::TestONNXBCAlgorithm::test_update_bias[MultipleConvTestModel-ref_biases0] - KeyError: '/Relu_1' This test only passes when I just pass the for algorithm in pipeline_step[:-1]:
current_model = algorithm.apply(current_model, current_graph, step_statistics)
current_graph = NNCFGraphFactory.create(current_model)
step_statistics.remove_statistic_points(algorithm)
current_model = pipeline_step[-1].apply(current_model, current_graph, step_statistics)
step_statistics.remove_statistic_points(pipeline_step[-1]) |
@kshpv Following up on the above^ |
@KodiaqQ |
Please, fix this and then it looks like it will work |
@kshpv I've tried this, but I still get this error: FAILED tests/onnx/quantization/test_bias_correction.py::TestONNXBCAlgorithm::test_update_bias[MultipleConvTestModel-ref_biases0] - KeyError: '/Relu_1' |
@kshpv UPDATE On the above: |
@kshpv Nope, fails here as well :/ Any ideas? |
Hello @AdiKsOnDev! |
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.
Precommit is green. Code looks okay. Please, apply last comments and I approve
Forgot to remove this change earlier
Hello once again! Just wanted to confirm, is this PR ready for being merged or is something more expected from my end? Thanks |
Hello @AdiKsOnDev! So, I am not sure about merging these changes yet. Initially, I had high hopes that this PR would significantly reduce memory usage. However, after experimenting and crunching the numbers, it has become apparent that the impact is small. I am disappointed that things did not pan out as I hoped, but I want to express my gratitude for your hard work. I hope you gain some experience from it, and I encourage you to keep contributing to the enhancement of NNCF. |
Yes, the experience was very interesting so it's perfectly fine :P |
So, thank you @AdiKsOnDev again! I am closing the PR |
Changes
Made changes in:
nncf/common/tensor_statistics/statistic_point.py
nncf/quantization/algorithms/pipeline.py
Focus on the way I used newly created
remove_statistic_point()
insidepipeline.py
, to see if it's up to the expectationsReason for changes
Save space by removing "unused" statistic points associated with an algorithm
Related tickets
120377
Tests
tests/common/test_statistic_points.py
was added:Closes #2557