|
28 | 28 | from .quantizer.autobit import AutoBitQuantizer |
29 | 29 | from .utils import calculate_accuracy as calc_accuracy |
30 | 30 | from .utils import calculate_perplexity as calc_perplexity |
| 31 | +from .utils.quantization_progress import QuantizationProgressTracker |
31 | 32 | from .log import setup_logger |
32 | 33 |
|
33 | 34 |
|
@@ -86,7 +87,7 @@ def __init__( |
86 | 87 | multi_gpu=False, |
87 | 88 | gpu_ids=None, |
88 | 89 | post_processes=None, |
89 | | - quantization_progress=True, |
| 90 | + report_progress=True, |
90 | 91 | ): |
91 | 92 | """__init__ method |
92 | 93 |
|
@@ -131,7 +132,7 @@ def __init__( |
131 | 132 | a quantized model on CPU (built via |
132 | 133 | ``create_quantized_model``) and may modify it in-place. |
133 | 134 | Processes are executed in order. Default is None. |
134 | | - quantization_progress (bool): |
| 135 | + report_progress (bool): |
135 | 136 | When ``True`` (default), emit ``[progress]`` log lines with |
136 | 137 | completed steps, elapsed time, and a linear ETA estimate |
137 | 138 | during long quantization (calibration, chunked, multi-GPU, |
@@ -221,7 +222,7 @@ def __init__( |
221 | 222 | self.lpcd_config = None |
222 | 223 | if lpcd: |
223 | 224 | self.lpcd_config = lpcd_config if lpcd_config is not None else LPCDConfig() |
224 | | - self.quantization_progress = quantization_progress |
| 225 | + self.report_progress = report_progress |
225 | 226 |
|
226 | 227 | def check(self): |
227 | 228 | """Check the settings |
@@ -602,10 +603,7 @@ def quantize_with_calibration(self): |
602 | 603 | # Register hooks to all linear layers |
603 | 604 | handles = [] |
604 | 605 | progress = None |
605 | | - if self.quantization_progress: |
606 | | - # pylint: disable-next=import-outside-toplevel |
607 | | - from .utils.quantization_progress import QuantizationProgressTracker |
608 | | - |
| 606 | + if self.report_progress: |
609 | 607 | progress = QuantizationProgressTracker( |
610 | 608 | logger, |
611 | 609 | len(self.quantizer.module_to_name), |
@@ -664,7 +662,7 @@ def quantize_with_calibration_chunked(self): |
664 | 662 | model_config=self.model_config, |
665 | 663 | quantizers=self.quantizers if self.quantizers is not None else [self.quantizer], |
666 | 664 | calibration_config=self.calibration_config, |
667 | | - quantization_progress=self.quantization_progress, |
| 665 | + report_progress=self.report_progress, |
668 | 666 | ) |
669 | 667 |
|
670 | 668 | def quantize_with_calibration_on_multi_gpu(self): |
@@ -693,7 +691,7 @@ def quantize_with_calibration_on_multi_gpu(self): |
693 | 691 | quantizer=self.quantizer, |
694 | 692 | calibration_config=self.calibration_config, |
695 | 693 | gpu_ids=self.gpu_ids, |
696 | | - quantization_progress=self.quantization_progress, |
| 694 | + report_progress=self.report_progress, |
697 | 695 | ) |
698 | 696 |
|
699 | 697 | # Store results in quantizer.results |
@@ -721,10 +719,7 @@ def quantize_without_calibration(self): |
721 | 719 | self.quantizer.name, |
722 | 720 | ) |
723 | 721 | progress = None |
724 | | - if self.quantization_progress: |
725 | | - # pylint: disable-next=import-outside-toplevel |
726 | | - from .utils.quantization_progress import QuantizationProgressTracker |
727 | | - |
| 722 | + if self.report_progress: |
728 | 723 | progress = QuantizationProgressTracker( |
729 | 724 | logger, |
730 | 725 | len(self.quantizer.module_to_name), |
@@ -754,7 +749,7 @@ def quantize_with_qep(self): |
754 | 749 | quantizer=self.quantizer, |
755 | 750 | qep_config=self.qep_config, |
756 | 751 | calibration_config=self.calibration_config, |
757 | | - quantization_progress=self.quantization_progress, |
| 752 | + report_progress=self.report_progress, |
758 | 753 | ) |
759 | 754 |
|
760 | 755 | if self.qep_config.general: |
|
0 commit comments