Skip to content

Commit e248a99

Browse files
authored
Arm backend: Increase qtol in Llama partial quant tests (pytorch#17816)
Additionally, * Adds new scale error log. * Fix error log by printing actual tolerance instead of hard coded values. cc @digantdesai @SS-JIA @freddan80 @per @zingo @oscarandersson8218 @Sebastian-Larsson @robell Signed-off-by: Måns Nilsson <mans.nilsson@arm.com>
1 parent e041e00 commit e248a99

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

backends/arm/test/models/test_llama.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ def test_llama_tosa_INT_FP_partial_quant():
209209
tosa_extensions=["FP"],
210210
# Due to a few outliers, atol must be set high
211211
atol=1.1,
212+
# TODO(MLETORCH-1875): reduce tolerance
213+
qtol=75,
212214
frobenius_threshold=None,
213215
cosine_threshold=None,
214216
)
@@ -232,6 +234,8 @@ def test_llama_vgf_quant_partial_quant():
232234
quantize=True,
233235
# Due to a few outliers, atol must be set high
234236
atol=1.1,
237+
# TODO(MLETORCH-1875): reduce tolerance
238+
qtol=75,
235239
)
236240
_use_partial_quantizer(pipeline)
237241
pipeline.run()

backends/arm/test/tester/analyze_output_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ def dump_error_output(
318318
output_node = export_stage.artifact.graph_module.graph.output_node()
319319
qp_input = get_input_quantization_params(export_stage.artifact)
320320
qp_output = get_output_quantization_params(output_node)
321+
scales = {k.name: v.scale for k, v in qp_output.items() if v is not None}
322+
logger.error(f"Output Quant scales: {scales}")
321323
logger.error(f"Input QuantArgs: {qp_input}")
322324
logger.error(f"Output QuantArgs: {qp_output}")
323325

backends/arm/test/tester/arm_tester.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,9 @@ def _compare_outputs(
999999
stage_output,
10001000
reference_output,
10011001
quantization_scale=quantization_scale,
1002-
atol=1e-03,
1003-
rtol=1e-03,
1004-
qtol=0,
1002+
atol=atol,
1003+
rtol=rtol,
1004+
qtol=qtol,
10051005
)
10061006
raise e
10071007

0 commit comments

Comments
 (0)