Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .azure-pipelines/code-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ pr:
paths:
include:
- auto_round
- auto_round_extension
- setup.py
- requirements.txt
- requirements-cpu.txt
- requirements-lib.txt
- .azure-pipelines/code-scan.yml
- .azure-pipelines/scripts/codeScan

Expand Down
17 changes: 7 additions & 10 deletions .azure-pipelines/docker/Dockerfile.devel
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG UBUNTU_VER=22.04
FROM ubuntu:${UBUNTU_VER} as devel
ARG UBUNTU_VER=24.04
FROM ubuntu:${UBUNTU_VER}

# See http://bugs.python.org/issue19846
ENV LANG C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
python3 \
python3-pip \
python3-dev \
python3-distutils \
python3.12-dev \
autoconf \
build-essential \
git \
libgl1-mesa-glx \
libglib2.0-0 \
libomp-dev \
numactl \
time \
wget \
Expand All @@ -45,10 +43,9 @@ RUN groupadd -g ${GROUP_ID} hostgroup && \

USER hostuser

ENV PATH="/home/hostuser/.local/bin:${PATH}"
RUN python -m pip install --no-cache-dir --upgrade pip
RUN python -m pip install --no-cache-dir setuptools

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

WORKDIR /
Expand Down
11 changes: 4 additions & 7 deletions .azure-pipelines/docker/DockerfileCodeScan.devel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG UBUNTU_VER=22.04
ARG UBUNTU_VER=24.04
FROM ubuntu:${UBUNTU_VER} as devel

# See http://bugs.python.org/issue19846
Expand All @@ -24,8 +24,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
aspell-en \
python3 \
python3-pip \
python3-dev \
python3-distutils \
autoconf \
build-essential \
wget
Expand All @@ -40,9 +38,8 @@ RUN groupadd -g ${GROUP_ID} hostgroup && \

USER hostuser

ENV PATH="/home/hostuser/.local/bin:${PATH}"
RUN python -m pip install --no-cache-dir --upgrade pip
RUN python -m pip install --no-cache-dir pylint==2.12.1\
bandit
ENV PATH="/home/hostuser/.local/bin:$PATH"
RUN pip config set global.break-system-packages true
RUN python -m pip install --no-cache-dir pylint bandit

WORKDIR /
2 changes: 1 addition & 1 deletion .azure-pipelines/scripts/codeScan/pylint/pylint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo "[DEBUG] list pipdeptree..."
pip install pipdeptree
pipdeptree

python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto \
python -m pylint -f json --disable=R,C,W,E0606,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto \
--ignored-modules=tensorflow,keras,torch,torch.quantization,torch.tensor,torchvision,fairseq,mxnet,onnx,onnxruntime,intel_extension_for_pytorch,intel_extension_for_tensorflow,torchinfo,horovod,transformers,deepspeed,deepspeed.module_inject \
/auto-round/${scan_module} > $log_dir/pylint.json

Expand Down
3 changes: 2 additions & 1 deletion .azure-pipelines/scripts/ut/run_ut_cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function create_conda_env() {
fi
uv pip install -v --no-build-isolation .
uv pip install pytest-cov pytest-html cmake==4.0.2
uv pip install torch==2.8.0 torchvision
}

