1313# limitations under the License.
1414# ==============================================================================
1515
16- import os
17- from typing import Dict , Any , List , Tuple , Optional , Union , Callable
16+ from typing import Dict , Any , List , Optional
1817import model_compression_toolkit as mct
1918from model_compression_toolkit .logger import Logger
2019from model_compression_toolkit .verify_packages import FOUND_TPC
@@ -96,7 +95,8 @@ def _initialize_and_validate(self, float_model: Any, method: str = 'PTQ',
9695 framework : str = 'pytorch' ,
9796 use_internal_tpc : bool = True ,
9897 use_mixed_precision : bool = False ,
99- representative_dataset : Any = None ) -> None :
98+ representative_dataset : Optional [Any ] = None
99+ ) -> None :
100100 """
101101 Validate inputs and Initialize parameters.
102102
@@ -255,6 +255,7 @@ def _get_tpc(self) -> None:
255255 self .tpc = mct .get_target_platform_capabilities (** params_TPC )
256256 else :
257257 if FOUND_TPC :
258+ import edgemdt_tpc
258259 # Use external EdgeMDT TPC configuration
259260 params_TPC = {
260261 TPC_VERSION : self .params [TPC_VERSION ],
@@ -275,7 +276,7 @@ def _setting_PTQ_mixed_precision(self) -> Dict[str, Any]:
275276 """
276277 params_MPCfg = {
277278 NUM_OF_IMAGES : self .params [NUM_OF_IMAGES ],
278- USE_HESSIAN_BASED_SCORES : self .params [USE_HESSIAN_BASED_SCORES ],
279+ USE_HESSIAN_BASED_SCORES : self .params [USE_HESSIAN_BASED_SCORES ]
279280 }
280281 mixed_precision_config = mct .core .MixedPrecisionQuantizationConfig (** params_MPCfg )
281282 core_config = mct .core .CoreConfig (mixed_precision_config = mixed_precision_config )
0 commit comments