Skip to content

Commit 65f5a27

Browse files
committed
Fix 'tuple' object has no attribute 'to_dict' for bert
1 parent afba506 commit 65f5a27

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

quantization/nlp/bert/migraphx/e2e_migraphx_bert_example.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -544,17 +544,11 @@ def output_run_config(flags, samples):
544544
data_reader = BertDataReader(model_path, input_dataset, input_tokens, batch_size, sequence_lengths[-1], flags.query_len, doc_stride[-1], start_index=0, end_index=calib_num)
545545
calibrator.collect_data(data_reader)
546546

547-
compute_range = calibrator.compute_data()
547+
compute_range = calibrator.compute_range()
548548

549-
# ORT returns data as return TensorsData(cal, self.collector.compute_collection_result())
550-
# Need to fix this for serialization but also convert values to float from float32 in order for JSON to correctly
551-
# write out calibration table
552-
json_compute_range = {}
553-
for k, v in compute_range.data.items():
554-
json_compute_range[k] = (float(v.range_value[0]), float(v.range_value[1]))
549+
print("Writing calibration table")
555550

556-
557-
write_calibration_table(json_compute_range)
551+
write_calibration_table(compute_range)
558552
print("Calibration is done. Calibration cache is saved to calibration.json")
559553

560554
model_quants = model_quants + "_int8"

0 commit comments

Comments
 (0)