File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
quantization/nlp/bert/migraphx Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -553,8 +553,19 @@ def output_run_config(flags, samples):
553553 for k , v in compute_range .data .items ():
554554 json_compute_range [k ] = (float (v .range_value [0 ]), float (v .range_value [1 ]))
555555
556-
557- write_calibration_table (json_compute_range )
556+ print ("Writing calibration table" )
557+ try :
558+ write_calibration_table (json_compute_range )
559+ except AttributeError as e :
560+ calibration_table = {}
561+ for k , v in compute_range .data .items ():
562+ min_val = float (v .range_value [0 ]) if hasattr (v .range_value [0 ], 'item' ) else float (v .range_value [0 ])
563+ max_val = float (v .range_value [1 ]) if hasattr (v .range_value [1 ], 'item' ) else float (v .range_value [1 ])
564+ calibration_table [k ] = [min_val , max_val ]
565+
566+ print ("Writing calibration.json file without using write_calibration_table" )
567+ with open ("calibration.json" , "w" ) as f :
568+ json .dump (calibration_table , f )
558569 print ("Calibration is done. Calibration cache is saved to calibration.json" )
559570
560571 model_quants = model_quants + "_int8"
You can’t perform that action at this time.
0 commit comments