From 3ac377b15785e069035842e7f69f4fd7cad7fbea Mon Sep 17 00:00:00 2001 From: Wenhua Cheng Date: Fri, 6 Dec 2024 12:32:13 +0800 Subject: [PATCH] fix bias issue in autogptq (#375) --- auto_round/export/export_to_autogptq/export.py | 4 ++-- auto_round/export/export_to_autoround/export.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/auto_round/export/export_to_autogptq/export.py b/auto_round/export/export_to_autogptq/export.py index 05034576..ad2cf5dc 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 f90fb270..ee36b4eb 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