Skip to content

Commit

Permalink
[Quant] Fix accuracy_level config option for MatMul 4bits quantizer (m…
Browse files Browse the repository at this point in the history
…icrosoft#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: microsoft#19106
  • Loading branch information
adrianlizarraga authored and Ted Themistokleous committed May 7, 2024
1 parent 92b164a commit 80301d3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def quantize(self, node: NodeProto, graph_stack: list[GraphProto]) -> NodeProto:
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",
Expand Down

0 comments on commit 80301d3

Please sign in to comment.