@@ -141,13 +141,13 @@ class MetricResults:
141
141
142
142
:param metric_value: Aggregated metric value.
143
143
:param values_for_each_item: Metric values for each data item.
144
- :param preperation_time : Time that it takes to prepare model for validation.
144
+ :param preparation_time : Time that it takes to prepare model for validation.
145
145
:param validation_time: Time that it takes to validate model.
146
146
"""
147
147
148
148
metric_value : float
149
149
values_for_each_item : Union [None , List [float ], List [List [TTensor ]]]
150
- preperation_time : float
150
+ preparation_time : float
151
151
validation_time : float
152
152
153
153
@@ -300,7 +300,7 @@ def _apply(
300
300
model_size = algo_backend .get_model_size (quantized_model )
301
301
num_ranking_processes = self ._calculate_number_ranker_parallel_proc (
302
302
model_size ,
303
- quantized_metric_results .preperation_time ,
303
+ quantized_metric_results .preparation_time ,
304
304
quantized_metric_results .validation_time ,
305
305
validation_dataset_size ,
306
306
)
@@ -409,32 +409,32 @@ def _apply(
409
409
def _calculate_number_ranker_parallel_proc (
410
410
self ,
411
411
model_size : int ,
412
- preperation_time : float ,
412
+ preparation_time : float ,
413
413
validation_time : float ,
414
414
validation_dataset_size : int ,
415
415
) -> int :
416
416
"""
417
417
Calculate the number of parallel ranker processes
418
418
419
419
:param model_size: Target model size.
420
- :param preperation_time : The time it takes to prepare the model.
420
+ :param preparation_time : The time it takes to prepare the model.
421
421
:param validation_time: The time it takes to validate the model.
422
422
:param validation_dataset_size: Validation dataset size.
423
423
:return: The number of parallel ranker processes
424
424
"""
425
- if preperation_time < PREPARATION_MODEL_THRESHOLD :
425
+ if preparation_time < PREPARATION_MODEL_THRESHOLD :
426
426
return 1
427
427
428
428
# Calculate the number of parallel processes needed to override model preparation and
429
429
# metric calculation on the ranking subset
430
430
ranking_time = validation_time * self .ranking_subset_size / validation_dataset_size
431
- n_proc = max (round ((preperation_time / ranking_time + 1 ) * OVERHEAD_COEFFICIENT ), 2 )
431
+ n_proc = max (round ((preparation_time / ranking_time + 1 ) * OVERHEAD_COEFFICIENT ), 2 )
432
432
433
433
# Apply limitation by number of CPU cores
434
- n_cores = get_available_cpu_count ()
434
+ n_cores = get_available_cpu_count (logical = True )
435
435
n_proc = max (min (n_proc , n_cores // 2 ), 1 )
436
436
437
- # Apply limitation by memmory
437
+ # Apply limitation by memory
438
438
ram = get_available_memory_amount ()
439
439
n_copies = ram // (model_size * MEMORY_INCREASE_COEFFICIENT )
440
440
n_proc = max (min (n_proc , n_copies - 1 ), 1 )
@@ -504,9 +504,9 @@ def _collect_metric_and_values(
504
504
model : TModel , dataset : Dataset , evaluator : Evaluator , model_name : str
505
505
) -> MetricResults :
506
506
nncf_logger .info (f"Validation of { model_name } model was started" )
507
- with timer () as preperation_time :
507
+ with timer () as preparation_time :
508
508
model_for_inference = evaluator .prepare_model_for_inference (model )
509
509
with timer () as validation_time :
510
510
metric , values_for_each_item = evaluator .validate_model_for_inference (model_for_inference , dataset )
511
511
nncf_logger .info (f"Metric of { model_name } model: { metric } " )
512
- return MetricResults (metric , values_for_each_item , preperation_time (), validation_time ())
512
+ return MetricResults (metric , values_for_each_item , preparation_time (), validation_time ())
0 commit comments