Skip to content

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

fix bias issue in autogptq (#375)

Wenhua Cheng3ac377b15785
diff --git a/auto_round/export/export_to_autogptq/export.py b/auto_round/export/export_to_autogptq/export.py
index 05034576c..ad2cf5dc5 100644
--- a/auto_round/export/export_to_autogptq/export.py
+++ b/auto_round/export/export_to_autogptq/export.py
@@ -88,8 +88,8 @@ def pack_layer(name, model, layer_config, backend, pbar):
in_features = layer.weight.shape[0]
out_features = layer.weight.shape[1]
- ##bias = layer.bias is not None and torch.any(layer.bias)
- bias = True ## if using the above, llama3 lambada RTN will be NAN , TODO why?
+ bias = layer.bias is not None
+ ##bias = True ## if using the above, llama3 lambada RTN will be NAN , TODO why?
new_layer = QuantLinear( ##pylint: disable=E1123
bits, group_size, in_features, out_features, bias, weight_dtype=layer.weight.dtype
)
diff --git a/auto_round/export/export_to_autoround/export.py b/auto_round/export/export_to_autoround/export.py
index f90fb2700..ee36b4ebd 100644
--- a/auto_round/export/export_to_autoround/export.py
+++ b/auto_round/export/export_to_autoround/export.py
@@ -110,7 +110,7 @@ def pack_layer(name, model, layer_config, backend, pbar):
elif isinstance(layer, transformers.pytorch_utils.Conv1D):
in_features = layer.weight.shape[0]
out_features = layer.weight.shape[1]
- bias = layer.bias is not None and torch.any(layer.bias)
+ bias = layer.bias is not None
if "awq" not in backend:
new_layer = QuantLinear( ##pylint: disable=E1123