PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
Optimize CPU CI pipelines (#1071)
Sun, Xuehao2ef7f3188c0c
diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.develindex d0ecbfb8c..7f196142a 100644--- a/.azure-pipelines/docker/Dockerfile.devel+++ b/.azure-pipelines/docker/Dockerfile.devel@@ -19,11 +19,8 @@ FROM ubuntu:${UBUNTU_VER}ENV LANG C.UTF-8RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \- python3 \- python3-pip \- python3.12-dev \- autoconf \build-essential \+ ca-certificates \git \libomp-dev \numactl \@@ -33,7 +30,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \jq \vim-RUN ln -sf $(which python3) /usr/bin/python+COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uvARG USER_ID=1000ARG GROUP_ID=1000@@ -43,10 +40,13 @@ RUN groupadd -g ${GROUP_ID} hostgroup && \USER hostuser-ENV PATH="/home/hostuser/.local/bin:$PATH"-RUN pip config set global.break-system-packages true-RUN python -m pip install --no-cache-dir --upgrade pip setuptools-RUN pip list+ENV PATH="/home/hostuser/.venv/bin:$PATH"+ENV VIRTUAL_ENV="/home/hostuser/.venv"+ENV UV_NO_PROGRESS=1 \+ UV_COMPILE_BYTECODE=1 \+ UV_LINK_MODE=copy-WORKDIR /+RUN uv venv --python=3.12 /home/hostuser/.venv+RUN which python && python --version+WORKDIR /home/hostuserdiff --git a/.azure-pipelines/scripts/ut/.coverage b/.azure-pipelines/scripts/ut/.coverageindex 7ac7a0fb2..5be62fc0d 100644--- a/.azure-pipelines/scripts/ut/.coverage+++ b/.azure-pipelines/scripts/ut/.coverage@@ -4,6 +4,7 @@ branch = True[paths]source =auto_round/+ /auto-round/auto_round/*/site-packages/auto_round/*/dist-packages/auto_round/diff --git a/.azure-pipelines/scripts/ut/collect_log.sh b/.azure-pipelines/scripts/ut/collect_log.shindex 54d5cb5b7..5e26c8240 100644--- a/.azure-pipelines/scripts/ut/collect_log.sh+++ b/.azure-pipelines/scripts/ut/collect_log.sh@@ -1,9 +1,9 @@#!/bin/bashset -e-pip install coverage-export COVERAGE_RCFILE=/auto-round/.azure-pipelines/scripts/ut/.coverage-coverage_log="/auto-round/log_dir/coverage_log"-cd /auto-round/log_dir+uv pip install coverage+export COVERAGE_RCFILE=${BUILD_SOURCESDIRECTORY}/.azure-pipelines/scripts/ut/.coverage+coverage_log="${BUILD_SOURCESDIRECTORY}/log_dir/coverage_log"+cd "${BUILD_SOURCESDIRECTORY}/log_dir"echo "collect coverage for PR branch"mkdir -p coverage_PR@@ -11,8 +11,8 @@ cp ut-*/.coverage.* ./coverage_PR/cd coverage_PRcoverage combine --keep --rcfile=${COVERAGE_RCFILE}-cp .coverage /auto-round/-cd /auto-round+cp .coverage "${BUILD_SOURCESDIRECTORY}"+cd "${BUILD_SOURCESDIRECTORY}"coverage report -m --rcfile=${COVERAGE_RCFILE} | tee ${coverage_log}coverage html -d log_dir/coverage_PR/htmlcov --rcfile=${COVERAGE_RCFILE}coverage xml -o log_dir/coverage_PR/coverage.xml --rcfile=${COVERAGE_RCFILE}diff --git a/.azure-pipelines/scripts/ut/run_ut.sh b/.azure-pipelines/scripts/ut/run_ut.shindex 50f8238bd..da3caecca 100644--- a/.azure-pipelines/scripts/ut/run_ut.sh+++ b/.azure-pipelines/scripts/ut/run_ut.sh@@ -6,18 +6,24 @@ test_part=$1# install requirementsecho "##[group]set up UT env..."export TQDM_MININTERVAL=60-pip install pytest-cov pytest-html-pip install -r /auto-round/test/test_cpu/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu-pip list+uv pip install pytest-cov pytest-html+uv pip install -r /auto-round/test/test_cpu/requirements.txt \+ --extra-index-url https://download.pytorch.org/whl/cpu+# install latest gguf for ut test-git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py && pip install .+cd ~ || 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 .++cd /auto-round && uv pip install .+uv pip install lm_eval==0.4.9.1+echo "##[endgroup]"-pip list+uv pip listcd /auto-round/test/test_cpu || exit 1find . -type f -exec sed -i '/sys\.path\.insert(0, "\.\.")/d' {} +-export LD_LIBRARY_PATH=${HOME}/.local/lib/:$LD_LIBRARY_PATH+export LD_LIBRARY_PATH=${HOME}/.venv/lib/:$LD_LIBRARY_PATHexport FORCE_BF16=1export COVERAGE_RCFILE=/auto-round/.azure-pipelines/scripts/ut/.coverageauto_round_path=$(python -c 'import auto_round; print(auto_round.__path__[0])')diff --git a/.azure-pipelines/template/docker-template.yml b/.azure-pipelines/template/docker-template.ymlindex f210de691..da0ca62dd 100644--- a/.azure-pipelines/template/docker-template.yml+++ b/.azure-pipelines/template/docker-template.yml@@ -40,6 +40,7 @@ steps:- checkout: selfclean: true+ fetchTags: truedisplayName: "Checkout out Repo"- ${{ if eq(parameters.dockerConfigName, 'gitCloneDockerConfig') }}:diff --git a/.azure-pipelines/template/ut-template.yml b/.azure-pipelines/template/ut-template.ymlindex 431bf23b5..ba4f21353 100644--- a/.azure-pipelines/template/ut-template.yml+++ b/.azure-pipelines/template/ut-template.yml@@ -35,12 +35,11 @@ steps:- ${{ if eq(parameters.imageSource, 'build') }}:- script: |docker exec ${{ parameters.utContainerName }} bash -c "cd /auto-round \- && pip install torch==2.8.0 torchvision --index-url https://download.pytorch.org/whl/cpu \- && pip install intel-extension-for-pytorch==2.8.0 \- && pip install -r requirements-cpu.txt \- && pip install transformers==4.57.1 \- && pip install . \- && pip list"+ && uv pip install torch==2.8.0 torchvision --index-url https://download.pytorch.org/whl/cpu \+ && uv pip install intel-extension-for-pytorch==2.8.0 \+ && uv pip install -r requirements.txt \+ && uv pip install -r requirements-cpu.txt \+ && uv pip list"displayName: "Env Setup"- ${{ if eq(parameters.imageSource, 'pull') }}:diff --git a/.azure-pipelines/unit-test-hpu.yml b/.azure-pipelines/unit-test-hpu.ymlindex 1704b1ac7..490173d50 100644--- a/.azure-pipelines/unit-test-hpu.yml+++ b/.azure-pipelines/unit-test-hpu.yml@@ -26,7 +26,7 @@ pool: GAUDIvariables:IMAGE_NAME: "auto-round"- IMAGE_TAG: "py310"+ IMAGE_TAG: "py312"UPLOAD_PATH: $(Build.SourcesDirectory)/log_dirDOWNLOAD_PATH: $(Build.SourcesDirectory)/log_dirARTIFACT_NAME: "UT_coverage_report"@@ -48,11 +48,6 @@ stages:uploadPath: $(UPLOAD_PATH)utArtifact: "ut"- - task: UseDotNet@2- displayName: 'Use .NET Core sdk 7.0.x'- inputs:- version: 7.0.x-- task: PublishCodeCoverageResults@2inputs:summaryFileLocation: $(UPLOAD_PATH)/coverage.xmldiff --git a/.azure-pipelines/unit-test.yml b/.azure-pipelines/unit-test.ymlindex c05514f71..b958a45e7 100644--- a/.azure-pipelines/unit-test.yml+++ b/.azure-pipelines/unit-test.yml@@ -27,7 +27,7 @@ pool: ICX-16Cvariables:IMAGE_NAME: "auto-round"- IMAGE_TAG: "py310"+ IMAGE_TAG: "py312"UPLOAD_PATH: $(Build.SourcesDirectory)/log_dirDOWNLOAD_PATH: $(Build.SourcesDirectory)/log_dirARTIFACT_NAME: "UT_coverage_report"@@ -69,33 +69,29 @@ stages:jobs:- job: CollectDatafilessteps:- - script: |- docker build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} .- docker images | grep -i ${IMAGE_NAME}- if [[ $? -ne 0 ]]; then- echo "NO Such Repo"- exit 1- fi- displayName: "Build develop docker image"-- task: DownloadPipelineArtifact@2inputs:artifact:patterns: '*_coverage/.coverage.*'path: $(DOWNLOAD_PATH)++ - task: UsePythonVersion@0+ inputs:+ versionSpec: '3.12'+ displayName: 'Use Python 3.12'- script: |- echo "--- create container ---"- docker run -d -it --name="collectLogs" -v ${BUILD_SOURCESDIRECTORY}:/auto-round ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash- echo "--- docker ps ---"- docker ps- echo "--- collect logs ---"- docker exec collectLogs bash -c "cd /auto-round \- && pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu \- && pip install . \- && pip list"- docker exec collectLogs /bin/bash +x -c "cd /auto-round/.azure-pipelines/scripts \- && bash ut/collect_log.sh"+ cd ${BUILD_SOURCESDIRECTORY}+ pip install -U pip setuptools uv+ uv pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu+ uv pip install .+ pip list+ cd ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/scripts+ bash ut/collect_log.sh+ env:+ PYTHONUNBUFFERED: '1'+ UV_NO_PROGRESS: '1'+ UV_SYSTEM_PYTHON: '1'displayName: "Collect UT Coverage"- task: PublishPipelineArtifact@1@@ -105,11 +101,6 @@ stages:artifact: $(ARTIFACT_NAME)publishLocation: "pipeline"- - task: UseDotNet@2- displayName: 'Use .NET Core sdk 7.0.x'- inputs:- version: 7.0.x-- task: PublishCodeCoverageResults@2inputs:summaryFileLocation: $(Build.SourcesDirectory)/log_dir/coverage_PR/coverage.xmldiff --git a/README.md b/README.mdindex b12b62731..e24e3f60e 100644--- a/README.md+++ b/README.md@@ -10,7 +10,7 @@<h3> Advanced Quantization Algorithm for LLMs</h3>[](https://github.com/intel/auto-round)-[](https://github.com/intel/auto-round)+[](https://github.com/intel/auto-round)[](https://github.com/intel/auto-round/blob/main/LICENSE)<a href="https://huggingface.co/Intel"><img alt="Model Checkpoints" src="https://img.shields.io/badge/%F0%9F%A4%97%20HF-Models-F57C00">diff --git a/auto_round/version.py b/auto_round/version.pyindex 159f318f8..7cbe54017 100644--- a/auto_round/version.py+++ b/auto_round/version.py@@ -14,4 +14,4 @@"""Intel® auto-round: An open-source Python librarysupporting popular model weight only compression based on signround."""-__version__ = "0.9.0"+__version__ = "0.9.2"