PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
fix cuda ut fail (#1144)
Heng Guod1a411604868
diff --git a/.azure-pipelines/scripts/ut/run_ut.sh b/.azure-pipelines/scripts/ut/run_ut.shindex ea402cb77..dcf1a7170 100644--- a/.azure-pipelines/scripts/ut/run_ut.sh+++ b/.azure-pipelines/scripts/ut/run_ut.sh@@ -12,7 +12,7 @@ uv pip install -r /auto-round/test/test_cpu/requirements.txt \# install latest gguf for ut testcd ~ || exit 1-git clone -b master --quiet --single-branch https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py && uv pip install .+git clone -b master --quiet --single-branch https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py && uv pip install . sentencepiececd /auto-round && uv pip install .diff --git a/auto_round/compressors/utils.py b/auto_round/compressors/utils.pyindex 658024846..dd85f4ebd 100644--- a/auto_round/compressors/utils.py+++ b/auto_round/compressors/utils.py@@ -558,7 +558,8 @@ def gguf_args_check(args_or_ar, formats: list[str] = None, model_type=ModelType.except AttributeError as e:raise ImportError("Please use the latest gguf-py, you can use the following command to install it:\n"- "git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py && pip install ."+ "git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py &&"+ " pip install . sentencepiece")download_convert_file(redownload)@@ -570,7 +571,8 @@ def gguf_args_check(args_or_ar, formats: list[str] = None, model_type=ModelType.except ImportError as e:raise ImportError("Please use the latest gguf-py, you can use the following command to install it:\n"- "git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py && pip install ."+ "git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py &&"+ " pip install . sentencepiece")if isinstance(args_or_ar.model, str):model_path = args_or_ar.modeldiff --git a/auto_round/export/export_to_autoround/export.py b/auto_round/export/export_to_autoround/export.pyindex 06b43ab4c..ccc7780b3 100644--- a/auto_round/export/export_to_autoround/export.py+++ b/auto_round/export/export_to_autoround/export.py@@ -338,7 +338,7 @@ def save_quantized_as_autoround(output_dir, inplace=True, backend="auto_round:exif len(neq_keys) > 0:extra_config[layer_name] = {}for key in scheme_keys:- if cfg[key] is not None:+ if cfg.get(key) is not None:extra_config[layer_name][key] = cfg[key]regex_config = quantization_config.pop("regex_config")diff --git a/test/test_cuda/test_auto_scheme.py b/test/test_cuda/test_auto_scheme.pyindex 51f78b32c..681e3b29b 100644--- a/test/test_cuda/test_auto_scheme.py+++ b/test/test_cuda/test_auto_scheme.py@@ -249,7 +249,7 @@ class TestAutoScheme(unittest.TestCase):self.assertGreater(result["results"]["lambada_openai"]["acc,none"], 0.25)shutil.rmtree(self.save_dir, ignore_errors=True)- model_name = "/tf_dataset/auto_round/models/Qwen/Qwen3-0.6B"+ model_name = "/models/Qwen3-0.6B"scheme = AutoScheme(avg_bits=3, options=("gguf:q2_k_s,gguf:q4_k_s"), nsamples=1, ignore_scale_zp_bits=True)ar = AutoRound(model=model_name, scheme=scheme, iters=0, nsamples=1)ar.quantize_and_save(self.save_dir)