Skip to content

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

update auto-round-kernel package name to auto-round-lib (#1410)

chen, suyuebab099351a7c
diff --git a/.azure-pipelines/scripts/ut/run_ut_xpu.sh b/.azure-pipelines/scripts/ut/run_ut_xpu.sh
index cafb83a3c..de3735aae 100644
--- a/.azure-pipelines/scripts/ut/run_ut_xpu.sh
+++ b/.azure-pipelines/scripts/ut/run_ut_xpu.sh
@@ -27,15 +27,7 @@ cat run_xpu.sh
bash run_xpu.sh 2>&1 | tee "${ut_log_name}"
-# run ark tests on xpu only
-export SKIP_CPU=1
-bash run_ark.sh 2>&1 | tee -a "${ut_log_name}"
-
-# run ark tests on cpu only
-unset SKIP_CPU
-export SKIP_XPU=1
-export LD_PRELOAD=libintelocl.so:libcommon_clang.so:libocl_svml_z1.so
-bash run_ark.sh 2>&1 | tee -a "${ut_log_name}"
+numactl -C "0-27" bash run_ark.sh 2>&1 | tee -a "${ut_log_name}"
cp report.html ${LOG_DIR}/
cp coverage.xml ${LOG_DIR}/
diff --git a/.azure-pipelines/template/ut-template.yml b/.azure-pipelines/template/ut-template.yml
index 7014044ff..5176d096d 100644
--- a/.azure-pipelines/template/ut-template.yml
+++ b/.azure-pipelines/template/ut-template.yml
@@ -46,7 +46,7 @@ steps:
- script: |
if [ "${{ parameters.utScriptFileName }}" == "run_ut_xpu" ];then
docker exec ${{ parameters.utContainerName }} bash -c "cd /auto-round \
- && uv pip install torch==2.9.0 --index-url https://download.pytorch.org/whl/xpu \
+ && uv pip install torch==2.10.0 --index-url https://download.pytorch.org/whl/xpu \
&& uv pip install -r requirements.txt \
&& uv pip install -r test/test_ark/requirements.txt \
&& cd /auto-round && uv pip install . \
diff --git a/auto_round/inference/backend.py b/auto_round/inference/backend.py
index c3dcbf59c..e024b65f0 100644
--- a/auto_round/inference/backend.py
+++ b/auto_round/inference/backend.py
@@ -451,7 +451,7 @@ BackendInfos["auto_round_kernel"] = BackendInfo(
compute_dtype=["float32", "float16"],
data_type=["int"],
act_bits=WOQ_DEFAULT_ACT_BITS,
- requirements=["torch>=2.8.0", "auto_round_kernel"],
+ requirements=["torch>=2.8.0", "auto-round-lib"],
)
BackendInfos["auto_round_kernel_xpu"] = BackendInfo(
@@ -466,7 +466,7 @@ BackendInfos["auto_round_kernel_xpu"] = BackendInfo(
compute_dtype=["float32", "float16"],
data_type=["int"],
act_bits=WOQ_DEFAULT_ACT_BITS,
- requirements=["torch>=2.8.0", "auto_round_kernel"],
+ requirements=["torch>=2.8.0", "auto-round-lib"],
)
BackendInfos["auto_round_kernel_zp"] = BackendInfo(
@@ -481,7 +481,7 @@ BackendInfos["auto_round_kernel_zp"] = BackendInfo(
compute_dtype=["float32", "float16"],
data_type=["int"],
act_bits=WOQ_DEFAULT_ACT_BITS,
- requirements=["torch>=2.8.0", "auto_round_kernel"],
+ requirements=["torch>=2.8.0", "auto-round-lib"],
)
BackendInfos["auto_round_kernel_zp_xpu"] = BackendInfo(
@@ -496,7 +496,7 @@ BackendInfos["auto_round_kernel_zp_xpu"] = BackendInfo(
compute_dtype=["float32", "float16"],
data_type=["int"],
act_bits=WOQ_DEFAULT_ACT_BITS,
- requirements=["torch>=2.8.0", "auto_round_kernel"],
+ requirements=["torch>=2.8.0", "auto-round-lib"],
)
BackendInfos["auto_round_kernel_awq"] = BackendInfo(
@@ -511,7 +511,7 @@ BackendInfos["auto_round_kernel_awq"] = BackendInfo(
compute_dtype=["float32", "float16"],
data_type=["int"],
act_bits=WOQ_DEFAULT_ACT_BITS,
- requirements=["torch>=2.8.0", "auto_round_kernel"],
+ requirements=["torch>=2.8.0", "auto-round-lib"],
)
BackendInfos["auto_round_kernel_awq_xpu"] = BackendInfo(
@@ -526,7 +526,7 @@ BackendInfos["auto_round_kernel_awq_xpu"] = BackendInfo(
compute_dtype=["float32", "float16"],
data_type=["int"],
act_bits=WOQ_DEFAULT_ACT_BITS,
- requirements=["torch>=2.8.0", "auto_round_kernel"],
+ requirements=["torch>=2.8.0", "auto-round-lib"],
)
BackendInfos["ipex_gptq_cpu"] = BackendInfo(
@@ -723,7 +723,7 @@ def dynamic_import_inference_linear(backend, config):
try:
import auto_round_kernel as ark # pylint: disable=E0611, E0401
except Exception as e:
- raise ImportError("Please install auto_round_kernel version for CPU/XPU")
+ raise ImportError("Please install auto-round-lib for CPU/XPU, e.g., using: pip install auto-round-lib")
import auto_round_extension.ark.qlinear as qlinear
if "zp" in backend:
diff --git a/auto_round_extension/ark/README.md b/auto_round_extension/ark/README.md
index dd14579de..b9aa6e755 100644
--- a/auto_round_extension/ark/README.md
+++ b/auto_round_extension/ark/README.md
@@ -40,9 +40,9 @@ AutoRound Kernel provides weight-only linear computational capabilities for LLM
### Install via pip
```bash
# Install the latest auto-round kernel which may upgrade your PyTorch version automatically
-pip install auto-round-kernel
+pip install auto-round-lib
# Install auto-round kernel with respective to specific PyTorch version (e.g., v2.8.x)
-pip install auto-round-kernel torch~=2.8.0
+pip install auto-round-lib torch~=2.8.0
```
<details>
@@ -55,33 +55,33 @@ python3 install_kernel.py
```
**Notes:**
Recommend to use this method if you want to keep your current PyTorch and auto-round versions.
-This installation script will detect the current environment and install the corresponding auto-round-kernel version.
+This installation script will detect the current environment and install the corresponding auto-round-lib version.
### Install via auto_round
```bash
pip install auto-round
-auto-round-kernel-install
+auto-round-lib-install
```
</details>
### Versioning Scheme
-The version number of auto-round-kernel follows the format:
-`{auto-round major version}.{auto-round minor version}.{oneAPI version}.{kernel version}`
+The version number of auto-round-lib follows the format:
+`{auto-round major version}.{auto-round minor version}.{oneAPI version}.{lib version}`
**For example: v0.9.1.1**
- The first two digits (0.9) correspond to the major and minor version of the auto_round framework.
- The third digit (1) represents the major version of Intel oneAPI: `1` indicates support for oneAPI 2025.1 (typically Torch 2.8), `2` indicates support for oneAPI 2025.2 (typically Torch 2.9).
-- The final digit (1) is the patch version of auto-round-kernel, reflecting updates, bug fixes, or improvements to the kernel package itself.
+- The final digit (1) is the patch version of auto-round-lib, reflecting updates, bug fixes, or improvements to the kernel package itself.
**Version mapping table**
-| auto-round-kernel Version | auto-round Version | oneAPI Version | Typical PyTorch Version |
-|:-------------------------:|:------------------:|:--------------:|:-------------------------:|
-| 0.9.1.x | 0.9.x | 2025.1 | 2.8.x |
-| 0.9.2.x | 0.9.x | 2025.2 | 2.9.x |
+| auto-round-lib Version | auto-round Version | oneAPI Version | Typical PyTorch Version |
+|:----------------------:|:------------------:|:--------------:|:-------------------------:|
+| 0.9.1.x | 0.9.x | 2025.1 | 2.8.x |
+| 0.9.2.x | 0.9.x | 2025.2 | 2.9.x |
-**Notes:** oneAPI version is aligned with PyTorch version during auto-round-kernel binary build, but oneAPI toolkit is not required in runtime.
+**Notes:** oneAPI version is aligned with PyTorch version during auto-round-lib binary build, but oneAPI toolkit is not required in runtime.
### Validated Hardware Environment
#### CPU based on [Intel 64 architecture or compatible processors](https://en.wikipedia.org/wiki/X86-64):
diff --git a/auto_round_extension/ark/install_kernel.py b/auto_round_extension/ark/install_kernel.py
index bb1adfc82..ef450e4a2 100644
--- a/auto_round_extension/ark/install_kernel.py
+++ b/auto_round_extension/ark/install_kernel.py
@@ -40,8 +40,9 @@ def get_auto_round_minor():
# Map torch minor version to kernel version
auto_round_minor = "0.9" if get_auto_round_minor() is None else get_auto_round_minor()
KERNEL_MAP = {
- "2.8": f"auto-round-kernel~={auto_round_minor}.1.0",
- "2.9": f"auto-round-kernel~={auto_round_minor}.2.0",
+ "2.8": f"auto-round-lib~={auto_round_minor}.1.0",
+ "2.9": f"auto-round-lib~={auto_round_minor}.2.0",
+ "2.10": f"auto-round-lib~={auto_round_minor}.3.0",
}
@@ -52,8 +53,8 @@ def main():
print(f"Detected torch {torch_minor}, installing {pkg} ...")
subprocess.check_call([sys.executable, "-m", "pip", "install", pkg, "--upgrade-strategy", "only-if-needed"])
else:
- print("torch not found or no mapping for your version. Installing the latest auto-round-kernel ...")
- subprocess.check_call([sys.executable, "-m", "pip", "install", "auto-round-kernel"])
+ print("torch not found or no mapping for your version. Installing the latest auto-round-lib ...")
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "auto-round-lib"])
if __name__ == "__main__":
diff --git a/auto_round_extension/ark/qlinear.py b/auto_round_extension/ark/qlinear.py
index 1e34ad4f6..b85d51c44 100644
--- a/auto_round_extension/ark/qlinear.py
+++ b/auto_round_extension/ark/qlinear.py
@@ -56,8 +56,8 @@ class QuantLinear(nn.Module):
if not ARK_INSTALLED:
raise ModuleNotFoundError(
"The 'auto_round_kernel' module is required but not installed. "
- "Please install the 'auto-round-kernel' package, for example:\n"
- " pip install auto-round-kernel"
+ "Please install the 'auto-round-lib' package, for example:\n"
+ " pip install auto-round-lib"
)
self.infeatures = in_features
diff --git a/setup.cfg b/setup.cfg
index 3c95893f1..f70fc33e8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -17,5 +17,5 @@ console_scripts =
auto_round_best = auto_round.__main__:run_best
auto-round-light = auto_round.__main__:run_light
auto_round_light = auto_round.__main__:run_light
- auto-round-kernel-install = auto_round_extension.ark.install_kernel:main
+ auto-round-lib-install = auto_round_extension.ark.install_kernel:main
diff --git a/test/test_ark/requirements.txt b/test/test_ark/requirements.txt
index fe43c33f0..6ee1f55eb 100644
--- a/test/test_ark/requirements.txt
+++ b/test/test_ark/requirements.txt
@@ -1,2 +1,2 @@
-auto-round-kernel
+auto-round-lib
lm_eval >= 0.4.10 # for transformers >= 5.0.0
\ No newline at end of file
diff --git a/test/test_ark/test_model.py b/test/test_ark/test_model.py
index 8ac1ac586..5fa30ae2c 100644
--- a/test/test_ark/test_model.py
+++ b/test/test_ark/test_model.py
@@ -32,12 +32,6 @@ class TestAutoRoundARKBackend:
if sym is False:
pytest.skip("No asym support for XPU")
- # Skip tests in CI based on environment variables, workaround for ark LD_PRELOAD issue
- if device == "cpu" and os.environ.get("SKIP_CPU"):
- pytest.skip("Skip CPU test in CI")
- if device == "xpu" and os.environ.get("SKIP_XPU"):
- pytest.skip("Skip XPU test in CI")
-
model = AutoModelForCausalLM.from_pretrained(self.model_name, dtype="auto")
tokenizer = AutoTokenizer.from_pretrained(self.model_name)
if fast_cfg:
@@ -80,7 +74,6 @@ class TestAutoRoundARKBackend:
@pytest.mark.parametrize("bits, group_size, sym", [(2, 32, False)])
@pytest.mark.parametrize("dtype", [torch.bfloat16])
@pytest.mark.parametrize("device", ["cpu"])
- @pytest.mark.skip(reason="temp skip, this test can't work with ark 0.9 without oneapi toolkit")
def test_other_bits(self, format, bits, group_size, sym, dtype, device):
self.main_op(format, bits, group_size, sym, dtype, device, False, 0.2)