Skip to content

Commit

Permalink
Add progress bar for calculating ranking scores (#2459)
Browse files Browse the repository at this point in the history
### Changes

- Add progress bar for calculating ranking scores

### Reason for changes

Calculating ranking score for groups of quantizers takes a long time for
SD models.

### Related tickets

Ref: 124131

### Tests

Manually
  • Loading branch information
andrey-churkin committed Feb 8, 2024
1 parent 11fe821 commit e30590d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nncf/quantization/algorithms/accuracy_control/ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from nncf.common.graph import NNCFGraph
from nncf.common.graph import NNCFNode
from nncf.common.logging import nncf_logger
from nncf.common.logging.track_progress import track
from nncf.common.quantization.quantizer_removal import find_quantizer_nodes_to_cut
from nncf.common.quantization.quantizer_removal import revert_operations_to_floating_point_precision
from nncf.common.utils.backend import BackendType
Expand Down Expand Up @@ -155,7 +156,6 @@ def rank_groups_of_quantizers(
self._ranking_fn,
)

nncf_logger.info("Calculating ranking score for groups of quantizers")
with timer():
# Calculate ranking score for groups of quantizers.
if self._num_workers > 1:
Expand Down Expand Up @@ -190,7 +190,7 @@ def _sequential_calculation_ranking_score(
reference_values_for_each_item: Union[List[float], List[List[TTensor]]],
):
ranking_scores = [] # ranking_scores[i] is the ranking score for groups_to_rank[i]
for current_group in groups_to_rank:
for current_group in track(groups_to_rank, description="Calculating ranking scores"):
modified_model = revert_operations_to_floating_point_precision(
current_group.operations,
current_group.quantizers,
Expand Down Expand Up @@ -219,6 +219,7 @@ def _multithreading_calculation_ranking_score(
ranking_scores = [] # ranking_scores[i] is the ranking score for groups_to_rank[i]
prepared_model_queue = []
executor = ThreadPoolExecutor(max_workers=self._num_workers)
nncf_logger.info("Calculating ranking scores")
for idx, current_group in enumerate(groups_to_rank):
modified_model = revert_operations_to_floating_point_precision(
current_group.operations,
Expand Down

0 comments on commit e30590d

Please sign in to comment.