Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Adapt INCWeightOnlyLinear #1323

Adapt INCWeightOnlyLinear

Adapt INCWeightOnlyLinear #1323

name: Engine Unit Test
on:
pull_request:
branches: [main]
paths:
- ".github/workflows/unit-test-engine.yml"
- "requirements.txt"
- "setup.py"
- intel_extension_for_transformers/transformers/**
- "intel_extension_for_transformers/transformers/runtime/**"
- "!intel_extension_for_transformers/transformers/runtime/kernels/**"
- "!intel_extension_for_transformers/transformers/llm/runtime/neural_speed/**"
- "!intel_extension_for_transformers/transformers/runtime/third_party/**"
- "!intel_extension_for_transformers/transformers/runtime/docs/**"
workflow_dispatch:
# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOCKER_CONFIG_NAME: "commonDockerConfig"
REPO_NAME: "intel-extension-for-transformers"
REPO_TAG: "py38"
DOCKER_FILE_NAME: "devel"
CONTAINER_NAME: "utTest"
EXTRA_CONTAINER_NAME: "modelTest"
CONTAINER_SCAN: "codeScan"
permissions:
contents: read
jobs:
engine-unit-test:
runs-on: [self-hosted, linux, X64, itrex-node]
strategy:
fail-fast: true
matrix:
include:
- test_branch: ${{ github.ref }}
test_name: "PR-test"
- test_branch: "main"
test_name: "baseline"
name: engine-unit-test-${{ matrix.test_name }}
steps:
- name: Docker Clean Up
run: |
docker ps -a
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}'$) ]]; then
docker start ${{ env.CONTAINER_NAME }}
echo "remove left files through container ..."
docker exec ${{ env.CONTAINER_NAME }} bash -c "ls -a /intel-extension-for-transformers && rm -fr /intel-extension-for-transformers/* && rm -fr /intel-extension-for-transformers/.* || true"
fi
if [[ $(docker ps -a | grep -i '${{ env.EXTRA_CONTAINER_NAME }}'$) ]]; then
docker start ${{ env.EXTRA_CONTAINER_NAME }}
echo "remove left files through container ..."
docker exec ${{ env.EXTRA_CONTAINER_NAME }} bash -c "ls -a /intel-extension-for-transformers && rm -fr /intel-extension-for-transformers/* && rm -fr /intel-extension-for-transformers/.* || true"
fi
- name: Checkout out Repo
uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ matrix.test_branch }}
fetch-depth: 0
- name: Docker Build
run: |
docker build -f ${{ github.workspace }}/.github/workflows/docker/${{ env.DOCKER_FILE_NAME }}.dockerfile -t ${{ env.REPO_NAME }}:${{ env.REPO_TAG }} .
- name: Docker Run
run: |
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}'$) ]]; then
docker stop ${{ env.CONTAINER_NAME }}
docker rm -vf ${{ env.CONTAINER_NAME }} || true
fi
docker run -dit --disable-content-trust --privileged --name=${{ env.CONTAINER_NAME }} -v /dev/shm:/dev/shm \
-v ${{ github.workspace }}:/intel-extension-for-transformers \
-v ~/.cache/oneAPI:/cache \
-v /dataset/tf_dataset2/inc-ut/nlptoolkit_ut_model:/tf_dataset2/inc-ut/nlptoolkit_ut_model \
-v /dataset/models:/tf_dataset2/models \
-v /dataset/cache/huggingface:/root/.cache/huggingface \
${{ env.REPO_NAME }}:${{ env.REPO_TAG }}
- name: Binary build
run: |
docker exec ${{ env.CONTAINER_NAME }} \
bash -c "cd /intel-extension-for-transformers/.github/workflows/script \
&& bash install_binary.sh"
- name: Run UT
run: |
docker exec ${{ env.CONTAINER_NAME }} \
bash -c "cd /intel-extension-for-transformers/.github/workflows/script/unitTest \
&& export HF_HOME=/dataset/cache/ \
&& bash run_unit_test_engine.sh --test_name=${{ matrix.test_name }}"
- name: Collect log
if: ${{ !cancelled() }}
run: |
docker exec ${{ env.CONTAINER_NAME }} \
bash -c "cd /intel-extension-for-transformers && \
mv /log_dir . "
- name: Publish pipeline artifact
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: "UnitTest${{ matrix.test_name }}"
path: ${{ github.workspace }}/log_dir
retention-days: 5
Genreate-Engine-Report:
runs-on: itrex-node-spell
needs: [engine-unit-test]
steps:
- name: Docker Clean Up
run: |
docker ps -a
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_SCAN }}-${{ runner.name }}'$) ]]; then
docker start ${{ env.CONTAINER_SCAN }}-${{ runner.name }}
echo "remove left files through container ..."
docker exec ${{ env.CONTAINER_SCAN }}-${{ runner.name }} bash -c "ls -a /intel-extension-for-transformers && rm -fr /intel-extension-for-transformers/* && rm -fr /intel-extension-for-transformers/.* || true"
fi
- name: Checkout out Repo
uses: actions/checkout@v4
- name: Download UT PR Log
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/log_dir
- name: Display structure of downloaded files
run: cd ${{ github.workspace }}/log_dir && ls -R
- name: Calculate coverage
run: |
cd ${{ github.workspace }}/.github/workflows/script/unitTest/coverage
/usr/bin/bash calc_coverage.sh ${{ github.workspace }}/log_dir
- name: Publish pipeline artifact
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: Engine Unit Test
path: ${{ github.workspace }}/log_dir
retention-days: 5