PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
fix bug and limit numpy version (#159)
yintong-lu77320b0afe57
diff --git a/auto_round/utils.py b/auto_round/utils.pyindex 47c4ef2f4..2b8d817bf 100644--- a/auto_round/utils.py+++ b/auto_round/utils.py@@ -25,6 +25,13 @@ import psutilimport torchfrom torch.amp import autocast+from functools import lru_cache+@lru_cache(None)+def warning_once(self, msg: str):+ self.warning(msg)+++logging.Logger.warning_once = warning_oncelogger = logging.getLogger("autoround")logger.setLevel(logging.INFO)logger.propagate = False@@ -35,7 +42,6 @@ logger.addHandler(fh)import importlibimport transformers-from functools import lru_cacheclass LazyImport(object):"""Lazy import python module till use."""@@ -607,11 +613,6 @@ def get_autogptq_backend_config(backend, bits=4):use_triton = Falsereturn use_triton, disable_exllamav1, disable_exllamav2, use_qigen, disable_marlin-@lru_cache(None)-def warning_once(logger, msg: str):- logger.warning(msg)--logger.warning_once = warning_oncedef dynamic_import_inference_linear(bits, group_size, backend):"""Dynamically imports and returns the appropriate QuantLinear class based on the given bits and backend.@@ -660,6 +661,7 @@ def dynamic_import_inference_linear(bits, group_size, backend):elif bits == 4 and "exllamav2" in backend:logger.warning_once("Please install auto-round from source to enable exllamav2 kernels, switch to triton ""kernels for now")+ from auto_round_extension.cuda.qliner_triton import QuantLinearelse:from auto_round_extension.cuda.qliner_triton import QuantLinearreturn QuantLineardiff --git a/examples/language-modeling/requirements.txt b/examples/language-modeling/requirements.txtindex 292166e4a..13d67e77c 100644--- a/examples/language-modeling/requirements.txt+++ b/examples/language-modeling/requirements.txt@@ -17,4 +17,5 @@ auto-gptqopenpyxlwandbpy-cpuinfo+numpy < 2.0diff --git a/requirements.txt b/requirements.txtindex cb8df6bba..0f5c4f7af 100644--- a/requirements.txt+++ b/requirements.txt@@ -5,3 +5,4 @@ sentencepiecetorchtransformerstriton+numpy < 2.0