fix: allow more than 6 bits in the last layer if asked by user

This commit is contained in:
jfrery
2022-01-10 13:00:56 +01:00
committed by Arthur Meyre
parent 3a9af99e86
commit 418feeb78c

View File

@@ -96,7 +96,7 @@ class PostTrainingAffineQuantization:
# Since this is the last layer and mostly used for classification,
# this does not have much impact.
# TODO: Put back 7 bits when 100% at 7b is achieved (see issue #1332).
q_layer = QuantizedLinear(6, q_weights, q_bias)
q_layer = QuantizedLinear(numpy.maximum(6, self.n_bits), q_weights, q_bias)
else:
q_layer = QuantizedLinear(self.n_bits, q_weights, q_bias)
# Calibrate and get new calibration_data for next layer/activation