Skip to content

Commit 2ef7f31

Browse files
authored
Optimize CPU CI pipelines (#1071)
Signed-off-by: Sun, Xuehao <[email protected]>
1 parent be56548 commit 2ef7f31

File tree

10 files changed

+55
-62
lines changed

10 files changed

+55
-62
lines changed

.azure-pipelines/docker/Dockerfile.devel

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ FROM ubuntu:${UBUNTU_VER}
1919
ENV LANG C.UTF-8
2020

2121
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
22-
python3 \
23-
python3-pip \
24-
python3.12-dev \
25-
autoconf \
2622
build-essential \
23+
ca-certificates \
2724
git \
2825
libomp-dev \
2926
numactl \
@@ -33,7 +30,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
3330
jq \
3431
vim
3532

36-
RUN ln -sf $(which python3) /usr/bin/python
33+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
3734

3835
ARG USER_ID=1000
3936
ARG GROUP_ID=1000
@@ -43,10 +40,13 @@ RUN groupadd -g ${GROUP_ID} hostgroup && \
4340

4441
USER hostuser
4542

46-
ENV PATH="/home/hostuser/.local/bin:$PATH"
47-
RUN pip config set global.break-system-packages true
48-
RUN python -m pip install --no-cache-dir --upgrade pip setuptools
49-
RUN pip list
43+
ENV PATH="/home/hostuser/.venv/bin:$PATH"
44+
ENV VIRTUAL_ENV="/home/hostuser/.venv"
45+
ENV UV_NO_PROGRESS=1 \
46+
UV_COMPILE_BYTECODE=1 \
47+
UV_LINK_MODE=copy
5048

51-
WORKDIR /
49+
RUN uv venv --python=3.12 /home/hostuser/.venv
50+
RUN which python && python --version
5251

52+
WORKDIR /home/hostuser

.azure-pipelines/scripts/ut/.coverage

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ branch = True
44
[paths]
55
source =
66
auto_round/
7+
/auto-round/auto_round/
78
*/site-packages/auto_round/
89
*/dist-packages/auto_round/
910

.azure-pipelines/scripts/ut/collect_log.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/bin/bash
22
set -e
3-
pip install coverage
4-
export COVERAGE_RCFILE=/auto-round/.azure-pipelines/scripts/ut/.coverage
5-
coverage_log="/auto-round/log_dir/coverage_log"
6-
cd /auto-round/log_dir
3+
uv pip install coverage
4+
export COVERAGE_RCFILE=${BUILD_SOURCESDIRECTORY}/.azure-pipelines/scripts/ut/.coverage
5+
coverage_log="${BUILD_SOURCESDIRECTORY}/log_dir/coverage_log"
6+
cd "${BUILD_SOURCESDIRECTORY}/log_dir"
77

88
echo "collect coverage for PR branch"
99
mkdir -p coverage_PR
1010
cp ut-*/.coverage.* ./coverage_PR/
1111
cd coverage_PR
1212
coverage combine --keep --rcfile=${COVERAGE_RCFILE}
1313

14-
cp .coverage /auto-round/
15-
cd /auto-round
14+
cp .coverage "${BUILD_SOURCESDIRECTORY}"
15+
cd "${BUILD_SOURCESDIRECTORY}"
1616
coverage report -m --rcfile=${COVERAGE_RCFILE} | tee ${coverage_log}
1717
coverage html -d log_dir/coverage_PR/htmlcov --rcfile=${COVERAGE_RCFILE}
1818
coverage xml -o log_dir/coverage_PR/coverage.xml --rcfile=${COVERAGE_RCFILE}

.azure-pipelines/scripts/ut/run_ut.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@ test_part=$1
66
# install requirements
77
echo "##[group]set up UT env..."
88
export TQDM_MININTERVAL=60
9-
pip install pytest-cov pytest-html
10-
pip install -r /auto-round/test/test_cpu/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
11-
pip list
9+
uv pip install pytest-cov pytest-html
10+
uv pip install -r /auto-round/test/test_cpu/requirements.txt \
11+
--extra-index-url https://download.pytorch.org/whl/cpu
12+
1213
# install latest gguf for ut test
13-
git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py && pip install .
14+
cd ~ || exit 1
15+
git clone -b master --quiet --single-branch https://github.com/ggml-org/llama.cpp.git && cd llama.cpp/gguf-py && uv pip install .
16+
17+
cd /auto-round && uv pip install .
18+
uv pip install lm_eval==0.4.9.1
19+
1420
echo "##[endgroup]"
15-
pip list
21+
uv pip list
1622

1723
cd /auto-round/test/test_cpu || exit 1
1824
find . -type f -exec sed -i '/sys\.path\.insert(0, "\.\.")/d' {} +
1925

20-
export LD_LIBRARY_PATH=${HOME}/.local/lib/:$LD_LIBRARY_PATH
26+
export LD_LIBRARY_PATH=${HOME}/.venv/lib/:$LD_LIBRARY_PATH
2127
export FORCE_BF16=1
2228
export COVERAGE_RCFILE=/auto-round/.azure-pipelines/scripts/ut/.coverage
2329
auto_round_path=$(python -c 'import auto_round; print(auto_round.__path__[0])')

.azure-pipelines/template/docker-template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ steps:
4040
4141
- checkout: self
4242
clean: true
43+
fetchTags: true
4344
displayName: "Checkout out Repo"
4445

4546
- ${{ if eq(parameters.dockerConfigName, 'gitCloneDockerConfig') }}:

.azure-pipelines/template/ut-template.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ steps:
3535
- ${{ if eq(parameters.imageSource, 'build') }}:
3636
- script: |
3737
docker exec ${{ parameters.utContainerName }} bash -c "cd /auto-round \
38-
&& pip install torch==2.8.0 torchvision --index-url https://download.pytorch.org/whl/cpu \
39-
&& pip install intel-extension-for-pytorch==2.8.0 \
40-
&& pip install -r requirements-cpu.txt \
41-
&& pip install transformers==4.57.1 \
42-
&& pip install . \
43-
&& pip list"
38+
&& uv pip install torch==2.8.0 torchvision --index-url https://download.pytorch.org/whl/cpu \
39+
&& uv pip install intel-extension-for-pytorch==2.8.0 \
40+
&& uv pip install -r requirements.txt \
41+
&& uv pip install -r requirements-cpu.txt \
42+
&& uv pip list"
4443
displayName: "Env Setup"
4544
4645
- ${{ if eq(parameters.imageSource, 'pull') }}:

.azure-pipelines/unit-test-hpu.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pool: GAUDI
2626

2727
variables:
2828
IMAGE_NAME: "auto-round"
29-
IMAGE_TAG: "py310"
29+
IMAGE_TAG: "py312"
3030
UPLOAD_PATH: $(Build.SourcesDirectory)/log_dir
3131
DOWNLOAD_PATH: $(Build.SourcesDirectory)/log_dir
3232
ARTIFACT_NAME: "UT_coverage_report"
@@ -48,11 +48,6 @@ stages:
4848
uploadPath: $(UPLOAD_PATH)
4949
utArtifact: "ut"
5050

51-
- task: UseDotNet@2
52-
displayName: 'Use .NET Core sdk 7.0.x'
53-
inputs:
54-
version: 7.0.x
55-
5651
- task: PublishCodeCoverageResults@2
5752
inputs:
5853
summaryFileLocation: $(UPLOAD_PATH)/coverage.xml

.azure-pipelines/unit-test.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pool: ICX-16C
2727

2828
variables:
2929
IMAGE_NAME: "auto-round"
30-
IMAGE_TAG: "py310"
30+
IMAGE_TAG: "py312"
3131
UPLOAD_PATH: $(Build.SourcesDirectory)/log_dir
3232
DOWNLOAD_PATH: $(Build.SourcesDirectory)/log_dir
3333
ARTIFACT_NAME: "UT_coverage_report"
@@ -69,33 +69,29 @@ stages:
6969
jobs:
7070
- job: CollectDatafiles
7171
steps:
72-
- script: |
73-
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} .
74-
docker images | grep -i ${IMAGE_NAME}
75-
if [[ $? -ne 0 ]]; then
76-
echo "NO Such Repo"
77-
exit 1
78-
fi
79-
displayName: "Build develop docker image"
80-
8172
- task: DownloadPipelineArtifact@2
8273
inputs:
8374
artifact:
8475
patterns: '*_coverage/.coverage.*'
8576
path: $(DOWNLOAD_PATH)
77+
78+
- task: UsePythonVersion@0
79+
inputs:
80+
versionSpec: '3.12'
81+
displayName: 'Use Python 3.12'
8682

