Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

fix bug of activation quant when act_max is None (#718)

Heng Guo04d053b8be77
diff --git a/auto_round/wrapper.py b/auto_round/wrapper.py
index 156246385..be3427424 100644
--- a/auto_round/wrapper.py
+++ b/auto_round/wrapper.py
@@ -321,7 +321,7 @@ class WrapperLinear(torch.nn.Module):
self.orig_layer.act_max = self.orig_layer.act_max * act_max_scale.item()
self.orig_layer.act_max = self.orig_layer.act_max.to("cpu")
else:
- act_scale = torch.ones_like(act_max_scale, dtype=self.act_data_type)
+ act_scale = torch.ones_like(act_max_scale, dtype=self.orig_layer.scale_dtype)
self.orig_layer.act_scale = act_scale.to("cpu")
self.orig_layer.q_scale_thresh = self.q_scale_thresh