File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 24
24
25
25
def save_calib_result (model ):
26
26
import habana_quantization_toolkit as hqt
27
- hqt .finish_measurements (model )
27
+ if (hasattr (model , "__hqt_config__" ) and
28
+ isinstance (model .__hqt_config__ , hqt ._quant_common .quant_config .Fp8cfg )):
29
+ # TODO SW-184714 modify hqt notation to inc notation once code is ported
30
+ hqt .finish_measurements (model )
31
+ else :
32
+ raise NotImplementedError ("Saving calibration results currently supported only in HPU." )
33
+
28
34
29
35
30
36
def update_mode (config_path , measure_step = False , quant_step = False ):
Original file line number Diff line number Diff line change @@ -220,9 +220,5 @@ def convert(
220
220
221
221
222
222
def finalize_calibration (model ):
223
- if hasattr (model , "quant_config" ) and isinstance (model .quant_config , FP8Config ): # FP8
224
223
from neural_compressor .torch .algorithms .fp8_quant import save_calib_result
225
-
226
224
save_calib_result (model )
227
- else :
228
- raise NotImplementedError ("`finalize_calibration` only supports FP8 measurement now." )
You can’t perform that action at this time.
0 commit comments