Skip to content

Commit

Permalink
Fix multithreading (#2198)
Browse files Browse the repository at this point in the history
### Changes

The `_multithreading_calculation_ranking_score` does not work when
len(groups_to_rank) < self._num_workers

### Reason for changes

IndexError: pop from empty list

### Related tickets

N/A

### Tests

N/A

---------

Co-authored-by: Alexander Suslov <[email protected]>
  • Loading branch information
andrey-churkin and alexsu52 authored Oct 16, 2023
1 parent 4d47869 commit 9b75974
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nncf/quantization/algorithms/accuracy_control/ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ def _multithreading_calculation_ranking_score(
)
ranking_scores.append(float(ranking_score))

for _ in range(self._num_workers - 1):
prepared_model = prepared_model_queue.pop(0).result()
for future in prepared_model_queue:
prepared_model = future.result()
ranking_score = self._calculate_ranking_score(
prepared_model, ranking_subset_indices, reference_values_for_each_item
)
Expand Down

0 comments on commit 9b75974

Please sign in to comment.