8783
- script: |
88-
echo "--- create container ---"
89-
docker run -d -it --name="collectLogs" -v ${BUILD_SOURCESDIRECTORY}:/auto-round ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash
90-
echo "--- docker ps ---"
91-
docker ps
92-
echo "--- collect logs ---"
93-
docker exec collectLogs bash -c "cd /auto-round \
94-
&& pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu \
95-
&& pip install . \
96-
&& pip list"
97-
docker exec collectLogs /bin/bash +x -c "cd /auto-round/.azure-pipelines/scripts \
98-
&& bash ut/collect_log.sh"
84+
cd ${BUILD_SOURCESDIRECTORY}
85+
pip install -U pip setuptools uv
86+
uv pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
87+
uv pip install .
88+
pip list
89+
cd ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/scripts
90+
bash ut/collect_log.sh
91+
env:
92+
PYTHONUNBUFFERED: '1'
93+
UV_NO_PROGRESS: '1'
94+
UV_SYSTEM_PYTHON: '1'
9995
displayName: "Collect UT Coverage"
10096
10197
- task: PublishPipelineArtifact@1
@@ -105,11 +101,6 @@ stages:
105101
artifact: $(ARTIFACT_NAME)
106102
publishLocation: "pipeline"
107103

108-
- task: UseDotNet@2
109-
displayName: 'Use .NET Core sdk 7.0.x'
110-
inputs:
111-
version: 7.0.x
112-
113104
- task: PublishCodeCoverageResults@2
114105
inputs:
115106
summaryFileLocation: $(Build.SourcesDirectory)/log_dir/coverage_PR/coverage.xml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<h3> Advanced Quantization Algorithm for LLMs</h3>
1111

1212
[![python](https://img.shields.io/badge/python-3.10%2B-blue)](https://github.com/intel/auto-round)
13-
[![version](https://img.shields.io/badge/release-0.9.0-green)](https://github.com/intel/auto-round)
13+
[![version](https://img.shields.io/badge/release-0.9.1-green)](https://github.com/intel/auto-round)
1414
[![license](https://img.shields.io/badge/license-Apache%202-9C27B0)](https://github.com/intel/auto-round/blob/main/LICENSE)
1515
<a href="https://huggingface.co/Intel">
1616
<img alt="Model Checkpoints" src="https://img.shields.io/badge/%F0%9F%A4%97%20HF-Models-F57C00">

auto_round/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
"""Intel® auto-round: An open-source Python library
1515
supporting popular model weight only compression based on signround."""
1616

17-
__version__ = "0.9.0"
17+
__version__ = "0.9.2"

0 commit comments

Comments
 (0)