Skip to content

Commit

Permalink
[Quant] Fix accuracy_level config option for MatMul 4bits quantizer (#…
Browse files Browse the repository at this point in the history
…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: #19106
  • Loading branch information
adrianlizarraga authored Mar 29, 2024
1 parent 1791971 commit b1a5eb2
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 b1a5eb2

Please sign in to comment.