function print_test_results_table() {
Expand Down Expand Up @@ -107,7 +108,7 @@ function run_unit_test() {
local auto_round_path=$(python -c 'import auto_round; print(auto_round.__path__[0])')

# run unit tests individually with separate logs
for test_file in $(find . -name "test_*.py"); do
for test_file in $(find . -name "test_*.py" ! -name "test_*vlms.py" | sort); do
local test_basename=$(basename ${test_file} .py)
local ut_log_name=${LOG_DIR}/unittest_cuda_${test_basename}.log
echo "Running ${test_file}..."
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/template/docker-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ steps:

- ${{ if eq(parameters.imageSource, 'pull') }}:
- script: |
docker pull vault.habana.ai/gaudi-docker/1.21.0/ubuntu22.04/habanalabs/pytorch-installer-2.6.0:latest
docker pull vault.habana.ai/gaudi-docker/1.22.1/ubuntu24.04/habanalabs/pytorch-installer-2.7.1:latest
displayName: "Pull habana docker image"

- script: |
Expand All @@ -95,7 +95,7 @@ steps:
else
docker run -dit --disable-content-trust --privileged --name=${{ parameters.containerName }} --shm-size="2g" \
--runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --net=host --ipc=host \
-v ${BUILD_SOURCESDIRECTORY}:/auto-round vault.habana.ai/gaudi-docker/1.21.0/ubuntu22.04/habanalabs/pytorch-installer-2.6.0:latest
-v ${BUILD_SOURCESDIRECTORY}:/auto-round vault.habana.ai/gaudi-docker/1.22.1/ubuntu24.04/habanalabs/pytorch-installer-2.7.1:latest
docker exec ${{ parameters.containerName }} bash -c "ln -sf \$(which python3) /usr/bin/python"
fi
echo "Show the container list after docker run ... "
Expand Down
9 changes: 5 additions & 4 deletions .azure-pipelines/template/ut-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ steps:
parameters:
dockerConfigName: ${{ parameters.dockerConfigName }}
repoName: "auto-round"
repoTag: "py310"
repoTag: "py312"
dockerFileName: "Dockerfile"
containerName: ${{ parameters.utContainerName }}
repo: ${{ parameters.repo }}
Expand All @@ -35,9 +35,10 @@ steps:
- ${{ if eq(parameters.imageSource, 'build') }}:
- script: |
docker exec ${{ parameters.utContainerName }} bash -c "cd /auto-round \
&& pip install torch==2.7.1 torchvision --index-url https://download.pytorch.org/whl/cpu \
&& pip install intel-extension-for-pytorch==2.7.0 \
&& pip install .[cpu] \
&& 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 . \
&& pip list"
displayName: "Env Setup"

Expand Down
1 change: 1 addition & 0 deletions .azure-pipelines/unit-test-hpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pr:
paths:
include:
- auto_round
- auto_round_extension
- test/test*hpu*'
- setup.py
- requirements-lib.txt
Expand Down
3 changes: 1 addition & 2 deletions .azure-pipelines/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ stages:
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 -r requirements-cpu.txt \
&& pip install --no-build-isolation . \
&& pip install . \
&& pip list"
docker exec collectLogs /bin/bash +x -c "cd /auto-round/.azure-pipelines/scripts \
&& bash ut/collect_log.sh"
Expand Down
2 changes: 1 addition & 1 deletion auto_round/compressors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def _adjust_torch_compile(self, enable_torch_compile: bool) -> None:
):
logger.info(
"'enable_torch_compile' is set to `False` by default. "
"Enabling it can reduce tuning cost by 20%, but it might throw an exception."
"Enabling it can reduce tuning cost by 20%%, but it might throw an exception."
)

if (self.data_type.startswith("fp") or self.act_data_type.startswith("fp")) and self.enable_torch_compile:
Expand Down
4 changes: 2 additions & 2 deletions auto_round/export/export_to_itrex/model_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ def forward(self, input):
self.weight = weight
input = input.type(self.weight.dtype)
logger.debug(f"Calculating {self}")
return F.linear(input, self.weight, self.bias)
return F.linear(input, self.weight, self.bias) # pylint: disable=E1102
else:
input = input.type(weight.dtype)
return F.linear(input, weight, self.bias)
return F.linear(input, weight, self.bias) # pylint: disable=E1102

def extra_repr(self) -> str:
tmp_str = "in_features={}, out_features={}, bits={}, group_size={}, bias={}".format(
Expand Down
2 changes: 1 addition & 1 deletion auto_round/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def linear_forward(self, x, weight, bias):
Returns:
torch.Tensor: Output tensor after applying the linear layer.
"""
return F.linear(x, weight, bias)
return F.linear(x, weight, bias) # pylint: disable=E1102

def all_reduce_linear_forward(self, x, weight, bias):
"""Performs the forward pass for a linear layer.
Expand Down
3 changes: 1 addition & 2 deletions test/test_cuda/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lm-eval>=0.4.9.1
numpy < 2.0
optimum
pandas
parameterized
pillow
py-cpuinfo
torch
Expand All @@ -20,5 +21,3 @@ numba
transformers
vllm>=0.8.5.post1
compressed-tensors


1 change: 1 addition & 0 deletions test/test_cuda/requirements_vlm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pandas
protobuf
pillow
py-cpuinfo
tiktoken
torch
torchvision
triton
Expand Down