diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 43dac1db6..7e2f24002 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -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 diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index 818262ae7..e5f204241 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -12,8 +12,8 @@ # 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 @@ -21,13 +21,11 @@ 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 \ @@ -45,9 +43,8 @@ RUN groupadd -g ${GROUP_ID} hostgroup && \ USER hostuser -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 pip list WORKDIR / diff --git a/.azure-pipelines/docker/DockerfileCodeScan.devel b/.azure-pipelines/docker/DockerfileCodeScan.devel index 7eba9068d..acf0cad76 100644 --- a/.azure-pipelines/docker/DockerfileCodeScan.devel +++ b/.azure-pipelines/docker/DockerfileCodeScan.devel @@ -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 @@ -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 @@ -40,7 +38,8 @@ RUN groupadd -g ${GROUP_ID} hostgroup && \ USER hostuser -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 / diff --git a/.azure-pipelines/template/docker-template.yml b/.azure-pipelines/template/docker-template.yml index 96a078a4b..9d18d7f5d 100644 --- a/.azure-pipelines/template/docker-template.yml +++ b/.azure-pipelines/template/docker-template.yml @@ -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.0/ubuntu24.04/habanalabs/pytorch-installer-2.7.1:latest displayName: "Pull habana docker image" - script: | @@ -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.0/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 ... " diff --git a/.azure-pipelines/template/ut-template.yml b/.azure-pipelines/template/ut-template.yml index d2725b523..d9a88568b 100644 --- a/.azure-pipelines/template/ut-template.yml +++ b/.azure-pipelines/template/ut-template.yml @@ -26,7 +26,7 @@ steps: parameters: dockerConfigName: ${{ parameters.dockerConfigName }} repoName: "auto-round" - repoTag: "py310" + repoTag: "py312" dockerFileName: "Dockerfile" containerName: ${{ parameters.utContainerName }} repo: ${{ parameters.repo }} @@ -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" diff --git a/.azure-pipelines/unit-test-hpu.yml b/.azure-pipelines/unit-test-hpu.yml index 8eb4c6999..f2446b817 100644 --- a/.azure-pipelines/unit-test-hpu.yml +++ b/.azure-pipelines/unit-test-hpu.yml @@ -9,6 +9,7 @@ pr: paths: include: - auto_round + - auto_round_extension - test/test*hpu*' - setup.py - requirements-lib.txt diff --git a/auto_round/export/export_to_itrex/model_wrapper.py b/auto_round/export/export_to_itrex/model_wrapper.py index 0d736b0b1..d6120cd72 100644 --- a/auto_round/export/export_to_itrex/model_wrapper.py +++ b/auto_round/export/export_to_itrex/model_wrapper.py @@ -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( diff --git a/auto_round/wrapper.py b/auto_round/wrapper.py index 4fa1ed1de..6c1200a6a 100644 --- a/auto_round/wrapper.py +++ b/auto_round/wrapper.py @@ -390,7 +390,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.