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

[NNCF]: Optimized memory footprint by removing redundant collected statistics #2563

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b84acfd
feat: Added a method for removing stat_point
AdiKsOnDev Mar 8, 2024
3a85e8f
feat: Integrated remove_statistic_point() to the pipelines
AdiKsOnDev Mar 8, 2024
42260a4
refactor: Rename the parameter name
AdiKsOnDev Mar 8, 2024
e4c6755
fix: Removed unnecessary list conversion
AdiKsOnDev Mar 8, 2024
c83ce10
fix: Wrong parameter usage
AdiKsOnDev Mar 9, 2024
5c7bdaa
refactor: Refactored the code to match PEP rules
AdiKsOnDev Mar 9, 2024
4368f49
CI/CD: Tests for the new feature
AdiKsOnDev Mar 9, 2024
856ce28
fix: Made a copy of the self.data dictionary
AdiKsOnDev Mar 9, 2024
ef4bb4a
refactor: Pre-Commit reformatting
AdiKsOnDev Mar 9, 2024
13356ca
fix: Returned the deleted line
AdiKsOnDev Mar 11, 2024
3131d48
fix: Typo in the method's name
AdiKsOnDev Mar 11, 2024
182728d
refactor: algorithm name
AdiKsOnDev Mar 11, 2024
13587a4
fix: Fixed the references to renamed algorithm
AdiKsOnDev Mar 11, 2024
6314994
fix: Used _algorithm_key attribute, instead of the algorithm Object i…
AdiKsOnDev Mar 11, 2024
73a7de9
fix: Added a loop for removing all algorithms
AdiKsOnDev Mar 12, 2024
b4eed33
fix: Correctly removed the statistical points
AdiKsOnDev Mar 12, 2024
dc846fa
fix: statistical points get remove only after being used
AdiKsOnDev Mar 13, 2024
884a489
CI/CD: Modified Tests for new functionality
AdiKsOnDev Mar 15, 2024
cf3abe8
fix: Method removes only the algorithm's tensor
AdiKsOnDev Mar 15, 2024
7b2b3da
fix: Returned the correct usage of new method
AdiKsOnDev Mar 15, 2024
6e4f5c8
fix: Forgot to append to list
AdiKsOnDev Mar 15, 2024
0625e85
feat: Added _algorithm_key property to base class
AdiKsOnDev Mar 15, 2024
3bcad1e
fix: Update nncf/quantization/algorithms/algorithm.py
AdiKsOnDev Mar 19, 2024
2ede9ca
fix: Utilised the encapsulation
AdiKsOnDev Mar 19, 2024
7b2c92b
refactor: Pre-Commit changes
AdiKsOnDev Mar 19, 2024
1238dbe
fix: Correct usage of algorithm_key()
AdiKsOnDev Mar 20, 2024
5f32d93
fix: Compare alg name instead of Object itself
AdiKsOnDev Mar 31, 2024
3bf0fef
fix: Iterating through items of collectors
AdiKsOnDev Mar 31, 2024
56fa9e6
fix: Should work now
AdiKsOnDev Mar 31, 2024
427f680
fix: Type 'str' not callable
AdiKsOnDev Mar 31, 2024
80b6afc
fix: @property deleted
AdiKsOnDev Apr 2, 2024
7fa02d4
Merge branch 'openvinotoolkit:develop' into develop
AdiKsOnDev Apr 3, 2024
495bd4f
git: Sync fork
AdiKsOnDev Apr 3, 2024
a0a0c5f
fix: Returned property decorator
AdiKsOnDev Apr 3, 2024
aefd170
refactor: Formatted & Cleaned the code
AdiKsOnDev Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions nncf/common/tensor_statistics/statistic_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ def add_statistic_point(self, statistic_point: StatisticPoint) -> None:

self.data[target_node_name].append(statistic_point)

def remove_statistic_point(self, algorithm: str) -> None:
AdiKsOnDev marked this conversation as resolved.
Show resolved Hide resolved
"""
Method to remove statistic point associated with a given algorithm
from statistic point container.

:param algorithm: Algorithm name
"""
for target_node_name, statistic_points in list(self.data.items()):
AdiKsOnDev marked this conversation as resolved.
Show resolved Hide resolved
# Reassign every target node name IF it doesn't contain the given algorithm
self.data[target_node_name] = [
kshpv marked this conversation as resolved.
Show resolved Hide resolved
_statistic_point for _statistic_point in statistic_points if algorithm not in _statistic_point.algorithm_to_tensor_collectors
]

if not self.data[target_node_name]:
del self.data[target_node_name]

def iter_through_statistic_points_in_target_node(
self, target_node_name: str, filter_fn: Callable[[StatisticPoint], bool]
) -> StatisticPoint:
Expand Down
2 changes: 2 additions & 0 deletions nncf/quantization/algorithms/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def run_step(
current_graph = NNCFGraphFactory.create(current_model)
current_model = pipeline_step[-1].apply(current_model, current_graph, step_statistics)

step_statistics.remove_statistic_point(algorithm)

return current_model

def run_from_step(
Expand Down
Loading