Skip to content

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

fix gguf bug by int zp (#771)

Heng Guof01e80470771
diff --git a/auto_round/export/export_to_gguf/convert.py b/auto_round/export/export_to_gguf/convert.py
index c204cf1e8..0072424fb 100644
--- a/auto_round/export/export_to_gguf/convert.py
+++ b/auto_round/export/export_to_gguf/convert.py
@@ -217,6 +217,8 @@ def _quant_data(cls, data_torch, data_qtype, name, modify_name, bid):
for attr in ["scale", "zp", "w_d_scale", "w_d_wmin", "w_wmin"]:
if hasattr(module, attr) and getattr(module, attr) is not None:
attr_tensor = getattr(module, attr)
+ if not isinstance(attr_tensor, torch.Tensor):
+ continue
ori_shape = attr_tensor.shape
attr_tensor = cls.modify_tensors(attr_tensor.reshape(bs, -1), modify_name, bid)[0][1]
attr_tensor = attr_tensor.reshape(ori_shape)