From b1a5eb255ed1a09b4ef13fd967b3e01e3e22771a Mon Sep 17 00:00:00 2001 From: Adrian Lizarraga Date: Fri, 29 Mar 2024 11:54:55 -0700 Subject: [PATCH] [Quant] Fix accuracy_level config option for MatMul 4bits quantizer (#20146) ### Description Fixes code that extracts the accuracy level when creating a MatMulNBits node in the `DefaultWeightOnlyQuantizer` class. ### Motivation and Context Error from line 443: `AttributeError: 'DefaultWeightOnlyQuantizer' object has no attribute 'accuracy_level'`. The solution is to access `self.config.accuracy_level` instead of `self.accuracy_level`. Relevant commit: https://github.com/microsoft/onnxruntime/pull/19106 --- onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py b/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py index f4bcd50896..3090296b77 100644 --- a/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py +++ b/onnxruntime/python/tools/quantization/matmul_4bits_quantizer.py @@ -440,7 +440,7 @@ class DefaultWeightOnlyQuantizer: kwargs["bits"] = 4 kwargs["block_size"] = self.config.block_size if self.config.accuracy_level is not None: - kwargs["accuracy_level"] = self.accuracy_level + kwargs["accuracy_level"] = self.config.accuracy_level matmul_q4_node = onnx.helper.make_node( "MatMulNBits",